On 03/ 3/10 01:16 PM, Alexander Eremin wrote: > After all updates I have in /var/pkg/pkg versions starting from 121 and > ending with last 133. For example I have for SUNWcs: > 0.5.11%2C5.11-0.121%3A20090816T213338Z > 0.5.11%2C5.11-0.124%3A20090925T203255Z > 0.5.11%2C5.11-0.125%3A20091013T054414Z > 0.5.11%2C5.11-0.126%3A20091022T195925Z > 0.5.11%2C5.11-0.127%3A20091111T043632Z > 0.5.11%2C5.11-0.128%3A20091125T004150Z > 0.5.11%2C5.11-0.129%3A20091205T075639Z > 0.5.11%2C5.11-0.130%3A20091218T225200Z > 0.5.11%2C5.11-0.131%3A20100114T233851Z > 0.5.11%2C5.11-0.132%3A20100130T065403Z > 0.5.11%2C5.11-0.133%3A20100216T063431Z > Each dir has size ~1M. I usually keep only the previous BE and I think need > some solution to clean safely this dir from old versions (especially after > Great Renaming). This time I have: > ~ # du -hs /var/pkg/pkg/ > 687M /var/pkg/pkg > and with future updates the size will increase (and I quess it's does not > increase pkg productivity).
Unfortunately, there's no easy (or supported) way to do this at this time. However, the totally unsupported and you get to keep all the pieces if it breaks algorithm for it would be something like: do_not_remove = {} for each package FMRI listed by "pkg list" (no options!): name, version = parse_fmri(package_fmri) name = urllib.urlquote(name, "") version = urllib.urlquote(version, "") do_not_remove[name] = version for name in ls of "/var/pkg/pkg": for version in ls of "/var/pkg/pkg/<name>": if name not in do_not_remove: remove "/var/pkg/pkg/<name>" elif version != do_not_remove[name]: remove "/var/pkg/pkg/<name>/<version>" The basic idea is that manifests for packages that aren't installed can be removed. Eventually, the pkg(5) client API will handle this automatically for clients: http://defect.opensolaris.org/bz/show_bug.cgi?id=8035 However, remember that if you remove the files from the current BE, that won't really save you any space because previous BEs still have them. So only once all BEs have had the files removed will you see a space savings. Cheers, -- Shawn Walker