summaryrefslogtreecommitdiff
path: root/any-to-ours
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2014-06-17 19:24:48 -0400
committerLuke Shumaker <LukeShu@sbcglobal.net>2014-06-17 19:24:48 -0400
commit827e305df0f565d7da844684290323a75bf081a6 (patch)
tree9753469d58a11b434d8da109c00a23c0e721a52d /any-to-ours
parentd42f5c6ab02a861ef548ae12fe403f61e2b02e4f (diff)
parent1d5db10302f0a0517c022fae4b6a66862eb7e2cf (diff)
Merge branch 'lukeshu/archlinux+xbs+merge-parabola' into lukeshu/archlinux+xbs+db-import
Diffstat (limited to 'any-to-ours')
-rwxr-xr-xany-to-ours72
1 files changed, 72 insertions, 0 deletions
diff --git a/any-to-ours b/any-to-ours
new file mode 100755
index 0000000..a1697c7
--- /dev/null
+++ b/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")")/libremessages"
+
+# 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 ${_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 'any' packages here"
+ continue
+ fi
+
+ for _arch in ${OURARCHES[@]}; do
+ msg2 "Syncing ${_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 ${#SYNCED[@]} packages: ${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