aptosaurus: reallly fix delete old

This commit is contained in:
Starbeamrainbowlabs 2020-05-13 20:32:03 +01:00
parent 00e683d102
commit 0747206a4e
Signed by: sbrl
GPG Key ID: 1BE5172E637709C2
1 changed files with 2 additions and 2 deletions

View File

@ -201,8 +201,8 @@ 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;
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
export -f __analyse_package_simple;
find sources/ -type f -name "*.deb" -print0 | xargs -0 -n1 -P "$(nproc)" -I{} bash -c '__analyse_package_simple "{}"' | 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;
task_end "$?";