summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2017-09-13 13:59:06 +0200
committerErich Eckner <git@eckner.net>2017-09-13 13:59:06 +0200
commit5b989f78de14473b45ccf689a02d1c525f705490 (patch)
tree8f376fed9d2a7bd3e3ffc42bc84deddb93d28c0e /bin
parent6dc42ff6e8f0b52aa0ed7b5e4d18e39dfcca1ce1 (diff)
downloadbuilder-5b989f78de14473b45ccf689a02d1c525f705490.tar.xz
bin/db-update: option -u|--unstage new to force an unstage of one package
Diffstat (limited to 'bin')
-rwxr-xr-xbin/db-update38
1 files changed, 31 insertions, 7 deletions
diff --git a/bin/db-update b/bin/db-update
index 98a324f..430946c 100755
--- a/bin/db-update
+++ b/bin/db-update
@@ -40,6 +40,9 @@ usage() {
>&2 echo ' stable from $file (- is stdin).'
>&2 echo ' -h|--help: Show this help and exit.'
>&2 echo ' -n|--no-action: Only print what would be moved.'
+ >&2 echo ' -u|--unstage $package:'
+ >&2 echo ' Unstage package $package, even if it'
+ >&2 echo ' would not be unstaged otherwise.'
[ -z "$1" ] && exit 1 || exit "$1"
}
@@ -331,11 +334,12 @@ move_packages() {
}
eval set -- "$(
- getopt -o bf:hn \
+ getopt -o bf:hnu: \
--long block \
--long from: \
--long help \
--long no-action \
+ --long unstage: \
-n "$(basename "$0")" -- "$@" || \
echo usage
)"
@@ -363,6 +367,10 @@ do
-n|--no-action)
no_action=true
;;
+ -u|--unstage)
+ shift
+ packages_to_force_unstage="${packages_to_force_unstage} $1"
+ ;;
--)
shift
break
@@ -421,6 +429,14 @@ for package in ${packages_to_stabilize}; do
fi
done
+for package in ${packages_to_force_unstage}; do
+ # some sanity checks
+ if [ ! -f "${work_dir}/package-states/${package}.done" ]; then
+ >&2 echo "Package '${package}' is not in staging!"
+ exit 2
+ fi
+done
+
# Create a lock file and a trap.
exec 9> "${build_list_lock_file}"
@@ -451,17 +467,15 @@ for ending in 'done' 'testing'; do
# testing packages (and maybe an unstaging fixes this anyway)
continue
fi
- if [ -n "$(
+ errors=$(
find "${work_dir}/package-states" -name "*.${ending}" -printf '%f\n' | \
sed 's|\(\.[^.]\+\)\{4\}$||' | \
sort | \
uniq -d
- )" ]; then
+ )
+ if [ -n "${errors}" ]; then
>&2 echo 'Removing duplicates not yet implemented:'
- find "${work_dir}/package-states" -name "*.${ending}" -printf '%f\n' | \
- sed 's|\(\.[^.]\+\)\{4\}$||' | \
- sort | \
- uniq -d
+ >&2 echo "${errors}"
exit 42
fi
done
@@ -556,6 +570,16 @@ while [ -s "${tmp_dir}/new-keep-packages" ]; do
done
+# remove force-unstage packages from keep-packages
+{
+ cat "${tmp_dir}/keep-packages"
+ # shellcheck disable=SC2086
+ printf '%s\n' ${packages_to_force_unstage} ${packages_to_force_unstage}
+} | \
+ sort | \
+ uniq -u | \
+ sponge "${tmp_dir}/keep-packages"
+
# unlock build list
rm -f "${build_list_lock_file}"