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:01:18 +0200
committerErich Eckner <git@eckner.net>2017-10-23 12:01:18 +0200
commitdd90c80ab005cb2fbc85472c408691cf20242924 (patch)
tree72b6b5a163926ea76bb1b3f8f8bffc4089e30051 /bin/common-functions
parent113054018f04cf5e1a942fe2c9c8a066bf1fcf00 (diff)
bin/common-functions: remove_old_package_versions: cleanup, prepare for arch-change-deletions
Diffstat (limited to 'bin/common-functions')
-rwxr-xr-xbin/common-functions24
1 files changed, 17 insertions, 7 deletions
diff --git a/bin/common-functions b/bin/common-functions
index 857140b..fd97cae 100755
--- a/bin/common-functions
+++ b/bin/common-functions
@@ -476,24 +476,31 @@ remove_old_package_versions() {
{
for repo in ${delete_older_repositories}; do
ls_master_mirror "${arch}/${repo}" | \
- sed '
+ sed -n '
/\.pkg\.tar\.xz$/!d
s|-\([^-]\+-[^-]\+\)-\([^-]\+\)$| \1 \2|
- /^'"$(str_to_regex "${package%-*-*-*}")"' /!d
- s|^|2 '"${arch} ${repo}"' |
+ /^'"$(str_to_regex "${package%-*-*-*}")"' / {
+ s|^|2 '"${arch} ${repo}"' |
+ p
+ }
'
done
for repo in ${delete_not_newer_repositories}; do
ls_master_mirror "${arch}/${repo}" | \
- sed '
+ sed -n '
/\.pkg\.tar\.xz$/!d
s|-\([^-]\+-[^-]\+\)-\([^-]\+\)$| \1 \2|
- /^'"$(str_to_regex "${package%-*-*-*}")"' /!d
- s|^|0 '"${arch} ${repo}"' |
+ /^'"$(str_to_regex "${package%-*-*-*}")"' / {
+ s|^|0 '"${arch} ${repo}"' |
+ p
+ }
'
done
echo "${package%-*}" | \
sed 's|^.*-\([^-]\+-[^-]\+\)$|1 %cut% %it% %here% \1|'
+
+ # the generated list contains the following columns:
+ # $delete-if-newer-vs-not-older $arch-directory $repo-directory $pkgname $pkgver-$pkgrel $pkg-arch.pkg.tar.xz
} | \
expand_version 5 | \
sort -k5V,5 -k1n,1 | \
@@ -503,8 +510,11 @@ remove_old_package_versions() {
s/^[02] //
s/ \(\S\+\)$/-\1/
p
- ' > \
+ ' | \
+ sort -u > \
"${tmp_dir}/packages-to-delete"
+ # this file contains a list of packages to be delete, one on each line:
+ # $architecture-directory $repository-directory $package-name $pkgver-$pkgrel-$package-architecture.pkg.tar.xz
cut -d' ' -f1,2 < \
"${tmp_dir}/packages-to-delete" | \