diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2004-03-07 19:29:09 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2004-03-07 19:29:09 +0000 |
commit | 5fd8309e025e86b2fa98632f8ef5d75cf58034d1 (patch) | |
tree | 9313c55374f783a5a49a4df37efd7f78cec86ef4 /usr.sbin/pkg_add/OpenBSD | |
parent | 098ca9d129ce67504785871b2519b7713d3637c6 (diff) |
A few useful features:
- pkg_add -A arch, to make believe we are extracting on a given arch
(matches pkg_create).
- pkg_add -P cdrom/-P ftp, to enforce extracting only cdrom'able packages
or ftp'able packages. Helps a lot for checking cdrom lists.
- dependency look-up will look through local directory listings to solve
dependencies, so that non-default dependencies will work more seemlessly.
(doing the same thing for distant repository will happen after 3.5, but
this requires more apparatus: caching package lists, and killing/restoring
existing connections, plus more error handling).
okay pval
Diffstat (limited to 'usr.sbin/pkg_add/OpenBSD')
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/PackageLocator.pm | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PackageLocator.pm b/usr.sbin/pkg_add/OpenBSD/PackageLocator.pm index 1df041e61fc..79680c203f9 100644 --- a/usr.sbin/pkg_add/OpenBSD/PackageLocator.pm +++ b/usr.sbin/pkg_add/OpenBSD/PackageLocator.pm @@ -1,4 +1,4 @@ -# $OpenBSD: PackageLocator.pm,v 1.7 2004/01/28 22:30:50 espie Exp $ +# $OpenBSD: PackageLocator.pm,v 1.8 2004/03/07 19:29:08 espie Exp $ # # Copyright (c) 2003 Marc Espie. # @@ -111,6 +111,11 @@ sub open return $fh; } +# by default, we don't know how to list packages there. +sub simplelist +{ +} + package OpenBSD::PackageLocation::SCP; our @ISA=qw(OpenBSD::PackageLocation OpenBSD::PackageLocation::FTPorSCP); @@ -158,16 +163,22 @@ sub list { my $self = shift; my @l = (); - opendir(my $dir, $self->{location}) or return undef; + my $dname = $self->{location}; + opendir(my $dir, $dname) or return undef; while (my $e = readdir $dir) { - next unless -f "$dir/$e"; - next unless $e = ~ m/\.tgz$/; + next unless -f "$dname/$e"; + next unless $e =~ m/\.tgz$/; push(@l, $`); } close($dir); return @l; } +sub simplelist +{ + return $_[0]->list(); +} + package OpenBSD::PackageLocation::FTPorSCP; sub _list @@ -313,6 +324,15 @@ sub find return $package; } +sub available +{ + my @l = (); + foreach my $loc (@pkgpath) { + push(@l, $loc->simplelist()); + } + return @l; +} + sub info { my $self = shift; |