summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2010-06-30 10:31:53 +0000
committerMarc Espie <espie@cvs.openbsd.org>2010-06-30 10:31:53 +0000
commit4882bbde0020aa3594f367ea4a7c6c0a9f58c521 (patch)
tree5220370f0fc8111634bf26916ecbcb59779588a9
parent8b57c0996f5a0ab4fb50c15361843c45f0567a07 (diff)
pass state along when signing packages, uses repo and fatal directly
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PkgCreate.pm15
1 files changed, 6 insertions, 9 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm b/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm
index e8384f2f2d8..bd4fa01055a 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.16 2010/06/25 10:21:41 espie Exp $
+# $OpenBSD: PkgCreate.pm,v 1.17 2010/06/30 10:31:52 espie Exp $
#
# Copyright (c) 2003-2010 Marc Espie <espie@openbsd.org>
#
@@ -626,11 +626,11 @@ sub create_archive
sub sign_existing_package
{
- my ($self, $repo, $pkgname, $cert, $privkey) = @_;
+ my ($self, $state, $pkgname, $cert, $privkey) = @_;
- my $true_package = $repo->find($pkgname);
- die "No such package $pkgname" unless $true_package;
+ my $true_package = $state->repo->find($pkgname);
+ $state->fatal("No such package #1", $pkgname) unless $true_package;
my $dir = $true_package->info;
my $plist = OpenBSD::PackingList->fromfile($dir.CONTENTS);
$plist->set_infodir($dir);
@@ -643,7 +643,7 @@ sub sign_existing_package
$true_package->wipe_info;
unlink($plist->pkgname.".tgz");
rename($tmp, $plist->pkgname.".tgz") or
- die "Can't create final signed package $!\n";
+ $state->fatal("Can't create final signed package: #1", $!);
}
sub add_extra_info
@@ -871,11 +871,8 @@ 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($repo, $pkgname, $cert, $privkey);
+ $self->sign_existing($state, $pkgname, $cert, $privkey);
}
exit(0);
} else {