diff options
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/copy-to-build-support | 30 |
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 |