From 9ef417865ef8b102875d42d4cb8ebe277de4ec01 Mon Sep 17 00:00:00 2001 From: Parabola Date: Wed, 23 Nov 2011 07:54:13 -0800 Subject: Making it work --- db-sync | 63 +++++++++++++++++++++++++++++++++++---------------------------- 1 file changed, 35 insertions(+), 28 deletions(-) (limited to 'db-sync') diff --git a/db-sync b/db-sync index 1a9e02f..320a71d 100755 --- a/db-sync +++ b/db-sync @@ -18,13 +18,14 @@ # Returns contents of a repo get_repos() { + mkdir -p ${TMPDIR}/${PID}.cache # Exclude everything but db files - rsync -avm --include="*/" \ + rsync -vmrtlH --no-p --include="*/" \ --include="*.db" \ --include="*${DBEXT}" \ --exclude="*" \ --delete-after \ - rsync://${mirror}/${mirrorpath}/ cache/ + rsync://${mirror}/${mirrorpath}/ ${TMPDIR}/${PID}.cache } get_repo_content() { @@ -42,9 +43,9 @@ get_blacklist() { # repo # arch get_repo_file() { - [ ! -r "cache/${1}/os/${2}/${1}${DBEXT}" ] && return 1 +# shopt -s nullglob - echo "cache/${1}/os/${2}/${1}${DBEXT}" + echo "${TMPDIR}/${PID}.cache/${1}/os/${2}/${1}${DBEXT}" } # Process the databases and get the libre packages @@ -61,8 +62,8 @@ init() { get_repos # Traverse all repo-arch pairs - for _arch in ${ARCHARCHES[@]}; do - for _repo in ${ARCHREPOS[@]}; do + for _repo in ${ARCHREPOS[@]}; do + for _arch in ${ARCHARCHES[@]}; do msg "Processing ${_repo}-${_arch}" repo_file=$(get_repo_file ${_repo} ${_arch}) @@ -91,7 +92,6 @@ init() { --delete-after \ --delete-excluded \ --delay-updates \ - --max-delete=1000 \ --include-from=/tmp/${_repo}-${_arch}.whitelist \ --exclude="*" \ rsync://${mirror}/${mirrorpath}/${_repo}/os/${_arch}/ \ @@ -100,17 +100,18 @@ init() { # Add a new whitelist whitelists+=(/tmp/${_repo}-${_arch}.whitelist) + msg "Putting databases back in place" + rsync -vrtlH \ + --delay-updates \ + --safe-links \ + ${TMPDIR}/${PID}.cache/${_repo}/os/${_arch}/ \ + ${FTP_BASE}/${_repo}/os/${_arch}/ + # Cleanup unset db done done - msg "Putting databases back in place" - rsync -vrtlH \ - --delay-updates \ - --safe-links \ - cache/ \ - ${FTP_BASE}/ msg "Syncing package pool" # Concatenate all whitelists @@ -121,13 +122,15 @@ init() { # Sync # *Don't delete-after*, this is the job of cleanup scripts. It will remove our # packages too - rsync -vrtlH \ - --delay-updates \ - --safe-links \ - --include-from=/tmp/any.whitelist \ - --exclude="*" \ - rsync://${mirror}/${mirrorpath}/${PKGPOOL}/ \ - ${FTP_BASE}/${PKGPOOL}/ + for PKGPOOL in pool/packages pool/community extra/os/any community/os/any; do + rsync -vrtlH \ + --delay-updates \ + --safe-links \ + --include-from=/tmp/any.whitelist \ + --exclude="*" \ + rsync://${mirror}/${mirrorpath}/${PKGPOOL}/ \ + ${FTP_BASE}/${PKGPOOL}/ + done # Sync sources msg "Syncing source pool" @@ -137,13 +140,15 @@ init() { # Sync # *Don't delete-after*, this is the job of cleanup scripts. It will remove our # packages too - rsync -vrtlH \ - --delay-updates \ - --safe-links \ - --include-from=/tmp/any.whitelist \ - --exclude="*" \ - rsync://${mirror}/${mirrorpath}/${SRCPOOL}/ \ - ${FTP_BASE}/${SRCPOOL}/ + for SRCPOOL in sources/packages sources/community ; do + rsync -vrtlH \ + --delay-updates \ + --safe-links \ + --include-from=/tmp/any.whitelist \ + --exclude="*" \ + rsync://${mirror}/${mirrorpath}/${SRCPOOL}/ \ + ${FTP_BASE}/${SRCPOOL}/ + done # Cleanup @@ -153,7 +158,7 @@ init() { trap_exit() { echo error "$@" - exit 1 + exit 1 } @@ -169,3 +174,5 @@ trap 'trap_exit "$(gettext "Aborted by user! Exiting...")"' INT trap 'trap_exit "$(gettext "An unknown error has occurred. Exiting...")"' ERR init + +rm -r ${TMPDIR}/${PID}.cache -- cgit v1.2.3-54-g00ecf