summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2017-05-22 08:50:03 +0200
committerErich Eckner <git@eckner.net>2017-05-22 08:50:03 +0200
commitc7895f146cc68a5e66a834d65d89bdef45326b63 (patch)
treee634fc42a4421d12c01f1ce881053d9ad3b0841b /bin
parent6d2d5420fdf4949da8822ae71e35e13107ac48e2 (diff)
downloadbuilder-c7895f146cc68a5e66a834d65d89bdef45326b63.tar.xz
bin/return-assignment: get info about broken loops from loops file rather than package lock files
Diffstat (limited to 'bin')
-rwxr-xr-xbin/return-assignment33
1 files changed, 18 insertions, 15 deletions
diff --git a/bin/return-assignment b/bin/return-assignment
index 53708a7..bcba543 100755
--- a/bin/return-assignment
+++ b/bin/return-assignment
@@ -41,21 +41,24 @@ if [ "$5" == 'ERROR' ]; then
# 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/" | \
- grep '\.locked$' | \
- 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.broken"
- ) | \
- sort | \
- uniq -u | \
- sed 's|$|.locked|' | \
- xargs -rn1 rm -f
+ locked_packages="$(
+ ls "${work_dir}/package-states/"*".locked" | \
+ sed 's@^.*/\([^/]\+\)\.\([0-9a-f]\{40\}\.\)\{2\}[^.]\+\.locked$@\1@'
+ )"
+ grep "^${1//./\\.}\$" "${work_dir}/build-list.loops/loop_"* 2> /dev/null | \
+ cut -d: -f1 | \
+ while read -r loop; do
+ if [ -z "$(
+ (
+ echo "${locked_packages}"
+ cat "${loop}"
+ ) | \
+ sort | \
+ uniq -d
+ )" ]; then
+ rm -f "${loop}.locked"
+ fi
+ done
exit 0