summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add/OpenBSD/PackingList.pm
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/PackingList.pm
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/PackingList.pm')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PackingList.pm23
1 files changed, 22 insertions, 1 deletions
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;