summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add/OpenBSD/PackingList.pm
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2004-08-05 23:36:41 +0000
committerMarc Espie <espie@cvs.openbsd.org>2004-08-05 23:36:41 +0000
commitb1a99bfe922d9636aedd85d5a14aa01ce59bf207 (patch)
tree8f84039a5285934713328aecc97069e97f21368f /usr.sbin/pkg_add/OpenBSD/PackingList.pm
parentcdf1b8ae47492fc96234d3786e7d3c125c35125b (diff)
refactor classes in PackingElement to share more code.
- all files go through FileBase, all directories go through DirBase. - dirclass() is used to switch classes based on final /, so that @sample, @extra, and @file all take directories as well. - set NoDuplicateNames() more thoroughly. - make sure all no-default-conflict objects are correct. compute_fullname() checks for absolute paths, allowed for @sample and @extra. lastfile only gets set for actual files. special names like INSTALL are only checked for normal files. add a CVSTag class for @comment $OpenBSD$, so that these get sorted first. Changes for make-plist rewrite: clone() method that can create copies of all hash objects, to specialize if needed. add_object() method so that add() is now new() followed by add_object() for most objects (useful for cloned objects). Check that plist has a name in pkg_create, allowing PackingList to write unnamed plists.
Diffstat (limited to 'usr.sbin/pkg_add/OpenBSD/PackingList.pm')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PackingList.pm25
1 files changed, 14 insertions, 11 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PackingList.pm b/usr.sbin/pkg_add/OpenBSD/PackingList.pm
index f302e8539a1..37adf5682c4 100644
--- a/usr.sbin/pkg_add/OpenBSD/PackingList.pm
+++ b/usr.sbin/pkg_add/OpenBSD/PackingList.pm
@@ -1,4 +1,4 @@
-# $OpenBSD: PackingList.pm,v 1.16 2004/08/03 12:33:48 espie Exp $
+# $OpenBSD: PackingList.pm,v 1.17 2004/08/05 23:36:40 espie Exp $
#
# Copyright (c) 2003 Marc Espie.
#
@@ -73,7 +73,7 @@ sub DirrmOnly
my ($fh, $cont) = @_;
local $_;
while (<$fh>) {
- next unless m/^\@(?:cwd|dirrm|dir|fontdir|mandir|name)\b/ || m/^[^\@].*\/$/;
+ next unless m/^\@(?:cwd|dirrm|dir|fontdir|mandir|name)\b/ || m/^\@(?:sample|extra)\b.*\/$/ || m/^[^\@].*\/$/;
&$cont($_);
}
}
@@ -121,16 +121,19 @@ MAINLOOP:
sub write
{
- my ($self, $fh) = @_;
- if (!defined $self->{name}) {
- print STDERR "Can't write unnamed packing list\n";
- exit 1;
- }
- $self->{name}->write($fh);
- if (defined $self->{'no-default-conflict'}) {
- $self->{'no-default-conflict'}->write($fh);
+ my ($self, $fh, $w) = @_;
+
+ $w = sub {
+ my ($o, $fh) = @_;
+ $o->write($fh);
+ } unless defined $w;
+
+ if (defined $self->{cvstags}) {
+ for my $item (@{$self->{cvstags}}) {
+ $item->write($fh);
+ }
}
- for my $unique_item (qw(extrainfo arch)) {
+ for my $unique_item (qw(name no-default-conflict extrainfo arch)) {
$self->{$unique_item}->write($fh) if defined $self->{$unique_item};
}
for my $listname (qw(pkgcfl pkgdep newdepend libdepend items)) {