diff options
author | Erich Eckner <git@eckner.net> | 2018-06-05 09:55:36 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2018-06-05 09:55:36 +0200 |
commit | 8118c8c71b9a0ede8980584bd69c98c4f4db4e8f (patch) | |
tree | 83c7b7e0b64f5c41ac14fb6880e43be1e42d5c82 | |
parent | e5dedb2e44f9de81d976fdd291b4dbfcf344433e (diff) | |
download | builder-8118c8c71b9a0ede8980584bd69c98c4f4db4e8f.tar.xz |
bin/build-packages: remove unexpected packages if expected_packages are given
-rwxr-xr-x | bin/build-packages | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/bin/build-packages b/bin/build-packages index 4563298..0811618 100755 --- a/bin/build-packages +++ b/bin/build-packages @@ -178,6 +178,18 @@ while [ "${count}" -ne 0 ] && \ "${master_build_server_user}@${master_build_server}" \ 'get-assignment' "${prefered_package}" ) || err=$? + if [ "$(printf '%s\n' "${package}" | wc -l)" -ne 1 ]; then + expected_packages=$( + printf '%s\n' "${package}" | \ + sed '1d' + ) + package=$( + printf '%s\n' "${package}" | \ + sed -n '1p' + ) + else + expected_packages='' + fi else package=$( echo "${forced_package}" | \ @@ -185,6 +197,7 @@ while [ "${count}" -ne 0 ] && \ s|\.\([^.]\+\)\.\([^.]\+\)\.\([^.]\+\)$| \1 \2 \3| ' ) + expected_packages='' fi case ${err} in @@ -409,6 +422,19 @@ while [ "${count}" -ne 0 ] && \ tar_content_dir=$(mktemp -d "${tmp_dir}/tar-content.XXXXXX") find . -maxdepth 1 -type f -name '*-debug-*.pkg.tar.xz*' -delete echo 'post-build' > "${tmp_dir}/.ping-build-master" + # remove unexpected packages + if [ -n "${expected_packages}" ]; then + { + find . -maxdepth 1 -type f -name '*.pkg.tar.xz' -printf '%f\n' + printf '%s\n' "${expected_packages}" | \ + sed 'p' + } | \ + sort | \ + uniq -u | \ + while read -r unexpected_package; do + rm "${unexpected_package}"* + done + fi >&2 printf 'signing package(s)\n' find . -maxdepth 1 -type f -name '*.pkg.tar.xz' \ -execdir gpg --local-user="${package_key}" --detach-sign '{}' \; \ |