summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2007-04-30 09:07:17 +0000
committerMarc Espie <espie@cvs.openbsd.org>2007-04-30 09:07:17 +0000
commit63ee3a4302c607763a1026c77ca6c77b348e5086 (patch)
tree9b827d97b6164f0fc8e02ee461fcd83b8487c3e9 /usr.sbin/pkg_add
parent1edec451fbb0d7fca80520f53d3a6c3e17fb47ee (diff)
stop looking at plist's internals during makesum, simply copy the objects
over to the new plist using add_object for all objects.
Diffstat (limited to 'usr.sbin/pkg_add')
-rw-r--r--usr.sbin/pkg_add/pkg_create39
1 files changed, 17 insertions, 22 deletions
diff --git a/usr.sbin/pkg_add/pkg_create b/usr.sbin/pkg_add/pkg_create
index 5f27895b43c..e1ad6928d6e 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.65 2007/04/30 08:43:19 espie Exp $
+# $OpenBSD: pkg_create,v 1.66 2007/04/30 09:07:16 espie Exp $
#
# Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org>
#
@@ -74,6 +74,12 @@ sub warn_once
}
}
+sub makesum_plist
+{
+ my ($self, $plist, $base, $stash) = @_;
+ $self->add_object($plist);
+}
+
package OpenBSD::PackingElement::PkgConflict;
sub avert_duplicates_and_other_checks
{
@@ -202,10 +208,11 @@ sub compute_checksum
}
}
-sub create_checksum
+sub makesum_plist
{
my ($self, $plist, $base, $stash) = @_;
$self->compute_checksum($self, $base, $stash);
+ $self->add_object($plist);
}
sub verify_checksum
@@ -226,36 +233,21 @@ sub verify_checksum
}
package OpenBSD::PackingElement::InfoFile;
-sub create_checksum
+sub makesum_plist
{
my ($self, $plist, $base, $stash) = @_;
- $self->SUPER::create_checksum($plist, $base, $stash);
+ $self->SUPER::makesum_plist($plist, $base, $stash);
my $fname = $self->fullname();
for (my $i = 1; ; $i++) {
if (-e "$base/$fname-$i") {
- my $file = OpenBSD::PackingElement::File->add($plist, $self->{name}."-".$i);
- $file->create_checksum($plist, $base, $stash);
+ my $e = OpenBSD::PackingElement::File->add($plist, $self->{name}."-".$i);
+ $e->compute_checksum($e, $base, $stash);
} else {
last;
}
}
}
-package OpenBSD::PackingList;
-
-sub makesum
-{
- my ($self, $base) = @_;
- my $stash = {};
- my $oldlist = $self->{items};
- $self->{items} = [];
- for my $item (@$oldlist) {
- push @{$self->{items}}, $item;
- $self->{state}->{cwd} = $item->{cwd} if defined $item->{cwd};
- $item->create_checksum($self, $base, $stash);
- }
-}
-
package main;
my %defines;
@@ -561,9 +553,12 @@ unless (defined $opt_q && defined $opt_n) {
if ($regen_package) {
$plist->verify_checksum($base, {});
} else {
- $plist->makesum($base);
+ my $p2 = OpenBSD::PackingList->new;
+ $plist->makesum_plist($p2, $base, {});
+ $plist = $p2;
}
}
+
$plist->avert_duplicates_and_other_checks({});
if ($errors) {