summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid P <megver83@parabola.nu>2018-10-02 15:16:08 -0300
committerDavid P <megver83@parabola.nu>2018-10-02 15:21:40 -0300
commit4823d67c1aae67566918f08facbcbee205771299 (patch)
tree8622c0d63c45e900983465939b43a7bde09ba3b6
parent013531bb6b11eb250cc897ef487532a34a1da836 (diff)
Recycle db-import-archlinux-any-to-ours
Now called db-import-any, it is used to sync -any packages to non-Arch's architectures The systemd files are based on db-import-keyring Signed-off-by: David P <megver83@parabola.nu>
-rwxr-xr-xdb-import-any60
-rw-r--r--db-import-any.conf11
-rw-r--r--systemd/db-import-any.service11
-rw-r--r--systemd/db-import-any.timer9
4 files changed, 91 insertions, 0 deletions
diff --git a/db-import-any b/db-import-any
new file mode 100755
index 0000000..346bd94
--- /dev/null
+++ b/db-import-any
@@ -0,0 +1,60 @@
+#!/bin/bash
+# Releases 'any' packages from Arch to ours
+
+source "$(dirname "$(readlink -e "$0")")/config"
+source "$(dirname "$(readlink -e "$0")")/db-import-any.conf"
+source "$(librelib messages)"
+setup_traps
+
+# From makepkg
+set -E
+
+# 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
diff --git a/db-import-any.conf b/db-import-any.conf
new file mode 100644
index 0000000..d75e337
--- /dev/null
+++ b/db-import-any.conf
@@ -0,0 +1,11 @@
+#!/hint/bash
+
+# The architecture to compare with
+BASEARCH='x86_64'
+
+# Architectures not supported by Arch Linux {32,ARM}
+OURARCHES=(ppc64le)
+# OURARCHES+=(riscv64)
+
+# Arch official repos supported by us
+ARCHREPOS=(core community extra testing)
diff --git a/systemd/db-import-any.service b/systemd/db-import-any.service
new file mode 100644
index 0000000..b263eac
--- /dev/null
+++ b/systemd/db-import-any.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=db-import-any
+Wants=network-online.target
+After=network-online.target
+
+[Service]
+Type=oneshot
+User=repo
+ExecStart=/usr/bin/db-import-any
+
+PrivateTmp=true
diff --git a/systemd/db-import-any.timer b/systemd/db-import-any.timer
new file mode 100644
index 0000000..a14e634
--- /dev/null
+++ b/systemd/db-import-any.timer
@@ -0,0 +1,9 @@
+[Unit]
+Description=Daily db-import-any
+
+[Timer]
+OnCalendar=daily
+Persistent=true
+
+[Install]
+WantedBy=timers.target