summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/prioritize-build-list15
1 files changed, 13 insertions, 2 deletions
diff --git a/bin/prioritize-build-list b/bin/prioritize-build-list
index 5655223..021e5c2 100755
--- a/bin/prioritize-build-list
+++ b/bin/prioritize-build-list
@@ -3,8 +3,6 @@
# shellcheck source=conf/default.conf
. "${0%/*}/../conf/default.conf"
-# TODO: save information in database
-
if [ $# -ne 1 ]; then
echo 'Usage: prioritize-build-list pkg-regex'
echo ' moves packages matching pkg-regex to front of build list'
@@ -31,6 +29,19 @@ fi
} | \
sponge "${work_dir}/build-list"
+# shellcheck disable=SC2016
+{
+ printf 'UPDATE `build_assignments`'
+ printf ' JOIN `package_sources` ON `build_assignments`.`package_source`=`package_sources`.`id`'
+ printf ' SET `build_assignments`.`priority`=('
+ printf 'SELECT COALESCE(MAX(`others`.`priority`),0)+1'
+ printf ' FROM `build_assignments` AS `others`'
+ printf ')'
+ printf ' WHERE `package_sources`.`pkgbase` REGEXP from_base64("%s");\n' \
+ "$(printf '%s' "$1" | base64 -w0)"
+} | \
+ ${mysql_command}
+
# Remove the lock file
rm -f "${build_list_lock_file}"