Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-07-24 11:01:24 +0200
committerErich Eckner <git@eckner.net>2018-07-24 11:01:24 +0200
commitefd5c746a3e75f0b67c881941e98262e0dbdff9d (patch)
tree3cc882a5f8c6f114af315993fac7faf622198fcb
parent9657de02c83b77b69fbc969412569d6ab6d5b6c8 (diff)
bin/get-package-updates: blacklist allows now to specify an architecture
-rwxr-xr-xbin/get-package-updates138
1 files changed, 106 insertions, 32 deletions
diff --git a/bin/get-package-updates b/bin/get-package-updates
index e6bfa29..77d4123 100755
--- a/bin/get-package-updates
+++ b/bin/get-package-updates
@@ -105,47 +105,82 @@ if [ -s "${work_dir}/build-master-sanity" ]; then
exit
fi
-# delete_package package
-# mark $package for deletion
+# delete_package arch package
+# mark $arch/$package for deletion
delete_package() {
# TODO: Once we want to rely on the database for test_exclusion, we
# need to run the command below unconditionally, but with some
# changes, so we can easily revert.
if [ -z "${test_exclusion}" ]; then
# shellcheck disable=SC2016
+ query_delete_packages=$(
+ printf '`architectures` AS `d_a`'
+ printf ' JOIN `architecture_compatibilities` AS `a_c`'
+ printf ' ON `a_c`.`runs_on`=`d_a`.`id`'
+ printf ' AND `d_a`.`name`=from_base64("%s")' \
+ "$(printf '%s' "$1" | base64 -w0)"
+ printf ' JOIN `build_assignments`'
+ printf ' ON (`a_c`.`built_for`=`build_assignments`.`architecture`'
+ # "any" references all architectures, but this is not represented
+ # in `architecture_compatibilities`: If a package is not buildable
+ # for "any", this means literally, that it is not buildable for
+ # the _least_ architecture (e.g. it is not generic)
+ printf ' OR `d_a`.`name`="any")'
+ mysql_join_build_assignments_package_sources
+ printf ' AND `package_sources`.`pkgbase`=from_base64("%s")' \
+ "$(printf '%s' "$2" | base64 -w0)"
+ mysql_join_build_assignments_binary_packages
+ mysql_join_binary_packages_binary_packages_in_repositories
+ )
+ # shellcheck disable=SC2016
{
# packages from the build-list/to-be-decided go straight to the deletion-list
- printf 'UPDATE `binary_packages_in_repositories`'
- mysql_join_binary_packages_in_repositories_binary_packages
- mysql_join_binary_packages_build_assignments
- mysql_join_build_assignments_package_sources
+ # this happens in two steps, because we need to create one item per
+ # target architecture
+ printf 'INSERT IGNORE INTO `binary_packages_in_repositories` ('
+ printf '`package`,'
+ printf '`repository`,'
+ printf '`last_moved`,'
+ printf '`is_to_be_deleted`'
+ printf ') SELECT'
+ printf ' `binary_packages`.`id`,'
+ printf '`d_r`.`id`,'
+ printf 'NOW(),'
+ printf '1'
+ printf ' FROM'
+ printf ' %s' "${query_delete_packages}"
mysql_join_binary_packages_in_repositories_repositories
+ # shellcheck disable=SC2154
+ printf ' AND `repositories`.`stability` in (%s,%s)' \
+ "${repository_stability_ids__unbuilt}" \
+ "${repository_stability_ids__virtual}"
+ mysql_join_build_assignments_architectures '' 'ba_a'
printf ' JOIN `repositories` AS `d_r`'
+ printf ' ON ('
+ # arch-specific build_assignments must match exactly
+ printf '`d_r`.`architecture`=`ba_a`.`id`'
+ # "any" build_assignments build for all architectures
+ printf ' OR `ba_a`.`name`="any"'
+ printf ')'
# shellcheck disable=SC2154
- printf ' ON `d_r`.`stability`=%s' \
+ printf ' AND `d_r`.`stability`=%s;\n' \
"${repository_stability_ids__forbidden}"
- printf ' AND `d_r`.`architecture`=`repositories`.`architecture`'
- printf ' SET '
- printf '`binary_packages_in_repositories`.`%s`=%s,' \
- 'repository' '`d_r`.`id`' \
- 'is_to_be_deleted' '1' \
- 'last_moved' 'NOW()' | \
- sed 's/,$//'
+
+ printf 'COMMIT;\n'
+
+ printf 'DELETE `binary_packages_in_repositories`'
+ printf ' FROM %s' "${query_delete_packages}"
+ mysql_join_binary_packages_in_repositories_repositories
# shellcheck disable=SC2154
- printf ' WHERE `binary_packages_in_repositories`.`repository` in (%s,%s)' \
- "${repository_ids__any_build_list}" \
- "${repository_ids__any_to_be_decided}"
- printf ' AND `package_sources`.`pkgbase`=from_base64("%s");\n' \
- "$(printf '%s' "$1" | base64 -w0)"
+ printf ' AND `repositories`.`stability` in (%s,%s);\n' \
+ "${repository_stability_ids__unbuilt}" \
+ "${repository_stability_ids__virtual}"
+
printf 'COMMIT;\n'
+
# other packages are marked as `is_to_be_deleted`
- printf 'UPDATE `binary_packages_in_repositories`'
- mysql_join_binary_packages_in_repositories_binary_packages
- mysql_join_binary_packages_build_assignments
- mysql_join_build_assignments_package_sources
- printf ' SET `binary_packages_in_repositories`.`is_to_be_deleted`=1'
- printf ' WHERE `package_sources`.`pkgbase`=from_base64("%s");' \
- "$(printf '%s' "$1" | base64 -w0)"
+ printf 'UPDATE %s' "${query_delete_packages}"
+ printf ' SET `binary_packages_in_repositories`.`is_to_be_deleted`=1;\n'
} | \
mysql_run_query
fi
@@ -435,18 +470,27 @@ touch "${tmp_dir}/black-listed"
sed '
s/\s*#.*$//
/^\s*$/d
+# TODO: remove the legacy-blacklist-parsing
+ /^\S*$/ {
+ h
+ s/^.*$/Warning: legacy entry in black-list detected:\n"\0"/
+ w /dev/stderr
+ g
+ s/^/any /
+ }
'
if [ -n "${test_exclusion}" ]; then
echo "${test_exclusion}"
fi
# shellcheck disable=SC2016
{
- printf 'SELECT DISTINCT `package_sources`.`pkgbase`'
+ printf 'SELECT DISTINCT "any",`package_sources`.`pkgbase`'
printf ' FROM `package_sources`'
printf ' WHERE `package_sources`.`pkgbase` LIKE "lib32-%%"'
} | \
mysql_run_query
} | \
+ tr ' ' '\t' | \
sort -u > \
"${tmp_dir}/black-listed-new"
@@ -462,13 +506,43 @@ while [ -s "${tmp_dir}/black-listed-new" ]; do
# shellcheck disable=SC2016
{
- printf 'CREATE TEMPORARY TABLE `bl` (`pkgbase` VARCHAR(64));\n'
- printf 'LOAD DATA LOCAL INFILE "%s" INTO TABLE `bl` (`pkgbase`);\n' \
+ for suffix in '' '_copy'; do
+ printf 'CREATE TEMPORARY TABLE `bl%s` (' \
+ "${suffix}"
+ printf '`arch` VARCHAR(16),'
+ printf '`pkgbase` VARCHAR(64),'
+ printf 'UNIQUE KEY `content`(`arch`,`pkgbase`)'
+ printf ');\n'
+ done
+ printf 'LOAD DATA LOCAL INFILE "%s" INTO TABLE `bl` (`arch`,`pkgbase`);\n' \
"${tmp_dir}/black-listed"
- printf 'SELECT `a_ps`.`pkgbase`'
+ printf 'INSERT INTO `bl_copy` (`arch`,`pkgbase`)'
+ printf ' SELECT `bl`.`arch`,'
+ printf '`bl`.`pkgbase`'
+ printf ' FROM `bl`;\n'
+
+ printf 'INSERT IGNORE INTO `bl` (`arch`,`pkgbase`)'
+ printf ' SELECT `n_a`.`name`,'
+ printf '`bl_copy`.`pkgbase`'
+ printf ' FROM `bl_copy`'
+ printf ' JOIN `architectures` AS `o_a`'
+ printf ' ON `o_a`.`name`=`bl_copy`.`arch`'
+ printf ' JOIN `architecture_compatibilities`'
+ printf ' ON `architecture_compatibilities`.`runs_on`=`o_a`.`id`'
+ printf ' JOIN `architectures` AS `n_a`'
+ printf ' ON `architecture_compatibilities`.`built_for`=`n_a`.`id`'
+ printf ' OR `o_a`.`name`="any";\n'
+
+ printf 'DELETE FROM `bl`'
+ printf ' WHERE `bl`.`arch`="any";\n'
+
+ printf 'SELECT `a_ra`.`name`,`a_ps`.`pkgbase`'
printf ' FROM `package_sources` AS `a_ps`'
mysql_join_package_sources_build_assignments 'a_ps' 'a_ba'
mysql_join_build_assignments_binary_packages 'a_ba' 'a_bp'
+ mysql_join_binary_packages_binary_packages_in_repositories 'a_bp' 'a_bpir'
+ mysql_join_binary_packages_in_repositories_repositories 'a_bpir' 'a_r'
+ mysql_join_repositories_architectures 'a_r' 'a_ra'
mysql_join_binary_packages_dependencies 'a_bp'
mysql_join_dependencies_dependency_types
printf ' AND (`dependency_types`.`relevant_for_building`'
@@ -531,8 +605,8 @@ if [ "${deletion_list_count}" -gt 1000 ]; then
fi
rm -f "${work_dir}/told-irc-about-too-many-deletion-list-packages"
-while read -r package; do
- delete_package "${package}"
+while read -r arch package; do
+ delete_package "${arch}" "${package}"
done < \
"${tmp_dir}/black-listed"