Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/bin/common-functions
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2017-10-23 12:13:32 +0200
committerErich Eckner <git@eckner.net>2017-10-23 12:13:32 +0200
commitad39062f22a1afb60888109420c1c5a309461f26 (patch)
tree7dce3084fa16f67ec6956b63419a4e7988cbd810 /bin/common-functions
parentdd90c80ab005cb2fbc85472c408691cf20242924 (diff)
bin/common-functions: remove_old_package_versions now handles architecture transitions
Diffstat (limited to 'bin/common-functions')
-rwxr-xr-xbin/common-functions26
1 files changed, 20 insertions, 6 deletions
diff --git a/bin/common-functions b/bin/common-functions
index fd97cae..9cf010b 100755
--- a/bin/common-functions
+++ b/bin/common-functions
@@ -407,12 +407,14 @@ ls_master_mirror() {
# removes all older (not-newer) versions of $package_file
# in all repositories not-older (newer) than $repository
-# TODO: implement b) and c)
-#
-# A package is considered older (not newer) if
-# a) its version is older (not newer) or
-# b) if its architecture is 'any' and different or
-# c) if the other architecture is 'any' and different
+# A package is considered not newer if
+# a) its version is not newer
+# A package is considered older if
+# b) its version is older or
+# c) if it's "not newer" and its architecture is 'any' and different or
+# d) if it's "not newer" and the other architecture is 'any' and different
+
+# this ensures an any package may replace arch-specific packages of the same version and vice versa
remove_old_package_versions() {
@@ -474,6 +476,15 @@ remove_old_package_versions() {
trap 'rm -rf --one-file-system "${tmp_dir}"' EXIT
{
+ # the architecture of the package (any vs. i686)
+ package_arch="${package##*-}"
+ package_arch="${package_arch%%.*}"
+ if [ "${package_arch}" = 'any' ]; then
+ package_arch_regex_inverter='!'
+ else
+ unset package_arch_regex_inverter
+ fi
+
for repo in ${delete_older_repositories}; do
ls_master_mirror "${arch}/${repo}" | \
sed -n '
@@ -481,6 +492,9 @@ remove_old_package_versions() {
s|-\([^-]\+-[^-]\+\)-\([^-]\+\)$| \1 \2|
/^'"$(str_to_regex "${package%-*-*-*}")"' / {
s|^|2 '"${arch} ${repo}"' |
+ / any\.pkg\.tar\.xz$/'"${package_arch_regex_inverter}"'{
+ s|^2|0|
+ }
p
}
'