From 0016717217f6fc2be8c702b171382cb33b8a381a Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Fri, 2 Jun 2017 11:20:30 +0200 Subject: bin/return-assignment: remove old versions of same packages --- bin/return-assignment | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/bin/return-assignment b/bin/return-assignment index e65bcfa..1f3267c 100755 --- a/bin/return-assignment +++ b/bin/return-assignment @@ -15,7 +15,6 @@ # 4: package error (e.g. wrong packages sent) # TODO: -# remove old version(s) of newly compiled packages # fix signing of database . "${0%/*}/../conf/default.conf" @@ -136,6 +135,15 @@ mv *.pkg.tar.xz{,.sig} "${master_mirror_directory}/i686/$4-staging/" cd "${master_mirror_directory}/i686/$4-staging" repo-add "$4-staging.db.tar.gz" "${packages[@]}" # repo-add -v -s -k "${repo_key}" "$4-staging.db.tar.gz" "${packages[@]}" + + # remove old versions of same packages + for package in "${packages[@]}"; do + pkgname="${package%-*-*-*.pkg.tar.xz}" + ls | \ + grep "^${pkgname//./\\.}\(-[^-]\+\)\{3\}\.pkg\.tar\.xz\(\.sig\)\?\$" | \ + grep -v "^${package//./\\.}\(\.sig\)\?\$" | \ + xargs -rn1 rm + done ) # remove all loops which are broken by this package -- cgit v1.2.3-54-g00ecf