summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PackageLocation.pm23
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PackageRepository.pm24
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PackageRepository/SCP.pm5
3 files changed, 26 insertions, 26 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PackageLocation.pm b/usr.sbin/pkg_add/OpenBSD/PackageLocation.pm
index a2444fce895..2e3bb2883a8 100644
--- a/usr.sbin/pkg_add/OpenBSD/PackageLocation.pm
+++ b/usr.sbin/pkg_add/OpenBSD/PackageLocation.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: PackageLocation.pm,v 1.3 2006/03/07 10:59:27 espie Exp $
+# $OpenBSD: PackageLocation.pm,v 1.4 2006/03/13 16:08:12 espie Exp $
#
# Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org>
#
@@ -25,8 +25,12 @@ use OpenBSD::Temp;
sub new
{
- my ($class, $repository, $name) = @_;
- my $self = { repository => $repository, name => $name};
+ my ($class, $repository, $name, $arch) = @_;
+
+ if (defined $name) {
+ $name =~ s/\.tgz$//;
+ }
+ my $self = { repository => $repository, name => $name, arch => $arch};
bless $self, $class;
}
@@ -106,9 +110,9 @@ sub scanPackage
sub grabPlist
{
- my ($self, $pkgname, $arch, $code) = @_;
+ my ($self, $code) = @_;
- my $pkg = $self->openPackage($pkgname, $arch);
+ my $pkg = $self->openPackage();
if (defined $pkg) {
my $plist = $self->plist($code);
$pkg->wipe_info();
@@ -121,7 +125,8 @@ sub grabPlist
sub openPackage
{
- my ($self, $pkgname, $arch) = @_;
+ my $self = shift;
+ my $arch = $self->{arch};
if (!$self->openArchive()) {
return undef;
}
@@ -140,11 +145,11 @@ sub openPackage
my $contents = $e->contents();
require OpenBSD::PackingList;
- $pkgname =~ s/\.tgz$//;
-
my $plist = OpenBSD::PackingList->fromfile(\$contents,
\&OpenBSD::PackingList::FatOnly);
- next if defined $pkgname and $plist->pkgname() ne $pkgname;
+ if (defined $self->{name}) {
+ next if $plist->pkgname() ne $self->{name};
+ }
if ($plist->has('arch')) {
if ($plist->{arch}->check($arch)) {
$self->{filter} = $prefix;
diff --git a/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm b/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm
index 44450fe4b54..449d2c54fe3 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.11 2006/03/08 12:10:47 espie Exp $
+# $OpenBSD: PackageRepository.pm,v 1.12 2006/03/13 16:08:12 espie Exp $
#
# Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org>
#
@@ -160,19 +160,17 @@ sub open
sub find
{
my ($repository, $name, $arch, $srcpath) = @_;
- $name.=".tgz" unless $name =~ m/\.tgz$/;
- my $self = OpenBSD::PackageLocation->new($repository, $name);
+ my $self = OpenBSD::PackageLocation->new($repository, $name, $arch);
- return $self->openPackage($name, $arch);
+ return $self->openPackage();
}
sub grabPlist
{
my ($repository, $name, $arch, $code) = @_;
- $name.=".tgz" unless $name =~ m/\.tgz$/;
- my $self = OpenBSD::PackageLocation->new($repository, $name);
+ my $self = OpenBSD::PackageLocation->new($repository, $name, $arch);
- return $self->grabPlist($name, $arch, $code);
+ return $self->grabPlist($code);
}
sub parse_problems
@@ -293,7 +291,7 @@ sub open_pipe
"-c",
"-q",
"-f",
- $self->{baseurl}.$object->{name}
+ $self->{baseurl}.$object->{name}.".tgz"
or die "Can't run gzip";
}
}
@@ -301,7 +299,7 @@ sub open_pipe
sub may_exist
{
my ($self, $name) = @_;
- return -r $self->{baseurl}.$name;
+ return -r $self->{baseurl}.$name.".tgz";
}
sub list
@@ -330,7 +328,6 @@ sub may_exist
sub open_pipe
{
my ($self, $object) = @_;
- my $fullname = $self->{baseurl}.$object->{name};
my $pid = open(my $fh, "-|");
if (!defined $pid) {
die "Cannot fork: $!";
@@ -362,8 +359,7 @@ sub pkg_copy
require File::Temp;
my $name = $object->{name};
my $dir = $object->{cache_dir};
- my $template = $name;
- $template =~ s/\.tgz$/.XXXXXXXX/;
+ my $template = "$name.XXXXXXXXX";
my ($copy, $filename) = File::Temp::tempfile($template,
DIR => $dir) or die "Can't write copy to cache";
@@ -410,7 +406,7 @@ sub pkg_copy
}
if ($nonempty && !$error) {
- rename $filename, "$dir/$name";
+ rename $filename, "$dir/$name.tgz";
} else {
unlink $filename;
}
@@ -519,7 +515,7 @@ sub grab_object
exec {$ftp}
"ftp",
"-o",
- "-", $self->{baseurl}.$object->{name}
+ "-", $self->{baseurl}.$object->{name}.".tgz"
or die "can't run ftp";
}
diff --git a/usr.sbin/pkg_add/OpenBSD/PackageRepository/SCP.pm b/usr.sbin/pkg_add/OpenBSD/PackageRepository/SCP.pm
index 68b37e2f3e7..dd2864891b7 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.7 2006/03/08 12:10:48 espie Exp $
+# $OpenBSD: SCP.pm,v 1.8 2006/03/13 16:08:12 espie Exp $
#
# Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org>
#
@@ -54,7 +54,6 @@ sub may_exist
{
my ($self, $name) = @_;
my $l = $self->list();
- $name =~ s/\.tgz$//;
return grep {$_ eq $name } @$l;
}
@@ -70,7 +69,7 @@ sub grab_object
while (<$getfh>) {
last if m/^ABORTED/;
}
- print $cmdfh "GET ", $self->{path}.$object->{name}, "\n";
+ print $cmdfh "GET ", $self->{path}.$object->{name}.".tgz", "\n";
close($cmdfh);
$_ = <$getfh>;
chomp;