From 042ffc9db745ddd0633e2d9f395919b6f6b4383b Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Thu, 18 May 2017 09:42:07 +0200 Subject: bin/return-assignment: check if sent packages are the expected ones --- bin/return-assignment | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) (limited to 'bin') diff --git a/bin/return-assignment b/bin/return-assignment index d65cb39..1ecae9c 100755 --- a/bin/return-assignment +++ b/bin/return-assignment @@ -12,10 +12,10 @@ # 1: another instance was already running # 2: outdated package # 3: signature error +# 4: package error (e.g. wrong packages sent) # TODO: # remove old version(s) of newly compiled packages -# check that received archive contains the expected packages . "${0%/*}/../conf/default.conf" @@ -81,6 +81,7 @@ trap clean_up_tmp_dir EXIT # extract package(s) tar -x +# check if all packages are signed and all signatures belong to a package signature_errors="$( ls -1 *.pkg.tar.xz{,.sig} | \ sed 's|\.sig$||' | \ @@ -96,8 +97,29 @@ if [ -n "${signature_errors}" ]; then exit 3 fi -# move packages +# check if the sent packages are the expected ones packages=(*.pkg.tar.xz) +package_errors="$( + ( + echo "${packages[@]}" | \ + tr ' ' '\n' | \ + sed ' + s@\(-[^-]\+\)\{2\}-\([^-]\+\)\.pkg\.tar\.xz@ \2@ + / any$/{s|any$|i486|} + ' + sed 's|$| i486|' "${work_dir}/package-infos/$1.$2.$3.packages" + ) | \ + sort | \ + uniq -u +)" + +if [ -n "${package_errors}" ]; then + >&2 echo 'The following packages should have been built but are missing or vice versa:' + >&2 echo "${package_errors}" + exit 4 +fi + +# move packages mkdir -p "${master_mirror_directory}/i486/$4-staging/" mv *.pkg.tar.xz{,.sig} "${master_mirror_directory}/i486/$4-staging/" -- cgit v1.2.3-54-g00ecf