summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add/OpenBSD
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2007-05-30 12:29:20 +0000
committerMarc Espie <espie@cvs.openbsd.org>2007-05-30 12:29:20 +0000
commita6f013d370040f6f35d1afad4ad1240ca74af53e (patch)
tree86f032560a092f0973e29685ffc8111fa42d0cb1 /usr.sbin/pkg_add/OpenBSD
parente97bf6c1fe3582f0b90f0af648b63450b17ea1a4 (diff)
new functionality: copy elements of packing-lists to a new plist if they
are registered in a hash. This will be used to create borked packages in a much simpler way. Also, set_pkgname, so that I don't have to remember whether this packing-list already has a name. Useful when copying stuff over.
Diffstat (limited to 'usr.sbin/pkg_add/OpenBSD')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PackingElement.pm8
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PackingList.pm23
2 files changed, 29 insertions, 2 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PackingElement.pm b/usr.sbin/pkg_add/OpenBSD/PackingElement.pm
index d694f368f1b..9e81dbf5acf 100644
--- a/usr.sbin/pkg_add/OpenBSD/PackingElement.pm
+++ b/usr.sbin/pkg_add/OpenBSD/PackingElement.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: PackingElement.pm,v 1.118 2007/05/29 13:52:07 espie Exp $
+# $OpenBSD: PackingElement.pm,v 1.119 2007/05/30 12:29:19 espie Exp $
#
# Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org>
#
@@ -133,6 +133,12 @@ sub NoDuplicateNames() { 0 }
sub signature {}
+sub copy_if
+{
+ my ($self, $copy, $h) = @_;
+ $self->add_object($copy) if defined $h->{$self};
+}
+
# Basic class hierarchy
# various stuff that's only linked to objects before/after them
diff --git a/usr.sbin/pkg_add/OpenBSD/PackingList.pm b/usr.sbin/pkg_add/OpenBSD/PackingList.pm
index acbc98c7735..2a8e5f919e7 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.70 2007/05/30 11:13:35 espie Exp $
+# $OpenBSD: PackingList.pm,v 1.71 2007/05/30 12:29:19 espie Exp $
#
# Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org>
#
@@ -66,6 +66,17 @@ sub set_infodir
${$self->{infodir}} = $dir;
}
+sub make_copy
+{
+ my ($plist, $h) = @_;
+
+ my $copy = bless {state => OpenBSD::PackingList::State->new,
+ infodir => \(my $d = ${$plist->{infodir}})}, ref($plist);
+ $plist->copy_if($copy, $h);
+ return $copy;
+}
+
+
sub infodir
{
my $self = shift;
@@ -318,6 +329,16 @@ sub get
return $plist->{$name};
}
+sub set_pkgname
+{
+ my ($self, $name) = @_;
+ if (defined $self->{name}) {
+ $self->{name}->{name} = $name;
+ } else {
+ OpenBSD::PackingElement::Name->add($self, $name);
+ }
+}
+
sub pkgname
{
my $self = shift;