summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolás Reynolds <fauno@kiwwwi.com.ar>2011-12-07 11:55:06 -0300
committerNicolás Reynolds <fauno@kiwwwi.com.ar>2011-12-07 11:55:06 -0300
commit2932fb1b926827c2e12eccd7eb10c3116b6835a4 (patch)
tree08c8c431edc3ec44d73406d6ea1f4e96cef365cf
parentd2d3d2785d622b9bd8539deca4d79ccc4a3d52c4 (diff)
Any-to-ours recycles Arch packages ("any" architecture) to Parabola specific architectures ("mips64el")
-rwxr-xr-xany-to-ours67
1 files changed, 67 insertions, 0 deletions
diff --git a/any-to-ours b/any-to-ours
new file mode 100755
index 0000000..2fa8323
--- /dev/null
+++ b/any-to-ours
@@ -0,0 +1,67 @@
+#!/bin/bash
+# Releases 'any' packages from Arch arches to ours
+
+trap_exit() {
+ echo
+ error "$@"
+ exit 1
+}
+
+source $(dirname $0)/config
+source $(dirname $0)/local_config
+source $(dirname $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' \
+ --exclude='*' \
+ ${FTP_BASE}/${_repo}/os/${BASEARCH}/ \
+ ${FTP_BASE}/${_repo}/os/${_arch}/ 2>&1 | \
+ grep '-any.pkg.tar' | \
+ cut -d ' ' -f 1 ))
+
+ msg2 "Synced ${#SYNCED[@]} packages"
+
+ msg2 "Adding to db..."
+
+ pushd ${FTP_BASE}/${_repo}/os/${_arch}/ >/dev/null
+
+# Add the packages to the db
+ $(dirname $0)/repo-add ${_repo}${DBEXT} \
+ ${SYNCED[@]}
+
+ popd >/dev/null
+
+# Avoid mixups
+ unset SYNCED PKGS
+ done
+done