Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/bin/prioritize-build-list
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-02-01 14:28:08 +0100
committerErich Eckner <git@eckner.net>2018-02-01 14:28:08 +0100
commitabf2c85b1d4b87a04dbb8d0d707f84308838861f (patch)
tree5706d1796dc5b47652620c9ce8c49d9cc39f8d70 /bin/prioritize-build-list
parent94d523412cc6818c6e898f0213ec00695c404836 (diff)
bin/prioritize-build-list: set priority in database
Diffstat (limited to 'bin/prioritize-build-list')
-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}"