summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2007-05-29 12:36:54 +0000
committerMarc Espie <espie@cvs.openbsd.org>2007-05-29 12:36:54 +0000
commitf284e3ff24ab1bda951d6eafa0e8fa0e61a2166e (patch)
tree84aa1cc25606c7f509a912f9611ed37448b20b5d
parent78cb5feddc850e7836e94dd8c3b1b50eef39bbfb (diff)
clean-up SpecialFile a bit: make sure the name passed during creation is
totally irrelevant. Add a new property to packing-lists: infodir, and use it to compute fullnames for special files. Once this is properly synchronized, we can tie infodir to packing-lists, and remove it from the state...
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PackingElement.pm34
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PackingList.pm14
2 files changed, 44 insertions, 4 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PackingElement.pm b/usr.sbin/pkg_add/OpenBSD/PackingElement.pm
index 011450cc9e1..683cbe64bcd 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.115 2007/05/29 10:56:22 espie Exp $
+# $OpenBSD: PackingElement.pm,v 1.116 2007/05/29 12:36:53 espie Exp $
#
# Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org>
#
@@ -1231,6 +1231,38 @@ sub write
&OpenBSD::PackingElement::FileBase::write;
}
+sub add_object
+{
+ my ($self, $plist) = @_;
+ $self->{infodir} = $plist->{infodir};
+ $self->SUPER::add_object($plist);
+}
+
+sub infodir
+{
+ my $self = shift;
+ return ${$self->{infodir}};
+}
+
+sub stringize
+{
+ my $self = shift;
+ return $self->category;
+}
+
+sub add
+{
+ my ($class, $plist, @args) = @_;
+
+ $class->SUPER::add($plist, $class->category);
+}
+
+sub fullname
+{
+ my $self = shift;
+ return $self->infodir.'/'.$self->category;
+}
+
package OpenBSD::PackingElement::FCONTENTS;
our @ISA=qw(OpenBSD::PackingElement::SpecialFile);
sub category() { OpenBSD::PackageInfo::CONTENTS }
diff --git a/usr.sbin/pkg_add/OpenBSD/PackingList.pm b/usr.sbin/pkg_add/OpenBSD/PackingList.pm
index 11f55da536f..032a5a2aa53 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.66 2007/05/28 11:35:54 espie Exp $
+# $OpenBSD: PackingList.pm,v 1.67 2007/05/29 12:36:53 espie Exp $
#
# Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org>
#
@@ -53,11 +53,18 @@ use OpenBSD::PackageInfo;
sub new
{
my $class = shift;
- my $plist = bless {state => OpenBSD::PackingList::State->new }, $class;
+ my $plist = bless {state => OpenBSD::PackingList::State->new,
+ infodir => \(my $d)}, $class;
OpenBSD::PackingElement::File->add($plist, CONTENTS);
return $plist;
}
+sub set_infodir
+{
+ my ($self, $dir) = shift;
+ ${$self->{infodir}} = $dir;
+}
+
sub read
{
my ($a, $u, $code) = @_;
@@ -399,6 +406,7 @@ sub from_installation
if (defined $plist && $code == \&DependOnly) {
$plist_cache->{$pkgname} = $plist;
}
+ $plist->set_infodir(OpenBSD::PackageInfo::installed_info($pkgname));
return $plist;
}
@@ -412,7 +420,7 @@ sub to_cache
$plist->{$c} = $self->{$c};
}
}
- $plist_cache->{$self->pkgname()} = $plist;
+ $plist_cache->{$self->pkgname} = $plist;
}
sub to_installation