Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-02-02 09:53:40 +0100
committerErich Eckner <git@eckner.net>2018-02-02 09:53:40 +0100
commitfdf371775ebbc5b70fc0df755259b8a7acce41d3 (patch)
treedaa0cd36917ccf6456d3b6537ad6df06a700e9f5
parentdc6742f7c7243e734d8ce278359e278674f10bd3 (diff)
bin/copy-to-build-support: expect packages in file instead of arguments
-rwxr-xr-xbin/copy-to-build-support30
1 files changed, 20 insertions, 10 deletions
diff --git a/bin/copy-to-build-support b/bin/copy-to-build-support
index 2fa43d1..4710012 100755
--- a/bin/copy-to-build-support
+++ b/bin/copy-to-build-support
@@ -5,20 +5,25 @@
# shellcheck source=conf/default.conf
. "${0%/*}/../conf/default.conf"
+if [ "$#" -ne 1 ]; then
+ >&2 echo 'usage:'
+ >&2 echo ' copy-to-build-support package-list'
+ exit 2
+fi
+
tmp_dir=$(mktemp -d "${work_dir}/tmp.copy-to-build-support.0.XXXXXXXXXX")
trap 'rm -rf --one-file-system "${tmp_dir}"' EXIT
to_copy='build_assignment epoch pkgver pkgrel sub_pkgrel has_issues is_tested pkgname architecture'
-printf '%s\n' "$@" | \
- sed -n '
- s/.\+/\0 \0/
- T
- s/\.pkg\.tar\.xz$//
- s/\(-[0-9]\+\)\(-[^- ]\+\)$/\1.0\2/
- s/-\([^-: ]\+\)\(\(-[^- ]\+\)\{2\}\)$/-0:\1\2/
- s/-\([^-: ]\+\):\([^-: ]\+\)-\([^-. ]\+\).\([^-. ]\+\)-\([^- ]\+\)$/ \1 \2 \3 \4 \5/
- p
- ' | \
+sed -n '
+ s/.\+/\0 \0/
+ T
+ s/\.pkg\.tar\.xz$//
+ s/\(-[0-9]\+\)\(-[^- ]\+\)$/\1.0\2/
+ s/-\([^-: ]\+\)\(\(-[^- ]\+\)\{2\}\)$/-0:\1\2/
+ s/-\([^-: ]\+\):\([^-: ]\+\)-\([^-. ]\+\).\([^-. ]\+\)-\([^- ]\+\)$/ \1 \2 \3 \4 \5/
+ p
+' "$1" | \
while read -r package pkgname epoch pkgver pkgrel sub_pkgrel architecture; do
# shellcheck disable=SC2016
@@ -128,3 +133,8 @@ if [ -s "${tmp_dir}/packages" ]; then
done < \
"${tmp_dir}/packages"
fi
+
+if [ -w "$1" ]; then
+ cat "${tmp_dir}/packages" > \
+ "$1"
+fi