summaryrefslogtreecommitdiff
path: root/bin/seed-build-list
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2020-03-04 14:23:41 +0100
committerErich Eckner <git@eckner.net>2020-03-04 14:23:41 +0100
commit2142e34e844393def605170a446aacca80f833b0 (patch)
tree335d93b65e8b71d88f3a77a77645f971dad80620 /bin/seed-build-list
parent62b7912c1723419072384a7cb2ac31c1d954d51f (diff)
downloadbuilder-2142e34e844393def605170a446aacca80f833b0.tar.xz
bin/seed-build-list: -s should work with -a, too
Diffstat (limited to 'bin/seed-build-list')
-rwxr-xr-xbin/seed-build-list25
1 files changed, 22 insertions, 3 deletions
diff --git a/bin/seed-build-list b/bin/seed-build-list
index c1df911..f1efc88 100755
--- a/bin/seed-build-list
+++ b/bin/seed-build-list
@@ -55,7 +55,7 @@ usage() {
>&2 echo ' Reschedule packages with matching pkgname or pkgbase.'
>&2 echo ' Note, that these packages must be known to the database.'
>&2 echo ' -s|--skip-arch $arch:'
- >&2 echo ' Ignore packages, that are outdated on $arch only (-m).'
+ >&2 echo ' Ignore packages, that are outdated on $arch only (-a|-m).'
>&2 echo ' -w|--wait:'
>&2 echo ' Wait for lock if necessary.'
[ -z "$1" ] && exit 1 || exit "$1"
@@ -160,8 +160,9 @@ if [ ! -s "${tmp_dir}/mirrors" ] && \
fi
if [ -s "${tmp_dir}/skip-archs" ] && \
+ ! ${auto} && \
[ ! -s "${tmp_dir}/mirrors" ]; then
- >&2 echo 'Invalid combination of options: -s|--skip-archs requires -m|--mirror.'
+ >&2 echo 'Invalid combination of options: -s|--skip-archs requires -m|--mirror or -a|--auto.'
usage 2
exit 2
fi
@@ -222,9 +223,10 @@ done
# TODO: translate lib32-* packages instead of ignoring them for -m
+touch "${tmp_dir}/skip-archs"
+
# harvest pkgnames from mirror delta
if [ -s "${tmp_dir}/mirrors" ]; then
- echo 'any' >> "${tmp_dir}/skip-archs"
{
# theirs
while read -r mirror; do
@@ -242,6 +244,7 @@ if [ -s "${tmp_dir}/mirrors" ]; then
s/^\(.*-\)x86_64\.pkg\.tar\.\(xz\|zst\)$/'"$(
# shellcheck disable=SC2086,SC2154
printf '%s\n' ${architectures} \
+ | grep -vxF 'any' \
| grep -vxFf "${tmp_dir}/skip-archs" \
| sed '
s/^.*$/\\1\0/
@@ -378,6 +381,20 @@ fi
fi
# auto-detect pkgbases
if ${auto}; then
+ printf 'CREATE TEMPORARY TABLE `relevant_archs`(`id` SMALLINT, PRIMARY KEY `id`(`id`));\n'
+ printf 'INSERT INTO `relevant_archs`(`id`)'
+ printf ' SELECT `architectures`.`id`'
+ printf ' FROM `architectures`'
+ printf ' WHERE `architectures`.`name` NOT IN ('
+ base64_encode_each \
+ <"${tmp_dir}/skip-archs" \
+ | sed '
+ s/^.*$/from_base64("\0")/
+ $! s/$/,/
+ ' \
+ | tr -d '\n'
+ printf ');\n'
+
# schedule any package, that:
# 1) is not on the build-list currently and
# 2) is not in ignore-packages and
@@ -394,6 +411,8 @@ fi
printf ' FROM `binary_packages`'
mysql_join_binary_packages_binary_packages_in_repositories
mysql_join_binary_packages_in_repositories_repositories
+ printf ' JOIN `relevant_archs`'
+ printf ' ON `relevant_archs`.`id`=`repositories`.`architecture`'
printf ' JOIN ('
printf 'SELECT `binary_packages`.`pkgname`,'
printf '`binary_packages`.`architecture`,'