summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2005-09-13 20:03:30 +0000
committerMarc Espie <espie@cvs.openbsd.org>2005-09-13 20:03:30 +0000
commit1d705097f209fa7e37dcb2cdc9e563c115212724 (patch)
tree9ff73eaf941c18525e87968675f960f14955ab82
parentbdf001ba61208b496013e7037f73bd00795219f8 (diff)
Repository::Installed class, to provide uniform access to installed
packages compared to other `repositories'.
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PackageLocator.pm39
1 files changed, 38 insertions, 1 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PackageLocator.pm b/usr.sbin/pkg_add/OpenBSD/PackageLocator.pm
index cfa0d0e1de8..44684370f6e 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.27 2005/09/13 19:40:30 espie Exp $
+# $OpenBSD: PackageLocator.pm,v 1.28 2005/09/13 20:03:29 espie Exp $
#
# Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org>
#
@@ -125,6 +125,43 @@ sub grabPlist
return $self->grabPlist($name, $arch, $code);
}
+package OpenBSD::PackageRepository::Installed;
+use OpenBSD::PackageInfo;
+
+sub find
+{
+ my ($repository, $name, $arch) = @_;
+ my $self;
+
+ if (is_installed($name)) {
+ $self = OpenBSD::PackageLocation->new($repository, $name);
+ $self->{dir} = installed_info($name);
+ }
+ return $self;
+}
+
+sub grabPlist
+{
+ my ($repository, $name, $arch, $code) = @_;
+ require OpenBSD::PackingList;
+ return OpenBSD::PackingList->from_installation($name, $code);
+}
+
+sub available
+{
+ return installed_packages();
+}
+
+sub wipe_info
+{
+}
+
+sub may_exist
+{
+ my ($self, $name) = @_;
+ return is_installed($name);
+}
+
package OpenBSD::PackageRepository::SCP;
our @ISA=qw(OpenBSD::PackageRepository OpenBSD::PackageRepository::FTPorSCP);