summaryrefslogtreecommitdiff
path: root/bin/get-package-updates
diff options
context:
space:
mode:
Diffstat (limited to 'bin/get-package-updates')
-rwxr-xr-xbin/get-package-updates566
1 files changed, 247 insertions, 319 deletions
diff --git a/bin/get-package-updates b/bin/get-package-updates
index 801aadd..cf2ea6c 100755
--- a/bin/get-package-updates
+++ b/bin/get-package-updates
@@ -1,6 +1,6 @@
#!/bin/sh
-# check for packages that need to be built, and build a list in the proper build order
+# check for packages that need to be built
# Details:
# https://github.com/archlinux32/builder/wiki/Build-system#get-package-updates
@@ -9,9 +9,12 @@
# TODO: Find out, why sometimes package updates are missed.
-# TODO: mark loops in mysql database
+# TODO: read information from database
-# TODO: test_exclusion does not yet cooperate with the database
+# TODO: correctly handle if pkgbase of a split package is renamed, e.g.:
+# $a -> ($a,$b) ==> $b -> ($a,$b)
+
+# TODO: keep database clean in case of abort
# shellcheck disable=SC2016
usage() {
@@ -86,57 +89,68 @@ if [ -s "${work_dir}/build-master-sanity" ]; then
exit
fi
+# TODO: How should new deletion-list packages be handled?
+# - packages deleted upstream should be marked as to-be-deleted if
+# existent and otherwise be ignored
+# - packages deleted due to black listing should be marked as black
+# listed - and thus as to-be-deleted, but they should remain in the
+# database after deletion!
+
# delete_package package
# mark $package for deletion
delete_package() {
- echo "$1" >> \
- "${work_dir}/deletion-list.new"
- sed -i "/^$(str_to_regex "${1}") /d" "${work_dir}/build-list.new"
- # shellcheck disable=SC2016
- {
- printf 'UPDATE `binary_packages`'
- printf ' JOIN `%s` ON `%s`.`id`=`binary_packages`.`%s`' \
- 'repositories' 'repositories' 'repository' \
- 'build_assignments' 'build_assignments' 'build_assignment'
- printf ' JOIN `%s` ON `%s`.`id`=`%s`.`%s`' \
- 'package_sources' 'package_sources' 'build_assignments' 'package_source'
- printf ' SET `binary_packages`.`repository`=(SELECT `repositories`.`id` FROM `repositories` WHERE `repositories`.`name`="deletion-list")'
- printf ' WHERE `repositories`.`name`="build-list"'
- printf ' AND `package_sources`.`pkgbase`=from_base64("%s");' \
- "$(printf '%s' "$1" | base64 -w0)"
- } | \
- ${mysql_command}
+ # 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
+ {
+ # packages from the build-list/to-be-decided go straight to the deletion-list
+ printf 'UPDATE `binary_packages`'
+ mysql_join_binary_packages_repositories
+ mysql_join_binary_packages_build_assignments
+ mysql_join_build_assignments_package_sources
+ printf ' SET `binary_packages`.`repository`=(SELECT `repositories`.`id` FROM `repositories` WHERE `repositories`.`name`="deletion-list")'
+ printf ' WHERE `repositories`.`name` in ("build-list","to-be-decided")'
+ printf ' AND `package_sources`.`pkgbase`=from_base64("%s");\n' \
+ "$(printf '%s' "$1" | base64 -w0)"
+ # other packages are marked as `is_to_be_deleted`
+ printf 'UPDATE `binary_packages`'
+ mysql_join_binary_packages_repositories
+ mysql_join_binary_packages_build_assignments
+ mysql_join_build_assignments_package_sources
+ printf ' SET `binary_packages`.`is_to_be_deleted`=1'
+ printf ' WHERE `package_sources`.`pkgbase`=from_base64("%s");' \
+ "$(printf '%s' "$1" | base64 -w0)"
+ } | \
+ mysql_run_query
+ fi
}
-# create tmp_dir and trap
-tmp_dir=$(mktemp -d 'tmp.get-package-updates.XXXXXXXXXX' --tmpdir)
-trap 'rm -rf --one-file-system "${tmp_dir}"' EXIT
-
-# Update git repositories (official packages, community packages and the repository of package customizations).
+something_new=false
for repo in ${repo_names}; do
eval repo_path='"${repo_paths__'"${repo}"'}"'
+ # Update git repositories (official packages, community packages and the repository of package customizations).
git -C "${repo_path}" fetch origin master:master
-done
-
-# Read previous git revision numbers from files.
-
-something_new=false
-
-for repo in ${repo_names}; do
+ # read previous git revision numbers from database.
+ # shellcheck disable=SC2016
eval "old_repo_revisions__${repo}='$(
- cat "${work_dir}/${repo}.revision" 2> /dev/null || \
- echo NONE
+ {
+ printf 'SELECT `git_repositories`.`head` FROM `git_repositories`'
+ printf ' WHERE `git_repositories`.`name`=from_base64("%s");\n' \
+ "$(printf '%s' "${repo}" | base64 -w0)"
+ } | \
+ mysql_run_query
)'"
- eval repo_path='"${repo_paths__'"${repo}"'}"'
- eval "new_repo_revisions__${repo}='$(
- if ${pull}; then
+ # determine new git revision
+ if ${pull}; then
+ eval "new_repo_revisions__${repo}='$(
git -C "${repo_path}" rev-parse HEAD
- else
- cat "${work_dir}/${repo}.revision"
- fi | \
- tee "${work_dir}/${repo}.revision.new"
- )'"
+ )'"
+ else
+ eval 'new_repo_revisions__'"${repo}"'="${old_repo_revisions__'"${repo}"'}"'
+ fi
if ! eval '[ "${new_repo_revisions__'"${repo}"'}" = "${old_repo_revisions__'"${repo}"'}" ]'; then
something_new=true
fi
@@ -162,6 +176,11 @@ if ! flock -s ${block_flag} 8; then
exit
fi
+trap mysql_cleanup EXIT
+
+# shellcheck disable=SC2119
+mysql_cleanup
+
echo 'Check modified packages from the last update, and put them to the build list.'
# Check modified packages from the last update, and put them to the build list.
@@ -169,13 +188,6 @@ echo 'Check modified packages from the last update, and put them to the build li
# If a package is deleted, remove from the rebuild list, and add it to the deletion list.
# If a new package is added, then ensure that it's not on the deletion list.
-cp \
- "${work_dir}/build-list" \
- "${work_dir}/build-list.new"
-cp \
- "${work_dir}/deletion-list" \
- "${work_dir}/deletion-list.new"
-
for repo in ${repo_names}; do
eval repo_path='"${repo_paths__'"${repo}"'}"'
eval old_repo_revision='"${old_repo_revisions__'"${repo}"'}"'
@@ -191,26 +203,9 @@ for repo in ${repo_names}; do
git -C "${repo_path}" diff --no-renames --name-status "${old_repo_revision}" "${new_repo_revision}"
fi
} | \
- # Packages which are already on the build list should receive a git_revision bump if _any_ file changed.
- # Thus, we rename any file "PKGBUILD" to trigger the successive logic.
- if [ "${repo}" = 'archlinux32' ]; then
- sed "$(
- sed '
- s/ .*$//
- s|^|\\@^.\\t[^/]\\+/|
- s|$|/@ s@/[^/]*$@/PKGBUILD@|
- ' "${work_dir}/build-list"
- )"
- else
- sed "$(
- sed '
- s/ .*$//
- s|^|\\@^.\\t|
- s|$|/@ s@/[^/]*$@/PKGBUILD@|
- ' "${work_dir}/build-list"
- )"
- fi | \
# only track changes in PKGBUILDs
+ # TODO: However, packages which are already on the build list should
+ # receive a git_revision bump if _any_ file changed.
grep '/PKGBUILD$' | \
if [ "${repo}" = "archlinux32" ]; then
# modify the directory structure from the modifiaction-repository
@@ -245,24 +240,26 @@ done | \
while read -r mode package git_revision repository; do
if [ "${mode}" = 'D' ]; then
# deleted PKGBUILD
- git_revision=$(cat "${work_dir}/archlinux32.revision.new")
+ # shellcheck disable=SC2154
+ git_revision="${new_repo_revisions__archlinux32}"
found_package=false
for repository in ${repo_names}; do
eval 'repo_path="${repo_paths__'"${repository}"'}"'
if [ "${repository}" = "archlinux32" ]; then
- if git -C "${repo_path}" archive "$(cat "${work_dir}/${repository}.revision.new")" 2> /dev/null | \
+ if git -C "${repo_path}" archive "${new_repo_revisions__archlinux32}" 2> /dev/null | \
tar -t 2> /dev/null | \
grep -q "/$(str_to_regex "${package}")/PKGBUILD$"; then
found_package=true
break;
fi
else
- if git -C "${repo_path}" archive "$(cat "${work_dir}/${repository}.revision.new")" -- "${package}/repos" 2> /dev/null | \
- tar -t --wildcards "${package}/repos/*/PKGBUILD" 2> /dev/null | \
- cut -d/ -f3 | \
- grep -v 'staging\|testing\|-unstable' | \
- grep -vq -- '-i686$'; then
- git_revision=$(cat "${work_dir}/${repository}.revision.new")
+ # shellcheck disable=SC2154
+ if eval 'git -C "${repo_path}" archive "${new_repo_revisions__'"${repository}"'}" -- "${package}/repos" 2> /dev/null | ' \
+ 'tar -t --wildcards "${package}/repos/*/PKGBUILD" 2> /dev/null | ' \
+ 'cut -d/ -f3 | ' \
+ 'grep -v '"'"'staging\|testing\|-unstable'"'"' | ' \
+ 'grep -vq -- '"'"'-i686$'"'"; then
+ eval 'git_revision="${new_repo_revisions__'"${repository}"'}"'
found_package=true
break;
fi
@@ -280,31 +277,36 @@ done | \
fi
fi
if [ "${mode}" = 'A' ] || [ "${mode}" = 'M' ]; then
- # new or modified PKGBUILD
- sed -i "/^$(str_to_regex "${package}") /d" "${work_dir}/build-list.new"
- # shellcheck disable=SC2154
- echo "${package} ${git_revision} ${new_repo_revisions__archlinux32} ${repository}" >> \
- "${work_dir}/build-list.new"
- sed -i "/^$(str_to_regex "${package}")\$/d" "${work_dir}/deletion-list.new"
# shellcheck disable=SC2016
{
# delete old build assignment and associated binary packages
- # which are not yet build or on the deletion list
+ # which are not yet built or on the deletion list
printf 'DELETE `build_assignments`,`binary_packages`'
printf ' FROM `binary_packages`'
- printf ' JOIN `%s` ON `%s`.`id`=`%s`.`%s`' \
- 'build_assignments' 'build_assignments' 'binary_packages' 'build_assignment' \
- 'package_sources' 'package_sources' 'build_assignments' 'package_source' \
- 'repositories' 'repositories' 'binary_packages' 'repository'
+ mysql_join_binary_packages_build_assignments
+ mysql_join_build_assignments_package_sources
+ mysql_join_binary_packages_repositories
printf ' WHERE `package_sources`.`pkgbase`=from_base64("%s")' \
"$(
printf '%s' "${package}" | \
base64 -w0
)"
printf ' AND (`repositories`.`name`="build-list" OR `repositories`.`name`="deletion-list");\n'
+ # remove is-to-be-deleted marker from old binary packages
+ printf 'UPDATE `binary_packages`'
+ mysql_join_binary_packages_build_assignments
+ mysql_join_build_assignments_package_sources
+ mysql_join_binary_packages_repositories
+ printf ' SET `is_to_be_deleted`=0'
+ printf ' WHERE `package_sources`.`pkgbase`=from_base64("%s");\n' \
+ "$(
+ printf '%s' "${package}" | \
+ base64 -w0
+ )"
} | \
- ${mysql_command}
- mysql_generate_package_metadata "${package}" "${git_revision}" "${new_repo_revisions__archlinux32}" "${repository}"
+ mysql_run_query
+ # shellcheck disable=SC2154
+ mysql_generate_package_metadata 'to-be-decided' "${package}" "${git_revision}" "${new_repo_revisions__archlinux32}" "${repository}"
continue
fi
@@ -312,21 +314,6 @@ done | \
exit 1
done
-sort -u "${work_dir}/deletion-list.new" | \
- sponge "${work_dir}/deletion-list.new"
-
-echo 'Extract dependencies of packages.'
-
-# First, we extract the dependencies of each package.
-
-mkdir -p "${work_dir}/package-infos"
-
-while read -r package git_revision mod_git_revision repository; do
-
- generate_package_metadata "${package}" "${git_revision}" "${mod_git_revision}" "${repository}"
-
-done < "${work_dir}/build-list.new"
-
echo 'apply blacklisting'
# ignore blacklisted packages and dependent packages
# this is the first time when all the information is available and up to date
@@ -334,249 +321,190 @@ echo 'apply blacklisting'
black_listed=''
black_listed_new=$(
{
- git -C "${repo_paths__archlinux32}" archive "$(cat "${work_dir}/archlinux32.revision.new")" -- 'blacklist' | \
- tar -Ox 'blacklist' | \
- sed '
- s/\s*#.*$//
- /^\s*$/d
- '
- if [ -n "${test_exclusion}" ]; then
- echo "${test_exclusion}"
- fi
- find "${work_dir}/package-infos" -maxdepth 1 -name 'lib32-*' -printf '%f\n' | \
- sed 's|\(\.[^.]\+\)\{4\}$||' | \
- uniq
+ {
+ git -C "${repo_paths__archlinux32}" archive "${new_repo_revisions__archlinux32}" -- 'blacklist' | \
+ tar -Ox 'blacklist' | \
+ sed '
+ s/\s*#.*$//
+ /^\s*$/d
+ '
+ if [ -n "${test_exclusion}" ]; then
+ echo "${test_exclusion}"
+ fi
+ } | \
+ base64_encode_each
+ # shellcheck disable=SC2016
+ {
+ printf 'SELECT DISTINCT replace(to_base64(`package_sources`.`pkgbase`),"\\n","")'
+ printf ' FROM `package_sources`'
+ printf ' WHERE `package_sources`.`pkgbase` LIKE "lib32-%%"'
+ } | \
+ mysql_run_query
} | \
sort -u
)
-find "${work_dir}/package-infos/" -maxdepth 1 -name '*.builds' -printf '%f\n' | \
- grep '\(\.[0-9a-f]\{40\}\)\{2\}\.[^.]\+\.builds$' | \
- sed '
- s|^\(.*\)\.\([^.]\+\)\.\([^.]\+\)\.\([^.]\+\)\.[^.]\+$|\2 \3 \4 \1|
- ' | \
- sort -u | \
- sort -k4,4 > \
- "${tmp_dir}/packages"
-
-{
- uniq -f3 -u "${tmp_dir}/packages" | \
- awk '{print $4 " " $4 "." $1 "." $2 "." $3}'
- uniq -f3 -D "${tmp_dir}/packages" | \
- uniq -f3 --group=append | \
- while read -r rev mod_rev repo pkg; do
- if [ -z "${rev}" ] && \
- [ -z "${mod_rev}" ] && \
- [ -z "${repo}" ] && \
- [ -z "${pkg}" ]; then
- # shellcheck disable=SC2031
- printf '%s %s.%s.%s.%s\n' \
- "${opkg}" \
- "${opkg}" \
- "$(
- # shellcheck disable=SC2086
- printf '%s\n' ${revs} | \
- sort -u | \
- find_newest_of_git_revisions
- )" \
- "$(
- # shellcheck disable=SC2086
- printf '%s\n' ${mod_revs} | \
- sort -u | \
- find_newest_of_git_revisions
- )" \
- "${orepo}" | \
- grep '\(\.[0-9a-f]\{40\}\)\{2\}\.[^.]\+$'
- revs=''
- mod_revs=''
- continue
- fi
- revs=$(
- printf '%s\n' \
- ${revs} \
- "${rev}"
- )
- mod_revs=$(
- printf '%s\n' \
- ${mod_revs} \
- "${mod_rev}"
- )
- opkg="${pkg}"
- orepo="${repo}"
- done
-} | \
- sort -k1,1 > \
- "${tmp_dir}/newest-revisions"
-
-sed '
- s|^\S\+ |'"${work_dir}"'/package-infos/|
- s|$|.builds|
-' "${tmp_dir}/newest-revisions" | \
- xargs -r cat | \
- sort | \
- uniq -c > \
- "${work_dir}/built-packages"
-
-sed '
- s|^\S\+ |'"${work_dir}"'/package-infos/|
- s|$|.build-depends|
-' "${tmp_dir}/newest-revisions" | \
- xargs -r grep -HF '' | \
- sed '
- s|\(\.[^.]\+\)\{4\}:\([^:]\+\)$| \2|
- s|^.*/||
- ' | \
- sort -k2,2 > \
- "${work_dir}/newest-dependencies"
-
while [ -n "${black_listed_new}" ]; do
black_listed=$(
- # shellcheck disable=SC2086
- printf '%s\n' ${black_listed} ${black_listed_new} | \
+ printf '%s\n' "${black_listed}" "${black_listed_new}" | \
+ grep -vxF '' | \
sort -u
)
black_listed_new=$(
{
- # shellcheck disable=SC2086
- printf '%s\n' ${black_listed} | \
- sort -k1,1 | \
- join -j1 -o 2.2 - "${tmp_dir}/newest-revisions" | \
- sed '
- s|^|'"${work_dir}"'/package-infos/|
- s|$|.builds|
- ' | \
- xargs -r cat | \
- sort | \
- uniq -c
- cat "${work_dir}/built-packages"
+ printf '%s\n' "${black_listed}" "${black_listed}"
+
+ # shellcheck disable=SC2016
+ {
+ printf 'CREATE TEMPORARY TABLE `bl` (`pkgbase` VARCHAR(64));\n'
+ printf 'INSERT INTO `bl` (`pkgbase`) VALUES '
+ printf '%s\n' "${black_listed}" | \
+ sort -u | \
+ sed '
+ s/^/(from_base64("/
+ s/$/")),/
+ $ s/,$/;/
+ '
+ printf 'SELECT replace(to_base64(`a_ps`.`pkgbase`),"\\n","")'
+ 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_dependencies 'a_bp'
+ printf ' WHERE NOT EXISTS ('
+ printf ' SELECT *'
+ printf ' FROM `install_target_providers`'
+ printf ' WHERE NOT EXISTS ('
+ printf ' SELECT *'
+ printf ' FROM `bl`'
+ printf ' JOIN `package_sources` AS `b_ps` ON `bl`.`pkgbase`=`b_ps`.`pkgbase`'
+ mysql_join_package_sources_build_assignments 'b_ps' 'b_ba'
+ mysql_join_build_assignments_binary_packages 'b_ba' 'b_bp'
+ printf ' WHERE `install_target_providers`.`package`=`b_bp`.`id`'
+ printf ')'
+ printf ' AND `install_target_providers`.`install_target`=`dependencies`.`depending_on`'
+ printf ') AND EXISTS ('
+ # TODO: This should be corrected at the root: automatic install targets, which are bogus should
+ # not be added in the first place - but how do we detect that?
+ printf ' SELECT *'
+ printf ' FROM `install_target_providers`'
+ printf ' WHERE `install_target_providers`.`install_target`=`dependencies`.`depending_on`'
+ printf ');\n'
+ } | \
+ mysql_run_query | \
+ sort -u
} | \
- sort | \
- uniq -d | \
- awk '{print $2}' | \
- sort -k1,1 | \
- join -1 1 -2 2 -o 2.1 - "${work_dir}/newest-dependencies" | \
- sort -u
- )
- black_listed_new=$(
- # shellcheck disable=SC2086
- printf '%s\n' ${black_listed} ${black_listed} ${black_listed_new} | \
+ grep -vxF '' | \
sort | \
uniq -u
)
done
-echo "${black_listed}" | \
- while read -r package; do
- [ -n "${package}" ] && \
- delete_package "${package}"
- done
-sort -u "${work_dir}/deletion-list.new" | \
- sponge "${work_dir}/deletion-list.new"
-
-
-if [ -n "${test_exclusion}" ]; then
- # we should not actually update the build-list et. al, but solely print this difference:
- if diff --color -u "${work_dir}/deletion-list" "${work_dir}/deletion-list.new"; then
- printf 'If you put "%s" on the blacklist, no additional packages will end up on the deletion list.\n' "${test_exclusion}"
- fi
- exit 0
-fi
-
-# Now we create the partial order.
-
-while read -r package git_revision mod_git_revision repository; do
- # add "$pkgname -> $build-target" to build-order list
- sed "s|^|${package} |" "${work_dir}/package-infos/${package}.${git_revision}.${mod_git_revision}.${repository}.builds"
- # add "$dependency -> $pkgname" to build-order list
- sed "s|\$| ${package}|" "${work_dir}/package-infos/${package}.${git_revision}.${mod_git_revision}.${repository}.build-depends"
- # add "base/base-devel -> $pkgname" to build-order list
- printf '%s '"${package}"'\n' 'base' 'base-devel'
-done \
- < "${work_dir}/build-list.new" \
- > "${work_dir}/build-order"
-
-if grep -vq '^\S\+ \S\+$' "${work_dir}/build-order"; then
- >&2 echo 'Created partial order file "build-order" is invalid.'
- exit 2
-fi
-
-echo 'Now actually sort it.'
-
-{
- # this part will have the correct build order, but all the infos are missing
- tsort "${work_dir}/build-order" 2> "${work_dir}/tsort.error" | \
- nl -ba | \
- awk '{print $1 " not-git also-not-git whatever " $2}'
- # this part has all the infos, but possibly the wrong order
- awk '{print "0 " $2 " " $3 " " $4 " " $1}' "${work_dir}/build-list.new"
-} | \
- sort -k5,5 -k1nr | \
- # now, we have the correct order and the infos, but in adjacent lines
- uniq -f4 -D | \
- sed '/^0 /d;N;s|\n| |' | \
- # now in one line, each
- sort -k1n,1 | \
- awk '{print $5 " " $7 " " $8 " " $9}' > \
- "${work_dir}/build-list.new.new"
-
-rm --one-file-system -rf "${work_dir}/build-list.loops.new"
-mkdir "${work_dir}/build-list.loops.new"
-
-if [ -s "${work_dir}/tsort.error" ]; then
- >&2 echo 'WARNING: There is a dependency cycle!'
- >&2 cat "${work_dir}/tsort.error"
- >&2 echo
- >&2 echo 'I will continue anyway.'
- # save loops in separate files each, so breaking them is easier
- awk '
- /^tsort: \S+: input contains a loop:$/{
- n++;
- getline
- }
- {
- print $2 >"'"${work_dir}"'/build-list.loops.new/loop_" n
- }
- ' "${work_dir}/tsort.error"
-
- # remove lines from loop files which are no packages
- find "${work_dir}/build-list.loops.new" -maxdepth 1 -regextype grep \
- -regex '.*/loop_[0-9]\+' \
- -printf '%p\n' | \
- while read -r loop; do
- {
- sort -u "${loop}"
- cut -d' ' -f1 "${work_dir}/build-list.new.new" | \
- sort -u
- } | \
- sort | \
- uniq -d | \
- sponge "${loop}"
- done
-else
- rm "${work_dir}/tsort.error"
-fi
+black_listed=$(
+ printf '%s\n' "${black_listed}" | \
+ while read -r line; do
+ printf '%s' \
+ "${line}" | \
+ base64 -d
+ printf '\n'
+ done
+)
deletion_list_count=$(
- wc -l < \
- "${work_dir}/deletion-list.new"
+ # shellcheck disable=SC2086
+ printf '%s\n' ${black_listed} | \
+ wc -l
)
if [ "${deletion_list_count}" -gt 1000 ]; then
>&2 printf 'There are %s > 1000 packages on the deletion-list. This does not seem right.\n' \
"${deletion_list_count}"
+ if [ ! -s "${work_dir}/told-irc-about-too-many-deletion-list-packages" ]; then
+ {
+ printf '\001ACTION refuses to blacklist %s packages.\001\n' "${deletion_list_count}"
+ for repo_name in ${repo_names}; do
+ eval 'old_revision="${old_repo_revisions__'"${repo_name}"'}"'
+ eval 'new_revision="${new_repo_revisions__'"${repo_name}"'}"'
+ # shellcheck disable=SC2154
+ if [ "${old_revision}" != "${new_revision}" ]; then
+ printf '%s: %s -> %s\n' \
+ "${repo_name}" \
+ "${old_revision}" \
+ "${new_revision}"
+ fi
+ done
+ } | \
+ tee "${work_dir}/told-irc-about-too-many-deletion-list-packages" | \
+ irc_say
+ fi
exit 3
fi
+rm -f "${work_dir}/told-irc-about-too-many-deletion-list-packages"
-# Move the .new-files to the actual files
+echo "${black_listed}" | \
+ while read -r package; do
+ if [ -z "${package}" ]; then
+ continue
+ fi
+ delete_package "${package}"
+ done
+
+
+if [ -n "${test_exclusion}" ]; then
+ # TODO: reimplement test_exclusion with information from the database
+ >&2 echo 'sry, not yet done.'
+ exit 0
+fi
+
+echo 'Done - mark decisions as final.'
-rm -rf --one-file-system "${work_dir}/build-list.loops"
+# shellcheck disable=SC2016
{
- printf '%s\n' "build-list.loops" "build-list.new" "build-list" "deletion-list"
- # shellcheck disable=SC2086
- printf '%s.revision\n' ${repo_names}
-} | \
- while read -r file; do
- mv "${work_dir}/${file}.new" "${work_dir}/${file}"
+ # save blacklist into database
+ printf 'CREATE TEMPORARY TABLE `bl` (`pkgbase` VARCHAR(64), `reason` TEXT);\n'
+ git -C "${repo_paths__archlinux32}" archive "${new_repo_revisions__archlinux32}" -- 'blacklist' | \
+ tar -Ox 'blacklist' | \
+ sed -n '
+ s/^\(\S\+\)\s*#\s*/\1 /
+ T
+ p
+ ' | \
+ while read -r pkgbase reason; do
+ printf '(from_base64("%s"),from_base64("%s")),\n' \
+ "$(printf '%s' "${pkgbase}" | base64 -w0)" \
+ "$(printf '%s' "${reason}" | base64 -w0)"
+ done | \
+ sed '
+ 1 i INSERT INTO `bl` (`pkgbase`,`reason`) VALUES
+ $ s/,$/;/
+ '
+ printf 'UPDATE `build_assignments`'
+ mysql_join_build_assignments_package_sources
+ printf ' LEFT JOIN `bl` ON `package_sources`.`pkgbase`=`bl`.`pkgbase`'
+ printf ' SET `build_assignments`.`is_black_listed`=`bl`.`reason`;\n'
+ printf 'DROP TEMPORARY TABLE `bl`;\n'
+
+ # update hashes of repositories in mysql database
+ for repo in ${repo_names}; do
+ printf 'UPDATE `git_repositories`'
+ printf ' SET `git_repositories`.`head`=from_base64("%s")' \
+ "$(eval 'printf '"'"'%s'"'"' "${new_repo_revisions__'"${repo}"'}" | base64 -w0')"
+ printf ' WHERE `git_repositories`.`name`=from_base64("%s");\n' \
+ "$(printf '%s' "${repo}" | base64 -w0)"
done
+ # move binary_packages from "to-be-decided" to "build-list"
+ printf 'UPDATE `binary_packages`'
+ mysql_join_binary_packages_repositories '' 'from_repo'
+ printf ' SET `repository`=('
+ printf 'SELECT `to_repo`.`id`'
+ printf ' FROM `repositories` AS `to_repo`'
+ printf ' WHERE `to_repo`.`name`="build-list"'
+ printf ')'
+ printf ' WHERE `from_repo`.`name`="to-be-decided";\n'
+} | \
+ mysql_run_query
+
+# update loop list in database (beware, the packages are expected to be in "build-list",
+# not "to-be-decided", so we need to run this after moving the packages from "to-be-decided" to the "build-list".
+mysql_find_build_assignment_loops
# Remove the lock file