From abf2c85b1d4b87a04dbb8d0d707f84308838861f Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Thu, 1 Feb 2018 14:28:08 +0100 Subject: bin/prioritize-build-list: set priority in database --- bin/prioritize-build-list | 15 +++++++++++++-- 1 file 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}" -- cgit v1.2.3-70-g09d2