index : builder | |
Archlinux32 build system | gitolite user |
summaryrefslogtreecommitdiff |
-rwxr-xr-x | bin/get-package-updates | 80 |
diff --git a/bin/get-package-updates b/bin/get-package-updates index ca2b51a..03ccdd2 100755 --- a/bin/get-package-updates +++ b/bin/get-package-updates @@ -202,26 +202,6 @@ delete_package() { mysql_run_query } -# check_if_package_should_be_deleted $pkgbase $repository - -# shellcheck disable=SC3043 -check_if_package_should_be_deleted() { - local pkgbase="$1" - local repository="$2" - >&2 printf 'check_if_package_should_be_deleted %s %s\n' "${pkgbase}" "${repository}" - # shellcheck disable=SC2154 - if git -C "${repo_paths__archlinux32}" archive "${new_repo_revisions__archlinux32}" -- "${repository}/${pkgbase}" >/dev/null 2>&1; then - return 1 - fi - for considered_architecture in 'any' 'x86_64'; do - # shellcheck disable=SC2154 - if git -C "${repo_paths__state}" archive "${new_repo_revisions__state}" -- "${repository}-${considered_architecture}/${pkgbase}" >/dev/null 2>&1; then - return 1 - fi - done - return 0 -} - something_new=false for repo in ${repo_names}; do @@ -353,19 +333,11 @@ echo 'Check modified packages from the last update, and put them to the build li | sort -u \ > "${tmp_dir}/upstream-packages" diff "${tmp_dir}/mysql-packages" "${tmp_dir}/upstream-packages" \ - | grep '^[<>]' \ - | awk '{print $1 " " $3 " " $2 " " $4}' \ - | sort -k3,3 -k1r,1 \ - | uniq -uf2 \ - | while read -r mode git_revision pkgbase repository; do - if [ "${mode}" = '<' ]; then - # TODO: To-be-deleted upstream packages need to be detected separately. - # if we have package x in version y and z, we *always* get a "<" entry, here -# if check_if_package_should_be_deleted "${pkgbase}" "${repository}"; then -# delete_package 'any' "${pkgbase}" "${repository}" -# fi - continue - fi + | grep '^>' \ + | awk '{print $3 " " $2 " " $4}' \ + | sort -k2,2 -k3,3 \ + | uniq -uf1 \ + | while read -r git_revision pkgbase repository; do if git -C "${repo_paths__archlinux32}" archive "${new_repo_revisions__archlinux32}" -- "${repository}/${pkgbase}" >/dev/null 2>&1; then mod_git_revision="${new_repo_revisions__archlinux32}" else @@ -381,21 +353,9 @@ echo 'Check modified packages from the last update, and put them to the build li # shellcheck disable=SC2154 git -C "${repo_paths__archlinux32}" diff "${old_repo_revisions__archlinux32}" "${new_repo_revisions__archlinux32}" --name-status \ | tr '\t/' ' ' \ - | cut -d' ' -f1,2,3 \ - | sed ' - s/^[AM]/>/ - t - s/^D/</ - t - d - ' \ - | while read -r mode repository pkgbase; do - if check_if_package_should_be_deleted "${pkgbase}" "${repository}"; then - delete_package 'any' "${pkgbase}" "${repository}" - continue - else - mode='>' - fi + | grep '^[AM]' \ + | cut -d' ' -f2,3 \ + | while read -r repository pkgbase; do git_revision=$( # shellcheck disable=SC2046 git -C "${repo_paths__state}" archive "${new_repo_revisions__state}" -- $( @@ -435,6 +395,30 @@ if [ -n "${errors}" ]; then exit 1 fi +>&2 echo 'check for to be deleted packages' + +cut -d' ' -f1,3 "${tmp_dir}/mysql-packages" \ +| sort -u \ +| sponge "${tmp_dir}/mysql-packages" + +{ + cut -d' ' -f1,3 "${tmp_dir}/upstream-packages" + git -C "${repo_paths__archlinux32}" archive "${new_repo_revisions__archlinux32}" \ + | tar -t \ + | grep -v '^blacklist/' \ + | tr '/' ' ' \ + | awk '{print $2 " " $1}' +} \ +| sort -u \ +| sponge "${tmp_dir}/upstream-packages" + +diff "${tmp_dir}/mysql-packages" "${tmp_dir}/upstream-packages" \ +| grep '^<' \ +| cut -d' ' -f2,3 \ +| while read -r pkgbase repository; do + delete_package 'any' "${pkgbase}" "${repository}" +done + grep -v '^lib32-' "${tmp_dir}/modified-packages" \ | sponge "${tmp_dir}/modified-packages" |