How to delete old packages in /usr/ports/packages?

Hi all,

I've created a lot of packages in /usr/ports/packages, since I always install using make package or portmaster -g <port>. So now I have a whole load of packages that are obsolete. Of course, I could write a shell script with little effort and figure a way out how to identify only the "Latest" packages and delete the rest (including the symlinks), but I wanted to know whether there is a known solution/existing port for this job.

Any recommendation of how do safely identify and delete old packages?

Thanks for any help and useful advice in advance.

:)
 
It depends on what you mean by old/obsolete. If you have many "orphan" dependencies, you can use ports-mgmt/pkg_cutleaves. It will also list all your top-level applications so you can also remove any of these if you want to or exclude them if you don't.

Of course the most radical way to have a clean hierarchy is simply to delete all the contents of /usr/local and /var/db/pkg and start from scratch.
 
portmaster(1):
[--index|--index-only] [-n] --clean-packages
offer to delete stale packages. The --index-only option is required if no ports tree is available.

[--index|--index-only] -y --clean-packages
does the same as above, but deletes all out of date files without prompting.
 
@SirDice

portmaster --index --clean-packages totally did the job for me.

Next time I'll run it with "-y" as well, since the packages prompted for deletion are exactly the ones I'd expected it to delete.

Quite honestly... I'm using portmaster since forever (because I don't want to pull in ruby+deps for sysutils/portupgrade) and I lookup the man-page quite often, but didn't know those options do exactly this. That "stale packages" part is probably a matter of definition really and a bit ambitious, IMHO. However, now that I know what is meant... PERFECT!

Thank you very much, mate!
 
Back
Top