The diff below fixes the spell-o in OpenBSD::PackageRepository::Persistant's
name.
All regress tests still pass on amd64.
On a related note, the regress tests now require user interaction because the
packages created & added during the tests are unsigned. I haven't looked into
that yet but am willing to cook up another diff if nobody else is working on it
already.
Index: usr.sbin/pkg_add//Makefile
===================================================================
RCS file: /work/cvsroot/src/usr.sbin/pkg_add/Makefile,v
retrieving revision 1.80
diff -p -u -r1.80 Makefile
--- usr.sbin/pkg_add//Makefile 14 Apr 2014 10:56:11 -0000 1.80
+++ usr.sbin/pkg_add//Makefile 5 Jun 2014 21:43:04 -0000
@@ -35,7 +35,7 @@ PACKAGES= \
OpenBSD/PackageRepository.pm \
OpenBSD/PackageRepository/HTTP.pm \
OpenBSD/PackageRepository/Installed.pm \
- OpenBSD/PackageRepository/Persistant.pm \
+ OpenBSD/PackageRepository/Persistent.pm \
OpenBSD/PackageRepository/SCP.pm \
OpenBSD/PackageRepository/Source.pm \
OpenBSD/PackageRepositoryList.pm \
Index: usr.sbin/pkg_add//OpenBSD/PackageRepository/HTTP.pm
===================================================================
RCS file: /work/cvsroot/src/usr.sbin/pkg_add/OpenBSD/PackageRepository/HTTP.pm,v
retrieving revision 1.11
diff -p -u -r1.11 HTTP.pm
--- usr.sbin/pkg_add//OpenBSD/PackageRepository/HTTP.pm 18 Mar 2014 18:53:29
-0000 1.11
+++ usr.sbin/pkg_add//OpenBSD/PackageRepository/HTTP.pm 5 Jun 2014 21:44:26
-0000
@@ -19,10 +19,10 @@
use strict;
use warnings;
-use OpenBSD::PackageRepository::Persistant;
+use OpenBSD::PackageRepository::Persistent;
package OpenBSD::PackageRepository::HTTP1;
-our @ISA = qw(OpenBSD::PackageRepository::Persistant);
+our @ISA = qw(OpenBSD::PackageRepository::Persistent);
sub urlscheme
{
return 'http';
Index: usr.sbin/pkg_add//OpenBSD/PackageRepository/Persistant.pm
===================================================================
RCS file: usr.sbin/pkg_add//OpenBSD/PackageRepository/Persistant.pm
diff -N usr.sbin/pkg_add//OpenBSD/PackageRepository/Persistant.pm
--- usr.sbin/pkg_add//OpenBSD/PackageRepository/Persistant.pm 18 Mar 2014
18:53:29 -0000 1.4
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,141 +0,0 @@
-# ex:ts=8 sw=4:
-# $OpenBSD: Persistant.pm,v 1.4 2014/03/18 18:53:29 espie Exp $
-#
-# Copyright (c) 2003-2014 Marc Espie <[email protected]>
-#
-# Permission to use, copy, modify, and distribute this software for any
-# purpose with or without fee is hereby granted, provided that the above
-# copyright notice and this permission notice appear in all copies.
-#
-# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
-use strict;
-use warnings;
-
-package OpenBSD::PackageRepository::Persistant;
-our @ISA=qw(OpenBSD::PackageRepository::Distant);
-
-our %distant = ();
-
-sub may_exist
-{
- my ($self, $name) = @_;
- my $l = $self->list;
- return grep {$_ eq $name } @$l;
-}
-
-sub grab_object
-{
- my ($self, $object) = @_;
-
- my $cmdfh = $self->{cmdfh};
- my $getfh = $self->{getfh};
-
- print $cmdfh "ABORT\n";
- while (<$getfh>) {
- last if m/^ABORTED/o;
- }
- print $cmdfh "GET ", $self->{path}.$object->{name}.".tgz", "\n";
- close($cmdfh);
- $_ = <$getfh>;
- chomp;
- if (m/^ERROR:/o) {
- $self->{state}->fatal("transfer error: #1", $_);
- }
- if (m/^TRANSFER:\s+(\d+)/o) {
- my $buffsize = 10 * 1024;
- my $buffer;
- my $size = $1;
- my $remaining = $size;
- my $n;
-
- do {
- $n = read($getfh, $buffer,
- $remaining < $buffsize ? $remaining :$buffsize);
- if (!defined $n) {
- $self->{state}->fatal("Error reading: #1", $!);
- }
- $remaining -= $n;
- if ($n > 0) {
- syswrite STDOUT, $buffer;
- }
- } while ($n != 0 && $remaining != 0);
- exit(0);
- }
-}
-
-sub maxcount
-{
- return 1;
-}
-
-sub opened
-{
- my $self = $_[0];
- my $k = $self->{host};
- if (!defined $distant{$k}) {
- $distant{$k} = [];
- }
- return $distant{$k};
-}
-
-sub list
-{
- my ($self) = @_;
- if (!defined $self->{list}) {
- if (!defined $self->{controller}) {
- $self->initiate;
- }
- my $cmdfh = $self->{cmdfh};
- my $getfh = $self->{getfh};
- my $path = $self->{path};
- my $l = [];
- print $cmdfh "LIST $path\n";
- $_ = <$getfh>;
- if (!defined $_) {
- $self->{state}->fatal("Could not initiate #1 session",
- $self->urlscheme);
- }
- chomp;
- if (m/^ERROR:/o) {
- $self->{state}->fatal("#1", $_);
- }
- if (!m/^SUCCESS:/o) {
- $self->{state}->fatal("Synchronization error");
- }
- while (<$getfh>) {
- chomp;
- last if $_ eq '';
- push(@$l, $_);
- }
- $self->{list} = $l;
- }
- return $self->{list};
-}
-
-sub cleanup
-{
- my $self = shift;
- if (defined $self->{controller}) {
- my $cmdfh = $self->{cmdfh};
- my $getfh = $self->{getfh};
- print $cmdfh "ABORT\nBYE\nBYE\n";
- CORE::close($cmdfh);
- CORE::close($getfh);
- waitpid($self->{controller}, 0);
- }
-}
-
-sub reinitialize
-{
- my $self = shift;
- $self->initiate;
-}
-
-1;
Index: usr.sbin/pkg_add//OpenBSD/PackageRepository/Persistent.pm
===================================================================
RCS file: usr.sbin/pkg_add//OpenBSD/PackageRepository/Persistent.pm
diff -N usr.sbin/pkg_add//OpenBSD/PackageRepository/Persistent.pm
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ usr.sbin/pkg_add//OpenBSD/PackageRepository/Persistent.pm 5 Jun 2014
21:43:56 -0000
@@ -0,0 +1,141 @@
+# ex:ts=8 sw=4:
+# $OpenBSD: Persistant.pm,v 1.4 2014/03/18 18:53:29 espie Exp $
+#
+# Copyright (c) 2003-2014 Marc Espie <[email protected]>
+#
+# Permission to use, copy, modify, and distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+use strict;
+use warnings;
+
+package OpenBSD::PackageRepository::Persistent;
+our @ISA=qw(OpenBSD::PackageRepository::Distant);
+
+our %distant = ();
+
+sub may_exist
+{
+ my ($self, $name) = @_;
+ my $l = $self->list;
+ return grep {$_ eq $name } @$l;
+}
+
+sub grab_object
+{
+ my ($self, $object) = @_;
+
+ my $cmdfh = $self->{cmdfh};
+ my $getfh = $self->{getfh};
+
+ print $cmdfh "ABORT\n";
+ while (<$getfh>) {
+ last if m/^ABORTED/o;
+ }
+ print $cmdfh "GET ", $self->{path}.$object->{name}.".tgz", "\n";
+ close($cmdfh);
+ $_ = <$getfh>;
+ chomp;
+ if (m/^ERROR:/o) {
+ $self->{state}->fatal("transfer error: #1", $_);
+ }
+ if (m/^TRANSFER:\s+(\d+)/o) {
+ my $buffsize = 10 * 1024;
+ my $buffer;
+ my $size = $1;
+ my $remaining = $size;
+ my $n;
+
+ do {
+ $n = read($getfh, $buffer,
+ $remaining < $buffsize ? $remaining :$buffsize);
+ if (!defined $n) {
+ $self->{state}->fatal("Error reading: #1", $!);
+ }
+ $remaining -= $n;
+ if ($n > 0) {
+ syswrite STDOUT, $buffer;
+ }
+ } while ($n != 0 && $remaining != 0);
+ exit(0);
+ }
+}
+
+sub maxcount
+{
+ return 1;
+}
+
+sub opened
+{
+ my $self = $_[0];
+ my $k = $self->{host};
+ if (!defined $distant{$k}) {
+ $distant{$k} = [];
+ }
+ return $distant{$k};
+}
+
+sub list
+{
+ my ($self) = @_;
+ if (!defined $self->{list}) {
+ if (!defined $self->{controller}) {
+ $self->initiate;
+ }
+ my $cmdfh = $self->{cmdfh};
+ my $getfh = $self->{getfh};
+ my $path = $self->{path};
+ my $l = [];
+ print $cmdfh "LIST $path\n";
+ $_ = <$getfh>;
+ if (!defined $_) {
+ $self->{state}->fatal("Could not initiate #1 session",
+ $self->urlscheme);
+ }
+ chomp;
+ if (m/^ERROR:/o) {
+ $self->{state}->fatal("#1", $_);
+ }
+ if (!m/^SUCCESS:/o) {
+ $self->{state}->fatal("Synchronization error");
+ }
+ while (<$getfh>) {
+ chomp;
+ last if $_ eq '';
+ push(@$l, $_);
+ }
+ $self->{list} = $l;
+ }
+ return $self->{list};
+}
+
+sub cleanup
+{
+ my $self = shift;
+ if (defined $self->{controller}) {
+ my $cmdfh = $self->{cmdfh};
+ my $getfh = $self->{getfh};
+ print $cmdfh "ABORT\nBYE\nBYE\n";
+ CORE::close($cmdfh);
+ CORE::close($getfh);
+ waitpid($self->{controller}, 0);
+ }
+}
+
+sub reinitialize
+{
+ my $self = shift;
+ $self->initiate;
+}
+
+1;
Index: usr.sbin/pkg_add//OpenBSD/PackageRepository/SCP.pm
===================================================================
RCS file: /work/cvsroot/src/usr.sbin/pkg_add/OpenBSD/PackageRepository/SCP.pm,v
retrieving revision 1.28
diff -p -u -r1.28 SCP.pm
--- usr.sbin/pkg_add//OpenBSD/PackageRepository/SCP.pm 18 Mar 2014 18:53:29
-0000 1.28
+++ usr.sbin/pkg_add//OpenBSD/PackageRepository/SCP.pm 5 Jun 2014 21:44:12
-0000
@@ -18,10 +18,10 @@
use strict;
use warnings;
-use OpenBSD::PackageRepository::Persistant;
+use OpenBSD::PackageRepository::Persistent;
package OpenBSD::PackageRepository::SCP;
-our @ISA=qw(OpenBSD::PackageRepository::Persistant);
+our @ISA=qw(OpenBSD::PackageRepository::Persistent);
use IPC::Open2;
use IO::Handle;