From ed90b1e67a44bfbd6783fa08f3031f6efd93affa Mon Sep 17 00:00:00 2001 From: Marc Espie Date: Fri, 25 Jun 2010 10:21:42 +0000 Subject: use locator object. rework options into state --- usr.sbin/pkg_add/OpenBSD/PkgCreate.pm | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'usr.sbin/pkg_add') diff --git a/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm b/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm index 5369b81c7a2..e8384f2f2d8 100644 --- a/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm +++ b/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm @@ -1,6 +1,6 @@ #! /usr/bin/perl # ex:ts=8 sw=4: -# $OpenBSD: PkgCreate.pm,v 1.15 2010/06/20 08:32:26 espie Exp $ +# $OpenBSD: PkgCreate.pm,v 1.16 2010/06/25 10:21:41 espie Exp $ # # Copyright (c) 2003-2010 Marc Espie # @@ -626,11 +626,10 @@ sub create_archive sub sign_existing_package { - my ($self, $pkgname, $cert, $privkey) = @_; + my ($self, $repo, $pkgname, $cert, $privkey) = @_; - require OpenBSD::PackageLocator; - my $true_package = OpenBSD::PackageLocator->find($pkgname); + my $true_package = $repo->find($pkgname); die "No such package $pkgname" unless $true_package; my $dir = $true_package->info; my $plist = OpenBSD::PackingList->fromfile($dir.CONTENTS); @@ -825,7 +824,8 @@ sub parse_and_run push(@signature_params, shift); } }; - $self->handle_options('p:f:d:M:U:s:A:L:B:P:W:qQ', $state, + $state->{no_exports} = 1; + $state->handle_options('p:f:d:M:U:s:A:L:B:P:W:qQ', '[-nQqvx] [-A arches] [-B pkg-destdir] [-D name[=value]]', '[-L localbase] [-M displayfile] [-P pkg-dependency]', '[-s x509 -s cert -s priv] [-U undisplayfile] [-W wantedlib]', @@ -871,8 +871,11 @@ sub parse_and_run if ($state->not) { $state->fatal("can't pretend to sign existing packages"); } + require OpenBSD::PackageLocator; + + my $repo = OpenBSD::PackageLocator->new($state); for my $pkgname (@ARGV) { - $self->sign_existing($pkgname, $cert, $privkey); + $self->sign_existing($repo, $pkgname, $cert, $privkey); } exit(0); } else { -- cgit v1.2.3