summaryrefslogtreecommitdiff
path: root/db-sync
diff options
context:
space:
mode:
authorParabola <dev@list.parabolagnulinux.org>2011-11-23 07:54:13 -0800
committerParabola <dev@list.parabolagnulinux.org>2011-11-23 07:54:13 -0800
commit9ef417865ef8b102875d42d4cb8ebe277de4ec01 (patch)
tree954c604efd308a82f7f4ed5f28be34c78c8678b2 /db-sync
parentce87644a79a5aad2c6f24695a2b142468d41d205 (diff)
Making it work
Diffstat (limited to 'db-sync')
-rwxr-xr-xdb-sync63
1 files changed, 35 insertions, 28 deletions
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