Skip site navigation (1)Skip section navigation (2)
Date:      10 Oct 1999 00:20:24 +0900
From:      sada@rr.IIJ4U.OR.JP (SADA Kenji)
To:        kris@hub.freebsd.org
Cc:        mmuir@es.co.nz, scrappy@hub.org, freebsd-ports@FreeBSD.ORG, sada@FreeBSD.org
Subject:   pkg_remove (Re: install newer version over old one...)
Message-ID:  <19991009152024.3667.sada@rr.iij4u.or.jp>
In-Reply-To: Your message of "Thu, 7 Oct 1999 11:03:38 JST". <Pine.BSF.4.10.9910061859001.84248-100000@hub.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
>> Probably safer to manually pkg_delete all of the kde* packages first -
>> this way you won't get bitten by any dependencies (e.g. linking against
>> wrong library versions when you recompile, or 1.1.2 finding leftover files
>> from 1.1.1 and acting weirdly, etc). Plus you won't have any port turds in
>> your tree from files which disappeared or moved in 1.1.2.

This script may help you.
The script `pkg_remove' would remove specified package and whole packages
which depends to it directry/indirectry.

You can remove all netscape packages with 'pkg_remove netscape',
all kde packages with 'pkg_remove kde'
all packages which depends to libtool with 'pkg_remove libtool',
all package with 'pkg_remove ALL'.

--
#!/usr/bin/perl
# $Id: pkg_remove,v 1.2 1999/09/13 13:46:12 sada Exp $
use Getopt::Std;
getopts('n');
die("usage: x [-n] ALL|<package-name> [, <package-name> [..]]\n -n : only tell what will take place.\n") if (@ARGV < 1);
$pkg_dbdir = "/var/db/pkg";
opendir(PKG_DBDIR, $pkg_dbdir);
while ($pkg = readdir(PKG_DBDIR)) {
        next if $pkg =~ m/^\./;
        $req_by{$pkg} = '';
        if (-f "$pkg_dbdir/$pkg/+REQUIRED_BY") {
                open(REQ_B, "$pkg_dbdir/$pkg/+REQUIRED_BY");
                $req_by{$pkg} = join('', <REQ_B>);
        }
}
while ($a = shift) {
        while (($key, $val) = each(%req_by)) {
                if ($a eq 'ALL' || $key =~ m/^$a/) {
                        &remove_package($key);
                }
        }
}

sub remove_package
{
        my ($pkg) = @_;
        return if ($pkg_removed{$pkg});
        my @r = split(/\n/, $req_by{$pkg});
        my $p;
        &remove_package($p) while $p = shift(@r);
        print "remove: $pkg\n";
        system "pkg_delete $pkg" unless ($opt_n);
        $pkg_removed{$pkg} = 'YES';
}


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19991009152024.3667.sada>