#!/bin/bash # report back on a build assignment # either on success via: # "$0 $package $revision $mod_revision $repository" and tar'ed packages (= a tar of # package(s) and signature(s)) on stdin # or on failure via: # "$0 $package $revision $mod_revision $repository ERROR" # TODO: # properly handle if built package is out of date # use lock file(s) # remove old version(s) of newly compiled packages . "${0%/*}/../conf/default.conf" if [ "$5" == 'ERROR' ]; then # the build failed on the build slave mv "${work_dir}/package-states/$1.$2.$3.$4."{locked,broken} # unlock every loop this package would have broken and which is not # broken by another locked package ( # loops broken by another locked package ls "${work_dir}/package-states/"{*.*.*.*,$1.$2.$3.$4}.locked | \ sort | \ uniq -u | \ sed 's|\.locked$||' | \ xargs -n1 sed '1d' | \ sort -u | \ sed 'p' # loops broken by this package sed '1d' "${work_dir}/package-states/$1.$2.$3.$4" ) | \ sort | \ uniq -u | \ sed 's|$|.locked|' | \ xargs -rn1 rm -f exit 0 fi # the build was successful on the build slave # extract package mkdir -p "${master_mirror_directory}/$4-staging/" cd "${master_mirror_directory}/$4-staging/" new_files="$(tar -xv --wildcards '*.pkg.tar.xz'{,.sig})" repo-add -v -s -k "${repo_key}" "$4-staging.db.tar.gz" $(echo "${new_files}" | grep '\.pkg\.tar\.xz\(\.sig\)\?$') # remove all loops which are broken by this package sed '1d' "${work_dir}/package-states/$1.$2.$3.$4.locked" | \ sort -u | \ sed 'p;s|$|.locked|' | \ xargs -rn1 rm -f # remove package from build list sed -i "/^${1//./\\.} $2 $3 $4\$/d" "${work_dir}/build-list" # remove package lock file rm "${work_dir}/package-states/$1.$2.$3.$4.locked"