Subject: Re: pkg helper tools?
To: None <netbsd-users@netbsd.org>
From: Roman Kennke <roman@ontographics.com>
List: netbsd-users
Date: 01/21/2004 22:35:23
------=_20040121223523_30663
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit


>> are there any helper tools for the pkgsrc package collection? I am
>> looking for:
>> 1. something like pkg_cutleaves in FreeBSD or debfoster in Debian. A
>> tool, which asks for every 'leaf-package' (a package, on which no
>> other package depends on) if it should be kept or removed, recursing
>> down, when nessecary. Very useful for finding packages that were at
>> some time installed to satisfy dependencies


Well, I just wrote a little shell script (attached), which does exactly
that: It asks for each leaf package if it should be kept or deleted, and
in the end it actually deletes them. Additionally it provides info about a
package when requested with 'i'. It is written in CSH so it should run
without any additional requirements on all NetBSD machines (except of
course csh,pkg_delete and the /var/db/pkg database).
There are some things that could be improved:
- when a leaf package is marked to be removed, the script should go down
to 'new' leaf packages and ask for their removal too. At the moment you
have to run the tool repeatedly- the program could remember the 'keepers' (in a file), so that in future
invokations only new packages (not marked as keep) are asked about
..and more

Try it out. Maybe it should go into pkgsrc/pkgtools ?

Cheers, Roman


------=_20040121223523_30663
Content-Type: application/x-shellscript; name="pkgleaves"
Content-Disposition: attachment; filename="pkgleaves"
Content-Transfer-Encoding: base64

IyEvYmluL2NzaAoKY2QgL3Zhci9kYi9wa2cKCnNldCBwa2dzX3RvX2JlX2RlbGV0ZWQKc2V0IGFu
c3dlcgoKZm9yZWFjaCBwa2dfbmFtZSAoKikKCgogICAgcmVwZWF0OgogICAgaWYgKCEoLWUgJHBr
Z19uYW1lLytSRVFVSVJFRF9CWSkpIHRoZW4KCiAgICAgICAgZWNobyAia2VlcCIgJHBrZ19uYW1l
ICI/IChZL24vaSkiCgogICAgICAgIHNldCBhbnN3ZXIgPSAkPAoKICAgICAgICBpZiAoJGFuc3dl
ciA9PSBuKSB0aGVuCgogICAgICAgICAgICBzZXQgcGtnc190b19iZV9kZWxldGVkID0gKCRwa2dz
X3RvX2JlX2RlbGV0ZWQgJHBrZ19uYW1lKQoKICAgICAgICBlbmRpZgoKICAgICAgICBpZiAoJGFu
c3dlciA9PSBpKSB0aGVuCiAgICAgICAgICAgIC91c3IvYmluL2xlc3MgJHBrZ19uYW1lLytERVND
CiAgICAgICAgICAgIGdvdG8gcmVwZWF0CiAgICAgICAgZW5kaWYKCiAgICBlbmRpZgoKZW5kCgpl
Y2hvICJUaGUgZm9sbG93aW5nIHBhY2thZ2VzIHdpbGwgYmUgZGVsZXRlZDoiCmVjaG8KZWNobyAk
cGtnc190b19iZV9kZWxldGVkCgplY2hvICJEbyB5b3Ugd2lzaCB0byBjb250aW51ZT8gKHkvTiki
CgoKc2V0IGFuc3dlciA9ICQ8CgppZiAoJGFuc3dlciA9PSB5KSB0aGVuCgogICAgZm9yZWFjaCBw
a2dfbmFtZSAoJHBrZ3NfdG9fYmVfZGVsZXRlZCkKCiAgICAgICAgZWNobyAicmVtb3ZpbmcgIiAk
cGtnX25hbWUgIi4uLiIKICAgICAgICBwa2dfZGVsZXRlICRwa2dfbmFtZQoKICAgIGVuZAoKZW5k
aWYKCmV4aXQgMAo=

------=_20040121223523_30663--