diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2004-07-22 22:23:27 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2004-07-22 22:23:27 +0000 |
commit | c20a38f0343b175356aa85e60b74743eb9862bfa (patch) | |
tree | 058a8b07595f7064001973a24bb6403fbb9c9c2c /usr.sbin | |
parent | 52b63c58dfe9f3f63b15f10ea557c7f252c34806 (diff) |
use
directory/
instead of
@dir directory
okay naddy@
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/PackingElement.pm | 45 |
1 files changed, 36 insertions, 9 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PackingElement.pm b/usr.sbin/pkg_add/OpenBSD/PackingElement.pm index 41222ed8aaf..fb18e6dd0dd 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.12 2004/07/20 18:58:41 espie Exp $ +# $OpenBSD: PackingElement.pm,v 1.13 2004/07/22 22:23:26 espie Exp $ # # Copyright (c) 2003 Marc Espie. # @@ -52,7 +52,11 @@ sub Factory exit(1); } } else { - OpenBSD::PackingElement::File->add(@_, $_); + if ($_ =~ m|/$|) { + OpenBSD::PackingElement::Dir->add(@_, $`); + } else { + OpenBSD::PackingElement::File->add(@_, $_); + } } } @@ -90,10 +94,27 @@ sub add sub keyword() { return; } +sub needs_keyword() { 1; } + sub write { my ($self, $fh) = @_; - print $fh "\@", $self->keyword(), " ", $self->stringize(), "\n"; + if ($self->needs_keyword()) { + print $fh "\@", $self->keyword(), " ", $self->stringize(), "\n"; + } else { + print $fh $self->stringize(), "\n"; + } +} + +# needed for comment checking +sub fullstring +{ + my ($self, $fh) = @_; + if ($self->needs_keyword()) { + return "\@".$self->keyword()." ".$self->stringize()."\n"; + } else { + return $self->stringize()."\n"; + } } sub stringize($) @@ -174,11 +195,7 @@ sub write my ($self, $fh) = @_; print $fh "\@ignore\n" if defined $self->{ignore}; print $fh "\@comment no checksum\n" if defined $self->{nochecksum}; - if ($self->needs_keyword()) { - $self->SUPER::write($fh); - } else { - print $fh $self->stringize(), "\n"; - } + $self->SUPER::write($fh); if (defined $self->{md5}) { print $fh "\@md5 ", $self->{md5}, "\n"; } @@ -606,7 +623,6 @@ package OpenBSD::PackingElement::Dir; our @ISA=qw(OpenBSD::PackingElement::Dirs OpenBSD::PackingElement); __PACKAGE__->setKeyword('dir'); -sub keyword() { "dir" } sub destate { @@ -615,6 +631,17 @@ sub destate $self->compute_modes($state); } +sub needs_keyword +{ + my $self = shift; + return $self->stringize() =~ m/\^@/; +} + +sub stringize($) +{ + return $_[0]->{name}."/"; +} + package OpenBSD::PackingElement::Extra; our @ISA=qw(OpenBSD::PackingElement); |