summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2003-10-19 18:39:20 +0000
committerMarc Espie <espie@cvs.openbsd.org>2003-10-19 18:39:20 +0000
commit8e124d028195fc07c59d76f956b84e0480cc4ace (patch)
tree150943ff3f3b8b21ec270242c244b29200b3d88c
parent44e5bb3fb0bb210b6e711ce4c4a14e10b3cdc147 (diff)
Let @cwd followed by no files work (for @extra), like the old tools.
ok pval
-rw-r--r--usr.sbin/pkg_add/pkg_create20
1 files changed, 14 insertions, 6 deletions
diff --git a/usr.sbin/pkg_add/pkg_create b/usr.sbin/pkg_add/pkg_create
index 19f0052e339..73745a5efdb 100644
--- a/usr.sbin/pkg_add/pkg_create
+++ b/usr.sbin/pkg_add/pkg_create
@@ -1,6 +1,6 @@
#! /usr/bin/perl
# ex:ts=8 sw=4:
-# $OpenBSD: pkg_create,v 1.1 2003/10/16 17:43:34 espie Exp $
+# $OpenBSD: pkg_create,v 1.2 2003/10/19 18:39:19 espie Exp $
#
# Copyright (c) 2003 Marc Espie.
#
@@ -41,10 +41,16 @@ sub archive_cmd { () }
package OpenBSD::PackingElement::File;
sub archive_cmd
{
- my ($self, $pfh) = @_;
+ my ($self, $pfh, $use_cwd) = @_;
my $fh = $$pfh;
print $fh $self->{name}, "\n";
- return ();
+ if (@$use_cwd != 0) {
+ my @r = @$use_cwd;
+ @$use_cwd = ();
+ return @r;
+ } else {
+ return ();
+ }
}
package OpenBSD::PackingElement::Cwd;
@@ -52,10 +58,11 @@ use OpenBSD::Temp;
sub archive_cmd
{
- my ($self, $pfh, $dir, $base) = @_;
+ my ($self, $pfh, $use_cwd, $dir, $base) = @_;
my ($fh, $fname) = OpenBSD::Temp::list($dir);
$$pfh = $fh;
- return ("-C", $base."/".$self->{name}, "-I", $fname);
+ @$use_cwd = ("-C", $base."/".$self->{name}, "-I", $fname );
+ return ();
}
package OpenBSD::PackingList;
@@ -65,9 +72,10 @@ sub archive_cmd
{
my ($self, $dir, $base) = @_;
my $fh;
+ my @use_cwd = ();
my @cmd = ();
for my $item (@{$self->{items}}) {
- push(@cmd, $item->archive_cmd(\$fh, $dir, $base));
+ push(@cmd, $item->archive_cmd(\$fh, \@use_cwd, $dir, $base));
}
return @cmd;
}