aptosaurus: fix delete old

This commit is contained in:
Starbeamrainbowlabs 2020-05-13 20:26:24 +01:00
parent efe6d55913
commit d057a9cea7
Signed by: sbrl
GPG Key ID: 1BE5172E637709C2
1 changed files with 1 additions and 1 deletions

View File

@ -201,7 +201,7 @@ task_generate-summary() {
task_delete-old() {
task_begin "Deleting packages more than ${keep_versions} versions ago";
# Find and delete old package versions
export -f __analyse_package_simple;
export -f __analyse_package;
find sources/ -type f -name "*.deb" -print0 | xargs -0 -n1 -P "$(nproc)" -I{} bash -c '__analyse_package "{}"' | sort -k1,2Vr | uniq | awk -v keep_ago=${keep_versions} '{ package=$1; gsub(/^.*\//, "", package); gsub(/_.*+$/, "", package); arch=$1; gsub(/^.*_/, "", arch); gsub(/\.deb$/, "", arch); counts[package arch]++; if(counts[package arch] > keep_ago) print($1); }' | xargs --verbose rm
# Result resultant broken symlinks
find "${dir_repo}" -xtype l -delete -print0 | xargs -0 -n1 echo Deleting;