summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2010-01-01 16:09:36 +0000
committerMarc Espie <espie@cvs.openbsd.org>2010-01-01 16:09:36 +0000
commit562c7e820cc7a44384cb81835b995a6e162ca47c (patch)
tree67f54514004e48408da8bc658a14b24757ac999e /usr.sbin/pkg_add
parent3b9a3f52ac621c498c38c580f9342336ab41400b (diff)
new method fullpkgpath that accesses the default fullpkgpath.
make use of it, relax pkg_create to allow any of FULLPKGPATH, PERMIT_PACKAGE_FTP, PERMIT_PACKAGE_CDROM (store the others as empty). remove warning in pkg_mklocatedb for newer perl.
Diffstat (limited to 'usr.sbin/pkg_add')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PackingList.pm19
-rw-r--r--usr.sbin/pkg_add/pkg_create11
-rw-r--r--usr.sbin/pkg_add/pkg_info18
-rw-r--r--usr.sbin/pkg_add/pkg_mklocatedb9
4 files changed, 40 insertions, 17 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PackingList.pm b/usr.sbin/pkg_add/OpenBSD/PackingList.pm
index 4e7a3fa1c97..86cafbdfc4f 100644
--- a/usr.sbin/pkg_add/OpenBSD/PackingList.pm
+++ b/usr.sbin/pkg_add/OpenBSD/PackingList.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: PackingList.pm,v 1.97 2010/01/01 13:36:07 espie Exp $
+# $OpenBSD: PackingList.pm,v 1.98 2010/01/01 16:09:35 espie Exp $
#
# Copyright (c) 2003-2010 Marc Espie <espie@openbsd.org>
#
@@ -50,8 +50,8 @@ sub match
{
my ($h, $plist) = @_;
return
- defined $plist->{extrainfo} &&
- $h->{$plist->{extrainfo}->{subdir}};
+ defined $plist->fullpkgpath &&
+ $h->{$plist->fullpkgpath};
}
package OpenBSD::PackingList;
@@ -412,14 +412,23 @@ sub is_signed
return defined $self->{'digital-signature'};
}
+sub fullpkgpath
+{
+ my $self = shift;
+ if (defined $self->{extrainfo} && $self->{extrainfo}->{subdir} ne '') {
+ return $self->{extrainfo}->{subdir};
+ } else {
+ return undef;
+ }
+}
sub pkgpath
{
my $self = shift;
if (!defined $self->{_hashpath}) {
my $h = $self->{_hashpath} =
bless {}, "OpenBSD::PackingList::hashpath";
- if (defined $self->{extrainfo}) {
- $h->{$self->{extrainfo}->{subdir}} = 1;
+ if (defined $self->fullpkgpath) {
+ $h->{$self->fullpkgpath} = 1;
}
if (defined $self->{pkgpath}) {
for my $i (@{$self->{pkgpath}}) {
diff --git a/usr.sbin/pkg_add/pkg_create b/usr.sbin/pkg_add/pkg_create
index da1a28090ea..3fa2670c2c9 100644
--- a/usr.sbin/pkg_add/pkg_create
+++ b/usr.sbin/pkg_add/pkg_create
@@ -1,6 +1,6 @@
#! /usr/bin/perl
# ex:ts=8 sw=4:
-# $OpenBSD: pkg_create,v 1.127 2010/01/01 14:34:59 espie Exp $
+# $OpenBSD: pkg_create,v 1.128 2010/01/01 16:09:35 espie Exp $
#
# Copyright (c) 2003-2010 Marc Espie <espie@openbsd.org>
#
@@ -448,7 +448,7 @@ sub add_description
}
if (defined $comment) {
if ($subst->empty('MAINTAINER')) {
- print STDERR "Warning: no MAINTAINER\n";
+ Warn "no MAINTAINER";
} else {
print $fh "\n", $subst->do('Maintainer: ${MAINTAINER}'), "\n";
}
@@ -613,12 +613,17 @@ if ($regen_package) {
my $fullpkgpath = $subst->value('FULLPKGPATH');
my $cdrom = $subst->value('PERMIT_PACKAGE_CDROM');
my $ftp = $subst->value('PERMIT_PACKAGE_FTP');
- if (defined $fullpkgpath && defined $cdrom && defined $ftp) {
+ if (defined $fullpkgpath || defined $cdrom || defined $ftp) {
+ $fullpkgpath //= '';
+ $cdrom //= '';
+ $ftp //= '';
$cdrom = 'yes' if $cdrom =~ m/^yes$/io;
$ftp = 'yes' if $ftp =~ m/^yes$/io;
OpenBSD::PackingElement::ExtraInfo->add($plist,
$fullpkgpath, $cdrom, $ftp);
+ } else {
+ Warn "Package without FULLPKGPATH";
}
for my $contentsfile (@contents) {
read_fragments($plist, $contentsfile) or
diff --git a/usr.sbin/pkg_add/pkg_info b/usr.sbin/pkg_add/pkg_info
index 7fcf6d5161e..edf3069ae97 100644
--- a/usr.sbin/pkg_add/pkg_info
+++ b/usr.sbin/pkg_add/pkg_info
@@ -1,8 +1,8 @@
#! /usr/bin/perl
# ex:ts=8 sw=4:
-# $OpenBSD: pkg_info,v 1.81 2009/11/10 11:36:56 espie Exp $
+# $OpenBSD: pkg_info,v 1.82 2010/01/01 16:09:35 espie Exp $
#
-# Copyright (c) 2003-2009 Marc Espie <espie@openbsd.org>
+# Copyright (c) 2003-2010 Marc Espie <espie@openbsd.org>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
@@ -229,8 +229,10 @@ sub find_by_path
OpenBSD::PackingList->from_installation($pkg,
\&OpenBSD::PackingList::ExtraInfoOnly);
next if !defined $plist;
- add_to_path_info($plist->{extrainfo}->{subdir},
- $plist->pkgname);
+ if (defined $plist->fullpkgpath) {
+ add_to_path_info($plist->fullpkgpath,
+ $plist->pkgname);
+ }
if ($plist->has('pkgpath')) {
for my $p (@{$plist->{pkgpath}}) {
add_to_path_info($p->name,
@@ -376,7 +378,13 @@ sub print_info
\&OpenBSD::PackingList::ExtraInfoOnly);
just_in_time_header($pkg, $handle ,\$done);
print "Pkgpath:\n" unless $opt_q;
- print $plist->{extrainfo}->{subdir}, "\n";
+ if (defined $plist->fullpkgpath) {
+ print $plist->fullpkgpath;
+ } else {
+ print STDERR $plist->pkgname,
+ " has no FULLPKGPATH\n";
+ }
+ print "\n";
}
if ($opt_f) {
diff --git a/usr.sbin/pkg_add/pkg_mklocatedb b/usr.sbin/pkg_add/pkg_mklocatedb
index e50ab4d4eb3..511b5464c41 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-2007 Marc Espie <espie@openbsd.org>
-# $OpenBSD: pkg_mklocatedb,v 1.21 2009/11/10 11:36:56 espie Exp $
+# Copyright (c) 2005-2010 Marc Espie <espie@openbsd.org>
+# $OpenBSD: pkg_mklocatedb,v 1.22 2010/01/01 16:09:35 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
@@ -46,9 +46,9 @@ sub info
my $plist = shift;
my $r;
if ($opt_a) {
- $r = $plist->{extrainfo}->{subdir}.":".$plist->pkgname;
+ $r = $plist->fullpkgpath.":".$plist->pkgname;
} elsif ($opt_P) {
- $r = $plist->{extrainfo}->{subdir};
+ $r = $plist->fullpkgpath;
} else {
$r = $plist->pkgname;
}
@@ -165,6 +165,7 @@ if ($opt_p) {
elsif ($opt_d) {
require File::Find;
+ no warnings qw(once);
die "Bad argument: $opt_d is not a directory" unless -d $opt_d;
File::Find::find(
sub {