#! /usr/bin/perl
# Copyright (c) 2005-2010 Marc Espie <espie@openbsd.org>
-# $OpenBSD: pkg_mklocatedb,v 1.42 2014/04/14 20:40:41 espie Exp $
+# $OpenBSD: pkg_mklocatedb,v 1.43 2014/07/13 15:54:28 espie Exp $
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
{
my $state = shift;
$state->{no_exports} = 1;
- $state->SUPER::handle_options('aCd:Knqs:x:X:r:p:Pu',
- '[-aCKnPqu] [-d repository] [-p portsdir] [-r release] [-s src] ',
- '[-X X11src] [pkg-name [...]]');
- $state->{srcdir} = $state->opt('s');
- $state->{xdir} = $state->opt('X') // $state->opt('x');
- $state->{releasedir} = $state->opt('r');
+ $state->SUPER::handle_options('ad:Knqp:Pu',
+ '[-aKnPqu] [-d repository] [-p portsdir] [pkg-name ...]');
$state->{portsdir} = $state->opt('p');
$state->{pkgdir} = $state->opt('d');
$state->{quiet} = $state->opt('q');
$state->{pkgpath} = $state->opt('P');
$state->{allinfo} = $state->opt('a');
$state->{nopipe} = $state->opt('n');
- $state->{check} = $state->opt('C');
$state->{full} = $state->opt('K');
$state->{update} = $state->opt('u');
- if ($state->{check}) {
- unless ($state->{srcdir} or $state->{portsdir}) {
- $state->usage("-C without -s dir or -x dir");
- }
- }
-}
-
-sub build_tag
-{
- my ($state, $dir, $set, $rev) = @_;
- my $r;
- if ($state->{allinfo}) {
- $r = "$dir/$set:$set$rev";
- } elsif ($state->{pkgpath}) {
- $r = "$dir/$set";
- } else {
- $r = "$set$rev";
- }
- $state->errsay($r) unless $state->{quiet};
- $state->{current_set} = $set;
- $state->{current_tag} = $r;
-}
-
-sub process_entry
-{
- my ($state, $e) = @_;
- if ($state->{check} && !-e $e) {
- $state->sync_error($e);
- }
- print {$state->{out}} "$state->{current_tag}:$e\n";
-}
-
-sub sync_error
-{
- my ($state, $e) = @_;
- my $set = $state->{current_set};
- if ($set =~ m/etc/) {
- $state->errsay("Couldn't find #1 from set #2:\n\tDid you run sysmerge recently ?", $e, $set);
- } else {
- $state->errsay("Couldn't find #1 from set #2:\n\tsrc and installation out of synch ?", $e, $set);
- $state->{fatals}++;
- }
}
package OpenBSD::PackingElement;
}
}
-sub do_release
-{
- my $state = shift;
-
- require OpenBSD::Ustar;
-
- opendir(my $dir, $state->{releasedir}) or return;
- while (my $e = readdir $dir) {
- if ($e =~ m/^(\w+\d\d)\.tgz$/o) {
- my $set = $1;
- open my $arc, '-|', OpenBSD::Paths->gzip, '-c', '-d',
- "--", $state->{releasedir}."/".$e or
- $state->fatal("couldn't open pipe from gzip: #1", $!);
-
- my $u = OpenBSD::Ustar->new($arc, $state, '/');
- while (my $f = $u->next) {
- my $name = $f->{name};
- $name =~ s/^\.//o;
- print {$state->{out}} "$set:$name\n";
- }
- close $arc;
- }
- }
- closedir($dir);
-}
-
sub print_out
{
my ($plist, $state) = @_;
open_output($state);
-if ($state->{srcdir}) {
- require OpenBSD::SetList;
- OpenBSD::SetList::Source->walk($state, $state->{srcdir});
-}
-if ($state->{xdir}) {
- require OpenBSD::SetList;
- OpenBSD::SetList::Xenocara->walk($state, $state->{xdir});
-}
if ($state->{fatals}) {
$state->fatal("Files not found, can't continue");
}
-if ($state->{releasedir}) {
- do_release($state);
-}
-
if ($state->{portsdir}) {
do_portsdir($state);
} elsif ($state->{pkgdir}) {
-.\" $OpenBSD: pkg_mklocatedb.1,v 1.16 2014/04/14 20:40:41 espie Exp $
+.\" $OpenBSD: pkg_mklocatedb.1,v 1.17 2014/07/13 15:54:28 espie Exp $
.\" Copyright (c) 2005-2007 Marc Espie <espie@openbsd.org>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: April 14 2014 $
+.Dd $Mdocdate: July 13 2014 $
.Dt PKG_MKLOCATEDB 1
.Os
.Sh NAME
.Sh SYNOPSIS
.Nm pkg_mklocatedb
.Bk -words
-.Op Fl aCKnPqu
+.Op Fl aKnPqu
.Op Fl d Ar repository
.Op Fl p Ar portsdir
-.Op Fl r Ar release
-.Op Fl s Ar src
-.Op Fl X Ar X11src
-.Op Ar pkg-name Op Ar ...
+.Op Ar pkg-name ...
.Ek
.Sh DESCRIPTION
The
.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
-.Ox
-distribution, which are not exactly packages in the usual sense.
-.Pp
The options are as follows:
.Bl -tag -width Ds
.It Fl a
Prepend file names with pkgpath information and package names.
-.It Fl C
-Check that files from the source and xenocara sets actually exist.
-This prevents badly out-of-synch errors.
.It Fl d Ar repository
Scan directory
.Ar repository
Retrieve packing-lists from the ports tree instead of binary packages.
.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 list 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 u
Update an existing list.
The list must come from standard input, and contain pkgpath information
for items to be replaced.
-This can also be used to supplement an existing database with source and
-x11 information.
-.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 ,