From: Nathan Wagner Date: Sat, 3 Nov 2018 14:48:57 +0000 (+0000) Subject: add passes to zpm-gc X-Git-Tag: v0.2.16~39 X-Git-Url: https://pd.if.org/git/?p=zpackage;a=commitdiff_plain;h=5324bc7cd7e6d6f654bb5b763bad7a13840004a3 add passes to zpm-gc remove orphaned files run sqlite vacuum and report before and after size --- diff --git a/zpm-gc b/zpm-gc index f07cdaf..3c1716c 100755 --- a/zpm-gc +++ b/zpm-gc @@ -38,6 +38,8 @@ done # remove orphaned rows in files table # references in packagefiles, notes, scripts, possibly others +zpm shell $ZPMDB 'delete from files where hash in (select hash from filerefs where refcount = 0);' + # remove old logs, given by date # remove acked notes @@ -49,4 +51,10 @@ done # remove command history by date # compactify the database file +osize=$(zpm stat -f '%s' $ZPMDB) +zpm log -v -i -a 'gc compacting' -t $ZPMDB +zpm shell $ZPMDB vacuum +nsize=$(zpm stat -f '%s' $ZPMDB) +printf 'original size %s\n' $osize +printf 'new size %s\n' $nsize