diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2005-03-03 11:52:16 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2005-03-03 11:52:16 +0000 |
commit | 7b754ad58c8aaeef9b772832fa51a74f30788e92 (patch) | |
tree | 2a057fc2671e4247fddf4cfe17b6141197e845d2 /usr.sbin/pkg_add | |
parent | 1330d77b43e263a41c8914ba02b3646681b72c00 (diff) |
allow pkg_mklocatedb to look into src and X11 sets as well.
`no objection' naddy@
Diffstat (limited to 'usr.sbin/pkg_add')
-rw-r--r-- | usr.sbin/pkg_add/pkg_mklocatedb | 59 | ||||
-rw-r--r-- | usr.sbin/pkg_add/pkg_mklocatedb.1 | 28 |
2 files changed, 83 insertions, 4 deletions
diff --git a/usr.sbin/pkg_add/pkg_mklocatedb b/usr.sbin/pkg_add/pkg_mklocatedb index b6450212553..dbd9893c21b 100644 --- a/usr.sbin/pkg_add/pkg_mklocatedb +++ b/usr.sbin/pkg_add/pkg_mklocatedb @@ -33,12 +33,12 @@ sub print_name package main; -set_usage('pkg_mklocatedb -nq [pkgname ...]'); +set_usage('pkg_mklocatedb -nq [-r release] [-s src] [-x X11src] [pkgname ...]'); -our ($opt_n, $opt_q); +our ($opt_n, $opt_q, $opt_s, $opt_x, $opt_r); try { - getopts('nq'); + getopts('nqs:x:r:'); } catchall { Usage($_); }; @@ -51,6 +51,59 @@ if ($opt_n or -t STDOUT) { } else { open $fh, "|-", $MKLOCATEDB, $MKLOCATEDB or die "couldn't open pipe: $!"; } +if ($opt_s || $opt_x) { + my ($rev, $arch) = split(/ /, `uname -mr`); + chomp $arch; + $rev =~ s/\.//; + if ($opt_s) { + my $dir = "$opt_s/distrib/sets/lists"; + for my $set (qw(base comp etc game man misc)) { + for my $f ("$dir/$set/mi", "$dir/$set/md.$arch") { + open my $l, '<', $f or next; + while (my $e = <$l>) { + chomp $e; + $e =~ s/^\.//; + print "$set$rev:$e\n"; + } + } + } + } + if ($opt_x) { + my $dir = "$opt_x/distrib/sets/lists"; + for my $set (qw(xbase xetc xfont xserv xshare)) { + for my $f ("$dir/$set/mi", "$dir/$set/md.$arch") { + open my $l, '<', $f or next; + while (my $e = <$l>) { + chomp $e; + $e =~ s/^\.//; + print "$set$rev:$e\n"; + } + } + } + } +} + +if ($opt_r) { + require OpenBSD::Ustar; + + opendir(my $dir, $opt_r) or next; + while (my $e = readdir $dir) { + if ($e =~ m/^(\w+\d\d)\.tgz$/) { + my $set = $1; + open my $arc, '-|', '/usr/bin/gzip', 'gzip', '-c', '-d', "$opt_r/$e"; + my $u = OpenBSD::Ustar->new($arc, '/'); + while (my $f = $u->next()) { + my $name = $f->{name}; + $name =~ s/^\.//; + print "$set:$name\n"; + } + close $arc; + } + } + closedir($dir); +} + + if (@ARGV==0) { for my $pkgname (installed_packages()) { diff --git a/usr.sbin/pkg_add/pkg_mklocatedb.1 b/usr.sbin/pkg_add/pkg_mklocatedb.1 index 001254844ef..9c44f461470 100644 --- a/usr.sbin/pkg_add/pkg_mklocatedb.1 +++ b/usr.sbin/pkg_add/pkg_mklocatedb.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: pkg_mklocatedb.1,v 1.2 2005/02/15 20:34:27 jmc Exp $ +.\" $OpenBSD: pkg_mklocatedb.1,v 1.3 2005/03/03 11:52:15 espie Exp $ .\" Copyright (c) 2005 Marc Espie <espie@openbsd.org> .\" .\" Permission to use, copy, modify, and distribute this software for any @@ -22,6 +22,9 @@ .Sh SYNOPSIS .Nm pkg_mklocatedb .Op Fl nq +.Op Fl r Ar release +.Op Fl s Ar src +.Op Fl x Ar X11src .Op Ar pkg-name Op Ar ... .Sh DESCRIPTION The @@ -48,6 +51,11 @@ the list of names is fed to .Pa /usr/libexec/locate.mklocatedb and the end result should be redirected to a file. .Pp +In addition, +.Nm +can also list files in the base sets of an OpenBSD distribution, which +are not exactly packages in the usual sense. +.Pp The options are as follows: .Bl -tag -width opt .It Fl n @@ -56,6 +64,24 @@ Do not pipe output to (default if standard output is a terminal). .It Fl q Be quiet: do not report every package processed to standard error. +.It Fl r Ar release +Specify the location of a release directory +.Po +see +.Xr release 8 +.Pc . +.Nm +will lists release tar balls from that directory. +.It Fl s Ar src +Specify the location of +.Ox +source. +.Nm +will list sets found under that source directory. +.It Fl x Ar X11src +Specify the location of X11 source. +.Nm +will list sets found under that X11 source directory. .El .Sh SEE ALSO .Xr locate 1 , |