summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2006-03-08 12:10:49 +0000
committerMarc Espie <espie@cvs.openbsd.org>2006-03-08 12:10:49 +0000
commita3e32db7620b275eb56225901bcdf80664dc16b6 (patch)
tree10ae29a35a18fdccc17596cdf482020bbfeec198 /usr.sbin/pkg_add
parent7e3e1895e51b34f7f91726c86c2f6cc25ac52ba4 (diff)
propagate stuff to be able to explicitly clean-up repositories.
(we can't use a normal destructor, since this will be called for each fork()ed subprocess).
Diffstat (limited to 'usr.sbin/pkg_add')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PackageLocator.pm7
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PackageRepository.pm7
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PackageRepository/SCP.pm7
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PackageRepositoryList.pm10
4 files changed, 24 insertions, 7 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PackageLocator.pm b/usr.sbin/pkg_add/OpenBSD/PackageLocator.pm
index 496e1e6d9c0..2d68883fc16 100644
--- a/usr.sbin/pkg_add/OpenBSD/PackageLocator.pm
+++ b/usr.sbin/pkg_add/OpenBSD/PackageLocator.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: PackageLocator.pm,v 1.52 2006/03/04 13:13:05 espie Exp $
+# $OpenBSD: PackageLocator.pm,v 1.53 2006/03/08 12:10:47 espie Exp $
#
# Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org>
#
@@ -107,4 +107,9 @@ sub grabPlist
return $plist;
}
+sub cleanup
+{
+ $pkgpath->cleanup();
+}
+
1;
diff --git a/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm b/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm
index 870b1e197ed..44450fe4b54 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.10 2006/03/08 11:22:02 espie Exp $
+# $OpenBSD: PackageRepository.pm,v 1.11 2006/03/08 12:10:47 espie Exp $
#
# Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org>
#
@@ -219,6 +219,11 @@ sub parse_problems
unlink $filename;
}
+sub cleanup
+{
+ # nothing to do
+}
+
package OpenBSD::PackageRepository::Installed;
our @ISA=qw(OpenBSD::PackageRepository);
use OpenBSD::PackageInfo;
diff --git a/usr.sbin/pkg_add/OpenBSD/PackageRepository/SCP.pm b/usr.sbin/pkg_add/OpenBSD/PackageRepository/SCP.pm
index 4a76a3154f3..68b37e2f3e7 100644
--- a/usr.sbin/pkg_add/OpenBSD/PackageRepository/SCP.pm
+++ b/usr.sbin/pkg_add/OpenBSD/PackageRepository/SCP.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: SCP.pm,v 1.6 2006/03/08 11:22:02 espie Exp $
+# $OpenBSD: SCP.pm,v 1.7 2006/03/08 12:10:48 espie Exp $
#
# Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org>
#
@@ -153,17 +153,16 @@ sub list
return $self->{list};
}
-# XXX not used yet
sub cleanup
{
my $self = shift;
if (defined $self->{controller}) {
- print STDERR "Closing repository\n";
my $cmdfh = $self->{cmdfh};
+ my $getfh = $self->{getfh};
print $cmdfh "ABORT\nBYE\nBYE\n";
CORE::close($cmdfh);
+ CORE::close($getfh);
waitpid($self->{controller}, 0);
- print STDERR "Repository closed\n";
}
}
diff --git a/usr.sbin/pkg_add/OpenBSD/PackageRepositoryList.pm b/usr.sbin/pkg_add/OpenBSD/PackageRepositoryList.pm
index c6868ac4099..0b9734ef3d8 100644
--- a/usr.sbin/pkg_add/OpenBSD/PackageRepositoryList.pm
+++ b/usr.sbin/pkg_add/OpenBSD/PackageRepositoryList.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: PackageRepositoryList.pm,v 1.1 2006/03/04 13:13:05 espie Exp $
+# $OpenBSD: PackageRepositoryList.pm,v 1.2 2006/03/08 12:10:47 espie Exp $
#
# Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org>
#
@@ -101,4 +101,12 @@ sub available
return keys %{$self->{avail}};
}
+sub cleanup
+{
+ my $self = shift;
+ for my $repo (@{$self->{list}}) {
+ $repo->cleanup();
+ }
+}
+
1;