From bb3c1be9fee3f67b28fa0447345ce80bd0a6deb5 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Thu, 13 Feb 2020 15:33:50 +0100 Subject: bin/return-assignment: remove hard-coded package suffixes --- bin/return-assignment | 44 ++++++++++++++++++++------------------------ 1 file changed, 20 insertions(+), 24 deletions(-) (limited to 'bin') diff --git a/bin/return-assignment b/bin/return-assignment index e24afa6..e7f75ed 100755 --- a/bin/return-assignment +++ b/bin/return-assignment @@ -17,8 +17,6 @@ # 4: package error (e.g. wrong packages sent) # 5: wrong number of arguments -# TODO: remove hard-coded package suffixes - # shellcheck disable=SC2119,SC2120 # shellcheck source=../lib/load-configuration @@ -613,14 +611,7 @@ cd "${tmp_dir}" export TMPDIR="${tmp_dir}" # extract package(s) -tar -x \ - --wildcards \ - --no-wildcards-match-slash \ - '*.pkg.tar.zst' \ - '*.pkg.tar.zst.sig' \ - '*.pkg.tar.zst-namcap.log.gz' \ - '*.pkg.tar.zst.so.needs.gz' \ - '*.pkg.tar.zst.so.provides.gz' +tar -x # check if all packages come with: # - a package file @@ -631,28 +622,28 @@ tar -x \ missing_files=$( find . -maxdepth 1 \( \ \( \ - -name '*.pkg.tar.zst' \ + -regex '.*\.pkg\.\('"${package_compression_suffix_regex}"'\)' \ -printf '%f package\n' \ \) -o \ \( \ - -name '*.pkg.tar.zst.sig' \ + -regex '.*\.pkg\.\('"${package_compression_suffix_regex}"'\)\.sig' \ -printf '%f signature\n' \ \) -o \ \( \ - -name '*.pkg.tar.zst-namcap.log.gz' \ + -regex '.*\.pkg\.\('"${package_compression_suffix_regex}"'\)-namcap\.log\.gz' \ -printf '%f namcap\n' \ \) -o \ \( \ - -name '*.pkg.tar.zst.so.needs.gz' \ + -regex '.*\.pkg\.\('"${package_compression_suffix_regex}"'\)\.so\.needs\.gz' \ -printf '%f needed-libraries\n' \ \) -o \ \( \ - -name '*.pkg.tar.zst.so.provides.gz' \ + -regex '.*\.pkg\.\('"${package_compression_suffix_regex}"'\)\.so\.provides\.gz' \ -printf '%f provided-libraries\n' \ \) \ \) | \ sed ' - s/\(\.pkg\.tar\.zst\)\(\.sig\|\(-namcap\.log\|\.so\.\(provides\|needs\)\)\.gz\) /\1 / + s/\(\.pkg\.\('"${package_compression_suffix_regex}"'\)\)\(\.sig\|\(-namcap\.log\|\.so\.\(provides\|needs\)\)\.gz\) /\1 / ' | \ sort -k1,1 -k2,2 | \ sed ' @@ -710,7 +701,8 @@ fi # check if the signatures are valid signatures=$( - find . -maxdepth 1 -name '*.pkg.tar.zst' \ + find . -maxdepth 1 \ + -regex '.*\.pkg\.\('"${package_compression_suffix_regex}"'\)' \ -printf 'package file %f\n' \ -exec gpg --batch --status-fd 1 -q --homedir /etc/pacman.d/gnupg --verify '{}.sig' '{}' \; 2> /dev/null ) @@ -734,7 +726,8 @@ fi # check if the package maintainer is set errors=$( - find . -maxdepth 1 -name '*.pkg.tar.zst' | \ + find . -maxdepth 1 \ + -regex '.*\.pkg\.\('"${package_compression_suffix_regex}"'\)' | \ while read -r pkg; do tar -Oxf "${pkg}" --zstd '.BUILDINFO' 2>/dev/null | \ grep -vxF 'packager = Unknown Packager' | \ @@ -754,7 +747,9 @@ if [ -n "${errors}" ]; then fi # check if the sent packages are the expected ones -find . -maxdepth 1 -name '*.pkg.tar.zst' -printf '%f\n' > \ +find . -maxdepth 1 \ + -regex '.*\.pkg\.\('"${package_compression_suffix_regex}"'\)' \ + -printf '%f\n' > \ "${tmp_dir}/packages" # shellcheck disable=SC2016 @@ -972,11 +967,10 @@ cut -d' ' -f4,5 "${tmp_dir}/repository-ids" | \ # upload the packages into /pool { - printf 'cd "%s"\n' \ - "${tmp_dir}" printf 'failsafe_rsync -c --copy-dest=/.transfer' - printf ' ./*".pkg.tar.zst%s"' \ - '' '.sig' + find "${tmp_dir}" -maxdepth 1 \ + -regex '.*\.pkg\.\('"${package_compression_suffix_regex}"'\)\(\.sig\)\?' \ + -printf ' "%p"' printf ' "%s/pool/"\n' \ "${master_mirror_rsync_directory}" } \ @@ -984,7 +978,9 @@ cut -d' ' -f4,5 "${tmp_dir}/repository-ids" | \ # create symlinks { - find . \( -name '*.pkg.tar.zst' -o -name '*.pkg.tar.zst.sig' \) -printf '%f\n' | \ + find . \ + -regex '.*\.pkg\.\('"${package_compression_suffix_regex}"'\)\(\.sig\)\?' \ + -printf '%f\n' | \ while read -r file; do printf 'rm "%s/%s"\n' \ "${tmp_dir}" \ -- cgit v1.2.3