index : builder | |
Archlinux32 build system | gitolite user |
summaryrefslogtreecommitdiff |
author | Erich Eckner <git@eckner.net> | 2018-07-03 14:24:12 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2018-07-03 14:24:12 +0200 |
commit | 0a50b0d876f180a8bda2a4c4eb595c942803d1cd (patch) | |
tree | 3fae0a36dababe4668ce22b2a2067df38c154697 | |
parent | 7968593c9cfd6d3c974d47f67232a52d3e992d63 (diff) |
-rwxr-xr-x | bin/seed-build-list | 90 |
diff --git a/bin/seed-build-list b/bin/seed-build-list index 731b0a8..a221922 100755 --- a/bin/seed-build-list +++ b/bin/seed-build-list @@ -34,6 +34,10 @@ usage() { >&2 echo ' Do not actually update build-list, just print it.' >&2 echo ' -p|--package $pkg_regex:' >&2 echo ' Update packages matching $pkg_regex.' + >&2 echo ' -u|--undelete $url: ' + >&2 echo ' Schedule all former deletion-list packages which do not' + >&2 echo ' belong on the deletion-list anymore and which are' + >&2 echo ' available on $url.' >&2 echo ' -w|--wait:' >&2 echo ' Wait for lock if necessary.' [ -z "$1" ] && exit 1 || exit "$1" @@ -44,7 +48,7 @@ tmp_dir=$(mktemp -d 'tmp.seed-build-list.XXXXXXXXXX' --tmpdir) trap "rm -rf --one-file-system '${tmp_dir:?}'" EXIT eval set -- "$( - getopt -o achi:m:np:w \ + getopt -o achi:m:np:u:w \ --long auto \ --long cron-exit \ --long help \ @@ -52,14 +56,16 @@ eval set -- "$( --long mirror: \ --long no-action \ --long package: \ + --long undelete: \ --long wait \ -n "$(basename "$0")" -- "$@" || \ echo usage )" +touch "${tmp_dir}/ignore-packages" touch "${tmp_dir}/mirrors" touch "${tmp_dir}/package-regexes" -touch "${tmp_dir}/ignore-packages" +touch "${tmp_dir}/undelete-mirrors" auto=false update=true @@ -100,6 +106,11 @@ do echo "$1" >> \ "${tmp_dir}/package-regexes" ;; + -u|--undelete) + shift + echo "$1" >> \ + "${tmp_dir}/undelete-mirrors" + ;; -w|--wait) wait_for_lock='' ;; @@ -121,6 +132,7 @@ fi if [ ! -s "${tmp_dir}/mirrors" ] && \ [ ! -s "${tmp_dir}/package-regexes" ] && \ + [ ! -s "${tmp_dir}/undelete-mirrors" ] && \ ! ${auto}; then # nothing to do exit 0 @@ -169,7 +181,7 @@ if [ -s "${tmp_dir}/mirrors" ]; then N s/^.*\n// s/-x86_64\(\.pkg\.tar\.xz\)$/-i686\1/ - s/^\(.*\)-\([^-]\+-[^-]\+\)-\([^-]\+\)/theirs \2 \3 \1/ + s/^\(.*\)-\([^-]\+-[^-]\+\)-\([^-]\+\)$/theirs \2 \3 \1/ ' done done < \ @@ -181,10 +193,12 @@ if [ -s "${tmp_dir}/mirrors" ]; then mysql_package_name_query printf ' FROM `binary_packages`' mysql_join_binary_packages_architectures + mysql_join_binary_packages_binary_packages_in_repositories + printf ' WHERE NOT `binary_packages_in_repositories`.`is_to_be_deleted`' } | \ mysql_run_query | \ sed ' - s/^\(.*\)-\([^-]\+-[^-]\+\)-\([^-]\+\)/ours \2 \3 \1/ + s/^\(.*\)-\([^-]\+-[^-]\+\)-\([^-]\+\)$/ours \2 \3 \1/ ' } | \ expand_version 2 | \ @@ -200,6 +214,29 @@ if [ -s "${tmp_dir}/mirrors" ]; then "${tmp_dir}/must-haves" fi +if [ -s "${tmp_dir}/undelete-mirrors" ]; then + while read -r mirror; do + if [ -z "${mirror}" ]; then + continue + fi + for repo in ${repos}; do + curl -sS "${mirror}/${repo}/os/x86_64/${repo}.db.tar.gz" | \ + tar -Oxz --wildcards '*/desc' | \ + sed ' + /^%FILENAME%$/!d + N + s/^.*\n// + s/-x86_64\(\.pkg\.tar\.xz\)$/-i686\1/ + s/^\(.*\)\(-[^-]\+\)\{3\}$/\1/ + /^lib32-/d + ' + done + done < \ + "${tmp_dir}/undelete-mirrors" | \ + sort -u > \ + "${tmp_dir}/available" +fi + # shellcheck disable=SC2016 { printf 'CREATE TEMPORARY TABLE `ignore_packages` (`pkgname` VARCHAR(64));\n' @@ -218,6 +255,7 @@ fi printf ' SELECT DISTINCT `ignore_bin`.`pkgname`' printf ' FROM `binary_packages` AS `ignore_bin`' mysql_join_binary_packages_binary_packages_in_repositories 'ignore_bin' + printf ' WHERE `binary_packages_in_repositories`.`repository` IN (%s,%s)' \ "${repository_ids__any_build_list}" \ "${repository_ids__any_deletion_list}" @@ -309,8 +347,11 @@ printf 'CREATE TEMPORARY TABLE `pkgbases` (`pkgbase` VARCHAR(64), `repository` V # shellcheck disable=SC2016 { cat "${tmp_dir}/must-haves" "${tmp_dir}/ignore-packages" "${tmp_dir}/pkgbases" - if ${auto}; then + if ${auto} || \ + [ -s "${tmp_dir}/available" ]; then printf 'CREATE TEMPORARY TABLE `bin_ids` (`id` BIGINT, UNIQUE KEY (`id`));\n' + fi + if ${auto}; then printf 'INSERT IGNORE INTO `bin_ids`' printf ' SELECT `binary_packages`.`id` FROM `binary_packages`' mysql_join_binary_packages_binary_packages_in_repositories @@ -352,6 +393,42 @@ printf 'CREATE TEMPORARY TABLE `pkgbases` (`pkgbase` VARCHAR(64), `repository` V printf ')' printf ';\n' fi + if [ -s "${tmp_dir}/available" ]; then + printf 'CREATE TEMPORARY TABLE `available` (`pkgname` VARCHAR(64), UNIQUE KEY (`pkgname`));\n' + printf 'LOAD DATA LOCAL INFILE "%s" INTO TABLE `available`;\n' \ + "${tmp_dir}/available" + + printf 'INSERT IGNORE INTO `bin_ids`' + printf ' SELECT `binary_packages`.`id` FROM `binary_packages`' + mysql_join_binary_packages_binary_packages_in_repositories + printf ' AND `binary_packages_in_repositories`.`repository`=%s' \ + "${repository_ids__any_deletion_list}" + printf ' JOIN `available` ON `available`.`pkgname`=`binary_packages`.`pkgname`' + mysql_join_binary_packages_build_assignments + printf ' WHERE `binary_packages`.`pkgname` NOT LIKE "lib32-%%"' + printf ' AND `build_assignments`.`is_black_listed` IS NULL' + printf ' AND NOT EXISTS (' + printf 'SELECT * FROM `dependencies`' + mysql_join_dependencies_dependency_types + printf ' AND (' + printf '`dependency_types`.`relevant_for_building`' + printf ' OR `dependency_types`.`relevant_for_binary_packages`' + printf ')' + mysql_join_dependencies_install_target_providers '' 'it_dummy' + printf ' WHERE `dependencies`.`dependent`=`binary_packages`.`id`' + printf ' AND NOT EXISTS (' + printf 'SELECT 1 FROM `install_target_providers`' + mysql_join_install_target_providers_binary_packages '' 'it_bp' + mysql_join_binary_packages_binary_packages_in_repositories 'it_bp' 'it_bpir' + printf ' WHERE `it_bp`.`build_assignment`!=`binary_packages`.`build_assignment`' + printf ' AND NOT `it_bpir`.`is_to_be_deleted`' + printf ' AND `install_target_providers`.`install_target`=`dependencies`.`depending_on`' + printf ')' + printf ');\n' + + printf 'DELETE `ignore_packages` FROM `ignore_packages`' + printf ' JOIN `available` ON `available`.`pkgname`=`ignore_packages`.`pkgname`;\n' + fi printf 'SELECT ' printf '`pkgbases`.`pkgbase`,' printf '`git_repositories`.`head`,' @@ -393,7 +470,8 @@ printf 'CREATE TEMPORARY TABLE `pkgbases` (`pkgbase` VARCHAR(64), `repository` V ' | \ tr -d '\n' fi - if ${auto}; then + if ${auto} || \ + [ -s "${tmp_dir}/available" ]; then printf 'EXISTS (' printf 'SELECT 1 FROM `bin_ids`' printf ' WHERE `bin_ids`.`id`=`binary_packages`.`id`' |