diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-04-17 15:49:31 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-04-17 15:49:31 -0400 |
commit | dfd907361f9b8ca470a7feb55339b2b8e2cb1b12 (patch) | |
tree | 190c7ea980b584093a56d98035e82cf7005f8933 /db-import-archlinux-any-to-ours | |
parent | da0737360ab185844e4461d7580cf81c639e9ded (diff) | |
parent | 0d7d26fb58525411847795e65ce4ce6260349732 (diff) |
Merge branch 'master' into lukeshu/xbs
# Conflicts:
# config
# cron-jobs/db-cleanup
# db-check-nonfree
# db-import-archlinux-any-to-ours
# db-import-archlinux-pkg
# db-import-archlinux-src
# test/lib/common.inc
# test/test.d/create-filelists.sh
# test/test.d/db-update.sh
# test/test.d/testing2x.sh
Diffstat (limited to 'db-import-archlinux-any-to-ours')
-rwxr-xr-x | db-import-archlinux-any-to-ours | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/db-import-archlinux-any-to-ours b/db-import-archlinux-any-to-ours new file mode 100755 index 0000000..ab9bb77 --- /dev/null +++ b/db-import-archlinux-any-to-ours @@ -0,0 +1,72 @@ +#!/bin/bash +# Releases 'any' packages from Arch arches to ours + +trap_exit() { + echo + error "$@" + exit 1 +} + +source "$(dirname "$(readlink -e "$0")")/config" +source "$(dirname "$(readlink -e "$0")")/db-import-archlinux.conf" +source "$(librelib messages)" + +# From makepkg +set -E + +trap 'trap_exit "$(gettext "TERM signal caught. Exiting...")"' TERM HUP QUIT +trap 'trap_exit "$(gettext "Aborted by user! Exiting...")"' INT +trap 'trap_exit "$(gettext "An unknown error has occurred. Exiting...")"' ERR + +# The architecture to compare with +BASEARCH='x86_64' + +# Traverse all Arch repos +for _repo in "${ARCHREPOS[@]}"; do + msg "Processing %s..." "${_repo}" + + # Find 'any' packages + # This is hardcoded but it could release other arches... + PKGS=($(find "${FTP_BASE}/${_repo}/os/${BASEARCH}/" \ + -iname '*-any.pkg.tar.?z' \ + -printf "%f ")) + + if [ ${#PKGS[@]} -eq 0 ]; then + msg2 "No '%s' packages here" any + continue + fi + + for _arch in "${OURARCHES[@]}"; do + msg2 "Syncing %s..." "${_arch}" + + # Sync 'any' only and extract the synced packages + SYNCED=($( + rsync -av \ + --include='*-any.pkg.tar.?z' \ + --include='*-any.pkg.tar.?z.sig' \ + --exclude='*' \ + "${FTP_BASE}/${_repo}/os/${BASEARCH}/" \ + "${FTP_BASE}/${_repo}/os/${_arch}/" 2>&1 | \ + grep 'any\.pkg\.tar\..z$' | \ + cut -d ' ' -f 1 )) + + if [ ${#SYNCED[@]} -eq 0 ]; then + msg2 "Already synced (or error happened)" + continue + fi + + msg2 "Synced %d packages: %s" "${#SYNCED[@]}" "${SYNCED[*]}" + + msg2 "Adding to db..." + + pushd "${FTP_BASE}/${_repo}/os/${_arch}/" >/dev/null + + # Add the packages to the db + repo-add "${_repo}${DBEXT}" "${SYNCED[@]}" + + popd >/dev/null + + # Avoid mixups + unset SYNCED PKGS + done +done |