summaryrefslogtreecommitdiff
path: root/update-packages
diff options
context:
space:
mode:
Diffstat (limited to 'update-packages')
-rwxr-xr-xupdate-packages35
1 files changed, 35 insertions, 0 deletions
diff --git a/update-packages b/update-packages
new file mode 100755
index 0000000..3df1022
--- /dev/null
+++ b/update-packages
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+if [ $# -eq 0 ]; then
+ [ -f "$0.lock" ] && kill -0 $(cat "$0.lock") && exit
+ echo $$ > "$0.lock"
+ GIT="git -C ${HOME}/.backend/archlinuxewe"
+ $GIT pull --rebase >/dev/null
+ $GIT submodule update >/dev/null
+ commit=$($GIT rev-parse HEAD)
+ if ! grep -qxF "${commit}" "$0.commit"; then
+ $GIT diff "$(cat "$0.commit")" "${commit}" --name-status \
+ | sed -n '
+ s/^[AM]\s\+//
+ T
+ s@/PKGBUILD$@@
+ p
+ ' \
+ | parallel -j50 "$0"
+ fi
+ "${0%/*}/package-status" > "${0%/*}/packages"
+ echo "$commit" > "$0.commit"
+ rm "$0.lock"
+ exit
+fi
+
+if [ $# -gt 1 ]; then
+ >&2 echo 'too many arguments'
+ exit 1
+fi
+
+cd "${HOME}/.backend/archlinuxewe/$1"
+if git archive HEAD -- .SRCINFO >/dev/null 2>&1; then
+ exit
+fi
+makepkg --printsrcinfo > .SRCINFO