summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2017-08-10 10:55:25 +0200
committerErich Eckner <git@eckner.net>2017-08-10 10:55:25 +0200
commitef56e1e1cce9e8d8b147778424667ccf1fc56ac7 (patch)
tree01b44acd4709ddc2770e76efad178a22f544ea4f
parentccc144ce80951945baf7efbd3be02d2053e3b264 (diff)
downloadbuilder-ef56e1e1cce9e8d8b147778424667ccf1fc56ac7.tar.xz
bin/db-update: also accept package file names instead of package state file names
-rwxr-xr-xbin/db-update33
1 files changed, 31 insertions, 2 deletions
diff --git a/bin/db-update b/bin/db-update
index 7c60df7..48e0eb0 100755
--- a/bin/db-update
+++ b/bin/db-update
@@ -381,6 +381,37 @@ if [ -s "${work_dir}/build-master-sanity" ]; then
exit 1
fi
+tmp_dir=$(mktemp -d "${work_dir}/tmp.XXXXXX")
+trap 'rm -rf --one-file-system "${tmp_dir}"' EXIT
+
+packages_to_stabilize=$(
+ (
+ printf '%s\n' ${packages_to_stabilize} | \
+ sort -u | \
+ sed '
+ /\.pkg\.tar\.xz$/{
+ w '"${tmp_dir}/packages-to-stabilize"'
+ d
+ }
+ ' > /dev/null
+ ls "${work_dir}/package-states" | \
+ sed -n '
+ /\.testing$/{
+ s|^|'"${work_dir}"'/package-states/|
+ p
+ }
+ ' | \
+ xargs -r grep -HF '' | \
+ sed '
+ s|^.*/||
+ s|^\([^:]\+\)\.testing:|\1 |
+ ' | \
+ sort -k2,2 | \
+ join -1 2 -2 1 -o 1.1 - "${tmp_dir}/packages-to-stabilize"
+ ) | \
+ sort -u
+)
+
for package in ${packages_to_stabilize}; do
# some sanity checks
if [ ! -f "${work_dir}/package-states/${package}.testing" ]; then
@@ -403,8 +434,6 @@ if ! flock ${block_flag} 8; then
exit 1
fi
-tmp_dir=$(mktemp -d "${work_dir}/tmp.XXXXXX")
-
clean_up_lock_file() {
rm -f "${package_database_lock_file}" "${build_list_lock_file}"
rm -rf --one-file-system "${tmp_dir}"