summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add/OpenBSD
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2004-07-14 10:44:04 +0000
committerMarc Espie <espie@cvs.openbsd.org>2004-07-14 10:44:04 +0000
commit4e1f856ff7193e68d6e8ce9bce3d382eeb9c467e (patch)
treebfecc120353c4df4f16fe4344378745a4cde14e6 /usr.sbin/pkg_add/OpenBSD
parentd8cb00a3eea2e3efb7fcaca41b8f8259439dde8d (diff)
Rework @dirrm: keep them all, and remove them at the end of pkg_delete.
Add @dir, more powerful than @dirrm, so that we can get rid of those pesky @exec mkdir -p. okay naddy@
Diffstat (limited to 'usr.sbin/pkg_add/OpenBSD')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PackingElement.pm43
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PackingList.pm4
2 files changed, 34 insertions, 13 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PackingElement.pm b/usr.sbin/pkg_add/OpenBSD/PackingElement.pm
index 40792fec9ca..df427f770bf 100644
--- a/usr.sbin/pkg_add/OpenBSD/PackingElement.pm
+++ b/usr.sbin/pkg_add/OpenBSD/PackingElement.pm
@@ -1,4 +1,4 @@
-# $OpenBSD: PackingElement.pm,v 1.10 2004/07/13 00:35:39 espie Exp $
+# $OpenBSD: PackingElement.pm,v 1.11 2004/07/14 10:44:03 espie Exp $
#
# Copyright (c) 2003 Marc Espie.
#
@@ -112,6 +112,20 @@ sub compute_fullname
return $fullname;
}
+sub compute_modes
+{
+ my ($self, $state) = @_;
+ if (defined $state->{mode}) {
+ $self->{mode} = $state->{mode};
+ }
+ if (defined $state->{owner}) {
+ $self->{owner} = $state->{owner};
+ }
+ if (defined $state->{group}) {
+ $self->{group} = $state->{group};
+ }
+}
+
sub expand
{
my $state = $_[2];
@@ -175,15 +189,7 @@ sub destate
{
my ($self, $state) = @_;
$self->compute_fullname($state);
- if (defined $state->{mode}) {
- $self->{mode} = $state->{mode};
- }
- if (defined $state->{owner}) {
- $self->{owner} = $state->{owner};
- }
- if (defined $state->{group}) {
- $self->{group} = $state->{group};
- }
+ $self->compute_modes($state);
if (defined $state->{nochecksum}) {
$self->{nochecksum} = 1;
undef $state->{nochecksum};
@@ -563,8 +569,10 @@ sub destate
$self->{expanded} = $self->expand($self->{name}, $state);
}
+package OpenBSD::PackingElement::Dirs;
+
package OpenBSD::PackingElement::DirRm;
-our @ISA=qw(OpenBSD::PackingElement);
+our @ISA=qw(OpenBSD::PackingElement::Dirs OpenBSD::PackingElement);
__PACKAGE__->setKeyword('dirrm');
sub keyword() { "dirrm" }
@@ -575,6 +583,19 @@ sub destate
$self->compute_fullname($state);
}
+package OpenBSD::PackingElement::Dir;
+our @ISA=qw(OpenBSD::PackingElement::Dirs OpenBSD::PackingElement);
+
+__PACKAGE__->setKeyword('dir');
+sub keyword() { "dir" }
+
+sub destate
+{
+ my ($self, $state) = @_;
+ $self->compute_fullname($state);
+ $self->compute_modes($state);
+}
+
package OpenBSD::PackingElement::Extra;
our @ISA=qw(OpenBSD::PackingElement);
diff --git a/usr.sbin/pkg_add/OpenBSD/PackingList.pm b/usr.sbin/pkg_add/OpenBSD/PackingList.pm
index 1e3420b75fc..d52b97dc449 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.10 2004/07/13 00:35:39 espie Exp $
+# $OpenBSD: PackingList.pm,v 1.11 2004/07/14 10:44:03 espie Exp $
#
# Copyright (c) 2003 Marc Espie.
#
@@ -73,7 +73,7 @@ sub DirrmOnly
my ($fh, $cont) = @_;
local $_;
while (<$fh>) {
- next unless m/^\@cwd\b/ || m/^\@dirrm\b/ || m/^\@name\b/;
+ next unless m/^\@cwd\b/ || m/^\@dirrm\b/ || m/^\@dir\b/ || m/^\@name\b/;
&$cont($_);
}
}