X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=zpm-gc;h=3c1716c4fcfb264682c0bac2888a3ad53716e77d;hb=50b0480e6259c1e4bed6e6dc7990e080ceb5e855;hp=f07cdaffd969d6c6bf4188cd672a123bf7e55be2;hpb=c5ae43ca2ab5b4a323e6154d0e08c629cc5a5e1d;p=zpackage 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