index : builder | |
Archlinux32 build system | gitolite user |
summaryrefslogtreecommitdiff |
author | Erich Eckner <git@eckner.net> | 2018-09-25 14:05:58 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2018-09-25 14:05:58 +0200 |
commit | d5fd54d50cd56069ee056378135a753a7369834b (patch) | |
tree | 520ceb16f35a5b956ce22f51e8250360ecf593bd /bin/prioritize-build-list | |
parent | 42c66010f8ade8d801ac4e531a35943083ea8a66 (diff) |
-rwxr-xr-x | bin/prioritize-build-list | 37 |
diff --git a/bin/prioritize-build-list b/bin/prioritize-build-list index bcdb67f..fa5ee5d 100755 --- a/bin/prioritize-build-list +++ b/bin/prioritize-build-list @@ -12,6 +12,9 @@ usage() { >&2 echo ' to front of build list' >&2 echo '' >&2 echo 'possible options:' + >&2 echo ' -d|--dependencies' + >&2 echo ' Set priority of dependencies not-lower as priority of' + >&2 echo ' dependent packages.' >&2 echo ' -h|--help:' >&2 echo ' Show this help and exit.' >&2 echo ' -w|--wait:' @@ -20,18 +23,23 @@ usage() { } eval set -- "$( - getopt -o hw \ + getopt -o dhw \ + --long dependencies \ --long help \ --long wait \ -n "$(basename "$0")" -- "$@" || \ echo usage )" +dependencies=false wait_for_lock='-n' while true do case "$1" in + -d|--dependencies) + dependencies=true + ;; -h|--help) usage 0 ;; @@ -90,6 +98,33 @@ verbose_flock ${wait_for_lock} 8 printf '0) AND `binary_packages_in_repositories`.`repository`=%s;\n' \ "${repository_ids__any_build_list}" printf 'SELECT row_count();\n' + if ${dependencies}; then + printf 'UPDATE `build_assignments`' + printf ' JOIN (' + printf 'SELECT' + printf ' `s_ba`.`id`,' + printf 'MAX(`g_ba`.`priority`) AS `priority`' + printf ' FROM `build_assignments` AS `s_ba`' + mysql_join_build_assignments_binary_packages 's_ba' 's_bp' + mysql_join_binary_packages_binary_packages_in_repositories 's_bp' 's_bpir' + printf ' AND `s_bpir`.`repository`=%s' \ + "${repository_ids__any_build_list}" + mysql_join_binary_packages_dependencies 's_bp' + mysql_join_dependencies_install_target_providers_with_versions + mysql_join_install_target_providers_binary_packages '' 'g_bp' + mysql_join_binary_packages_binary_packages_in_repositories 'g_bp' 'g_bpir' + printf ' AND `g_bpir`.`repository`=%s' \ + "${repository_ids__any_build_list}" + mysql_join_binary_packages_build_assignments 'g_bp' 'g_ba' + printf ' GROUP BY `s_ba`.`id`' + printf ') AS `s_ba`' + printf ' ON `s_ba`.`id`=`build_assignments`.`id`' + printf ' SET `build_assignments`.`priority`=GREATEST(' + printf '`s_ba`.`priority`,' + printf '`build_assignments`.`priority`' + printf ');\n' + printf 'SELECT row_count();\n' + fi } | \ mysql_run_query | \ if [ -w "$1" ] && \ |