On my main workstation I install packages in testing phases (like right
now) and deinstall them afterwards, one of the things that bugged me
while trying out gnumeric was that it depended on lots of other packages
which logically aren't uninstalled when you pkg_delete it.

When uninstalling one package it is no problem, but when dealing with
multiple packages it can become a pain.

I decided to write a small script inspired from the pkg_tools to locate
packages upon which no other packages had a dependency.

Maybe there's a better way to find this out with pkg_add or pkg_info but
I couldn't, so here goes.

---8<---8<---8<---


use strict;
use warnings;
use OpenBSD::PackageInfo;
use OpenBSD::RequiredBy;

foreach my $pkg (OpenBSD::PackageInfo::installed_packages()) {
        my @tab = OpenBSD::RequiredBy->compute_closure($pkg);
        print "$pkg\n" unless ($#tab);
}

---8<---8<---8<---

Thanks to the framework in /usr/src/usr.sbin/pkg_add it is pretty
simple.

-- 
Pierre-Yves Ritschard
Ingenieur Systemes, Reseaux et Securite
Steria Pour France Telecom - SCR/HDI/DOP/HEBEX
Sophia-Antipolis - France

Reply via email to