From bb0696cde502ae6fba31aec6f0064569ba8201ae Mon Sep 17 00:00:00 2001 From: Marc Espie Date: Tue, 7 Mar 2006 14:00:22 +0000 Subject: make pkg_copy be overidable by subclass. --- usr.sbin/pkg_add/OpenBSD/PackageRepository.pm | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'usr.sbin') 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 # @@ -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); -- cgit v1.2.3