summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2012-05-08 10:54:44 +0000
committerMarc Espie <espie@cvs.openbsd.org>2012-05-08 10:54:44 +0000
commite431f49d99876a3d64a76ceabc4aaa0239433fb1 (patch)
tree2f83fef741a76d6f9333ad098a87a1fe9cc11659
parentc2c8ecf451bc0966d52799e3d7674406d71fcec8 (diff)
add an extra check to avoid out-of-synch
-rw-r--r--usr.sbin/pkg_add/pkg_mklocatedb15
-rw-r--r--usr.sbin/pkg_add/pkg_mklocatedb.19
2 files changed, 18 insertions, 6 deletions
diff --git a/usr.sbin/pkg_add/pkg_mklocatedb b/usr.sbin/pkg_add/pkg_mklocatedb
index 3a63c13e306..82c0fe7158e 100644
--- a/usr.sbin/pkg_add/pkg_mklocatedb
+++ b/usr.sbin/pkg_add/pkg_mklocatedb
@@ -1,6 +1,6 @@
#! /usr/bin/perl
# Copyright (c) 2005-2010 Marc Espie <espie@openbsd.org>
-# $OpenBSD: pkg_mklocatedb,v 1.33 2012/04/29 08:46:02 espie Exp $
+# $OpenBSD: pkg_mklocatedb,v 1.34 2012/05/08 10:54:43 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
@@ -31,8 +31,8 @@ sub handle_options
{
my $state = shift;
$state->{no_exports} = 1;
- $state->SUPER::handle_options('ad:nqs:x:r:p:P',
- '[-anPq] [-d repository] [-p portsdir] [-r release] [-s src] ',
+ $state->SUPER::handle_options('aCd:nqs:x:r:p:P',
+ '[-aCnPq] [-d repository] [-p portsdir] [-r release] [-s src] ',
'[-x X11src] [pkg-name [...]]');
$state->{srcdir} = $state->opt('s');
$state->{xdir} = $state->opt('x');
@@ -43,6 +43,12 @@ sub handle_options
$state->{pkgpath} = $state->opt('P');
$state->{allinfo} = $state->opt('a');
$state->{nopipe} = $state->opt('n');
+ $state->{check} = $state->opt('C');
+ if ($state->{check}) {
+ unless ($state->{srcdir} or $state->{portsdir}) {
+ $state->usage("-C without -s dir or -x dir");
+ }
+ }
}
@@ -135,6 +141,9 @@ sub do_source
while (my $e = <$l>) {
chomp $e;
$e =~ s/^\.//;
+ if ($state->{check} && !-e $e) {
+ $state->fatal("Couldn't find #1 from set #2:\n\tsrc and installation out of synch ?", $e, $f);
+ }
print {$state->{out}} "$tag:$e\n";
$output = 1;
}
diff --git a/usr.sbin/pkg_add/pkg_mklocatedb.1 b/usr.sbin/pkg_add/pkg_mklocatedb.1
index d6fcf893bfb..62b083f1822 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.13 2011/09/10 08:46:37 espie Exp $
+.\" $OpenBSD: pkg_mklocatedb.1,v 1.14 2012/05/08 10:54:43 espie Exp $
.\" Copyright (c) 2005-2007 Marc Espie <espie@openbsd.org>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
@@ -13,7 +13,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: September 10 2011 $
+.Dd $Mdocdate: May 8 2012 $
.Dt PKG_MKLOCATEDB 1
.Os
.Sh NAME
@@ -22,7 +22,7 @@
.Sh SYNOPSIS
.Nm pkg_mklocatedb
.Bk -words
-.Op Fl anPq
+.Op Fl aCnPq
.Op Fl d Ar repository
.Op Fl p Ar portsdir
.Op Fl r Ar release
@@ -89,6 +89,9 @@ 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