From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1SHafz-0004gz-0w for garchives@archives.gentoo.org; Tue, 10 Apr 2012 13:00:03 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id E5BCCE0B86; Tue, 10 Apr 2012 12:59:54 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 9C971E0B86 for ; Tue, 10 Apr 2012 12:59:54 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id C9E381B4004 for ; Tue, 10 Apr 2012 12:59:53 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 76DFCE5402 for ; Tue, 10 Apr 2012 12:59:51 +0000 (UTC) From: "Dennis Schridde" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Dennis Schridde" Message-ID: <1334062777.8a3b621be420a888eb33355482aa54ab6088d504.devurandom@gentoo> Subject: [gentoo-commits] proj/kde:master commit in: Documentation/maintainers/ X-VCS-Repository: proj/kde X-VCS-Files: Documentation/maintainers/sync-gentoo-overlay.sh X-VCS-Directories: Documentation/maintainers/ X-VCS-Committer: devurandom X-VCS-Committer-Name: Dennis Schridde X-VCS-Revision: 8a3b621be420a888eb33355482aa54ab6088d504 X-VCS-Branch: master Date: Tue, 10 Apr 2012 12:59:51 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: 9394c30f-d53d-4dc2-bc2a-6f12ffab1ae8 X-Archives-Hash: d510cffb05c8c6198e6c8eb5a9ee1b7a commit: 8a3b621be420a888eb33355482aa54ab6088d504 Author: Dennis Schridde gmx net> AuthorDate: Tue Apr 10 12:56:36 2012 +0000 Commit: Dennis Schridde gmx net> CommitDate: Tue Apr 10 12:59:37 2012 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/kde.git;a=3Dc= ommit;h=3D8a3b621b [Documentation/maintainers/sync-gentoo-overlay.sh] Bump to a new version * Be much more automatic (i.e. user friendly) * Use atomic moves to ensure the rsync dir does not change during a sync * Ensure the rsync dir does not contain .svn folders and the like --- Documentation/maintainers/sync-gentoo-overlay.sh | 116 ++++++++++++++++= +----- 1 files changed, 90 insertions(+), 26 deletions(-) diff --git a/Documentation/maintainers/sync-gentoo-overlay.sh b/Documenta= tion/maintainers/sync-gentoo-overlay.sh index ea28c8e..3172dfa 100755 --- a/Documentation/maintainers/sync-gentoo-overlay.sh +++ b/Documentation/maintainers/sync-gentoo-overlay.sh @@ -2,20 +2,31 @@ =20 # Run this script via cronjob to update your overlay mirror =20 -OVERLAY_MIRROR_DIR=3D/var/gentoo/overlays +GENTOO_MIRROR_DIR=3D/var/gentoo +GENTOO_PORTAGE_DIR=3D/var/gentoo/portage =20 -# OVERLAY_MIRROR_DIR must contain: -# * a folder $overlay/ for each overlay you intent to mirror. -# * a folder cache/ to store the cache of all overlays. +# GENTOO_MIRROR_DIR must contain: +# * a directory overlay-repos/$overlay for each overlay you intend to m= irror: +# It shall contain the checked out overlay repository. +# Git repositories must be named "overlay-repos/${overlay}.git". +# SVN repositories must contain a directory "overlay-repos/${overlay}= /.svn". +# Directories and files within OVERLAY_MIRROR_DIR that will be created b= y this script: +# * overlays/$overlay/ contains the overlays suitable to sync with rsyn= c. +# * overlay-etc/$overlay/ contains a portage config necessary to genera= te the caches. +# * cache/ to store the intermediate cache of all overlays. # (so it is not mixed with the cache of your system portage-trees) -# OVERLAY_MIRROR_DIR/$overlay/ must contain: -# * a file etc/make.conf with following contents: -# PORTDIR=3D/your/portage/directory -# PORTDIR_OVERLAY=3D/path/to/your/mirror/dir/$overlay/repo -# FEATURES=3D"${FEATURES} userpriv userfetch usersandbox usersync met= adata-transfer" -# * a directory repo/ containing the checked out overlay repository -# For speed reasons it is advisable to have a file etc/portage/modules c= ontaining: -# portdbapi.auxdbmodule =3D portage.cache.sqlite.database +# * etc/portage/ containing following files: +# * etc/portage/make.conf: +# PORTDIR=3D/your/portage/directory +# FEATURES=3D"${FEATURES} userpriv userfetch usersandbox usersync = metadata-transfer" +# NOCOLOR=3Dtrue +# * etc/portage/modules: +# portdbapi.auxdbmodule =3D portage.cache.sqlite.database +# (for speed reasons) +# (files in this directory are not changed if they exist) + +PORTAGE_CONFIGROOT=3D"${GENTOO_MIRROR_DIR}" +PORTAGE_DEPCACHEDIR=3D"${GENTOO_MIRROR_DIR}/cache" =20 die() { echo "USAGE: $0 " 1>&2 @@ -26,36 +37,84 @@ die() { [[ "$1" ]] || die 'overlay' overlay=3D"$1" ; shift =20 -overlay_name=3D"$(< $OVERLAY_MIRROR_DIR/$overlay/repo/profiles/repo_name= )" -[[ "$overlay_name" ]] || die 'overlay_name' +overlay_dir=3D"${GENTOO_MIRROR_DIR}/overlays/${overlay}" +overlay_repo_dir=3D"${GENTOO_MIRROR_DIR}/overlay-repos/${overlay}" =20 -if [ -e "$OVERLAY_MIRROR_DIR/$overlay/repo/.svn" ] ; then +if [ -e "${overlay_repo_dir}/.svn" ] ; then type=3Dsvn -elif [ -e "$OVERLAY_MIRROR_DIR/$overlay/repo/.git" ] ; then +elif [ -e "${overlay_repo_dir}.git" ] ; then type=3Dgit + overlay_repo_dir=3D"${overlay_repo_dir}.git" else die "Unable to determine overlay type for $overlay" fi =20 -cd $OVERLAY_MIRROR_DIR/$overlay/repo || cd "failed to cd to $OVERLAY_MIR= ROR_DIR/$overlay/repo" - echo 'Updating overlay ...' case "$type" in svn) - [ -e metadata/layout.conf ] && svn revert metadata/layout.conf - svn cleanup || die 'svn cleanup failed' - svn update --force --config-option=3Dconfig:miscellany:use-commit-time= s=3Dyes || die 'svn update failed' + svn cleanup "${overlay_repo_dir}" || die 'svn cleanup failed' + svn update --force "${overlay_repo_dir}" || die 'svn update failed' + ;; + git) + git --git-dir=3D"${overlay_repo_dir}" fetch || die 'git update failed' + ;; + *) + die "Unsupported overlay type '$type' for $overlay" + ;; +esac + +mkdir -p "${GENTOO_MIRROR_DIR}/overlays" || die 'failed to create overla= ys/ dir' +mkdir -p "${GENTOO_MIRROR_DIR}/etc/portage/" || die 'failed to create et= c/portage/ dir' + +if [ -! -e "${GENTOO_MIRROR_DIR}/etc/portage/make.conf" ] ; then + cat <<- EOF > "${GENTOO_MIRROR_DIR}/etc/portage/make.conf" + PORTDIR=3D${GENTOO_PORTAGE_DIR} + FEATURES=3D"\${FEATURES} userpriv userfetch usersandbox usersync metad= ata-transfer" + NOCOLOR=3Dtrue + EOF +fi +if [ -! -e "${GENTOO_MIRROR_DIR}/etc/portage/modules" ] ; then + cat <<- EOF > "${GENTOO_MIRROR_DIR}/etc/portage/modules" + portdbapi.auxdbmodule =3D portage.cache.sqlite.database + EOF +fi + +if [ -e "${overlay_dir}.tmp" ] ; then + echo 'Removing old export ...' + rm -fr "${overlay_dir}.tmp" +fi + +echo 'Exporting overlay ...' +case "$type" in + svn) + svn export --force --config-option=3Dconfig:miscellany:use-commit-time= s=3Dyes "${overlay_repo_dir}" "${overlay_dir}.tmp" || die 'svn export fai= led' ;; git) - [ -e metadata/layout.conf ] && git checkout metadata/layout.conf - git pull || die 'git update failed' - /usr/local/bin/git-set-file-times || die 'setting file times failed' + mkdir -p "${overlay_dir}.tmp" || die 'creating export dir failed' + git --git-dir=3D"${overlay_repo_dir}" archive master | tar -x -C "${ov= erlay_dir}.tmp" || die 'git export failed' ;; *) die "Unsupported overlay type '$type' for $overlay" + ;; esac =20 -export PORTAGE_CONFIGROOT=3D$OVERLAY_MIRROR_DIR/$overlay PORTAGE_DEPCACH= EDIR=3D$OVERLAY_MIRROR_DIR/cache +cd "${overlay_dir}.tmp" || die "failed to cd to ${overlay_dir}.tmp" + +overlay_name=3D"$(< profiles/repo_name)" +[[ "$overlay_name" ]] || die 'overlay_name' + +overlay_configroot=3D"${GENTOO_MIRROR_DIR}/overlay-etc/${overlay}" +mkdir -p "${overlay_configroot}/etc/portage" || die 'creating overlay co= nfigroot failed' +cat <<- EOF > "${overlay_configroot}/etc/portage/make.conf" || die 'crea= ting overlay make.conf failed' + source ${PORTAGE_CONFIGROOT}/etc/portage/make.conf + PORTDIR_OVERLAY=3D${overlay_dir}.tmp +EOF +ln -sfn "${PORTAGE_CONFIGROOT}/etc/portage/modules" "${overlay_configroo= t}/etc/portage/" || die 'creating overlay modules symlink failed' + +PORTAGE_CONFIGROOT=3D"${overlay_configroot}" +PORTDIR_OVERLAY=3D"${overlay_dir}.tmp" + +export PORTAGE_CONFIGROOT PORTAGE_DEPCACHEDIR PORTDIR_OVERLAY =20 echo 'Enforcing full manifests ...' #sed -e 's/^thin-manifests.*/thin-manifests =3D false/' -i metadata/layo= ut.conf || die 'patching layout.conf failed' @@ -64,4 +123,9 @@ echo 'Generating manifests ...' #repoman manifest || die 'generating manifests failed' =20 echo 'Generating metadata caches ...' -egencache --config-root=3D$PORTAGE_CONFIGROOT --cache-dir=3D$PORTAGE_DE= PCACHEDIR --repo=3D$overlay_name --update +egencache --config-root=3D"${PORTAGE_CONFIGROOT}" --cache-dir=3D"${PORTA= GE_DEPCACHEDIR}" --portdir-overlay=3D"${PORTDIR_OVERLAY}" --repo=3D$overl= ay_name --update || die 'generating metadata caches failed' + +echo 'Moving export into place ...' +mv -T "${overlay_dir}" "${overlay_dir}.old" +mv -T "${overlay_dir}.tmp" "${overlay_dir}" || die 'moving export failed= ' +rm -fr "${overlay_dir}.old"