diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2006-03-07 14:00:22 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2006-03-07 14:00:22 +0000 |
commit | bb0696cde502ae6fba31aec6f0064569ba8201ae (patch) | |
tree | 7335ab018016a16687b7652724bde8e96983e13a /usr.sbin | |
parent | b4020dcf786c9b36705e9e464476c3719d51939f (diff) |
make pkg_copy be overidable by subclass.
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/PackageRepository.pm | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm b/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm index ffa3b3c8cd3..97de9b5e990 100644 --- a/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm +++ b/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: PackageRepository.pm,v 1.5 2006/03/07 10:59:27 espie Exp $ +# $OpenBSD: PackageRepository.pm,v 1.6 2006/03/07 14:00:21 espie Exp $ # # Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org> # @@ -351,9 +351,11 @@ my $buffsize = 2 * 1024 * 1024; sub pkg_copy { - my ($in, $dir, $name) = @_; + my ($self, $in, $object) = @_; require File::Temp; + my $name = $object->{name}; + my $dir = $object->{cache_dir}; my $template = $name; $template =~ s/\.tgz$/.XXXXXXXX/; @@ -407,6 +409,7 @@ sub open_pipe my ($self, $object) = @_; $object->{errors} = OpenBSD::Temp::file(); $object->{cache_dir} = $ENV{'PKG_CACHE'}; + $object->{parent} = $$; my $pid = open(my $fh, "-|"); if (!defined $pid) { die "Cannot fork: $!"; @@ -439,8 +442,7 @@ sub open_pipe die "Cannot fork: $!"; } if ($pid3) { - pkg_copy($in, $object->{cache_dir}, - $object->{name}); + $self->pkg_copy($in, $object); exit(0); } else { $self->grab_object($object); |