diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2007-06-04 14:40:40 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2007-06-04 14:40:40 +0000 |
commit | 8a3fdf46bd93e71794fcec29cb31017529d8ec57 (patch) | |
tree | 8721baf5d52b0079af9d143523c9b5d0a8cd2bef /usr.sbin/pkg_add | |
parent | cc4e44748b6a845f1f2d35fc2fe8753cb8b89300 (diff) |
some minor systematic changes.
- mark all regexps I can with /o if they can be compiled once.
- turn $o->method() into $o->method
- remove unneeded prototypes
- reduce split /re/ into split "string" where possible.
Diffstat (limited to 'usr.sbin/pkg_add')
33 files changed, 279 insertions, 277 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Add.pm b/usr.sbin/pkg_add/OpenBSD/Add.pm index 8385996ad50..cdf4a041e70 100644 --- a/usr.sbin/pkg_add/OpenBSD/Add.pm +++ b/usr.sbin/pkg_add/OpenBSD/Add.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Add.pm,v 1.70 2007/06/01 22:06:03 espie Exp $ +# $OpenBSD: Add.pm,v 1.71 2007/06/04 14:40:39 espie Exp $ # # Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org> # @@ -168,7 +168,7 @@ sub set_modes } if (defined $self->{mode}) { my $v = $self->{mode}; - if ($v =~ m/^\d+$/) { + if ($v =~ m/^\d+$/o) { chmod oct($v), $name; } else { System('chmod', $self->{mode}, $name); @@ -204,7 +204,7 @@ sub add_entry my $f = shift; my $v = shift; next if !defined $v or $v eq ''; - if ($v =~ m/^\!/) { + if ($v =~ m/^\!/o) { push(@$l, $f, $'); } else { push(@$l, $f, $v); @@ -534,7 +534,7 @@ sub install open(my $shells, '<', $destdir.'/etc/shells') or return; local $_; while(<$shells>) { - s/^\#.*//; + s/^\#.*//o; return if $_ =~ m/^\Q$fullname\E\s*$/; } close($shells); diff --git a/usr.sbin/pkg_add/OpenBSD/ArcCheck.pm b/usr.sbin/pkg_add/OpenBSD/ArcCheck.pm index 42b64d7fc5f..eddf5c28f11 100644 --- a/usr.sbin/pkg_add/OpenBSD/ArcCheck.pm +++ b/usr.sbin/pkg_add/OpenBSD/ArcCheck.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: ArcCheck.pm,v 1.8 2007/05/25 22:32:47 espie Exp $ +# $OpenBSD: ArcCheck.pm,v 1.9 2007/06/04 14:40:39 espie Exp $ # # Copyright (c) 2005-2006 Marc Espie <espie@openbsd.org> # @@ -29,7 +29,7 @@ sub check_name { my ($self, $item) = @_; return 1 if $self->{name} eq $item->{name}; - if ($self->{name} =~ m/^LongName\d+$/) { + if ($self->{name} =~ m/^LongName\d+$/o) { $self->{name} = $item->{name}; return 1; } @@ -45,7 +45,7 @@ sub check_linkname $c = $self->{cwd}.'/'.$c; } return 1 if $c eq $linkname; - if ($self->{linkname} =~ m/^Long(?:Link|Name)\d+$/) { + if ($self->{linkname} =~ m/^Long(?:Link|Name)\d+$/o) { $self->{linkname} = $linkname; if ($self->isHardLink && defined $self->{cwd}) { $self->{linkname} =~ s|^$self->{cwd}/||; @@ -98,7 +98,7 @@ sub verify_modes sub copy_long { my ($self, $wrarc) = @_; - if ($self->{name} =~ m/^LongName(\d+)$/) { + if ($self->{name} =~ m/^LongName(\d+)$/o) { $wrarc->{name_index} = $1 + 1; } if (length($self->{name}) > MAXFILENAME+MAXPREFIX+1) { diff --git a/usr.sbin/pkg_add/OpenBSD/CollisionReport.pm b/usr.sbin/pkg_add/OpenBSD/CollisionReport.pm index 5b0ae16bebc..e1657d2ee56 100644 --- a/usr.sbin/pkg_add/OpenBSD/CollisionReport.pm +++ b/usr.sbin/pkg_add/OpenBSD/CollisionReport.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: CollisionReport.pm,v 1.12 2007/05/30 12:27:19 espie Exp $ +# $OpenBSD: CollisionReport.pm,v 1.13 2007/06/04 14:40:39 espie Exp $ # # Copyright (c) 2003-2006 Marc Espie <espie@openbsd.org> # @@ -73,10 +73,10 @@ sub collision_report($$) for my $item (sort @{$bypkg->{$pkg}}) { print "\t$item ($pkg)\n"; } - if ($pkg =~ m/^(?:partial\-|borked\.\d+$)/) { + if ($pkg =~ m/^(?:partial\-|borked\.\d+$)/o) { $clueless_bat = $pkg; } - if ($pkg =~ m/^\.libs-*$/) { + if ($pkg =~ m/^\.libs-*$/o) { $clueless_bat2 = $pkg; } } diff --git a/usr.sbin/pkg_add/OpenBSD/Delete.pm b/usr.sbin/pkg_add/OpenBSD/Delete.pm index 2123d65dec6..d5d6d0d9883 100644 --- a/usr.sbin/pkg_add/OpenBSD/Delete.pm +++ b/usr.sbin/pkg_add/OpenBSD/Delete.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Delete.pm,v 1.60 2007/06/04 10:58:23 espie Exp $ +# $OpenBSD: Delete.pm,v 1.61 2007/06/04 14:40:39 espie Exp $ # # Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org> # @@ -35,7 +35,7 @@ sub rename_file_to_temp close $fh; if (rename($n, $j)) { print "Renaming old file $n to $j\n"; - if ($i->{name} !~ m|^/| && $i->cwd ne '.') { + if ($i->{name} !~ m/^\//o && $i->cwd ne '.') { my $c = $i->cwd; $j =~ s|^\Q$c\E/||; } @@ -373,7 +373,7 @@ sub delete } unless (defined($self->{link}) or $self->{nochecksum} or $state->{quick}) { if (!defined $self->{md5}) { - print "Problem: ", $self->fullname(), + print "Problem: ", $self->fullname, " does not have an md5 checksum\n"; print "NOT deleting: $realname\n"; $state->print("Couldn't delete $realname (no md5)\n"); @@ -544,7 +544,7 @@ sub delete local $_; while(<$shells>) { push(@l, $_); - s/^\#.*//; + s/^\#.*//o; if ($_ =~ m/^\Q$fullname\E\s*$/) { pop(@l); } diff --git a/usr.sbin/pkg_add/OpenBSD/Error.pm b/usr.sbin/pkg_add/OpenBSD/Error.pm index be652eb656f..34c523f0f91 100644 --- a/usr.sbin/pkg_add/OpenBSD/Error.pm +++ b/usr.sbin/pkg_add/OpenBSD/Error.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Error.pm,v 1.10 2004/12/12 22:44:51 espie Exp $ +# $OpenBSD: Error.pm,v 1.11 2007/06/04 14:40:39 espie Exp $ # # Copyright (c) 2004 Marc Espie <espie@openbsd.org> # @@ -164,7 +164,7 @@ sub dienow { my ($error, $handler) = @_; if ($error) { - if ($error =~ m/^(Expected:\s+)?(.*?)(?:\s+at\s+(.*)\s+line\s+(\d+)\.?)?$/) { + if ($error =~ m/^(Expected:\s+)?(.*?)(?:\s+at\s+(.*)\s+line\s+(\d+)\.?)?$/o) { local $_ = $2; $FileName = $3; $Line = $4; diff --git a/usr.sbin/pkg_add/OpenBSD/Getopt.pm b/usr.sbin/pkg_add/OpenBSD/Getopt.pm index 2f67f0f64ac..3aabc005bca 100644 --- a/usr.sbin/pkg_add/OpenBSD/Getopt.pm +++ b/usr.sbin/pkg_add/OpenBSD/Getopt.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Getopt.pm,v 1.3 2006/07/31 16:27:21 espie Exp $ +# $OpenBSD: Getopt.pm,v 1.4 2007/06/04 14:40:39 espie Exp $ # # Copyright (c) 2006 Marc Espie <espie@openbsd.org> # @@ -51,8 +51,8 @@ sub getopts($;$) local @EXPORT; while ($_ = shift @ARGV) { - last if /^--$/; - unless (m/^-(.)(.*)/s) { + last if /^--$/o; + unless (m/^-(.)(.*)/so) { unshift @ARGV, $_; last; } diff --git a/usr.sbin/pkg_add/OpenBSD/IdCache.pm b/usr.sbin/pkg_add/OpenBSD/IdCache.pm index 37f0e47cb3f..de19ef6321a 100644 --- a/usr.sbin/pkg_add/OpenBSD/IdCache.pm +++ b/usr.sbin/pkg_add/OpenBSD/IdCache.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: IdCache.pm,v 1.3 2007/04/15 10:17:29 espie Exp $ +# $OpenBSD: IdCache.pm,v 1.4 2007/06/04 14:40:39 espie Exp $ # # Copyright (c) 2002-2005 Marc Espie <espie@openbsd.org> # @@ -50,7 +50,7 @@ sub lookup { my ($self, $name, $default) = @_; - if ($name =~ m/^\d+$/) { + if ($name =~ m/^\d+$/o) { return $name; } else { return $self->SUPER::lookup($name, $default); diff --git a/usr.sbin/pkg_add/OpenBSD/Interactive.pm b/usr.sbin/pkg_add/OpenBSD/Interactive.pm index 64d2f7867b3..301882a99a8 100644 --- a/usr.sbin/pkg_add/OpenBSD/Interactive.pm +++ b/usr.sbin/pkg_add/OpenBSD/Interactive.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Interactive.pm,v 1.8 2007/04/15 17:42:29 espie Exp $ +# $OpenBSD: Interactive.pm,v 1.9 2007/06/04 14:40:39 espie Exp $ # # Copyright (c) 2005-2007 Marc Espie <espie@openbsd.org> # @@ -43,7 +43,7 @@ LOOP: if ($result eq '') { return $values[0]; } - if ($result =~ m/^\d+$/) { + if ($result =~ m/^\d+$/o) { if ($result >= 0 && $result < @values) { return $values[$result]; } @@ -79,7 +79,7 @@ LOOP2: return $default; } chomp $result; - $result =~ s/\s+//g; + $result =~ s/\s+//go; $result =~ tr/A-Z/a-z/; if ($result eq 'yes' or $result eq 'y') { return 1; diff --git a/usr.sbin/pkg_add/OpenBSD/Mtree.pm b/usr.sbin/pkg_add/OpenBSD/Mtree.pm index c20706dba0a..1b4607122e9 100644 --- a/usr.sbin/pkg_add/OpenBSD/Mtree.pm +++ b/usr.sbin/pkg_add/OpenBSD/Mtree.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Mtree.pm,v 1.3 2007/04/15 10:17:29 espie Exp $ +# $OpenBSD: Mtree.pm,v 1.4 2007/06/04 14:40:39 espie Exp $ # # Copyright (c) 2004-2005 Marc Espie <espie@openbsd.org> # @@ -29,18 +29,18 @@ sub parse_fh local $_; while(<$fh>) { chomp; - s/^\s*//; - next if /^\#/ || /^\//; - s/\s.*$//; - next if /^$/; + s/^\s*//o; + next if /^\#/o || /^\//o; + s/\s.*$//o; + next if /^$/o; if ($_ eq '..') { - $basedir =~ s|/[^/]*$||; + $basedir =~ s|/[^/]*$||o; next; } else { $basedir.="/$_"; } $_ = $basedir; - while (s|/\./|/|) {} + while (s|/\./|/|o) {} $mtree->{File::Spec->canonpath($_)} = 1; } } diff --git a/usr.sbin/pkg_add/OpenBSD/PackageInfo.pm b/usr.sbin/pkg_add/OpenBSD/PackageInfo.pm index 5525a9cda66..068f5f6ee9c 100644 --- a/usr.sbin/pkg_add/OpenBSD/PackageInfo.pm +++ b/usr.sbin/pkg_add/OpenBSD/PackageInfo.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: PackageInfo.pm,v 1.32 2007/06/01 14:58:29 espie Exp $ +# $OpenBSD: PackageInfo.pm,v 1.33 2007/06/04 14:40:39 espie Exp $ # # Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org> # @@ -48,7 +48,7 @@ our @info = (CONTENTS, COMMENT, DESC, REQUIRE, INSTALL, DEINSTALL, REQUIRED_BY, our %info = (); for my $i (@info) { my $j = $i; - $j =~ s/\+/F/; + $j =~ s/\+/F/o; $info{$i} = $j; } @@ -93,35 +93,36 @@ sub installed_stems return $stemlist; } -sub installed_packages(;$) +sub installed_packages { if (!defined $list) { _init_list(); } if ($_[0]) { - return grep { !/^\./ } keys %$list; + return grep { !/^\./o } keys %$list; } else { return keys %$list; } } -sub installed_info($) +sub installed_info { my $name = shift; - if ($name =~ m|^\Q$pkg_db\E/?|) { + # XXX remove the o if we allow pkg_db to change dynamically + if ($name =~ m|^\Q$pkg_db\E/?|o) { return "$name/"; } else { return "$pkg_db/$name/"; } } -sub installed_contents($) +sub installed_contents { return installed_info(shift).CONTENTS; } -sub borked_package($) +sub borked_package { my $pkgname = $_[0]; unless (-e "$pkg_db/partial-$pkgname") { @@ -135,7 +136,7 @@ sub borked_package($) return "partial-$pkgname.$i"; } -sub is_installed($) +sub is_installed { my $name = installed_name(shift); if (!defined $list) { @@ -144,12 +145,13 @@ sub is_installed($) return defined $list->{$name}; } -sub installed_name($) +sub installed_name { my $name = shift; - $name =~ s|/$||; - $name =~ s|^\Q$pkg_db\E/?||; - $name =~ s|/\+CONTENTS$||; + $name =~ s|/$||o; + # XXX remove the o if we allow pkg_db to change dynamically + $name =~ s|^\Q$pkg_db\E/?||o; + $name =~ s|/\+CONTENTS$||o; return $name; } @@ -158,7 +160,7 @@ sub info_names() return @info; } -sub is_info_name($) +sub is_info_name { my $name = shift; return $info{$name}; @@ -198,7 +200,7 @@ sub solve_installed_names my $seen = {}; for my $pkgname (@$old) { - $pkgname =~ s/\.tgz$//; + $pkgname =~ s/\.tgz$//o; if (is_installed($pkgname)) { if (!$seen->{$pkgname}) { $seen->{$pkgname} = 1; diff --git a/usr.sbin/pkg_add/OpenBSD/PackageLocation.pm b/usr.sbin/pkg_add/OpenBSD/PackageLocation.pm index ba757e836dd..5792fc6c7b3 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.11 2007/05/17 18:52:58 espie Exp $ +# $OpenBSD: PackageLocation.pm,v 1.12 2007/06/04 14:40:39 espie Exp $ # # Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org> # @@ -28,7 +28,7 @@ sub new my ($class, $repository, $name, $arch) = @_; if (defined $name) { - $name =~ s/\.tgz$//; + $name =~ s/\.tgz$//o; } my $self = { repository => $repository, name => $name, arch => $arch}; bless $self, $class; @@ -82,15 +82,15 @@ sub grabInfoFiles while (my $e = $self->intNext) { if ($e->isFile && is_info_name($e->{name})) { $e->{name}=$dir.$e->{name}; - eval { $e->create(); }; + eval { $e->create; }; if ($@) { unlink($e->{name}); - $@ =~ s/\s+at.*//; + $@ =~ s/\s+at.*//o; print STDERR $@; return 0; } } else { - $self->unput(); + $self->unput; last; } } @@ -103,7 +103,7 @@ sub scanPackage while (my $e = $self->intNext) { if ($e->isFile && is_info_name($e->{name})) { if ($e->{name} eq CONTENTS && !defined $self->{dir}) { - $self->{contents} = $e->contents(); + $self->{contents} = $e->contents; last; } if (!defined $self->{dir}) { @@ -113,7 +113,7 @@ sub scanPackage eval { $e->create; }; if ($@) { unlink($e->{name}); - $@ =~ s/\s+at.*//; + $@ =~ s/\s+at.*//o; print STDERR $@; return 0; } @@ -155,7 +155,7 @@ sub openPackage # maybe it's a fat package. while (my $e = $self->intNext) { - unless ($e->{name} =~ m/\/\+CONTENTS$/) { + unless ($e->{name} =~ m/\/\+CONTENTS$/o) { last; } my $prefix = $`; @@ -324,14 +324,14 @@ sub getNext my $self = shift; my $e = $self->SUPER::getNext; - if ($e->{name} =~ m/^(.*?)\/(.*)$/) { + if ($e->{name} =~ m/^(.*?)\/(.*)$/o) { my ($beg, $name) = ($1, $2); if (index($beg, $self->{filter}) == -1) { return $self->next; } $e->{name} = $name; if ($e->isHardLink) { - $e->{linkname} =~ s/^(.*?)\///; + $e->{linkname} =~ s/^(.*?)\///o; } } return $e; diff --git a/usr.sbin/pkg_add/OpenBSD/PackageLocator.pm b/usr.sbin/pkg_add/OpenBSD/PackageLocator.pm index eb8496167c3..79a9e2c6944 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.71 2007/05/19 09:45:33 espie Exp $ +# $OpenBSD: PackageLocator.pm,v 1.72 2007/06/04 14:40:39 espie Exp $ # # Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org> # @@ -31,11 +31,11 @@ my $pkgpath = OpenBSD::PackageRepositoryList->new; if (defined $ENV{PKG_PATH}) { my $v = $ENV{PKG_PATH}; - $v =~ s/^\:+//; - $v =~ s/\:+$//; - my @tentative = split /\/\:/, $v; + $v =~ s/^\:+//o; + $v =~ s/\:+$//o; + my @tentative = split '/:', $v; while (my $i = shift @tentative) { - $i =~ m|/$| or $i.='/'; + $i =~ m|/$|o or $i.='/'; $pkgpath->add(OpenBSD::PackageRepository->new($i)); } } else { @@ -66,7 +66,7 @@ sub find return $packages{$_}; } my $package; - if (m/\//) { + if (m/\//o) { my ($repository, undef, $pkgname) = path_parse($_); $package = $repository->find($pkgname, $arch); if (defined $package) { @@ -92,7 +92,7 @@ sub grabPlist return $plist; } my $plist; - if (m/\//) { + if (m/\//o) { my ($repository, undef, $pkgname) = path_parse($_); $plist = $repository->grabPlist($pkgname, $arch, $code); if (defined $plist) { diff --git a/usr.sbin/pkg_add/OpenBSD/PackageName.pm b/usr.sbin/pkg_add/OpenBSD/PackageName.pm index d588375c250..711f20abd81 100644 --- a/usr.sbin/pkg_add/OpenBSD/PackageName.pm +++ b/usr.sbin/pkg_add/OpenBSD/PackageName.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: PackageName.pm,v 1.27 2007/05/17 12:07:46 espie Exp $ +# $OpenBSD: PackageName.pm,v 1.28 2007/06/04 14:40:39 espie Exp $ # # Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org> # @@ -32,10 +32,10 @@ sub url2pkgname($) sub splitname { local $_ = shift; - if (/\-(?=\d)/) { + if (/\-(?=\d)/o) { my $stem = $`; my $rest = $'; - my @all = split /\-/, $rest; + my @all = split '-', $rest; return ($stem, @all); } else { return ($_); @@ -46,10 +46,10 @@ sub from_string { my $class = shift; local $_ = shift; - if (/\-(?=\d)/) { + if (/\-(?=\d)/o) { my $stem = $`; my $rest = $'; - my @all = split /\-/, $rest; + my @all = split '-', $rest; my $version = OpenBSD::PackageName::version->from_string(shift @all); my %flavors = map {($_,1)} @all; return bless { @@ -67,7 +67,7 @@ sub from_string sub splitstem { local $_ = shift; - if (/\-(?=\d)/) { + if (/\-(?=\d)/o) { return $`; } else { return $_; @@ -77,7 +77,7 @@ sub splitstem sub is_stem { local $_ = shift; - if (m/\-\d/ || $_ eq '-') { + if (m/\-\d/o || $_ eq '-') { return 0; } else { return 1; @@ -88,7 +88,7 @@ sub splitp { local $_ = shift; - if (/^(.*\-\d[^-]*)p(\d+)/) { + if (/^(.*\-\d[^-]*)p(\d+)/o) { return ($1.$', $2); } else { return ($_,-1); @@ -101,7 +101,7 @@ sub rebuildp if ($p == -1) { return $pkg; } - if ($pkg =~ m/\-\d[^-]*/) { + if ($pkg =~ m/\-\d[^-]*/o) { return "$`$&p$p$'"; } else { return $pkg."p".$p; @@ -187,7 +187,7 @@ package OpenBSD::PackageName::version; sub make_dewey { my $o = shift; - $o->{deweys} = [ split(/\./, $o->{string}) ]; + $o->{deweys} = [ split('.', $o->{string}) ]; for my $suffix (qw(rc beta pre pl)) { if ($o->{deweys}->[-1] =~ m/^(\d+)$suffix(\d*)$/) { $o->{deweys}->[-1] = $1; @@ -201,11 +201,11 @@ sub from_string my ($class, $string) = @_; my $vnum = -1; my $pnum = -1; - if ($string =~ m/v(\d+)$/) { + if ($string =~ m/v(\d+)$/o) { $vnum = $1; $string = $`; } - if ($string =~ m/p(\d+)$/) { + if ($string =~ m/p(\d+)$/o) { $pnum = $1; $string = $`; } @@ -281,11 +281,11 @@ sub dewey_compare { my ($a, $b) = @_; # numerical comparison - if ($a =~ m/^\d+$/ and $b =~ m/^\d+$/) { + if ($a =~ m/^\d+$/o and $b =~ m/^\d+$/o) { return $a <=> $b; } # added lowercase letter - if ("$a.$b" =~ m/^(\d+)([a-z]?)\.(\d+)([a-z]?)$/) { + if ("$a.$b" =~ m/^(\d+)([a-z]?)\.(\d+)([a-z]?)$/o) { my ($an, $al, $bn, $bl) = ($1, $2, $3, $4); if ($an != $bn) { return $an <=> $bn; diff --git a/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm b/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm index e06d82521d6..06506a5be69 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.39 2007/05/30 11:04:31 espie Exp $ +# $OpenBSD: PackageRepository.pm,v 1.40 2007/06/04 14:40:39 espie Exp $ # # Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org> # @@ -38,21 +38,21 @@ sub _new sub new { my ($class, $baseurl) = @_; - if ($baseurl =~ m/^ftp\:/i) { + if ($baseurl =~ m/^ftp\:/io) { return OpenBSD::PackageRepository::FTP->_new($'); - } elsif ($baseurl =~ m/^http\:/i) { + } elsif ($baseurl =~ m/^http\:/io) { return OpenBSD::PackageRepository::HTTP->_new($'); - } elsif ($baseurl =~ m/^scp\:/i) { + } elsif ($baseurl =~ m/^scp\:/io) { require OpenBSD::PackageRepository::SCP; return OpenBSD::PackageRepository::SCP->_new($'); - } elsif ($baseurl =~ m/^src\:/i) { + } elsif ($baseurl =~ m/^src\:/io) { require OpenBSD::PackageRepository::Source; return OpenBSD::PackageRepository::Source->_new($'); - } elsif ($baseurl =~ m/^file\:/i) { + } elsif ($baseurl =~ m/^file\:/io) { return OpenBSD::PackageRepository::Local->_new($'); - } elsif ($baseurl =~ m/^inst\:/i) { + } elsif ($baseurl =~ m/^inst\:/io) { return OpenBSD::PackageRepository::Installed->_new($'); } else { return OpenBSD::PackageRepository::Local->_new($baseurl); @@ -114,7 +114,7 @@ sub close $self->parse_problems($object->{errors}, $hint) if defined $object->{errors}; undef $object->{errors}; - $object->deref(); + $object->deref; } sub make_room @@ -236,7 +236,7 @@ sub list my $dname = $self->{baseurl}; opendir(my $dir, $dname) or return $l; while (my $e = readdir $dir) { - next unless $e =~ m/\.tgz$/; + next unless $e =~ m/\.tgz$/o; next unless -f "$dname/$e"; push(@$l, $`); } @@ -473,7 +473,7 @@ sub _new { my ($class, $baseurl) = @_; my $distant_host; - if ($baseurl =~ m/^\/\/(.*?)\//i) { + if ($baseurl =~ m/^\/\/(.*?)\//io) { $distant_host = $&; } bless { baseurl => $baseurl, key => $distant_host }, $class; @@ -536,33 +536,33 @@ sub parse_problems local $_; my $notyet = 1; while(<$fh>) { - next if m/^(?:200|220|221|226|229|230|227|250|331|500|150)[\s\-]/; - next if m/^EPSV command not understood/; - next if m/^Trying [\da-f\.\:]+\.\.\./; + next if m/^(?:200|220|221|226|229|230|227|250|331|500|150)[\s\-]/o; + next if m/^EPSV command not understood/o; + next if m/^Trying [\da-f\.\:]+\.\.\./o; next if m/^Requesting \Q$baseurl\E/; - next if m/^Remote system type is\s+/; - next if m/^Connected to\s+/; - next if m/^remote\:\s+/; - next if m/^Using binary mode to transfer files/; - next if m/^Retrieving\s+/; - next if m/^Success?fully retrieved file/; - next if m/^\d+\s+bytes\s+received\s+in/; - next if m/^ftp: connect to address.*: No route to host/; + next if m/^Remote system type is\s+/o; + next if m/^Connected to\s+/o; + next if m/^remote\:\s+/o; + next if m/^Using binary mode to transfer files/o; + next if m/^Retrieving\s+/o; + next if m/^Success?fully retrieved file/o; + next if m/^\d+\s+bytes\s+received\s+in/o; + next if m/^ftp: connect to address.*: No route to host/o; if (defined $hint && $hint == 0) { - next if m/^ftp: -: short write/; - next if m/^421\s+/; + next if m/^ftp: -: short write/o; + next if m/^421\s+/o; } if ($notyet) { print STDERR "Error from $baseurl:\n" if $notyet; $notyet = 0; } - if (m/^421\s+/ || - m/^ftp: connect: Connection timed out/ || - m/^ftp: Can't connect or login to host/) { + if (m/^421\s+/o || + m/^ftp: connect: Connection timed out/o || + m/^ftp: Can't connect or login to host/o) { $self->{lasterror} = 421; } - if (m/^550\s+/) { + if (m/^550\s+/o) { $self->{lasterror} = 550; } print STDERR $_; @@ -593,7 +593,7 @@ sub list # XXX assumes a pkg HREF won't cross a line. Is this the case ? while(<$fh>) { chomp; - for my $pkg (m/\<A\s+HREF=\"(.*?)\.tgz\"\>/gi) { + for my $pkg (m/\<A\s+HREF=\"(.*?)\.tgz\"\>/gio) { next if $pkg =~ m|/|; push(@$l, $pkg); } diff --git a/usr.sbin/pkg_add/OpenBSD/PackageRepository/SCP.pm b/usr.sbin/pkg_add/OpenBSD/PackageRepository/SCP.pm index f373994b931..aa2190c3464 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.13 2007/05/19 09:44:28 espie Exp $ +# $OpenBSD: SCP.pm,v 1.14 2007/06/04 14:40:39 espie Exp $ # # Copyright (c) 2003-2006 Marc Espie <espie@openbsd.org> # @@ -47,9 +47,9 @@ sub initiate while(<DATA>) { # compress script a bit - next if m/^\#/ && !m/^\#!/; - s/^\s*//; - next if m/^$/; + next if m/^\#/o && !m/^\#!/o; + s/^\s*//o; + next if m/^$/o; print $wrfh $_; } } @@ -58,7 +58,7 @@ sub initiate sub may_exist { my ($self, $name) = @_; - my $l = $self->list(); + my $l = $self->list; return grep {$_ eq $name } @$l; } @@ -72,16 +72,16 @@ sub grab_object print $cmdfh "ABORT\n"; local $_; while (<$getfh>) { - last if m/^ABORTED/; + last if m/^ABORTED/o; } print $cmdfh "GET ", $self->{path}.$object->{name}.".tgz", "\n"; close($cmdfh); $_ = <$getfh>; chomp; - if (m/^ERROR:/) { + if (m/^ERROR:/o) { die "transfer error: $_"; } - if (m/^TRANSFER:\s+(\d+)/) { + if (m/^TRANSFER:\s+(\d+)/o) { my $buffsize = 10 * 1024; my $buffer; my $size = $1; @@ -106,7 +106,7 @@ sub grab_object sub _new { my ($class, $baseurl) = @_; - if ($baseurl =~ m/^\/\/(.*?)(\/.*)$/) { + if ($baseurl =~ m/^\/\/(.*?)(\/.*)$/o) { bless { host => $1, baseurl => $baseurl, key => $1, path => $2 }, $class; } else { @@ -134,7 +134,7 @@ sub list my ($self) = @_; if (!defined $self->{list}) { if (!defined $self->{controller}) { - $self->initiate(); + $self->initiate; } my $cmdfh = $self->{cmdfh}; my $getfh = $self->{getfh}; @@ -147,10 +147,10 @@ sub list die "Could not initiate SSH session\n"; } chomp; - if (m/^ERROR:/) { + if (m/^ERROR:/o) { die $_; } - if (!m/^SUCCESS:/) { + if (!m/^SUCCESS:/o) { die "Synchronization error\n"; } while (<$getfh>) { @@ -217,7 +217,7 @@ sub abort_batch() local $_; while (<STDIN>) { chomp; - if (m/^LIST\s+/) { + if (m/^LIST\s+/o) { my $dname = $'; batch(sub { my $d; @@ -235,7 +235,7 @@ while (<STDIN>) { print "\n"; closedir($d); }); - } elsif (m/^GET\s+/) { + } elsif (m/^GET\s+/o) { my $fname = $'; batch(sub { if (open(my $fh, '<', $fname)) { @@ -250,9 +250,9 @@ while (<STDIN>) { print "ERROR: bad file $fname $!\n"; } }); - } elsif (m/^BYE$/) { + } elsif (m/^BYE$/o) { exit(0); - } elsif (m/^ABORT$/) { + } elsif (m/^ABORT$/o) { abort_batch(); } else { print "ERROR: Unknown command\n"; diff --git a/usr.sbin/pkg_add/OpenBSD/PackageRepository/Source.pm b/usr.sbin/pkg_add/OpenBSD/PackageRepository/Source.pm index 332d91e8850..975294d67a3 100644 --- a/usr.sbin/pkg_add/OpenBSD/PackageRepository/Source.pm +++ b/usr.sbin/pkg_add/OpenBSD/PackageRepository/Source.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Source.pm,v 1.4 2007/05/18 13:22:06 espie Exp $ +# $OpenBSD: Source.pm,v 1.5 2007/06/04 14:40:39 espie Exp $ # # Copyright (c) 2003-2006 Marc Espie <espie@openbsd.org> # @@ -63,7 +63,7 @@ sub build_package if (! -f $pkgfile) { return undef; } - $pkgfile =~ m|(.*/)([^/]*)|; + $pkgfile =~ m|(.*/)([^/]*)|o; my ($base, $fname) = ($1, $2); my $repo = OpenBSD::PackageRepository::Local->_new($base); diff --git a/usr.sbin/pkg_add/OpenBSD/PackingElement.pm b/usr.sbin/pkg_add/OpenBSD/PackingElement.pm index 50cb56cb0f1..91e88952ad8 100644 --- a/usr.sbin/pkg_add/OpenBSD/PackingElement.pm +++ b/usr.sbin/pkg_add/OpenBSD/PackingElement.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: PackingElement.pm,v 1.126 2007/06/02 12:44:37 espie Exp $ +# $OpenBSD: PackingElement.pm,v 1.127 2007/06/04 14:40:39 espie Exp $ # # Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org> # @@ -174,7 +174,7 @@ sub fullname { my $self = $_[0]; my $fullname = $self->{name}; - if ($fullname !~ m|^/| && $self->cwd ne '.') { + if ($fullname !~ m|^/|o && $self->cwd ne '.') { $fullname = $self->cwd."/".$fullname; } return $fullname; @@ -205,7 +205,7 @@ sub dirclass() { undef } sub new { my ($class, $args) = @_; - if ($args =~ m|/+$| and defined $class->dirclass) { + if ($args =~ m|/+$|o and defined $class->dirclass) { bless { name => $` }, $class->dirclass; } else { bless { name => $args }, $class; @@ -432,7 +432,7 @@ sub register_manpage sub is_source { my $self = shift; - return $self->{name} =~ m/man\/man[^\/]+\/[^\/]+\.[\dln][^\/]?$/; + return $self->{name} =~ m/man\/man[^\/]+\/[^\/]+\.[\dln][^\/]?$/o; } sub source_to_dest @@ -453,9 +453,9 @@ sub format close $fh; my @extra = (); # extra preprocessors as described in man. - if ($line =~ m/^\'\\\"\s+(.*)$/) { + if ($line =~ m/^\'\\\"\s+(.*)$/o) { for my $letter (split $1) { - if ($letter =~ m/[ept]/) { + if ($letter =~ m/[ept]/o) { push(@extra, "-$letter"); } elsif ($letter eq 'r') { push(@extra, "-R"); @@ -527,12 +527,12 @@ sub add { my ($class, $plist, $args) = @_; - if ($args =~ m/^\$OpenBSD.*\$\s*$/) { + if ($args =~ m/^\$OpenBSD.*\$\s*$/o) { return OpenBSD::PackingElement::CVSTag->add($plist, $args); - } elsif ($args =~ m/^MD5:\s*/) { + } elsif ($args =~ m/^MD5:\s*/o) { $plist->{state}->{lastfile}->add_md5(pack('H*', $')); return; - } elsif ($args =~ m/^subdir\=(.*?)\s+cdrom\=(.*?)\s+ftp\=(.*?)\s*$/) { + } elsif ($args =~ m/^subdir\=(.*?)\s+cdrom\=(.*?)\s+ftp\=(.*?)\s*$/o) { return OpenBSD::PackingElement::ExtraInfo->add($plist, $1, $2, $3); } elsif ($args eq 'no checksum') { $plist->{state}->{nochecksum} = 1; @@ -729,7 +729,7 @@ sub category() { "depend" } sub new { my ($class, $args) = @_; - my ($pkgpath, $pattern, $def) = split /\:/, $args; + my ($pkgpath, $pattern, $def) = split ':', $args; bless { name => $def, pkgpath => $pkgpath, pattern => $pattern, def => $def }, $class; } @@ -794,7 +794,7 @@ sub new { my ($class, $args) = @_; my ($name, $uid, $group, $loginclass, $comment, $home, $shell) = - split /\:/, $args; + split ':', $args; bless { name => $name, uid => $uid, group => $group, class => $loginclass, comment => $comment, home => $home, shell => $shell }, $class; @@ -806,27 +806,27 @@ sub check my ($name, $passwd, $uid, $gid, $quota, $class, $gcos, $dir, $shell, $expire) = getpwnam($self->{name}); return unless defined $name; - if ($self->{uid} =~ m/^\!/) { + if ($self->{uid} =~ m/^\!/o) { return 0 unless $uid == $'; } - if ($self->{group} =~ m/^\!/) { + if ($self->{group} =~ m/^\!/o) { my $g = $'; - unless ($g =~ m/^\d+/) { + unless ($g =~ m/^\d+/o) { $g = getgrnam($g); return 0 unless defined $g; } return 0 unless $gid eq $g; } - if ($self->{class} =~ m/^\!/) { + if ($self->{class} =~ m/^\!/o) { return 0 unless $class eq $'; } - if ($self->{comment} =~ m/^\!/) { + if ($self->{comment} =~ m/^\!/o) { return 0 unless $gcos eq $'; } - if ($self->{home} =~ m/^\!/) { + if ($self->{home} =~ m/^\!/o) { return 0 unless $dir eq $'; } - if ($self->{shell} =~ m/^\!/) { + if ($self->{shell} =~ m/^\!/o) { return 0 unless $shell eq $'; } return 1; @@ -852,7 +852,7 @@ __PACKAGE__->register_with_factory; sub new { my ($class, $args) = @_; - my ($name, $gid) = split /\:/, $args; + my ($name, $gid) = split ':', $args; bless { name => $name, gid => $gid }, $class; } @@ -861,7 +861,7 @@ sub check my $self = shift; my ($name, $passwd, $gid, $members) = getgrnam($self->{name}); return unless defined $name; - if ($self->{gid} =~ m/^\!/) { + if ($self->{gid} =~ m/^\!/o) { return 0 unless $gid == $'; } return 1; @@ -963,7 +963,7 @@ sub new { my ($class, $args) = @_; - if ($args =~ m/^\s*(.*)\s*(\=|\>=)\s*(.*)\s*$/) { + if ($args =~ m/^\s*(.*)\s*(\=|\>=)\s*(.*)\s*$/o) { bless { name => $1, mode => $2, value => $3}, $class; } else { die "Bad syntax for \@sysctl"; @@ -985,21 +985,21 @@ sub expand { my $state = $_[2]; local $_ = $_[1]; - if (m/\%F/) { + if (m/\%F/o) { die "Bad expand" unless defined $state->{lastfile}; s/\%F/$state->{lastfile}->{name}/g; } - if (m/\%D/) { + if (m/\%D/o) { die "Bad expand" unless defined $state->{cwd}; - s/\%D/$state->cwd()/ge; + s/\%D/$state->cwd/ge; } - if (m/\%B/) { + if (m/\%B/o) { die "Bad expand" unless defined $state->{lastfile}; - s/\%B/dirname($state->{lastfile}->fullname())/ge; + s/\%B/dirname($state->{lastfile}->fullname)/ge; } - if (m/\%f/) { + if (m/\%f/o) { die "Bad expand" unless defined $state->{lastfile}; - s/\%f/basename($state->{lastfile}->fullname())/ge; + s/\%f/basename($state->{lastfile}->fullname)/ge; } return $_; } @@ -1065,7 +1065,7 @@ sub destate sub needs_keyword { my $self = shift; - return $self->stringize =~ m/\^@/; + return $self->stringize =~ m/\^@/o; } package OpenBSD::PackingElement::Infodir; @@ -1316,8 +1316,8 @@ sub prepare my $fname = $self->fullname; open(my $src, '<', $fname) or Warn "Can't open $fname: $!"; while (<$src>) { - next if m/^\+\-+\s*$/; - s/^[+-] //; + next if m/^\+\-+\s*$/o; + s/^[+-] //o; $state->print($_); } } @@ -1344,14 +1344,14 @@ __PACKAGE__->register_with_factory; sub new { my ($class, $args) = @_; - my @arches= split(/\,/, $args); + my @arches= split(',', $args); bless { arches => \@arches }, $class; } sub stringize($) { my $self = $_[0]; - return join(',',@{$self->{arches}}); + return join(',', @{$self->{arches}}); } sub check diff --git a/usr.sbin/pkg_add/OpenBSD/PackingList.pm b/usr.sbin/pkg_add/OpenBSD/PackingList.pm index 98aece3e393..57702e4043f 100644 --- a/usr.sbin/pkg_add/OpenBSD/PackingList.pm +++ b/usr.sbin/pkg_add/OpenBSD/PackingList.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: PackingList.pm,v 1.75 2007/06/01 20:39:41 espie Exp $ +# $OpenBSD: PackingList.pm,v 1.76 2007/06/04 14:40:39 espie Exp $ # # Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org> # @@ -62,7 +62,7 @@ sub new sub set_infodir { my ($self, $dir) = @_; - $dir .= '/' unless $dir =~ m/\/$/; + $dir .= '/' unless $dir =~ m/\/$/o; ${$self->{infodir}} = $dir; } @@ -252,16 +252,16 @@ sub SharedStuffOnly local $_; MAINLOOP: while (<$fh>) { - if (m/^\@shared\b/) { + if (m/^\@shared\b/o) { &$cont($_); while(<$fh>) { - redo MAINLOOP unless m/^\@(?:md5|size|symlink|link)\b/; - m/^\@size\b/ || m/^\@symlink\b/ || - m/^\@link\b/; + redo MAINLOOP unless m/^\@(?:md5|size|symlink|link)\b/o; + m/^\@size\b/o || m/^\@symlink\b/o || + m/^\@link\b/o; &$cont($_); } } else { - next unless m/^\@(?:cwd|name)\b/; + next unless m/^\@(?:cwd|name)\b/o; } &$cont($_); } @@ -277,7 +277,7 @@ sub fromfile }; if ($@) { chomp $@; - $@ =~ s/\.$/,/; + $@ =~ s/\.$/,/o; die "$@ in $fname, "; } close($fh); @@ -465,7 +465,7 @@ sub AUTOLOAD { our $AUTOLOAD; my $fullsub = $AUTOLOAD; - (my $sub = $fullsub) =~ s/.*:://; + (my $sub = $fullsub) =~ s/.*:://o; return if $sub eq 'DESTROY'; # special case # verify it makes sense if (OpenBSD::PackingElement->can($sub)) { diff --git a/usr.sbin/pkg_add/OpenBSD/PkgSpec.pm b/usr.sbin/pkg_add/OpenBSD/PkgSpec.pm index 08ef81afbf6..ae9271c3713 100644 --- a/usr.sbin/pkg_add/OpenBSD/PkgSpec.pm +++ b/usr.sbin/pkg_add/OpenBSD/PkgSpec.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: PkgSpec.pm,v 1.12 2007/05/14 11:02:15 espie Exp $ +# $OpenBSD: PkgSpec.pm,v 1.13 2007/06/04 14:40:39 espie Exp $ # # Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org> # @@ -26,11 +26,11 @@ sub compare_pseudo_numbers my ($n1, $m1); - if ($n =~ m/^\d+/) { + if ($n =~ m/^\d+/o) { $n1 = $&; $n = $'; } - if ($m =~ m/^\d+/) { + if ($m =~ m/^\d+/o) { $m1 = $&; $m = $'; } @@ -48,22 +48,22 @@ sub dewey_compare my ($a, $b) = @_; my ($pa, $pb); - unless ($b =~ m/p\d+$/) { # does the Dewey hold a p<number> ? - $a =~ s/p\d+$//; # No -> strip it from version. + unless ($b =~ m/p\d+$/o) { # does the Dewey hold a p<number> ? + $a =~ s/p\d+$//o; # No -> strip it from version. } return 0 if $a =~ /^$b$/; # bare equality - if ($a =~ s/p(\d+)$//) { # extract patchlevels + if ($a =~ s/p(\d+)$//o) { # extract patchlevels $pa = $1; } - if ($b =~ s/p(\d+)$//) { + if ($b =~ s/p(\d+)$//o) { $pb = $1; } - my @a = split(/\./, $a); + my @a = split('.', $a); push @a, $pa if defined $pa; # ... and restore them - my @b = split(/\\\./, $b); + my @b = split("\\.", $b); push @b, $pb if defined $pb; while (@a > 0 && @b > 0) { my $va = shift @a; @@ -86,16 +86,16 @@ sub check_version # any version spec return 1 if $spec eq '.*'; - my @specs = split(/,/, $spec); - for (grep /^\d/, @specs) { # exact number: check match + my @specs = split(',', $spec); + for (grep /^\d/o, @specs) { # exact number: check match return 1 if $v =~ /^$_$/; return 1 if $v =~ /^${_}p\d+$/; # allows for recent patches } # Last chance: dewey specs ? - my @deweys = grep !/^\d/, @specs; + my @deweys = grep !/^\d/o, @specs; for (@deweys) { - if (m/^\<\=|\>\=|\<|\>/) { + if (m/^\<\=|\>\=|\<|\>/o) { my ($op, $dewey) = ($&, $'); my $compare = dewey_compare($v, $dewey); return 0 if $op eq '<' && $compare >= 0; @@ -114,9 +114,9 @@ sub check_1flavor my ($f, $spec) = @_; local $_; - for (split /-/, $spec) { + for (split '-', $spec) { # must not be here - if (m/^\!/) { + if (m/^\!/o) { return 0 if $f->{$'}; # must be here } else { @@ -133,12 +133,12 @@ sub check_flavor # no flavor constraints return 1 if $spec eq ''; - $spec =~ s/^-//; + $spec =~ s/^-//o; # retrieve all flavors - my %f = map +($_, 1), split /\-/, $f; + my %f = map +($_, 1), split '-', $f; # check each flavor constraint - for (split /,/, $spec) { + for (split ',', $spec) { if (check_1flavor(\%f, $_)) { return 1; } @@ -160,24 +160,24 @@ sub subpattern_match # the only constraint is that the actual number # - must start with a digit, # - not contain - or , - if ($p =~ m/\-((?:\>|\>\=|\<|\<\=)?\d[^-]*)/) { + if ($p =~ m/\-((?:\>|\>\=|\<|\<\=)?\d[^-]*)/o) { ($stemspec, $vspec, $flavorspec) = ($`, $1, $'); # `any version' matcher - } elsif ($p =~ m/\-\*/) { + } elsif ($p =~ m/\-\*/o) { ($stemspec, $vspec, $flavorspec) = ($`, '*', $'); # okay, so no version marker. Assume no flavor spec. } else { ($stemspec, $vspec, $flavorspec) = ($p, '', ''); } - $stemspec =~ s/\./\\\./g; - $stemspec =~ s/\+/\\\+/g; - $stemspec =~ s/\*/\.\*/g; - $stemspec =~ s/\?/\./g; - $vspec =~ s/\./\\\./g; - $vspec =~ s/\+/\\\+/g; - $vspec =~ s/\*/\.\*/g; - $vspec =~ s/\?/\./g; + $stemspec =~ s/\./\\\./go; + $stemspec =~ s/\+/\\\+/go; + $stemspec =~ s/\*/\.\*/go; + $stemspec =~ s/\?/\./go; + $vspec =~ s/\./\\\./go; + $vspec =~ s/\+/\\\+/go; + $vspec =~ s/\*/\.\*/go; + $vspec =~ s/\?/\./go; $p = $stemspec; $p.="-.*" if $vspec ne ''; @@ -189,7 +189,7 @@ sub subpattern_match # Now, have to extract the version number, and the flavor... for (@l) { my ($stem, $v, $flavor); - if (m/\-(\d[^-]*)/) { + if (m/\-(\d[^-]*)/o) { ($stem, $v, $flavor) = ($`, $1, $'); if ($stem =~ m/^$stemspec$/ && check_version($v, $vspec) && diff --git a/usr.sbin/pkg_add/OpenBSD/Replace.pm b/usr.sbin/pkg_add/OpenBSD/Replace.pm index 1991c8bef1b..da572cfefff 100644 --- a/usr.sbin/pkg_add/OpenBSD/Replace.pm +++ b/usr.sbin/pkg_add/OpenBSD/Replace.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Replace.pm,v 1.30 2007/06/01 22:35:46 espie Exp $ +# $OpenBSD: Replace.pm,v 1.31 2007/06/04 14:40:39 espie Exp $ # # Copyright (c) 2004-2006 Marc Espie <espie@openbsd.org> # @@ -199,7 +199,7 @@ sub mark_lib { my ($self, $libs, $libpatterns) = @_; my $libname = $self->fullname; - if ($libname =~ m/^(.*\.so\.)(\d+)\.(\d+)$/) { + if ($libname =~ m/^(.*\.so\.)(\d+)\.(\d+)$/o) { $libpatterns->{$1} = [$2, $3, $libname]; } $libs->{$libname} = 1; @@ -209,7 +209,7 @@ sub unmark_lib { my ($self, $libs, $libpatterns) = @_; my $libname = $self->fullname; - if ($libname =~ m/^(.*\.so\.)(\d+)\.(\d+)$/) { + if ($libname =~ m/^(.*\.so\.)(\d+)\.(\d+)$/o) { my ($pat, $major, $minor) = ($1, $2, $3); my $p = $libpatterns->{$pat}; if (defined $p && $p->[0] == $major && $p->[1] <= $minor) { @@ -325,7 +325,7 @@ sub split_libs $splitted->set_pkgname(".libs-".$plist->pkgname); if (defined $plist->{conflict}) { for my $item (@{$plist->{conflict}}) { - $item->clone()->add_object($splitted); + $item->clone->add_object($splitted); } } if (defined $plist->{'no-default-conflict'}) { diff --git a/usr.sbin/pkg_add/OpenBSD/RequiredBy.pm b/usr.sbin/pkg_add/OpenBSD/RequiredBy.pm index 176303f00f0..78c56b1cf76 100644 --- a/usr.sbin/pkg_add/OpenBSD/RequiredBy.pm +++ b/usr.sbin/pkg_add/OpenBSD/RequiredBy.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: RequiredBy.pm,v 1.15 2007/06/01 22:35:47 espie Exp $ +# $OpenBSD: RequiredBy.pm,v 1.16 2007/06/04 14:40:39 espie Exp $ # # Copyright (c) 2003-2005 Marc Espie <espie@openbsd.org> # @@ -33,8 +33,8 @@ sub fill_entries $self->{filename}, ": $!"; local $_; while(<$fh>) { - s/\s+$//; - next if /^$/; + s/\s+$//o; + next if /^$/o; chomp; $l->{$_} = 1; } diff --git a/usr.sbin/pkg_add/OpenBSD/Search.pm b/usr.sbin/pkg_add/OpenBSD/Search.pm index 03f69f4e2eb..7905e63264a 100644 --- a/usr.sbin/pkg_add/OpenBSD/Search.pm +++ b/usr.sbin/pkg_add/OpenBSD/Search.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Search.pm,v 1.5 2007/05/19 09:45:33 espie Exp $ +# $OpenBSD: Search.pm,v 1.6 2007/06/04 14:40:39 espie Exp $ # # Copyright (c) 2007 Marc Espie <espie@openbsd.org> # @@ -67,7 +67,7 @@ sub filter sub new { my ($class, $pattern) = @_; - my @l = split /\|/, $pattern; + my @l = split '|', $pattern; bless { patterns => \@l }, $class; } diff --git a/usr.sbin/pkg_add/OpenBSD/SharedLibs.pm b/usr.sbin/pkg_add/OpenBSD/SharedLibs.pm index af9faf8cd9e..553fd9cfe6c 100644 --- a/usr.sbin/pkg_add/OpenBSD/SharedLibs.pm +++ b/usr.sbin/pkg_add/OpenBSD/SharedLibs.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: SharedLibs.pm,v 1.16 2007/05/23 10:33:45 espie Exp $ +# $OpenBSD: SharedLibs.pm,v 1.17 2007/06/04 14:40:39 espie Exp $ # # Copyright (c) 2003-2005 Marc Espie <espie@openbsd.org> # @@ -50,7 +50,7 @@ sub init_path($) if (defined $fh) { local $_; while (<$fh>) { - if (m/^\s*search directories:\s*(.*?)\s*$/) { + if (m/^\s*search directories:\s*(.*?)\s*$/o) { for my $d (split(':', $1)) { $path->{$d} = 1; } @@ -87,7 +87,7 @@ our $registered_libs = {}; sub register_lib { my ($name, $pkgname) = @_; - if ($name =~ m/^(.*\/lib.*?\.so\.\d+)\.(\d+)$/) { + if ($name =~ m/^(.*\/lib.*?\.so\.\d+)\.(\d+)$/o) { my ($stem, $minor) = ($1, $2); push(@{$registered_libs->{$stem}}, [$minor, $pkgname]); } @@ -143,7 +143,7 @@ sub _lookup_libspec my ($dir, $spec) = @_; my @r = (); - if ($spec =~ m/^(.*)\.(\d+)\.(\d+)$/) { + if ($spec =~ m/^(.*)\.(\d+)\.(\d+)$/o) { my ($libname, $major, $minor) = ($1, $2, $3); my $exists = $registered_libs->{"$dir/lib$libname.so.$major"}; if (defined $exists) { @@ -161,7 +161,7 @@ sub lookup_libspec { my ($base, $libspec, $wantpath) = @_; - if ($libspec =~ m|(.*)/|) { + if ($libspec =~ m|(.*)/|o) { return _lookup_libspec("$base/$1", $'); } else { return _lookup_libspec("$base/lib", $libspec); diff --git a/usr.sbin/pkg_add/OpenBSD/Update.pm b/usr.sbin/pkg_add/OpenBSD/Update.pm index 61d7d1212f5..f3dd40af440 100644 --- a/usr.sbin/pkg_add/OpenBSD/Update.pm +++ b/usr.sbin/pkg_add/OpenBSD/Update.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Update.pm,v 1.78 2007/06/01 14:58:29 espie Exp $ +# $OpenBSD: Update.pm,v 1.79 2007/06/04 14:40:39 espie Exp $ # # Copyright (c) 2004-2006 Marc Espie <espie@openbsd.org> # @@ -57,7 +57,7 @@ sub add2updates sub process_package { my ($self, $pkgname, $state) = @_; - if ($pkgname =~ m/^(?:\.libs|partial)\-/) { + if ($pkgname =~ m/^(?:\.libs|partial)\-/o) { $state->progress->clear; print "Not updating $pkgname, remember to clean it\n"; return; @@ -100,7 +100,7 @@ sub process_package next; } } - if ($plist->signature() eq $p2->signature()) { + if ($plist->signature eq $p2->signature) { $found = $candidate; push(@l2, $candidate); next; diff --git a/usr.sbin/pkg_add/OpenBSD/Ustar.pm b/usr.sbin/pkg_add/OpenBSD/Ustar.pm index 483e59a2caf..a11c58399b1 100644 --- a/usr.sbin/pkg_add/OpenBSD/Ustar.pm +++ b/usr.sbin/pkg_add/OpenBSD/Ustar.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Ustar.pm,v 1.47 2007/05/02 15:05:30 espie Exp $ +# $OpenBSD: Ustar.pm,v 1.48 2007/06/04 14:40:39 espie Exp $ # # Copyright (c) 2002-2007 Marc Espie <espie@openbsd.org> # @@ -104,7 +104,7 @@ sub next die "Error while reading header" unless defined $n and $n == 512; if ($header eq "\0"x512) { - return $self->next(); + return $self->next; } # decode header my ($name, $mode, $uid, $gid, $size, $mtime, $chksum, $type, @@ -120,11 +120,11 @@ sub next if ($ck2 != oct($chksum)) { die "Bad archive checksum"; } - $name =~ s/\0*$//; + $name =~ s/\0*$//o; $mode = oct($mode) & 0xfff; - $uname =~ s/\0*$//; - $gname =~ s/\0*$//; - $linkname =~ s/\0*$//; + $uname =~ s/\0*$//o; + $gname =~ s/\0*$//o; + $linkname =~ s/\0*$//o; $major = oct($major); $minor = oct($minor); $uid = oct($uid); @@ -132,8 +132,8 @@ sub next $uid = $uidcache->lookup($uname, $uid); $gid = $gidcache->lookup($gname, $gid); $mtime = oct($mtime); - unless ($prefix =~ m/^\0/) { - $prefix =~ s/\0*$//; + unless ($prefix =~ m/^\0/o) { + $prefix =~ s/\0*$//o; $name = "$prefix/$name"; } @@ -175,7 +175,7 @@ sub split_name my $l = length $name; if ($l > MAXFILENAME && $l <= MAXFILENAME+MAXPREFIX+1) { while (length($name) > MAXFILENAME && - $name =~ m/^(.*?\/)(.*)$/) { + $name =~ m/^(.*?\/)(.*)$/o) { $prefix .= $1; $name = $2; } @@ -215,7 +215,7 @@ sub mkheader if (defined $entry->{cwd}) { my $cwd = $entry->{cwd}; - $cwd.='/' unless $cwd =~ m/\/$/; + $cwd.='/' unless $cwd =~ m/\/$/o; $linkname =~ s/^\Q$cwd\E//; } if (!defined $linkname) { @@ -370,7 +370,7 @@ sub write my $out = $arc->{fh}; $arc->{padout} = 1; - my $header = OpenBSD::Ustar::mkheader($self, $self->type()); + my $header = OpenBSD::Ustar::mkheader($self, $self->type); print $out $header or die "Error writing to archive: $!"; $self->write_contents($arc); my $k = $self->{key}; @@ -410,7 +410,7 @@ sub copy my $out = $wrarc->{fh}; $self->resolve_links($wrarc); $wrarc->{padout} = 1; - my $header = OpenBSD::Ustar::mkheader($self, $self->type()); + my $header = OpenBSD::Ustar::mkheader($self, $self->type); print $out $header or die "Error writing to archive: $!"; $self->copy_contents($wrarc); diff --git a/usr.sbin/pkg_add/OpenBSD/Vstat.pm b/usr.sbin/pkg_add/OpenBSD/Vstat.pm index 8d805644cc6..456e3964087 100644 --- a/usr.sbin/pkg_add/OpenBSD/Vstat.pm +++ b/usr.sbin/pkg_add/OpenBSD/Vstat.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Vstat.pm,v 1.31 2007/06/01 14:58:29 espie Exp $ +# $OpenBSD: Vstat.pm,v 1.32 2007/06/04 14:40:39 espie Exp $ # # Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org> # @@ -50,7 +50,7 @@ sub init_devices() open(my $cmd1, "/sbin/mount|") or print STDERR "Can't run mount\n"; while (<$cmd1>) { chomp; - if (m/^(.*?)\s+on\s+\/.*?\s+type\s+.*?(?:\s+\((.*?)\))?$/) { + if (m/^(.*?)\s+on\s+\/.*?\s+type\s+.*?(?:\s+\((.*?)\))?$/o) { my ($dev, $opts) = ($1, $2); my $i = create_device($dev); next unless defined $i; @@ -85,9 +85,9 @@ sub ask_df($) my $blocksize = 512; while (<$cmd2>) { chomp; - if (m/^Filesystem\s+(\d+)\-blocks/) { + if (m/^Filesystem\s+(\d+)\-blocks/o) { $blocksize = $1; - } elsif (m/^(.*?)\s+\d+\s+\d+\s+(\-?\d+)\s+\d+\%\s+\/.*?$/) { + } elsif (m/^(.*?)\s+\d+\s+\d+\s+(\-?\d+)\s+\d+\%\s+\/.*?$/o) { my ($dev, $avail) = ($1, $2); $info = $devinfo->{$dev}; if (!defined $info) { @@ -182,7 +182,7 @@ sub tally() while (my ($device, $data) = each %$devinfo) { if ($data->{used} != 0) { print $device, ": ", $data->{used}, " bytes"; - my $avail = $data->avail(); + my $avail = $data->avail; if ($avail < 0) { print " (missing ", int(-$avail+1), " blocks)"; } diff --git a/usr.sbin/pkg_add/pkg_add b/usr.sbin/pkg_add/pkg_add index 0b350a97005..3a4fb8a41de 100644 --- a/usr.sbin/pkg_add/pkg_add +++ b/usr.sbin/pkg_add/pkg_add @@ -1,7 +1,7 @@ #! /usr/bin/perl # ex:ts=8 sw=4: -# $OpenBSD: pkg_add,v 1.308 2007/06/02 12:37:37 espie Exp $ +# $OpenBSD: pkg_add,v 1.309 2007/06/04 14:40:39 espie Exp $ # # Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org> # @@ -136,7 +136,7 @@ sub can_install my @libs = (); @conflicts = (); for my $k (keys %conflicts) { - if ($k =~ m/^\.libs\-/) { + if ($k =~ m/^\.libs\-/o) { push(@libs, $k); } else { push(@conflicts, $k); @@ -531,7 +531,7 @@ sub find_truenames for my $pkgname (@$old) { if (OpenBSD::PackageName::is_stem($pkgname)) { my ($h, $path, $repo); - if ($pkgname =~ m/\//) { + if ($pkgname =~ m/\//o) { ($repo, $path, $pkgname) = OpenBSD::PackageLocator::path_parse($pkgname); $h = $repo; } else { @@ -580,12 +580,12 @@ try { {'v' => sub {++$opt_v;}, 'h' => sub { Usage(); }, 'F' => sub { - for my $o (split/,/, shift) { + for my $o (split ',', shift) { $forced{$o} = 1; } }, 'f' => sub { - for my $o (split/,/, shift) { + for my $o (split ',', shift) { $forced{$o} = 1; } }}); @@ -698,7 +698,7 @@ if ($opt_u) { if (defined $state->{forced}->{kitchensink}) { reorder(\@todo); if (!$opt_r) { - @todo = grep {s/\.tgz$//; !is_installed($_);} @todo; + @todo = grep {s/\.tgz$//o; !is_installed($_);} @todo; } print "Adding in order:\n", (map { "\t$_\n" } @todo), "\n"; } @@ -724,7 +724,7 @@ OpenBSD::PackingElement::Lib::ensure_ldconfig($state); if ($state->{beverbose}) { OpenBSD::Vstat::tally(); } -$state->delayed_output(); +$state->delayed_output; if (defined $state->{updatedepends} && %{$state->{updatedepends}}) { print "Forced updates, bogus dependencies for ", join(' ', sort(keys %{$state->{updatedepends}})), @@ -736,7 +736,7 @@ if (defined $state->{forced}->{kitchensink}) { rethrow $dielater; } catch { print STDERR "$0: $_\n"; - if ($_ =~ m/^Caught SIG(\w+)/) { + if ($_ =~ m/^Caught SIG(\w+)/o) { kill $1, $$; } exit(1); @@ -753,7 +753,7 @@ sub uses_old_libs my $plist = shift; require OpenBSD::RequiredBy; - return grep {/^\.libs\-/} + return grep {/^\.libs\-/o} OpenBSD::Requiring->new($plist->pkgname)->list; } diff --git a/usr.sbin/pkg_add/pkg_audit b/usr.sbin/pkg_add/pkg_audit index c75fcb71659..5242dd2be76 100644 --- a/usr.sbin/pkg_add/pkg_audit +++ b/usr.sbin/pkg_add/pkg_audit @@ -1,6 +1,6 @@ #! /usr/bin/perl # ex:ts=8 sw=4: -# $OpenBSD: pkg_audit,v 1.3 2004/11/11 11:16:39 espie Exp $ +# $OpenBSD: pkg_audit,v 1.4 2007/06/04 14:40:39 espie Exp $ # # Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org> # @@ -29,8 +29,8 @@ for my $pkg (installed_packages()) { \&OpenBSD::PackingList::FilesOnly); print "$pkg...\n"; for my $item (@{$plist->{items}}) { - next unless $item->IsFile(); - $found{$item->fullname()} = $pkg; + next unless $item->IsFile; + $found{$item->fullname} = $pkg; } } diff --git a/usr.sbin/pkg_add/pkg_create b/usr.sbin/pkg_add/pkg_create index 2b04e72634a..08f9c9a087a 100644 --- a/usr.sbin/pkg_add/pkg_create +++ b/usr.sbin/pkg_add/pkg_create @@ -1,6 +1,6 @@ #! /usr/bin/perl # ex:ts=8 sw=4: -# $OpenBSD: pkg_create,v 1.110 2007/05/31 13:11:21 espie Exp $ +# $OpenBSD: pkg_create,v 1.111 2007/06/04 14:40:39 espie Exp $ # # Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org> # @@ -307,11 +307,11 @@ my %defines; sub dosubst { local $_ = shift; - return $_ unless m/\$/; + return $_ unless m/\$/o; while (my ($k, $v) = each %defines) { s/\$\{\Q$k\E\}/$v/g; } - s/\$\\/\$/g; + s/\$\\/\$/go; return $_; } @@ -343,11 +343,11 @@ sub deduce_name my $noto = $o; my $nofrag = "no-$frag"; - $o =~ s/PFRAG\./PFRAG.$frag-/ or - $o =~ s/PLIST/PFRAG.$frag/; + $o =~ s/PFRAG\./PFRAG.$frag-/o or + $o =~ s/PLIST/PFRAG.$frag/o; - $noto =~ s/PFRAG\./PFRAG.no-$frag-/ or - $noto =~ s/PLIST/PFRAG.no-$frag/; + $noto =~ s/PFRAG\./PFRAG.no-$frag-/o or + $noto =~ s/PLIST/PFRAG.no-$frag/o; unless (-e $o or -e $noto) { die "Missing fragments for $frag: $o and $noto don't exist"; } @@ -375,7 +375,7 @@ sub read_fragments while(my $file = pop @$stack) { GETLINE: while ($_ = $file->readline) { - if (m/^(\!)?\%\%(.*)\%\%$/) { + if (m/^(\!)?\%\%(.*)\%\%$/o) { my ($not, $frag) = ($1, $2); my $def = $frag; if ($frag eq 'SHARED') { @@ -398,10 +398,10 @@ sub read_fragments } next GETLINE; } - if (m/^(\@comment\s+\$(?:Open)BSD\$)$/) { + if (m/^(\@comment\s+\$(?:Open)BSD\$)$/o) { $_ = '@comment $'.'OpenBSD: '.basename($file->name).',v$'; } - if (m,^\@lib\s+.*/lib[^/]+\.so\.\d+\.\d+$,) { + if (m,^\@lib\s+.*/lib[^/]+\.so\.\d+\.\d+$,o) { Warn "Shared library without SHARED_LIBS: $_"; $main::errors++; } @@ -444,13 +444,13 @@ sub add_description if (defined $comment) { print $fh dosubst($comment), "\n"; } else { - if ($opt_c =~ /^\-/) { + if ($opt_c =~ /^\-/o) { print $fh $', "\n"; } else { copy_subst_fh($opt_c, $fh); } } - if ($opt_d =~ /^\-/) { + if ($opt_d =~ /^\-/o) { print $fh $', "\n"; } else { copy_subst_fh($opt_d, $fh); @@ -484,7 +484,7 @@ try { {'D' => sub { local $_ = shift; - if (m/\=/) { + if (m/\=/o) { my ($k, $v) = ($`,$'); $v =~ s/^\'(.*)\'$/$1/; $v =~ s/^\"(.*)\"$/$1/; @@ -583,17 +583,17 @@ if ($regen_package) { if (defined $opt_L) { OpenBSD::PackingElement::LocalBase->add($plist, $opt_L); } - if ($ARGV[0] =~ m|([^/]+)$|) { + if ($ARGV[0] =~ m|([^/]+)$|o) { my $pkgname = $1; - $pkgname =~ s/\.tgz$//; + $pkgname =~ s/\.tgz$//o; $plist->set_pkgname($pkgname); } my $fullpkgpath = $defines{'FULLPKGPATH'}; my $cdrom = $defines{'PERMIT_PACKAGE_CDROM'}; my $ftp = $defines{'PERMIT_PACKAGE_FTP'}; if (defined $fullpkgpath && defined $cdrom && defined $ftp) { - $cdrom = 'yes' if $cdrom =~ m/^yes$/i; - $ftp = 'yes' if $ftp =~ m/^yes$/i; + $cdrom = 'yes' if $cdrom =~ m/^yes$/io; + $ftp = 'yes' if $ftp =~ m/^yes$/io; OpenBSD::PackingElement::ExtraInfo->add($plist, $fullpkgpath, $cdrom, $ftp); diff --git a/usr.sbin/pkg_add/pkg_delete b/usr.sbin/pkg_add/pkg_delete index 8f8fc3b879d..9e41ae146b8 100644 --- a/usr.sbin/pkg_add/pkg_delete +++ b/usr.sbin/pkg_add/pkg_delete @@ -1,6 +1,6 @@ #!/usr/bin/perl # ex:ts=8 sw=4: -# $OpenBSD: pkg_delete,v 1.106 2007/06/01 14:58:29 espie Exp $ +# $OpenBSD: pkg_delete,v 1.107 2007/06/04 14:40:39 espie Exp $ # # Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org> # @@ -46,12 +46,12 @@ try { {'v' => sub {++$opt_v;}, 'h' => sub { Usage(); }, 'F' => sub { - for my $o (split/,/, shift) { + for my $o (split ',', shift) { $forced{$o} = 1; } }, 'f' => sub { - for my $o (split/,/, shift) { + for my $o (split ',', shift) { $forced{$o} = 1; } }}); @@ -65,7 +65,7 @@ if ($opt_D) { $opt_B = $ENV{'PKG_DESTDIR'} unless defined $opt_B; $opt_B = '' unless defined $opt_B; if ($opt_B ne '') { - $opt_B.='/' unless $opt_B =~ m/\/$/; + $opt_B.='/' unless $opt_B =~ m/\/$/o; } $ENV{'PKG_DESTDIR'} = $opt_B; @@ -203,7 +203,7 @@ OpenBSD::PackingElement::Fontdir::finish_fontdirs($state); if ($state->{beverbose}) { OpenBSD::Vstat::tally(); } -$state->delayed_output(); +$state->delayed_output; rethrow $dielater; } catch { print STDERR "$0: $_\n"; diff --git a/usr.sbin/pkg_add/pkg_info b/usr.sbin/pkg_add/pkg_info index 377436cf23f..610bfbf098f 100644 --- a/usr.sbin/pkg_add/pkg_info +++ b/usr.sbin/pkg_add/pkg_info @@ -1,6 +1,6 @@ #! /usr/bin/perl # ex:ts=8 sw=4: -# $OpenBSD: pkg_info,v 1.58 2007/06/04 11:42:03 pyr Exp $ +# $OpenBSD: pkg_info,v 1.59 2007/06/04 14:40:39 espie Exp $ # # Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org> # @@ -191,11 +191,11 @@ sub find_by_path OpenBSD::PackingList->from_installation($pkg, \&OpenBSD::PackingList::ExtraInfoOnly); add_to_path_info($plist->{extrainfo}->{subdir}, - $plist->pkgname()); + $plist->pkgname); if ($plist->has('pkgpath')) { for my $p (@{$plist->{pkgpath}}) { add_to_path_info($p->{name}, - $plist->pkgname()); + $plist->pkgname); } } } @@ -328,7 +328,7 @@ try { my @list; lock_db(1, $opt_q); $locked = 1; - if ($pat =~ m/\//) { + if ($pat =~ m/\//o) { @list = find_by_path($pat); } else { @list = find_by_spec($pat); diff --git a/usr.sbin/pkg_add/pkg_merge b/usr.sbin/pkg_add/pkg_merge index 1c66e97a77d..05dde5863bf 100644 --- a/usr.sbin/pkg_add/pkg_merge +++ b/usr.sbin/pkg_add/pkg_merge @@ -41,7 +41,7 @@ sub mark_tocopy sub copy_over { my ($self, $wrarc, $prefix, $pkg) = @_; - my $e = $pkg->{pkg}->next(); + my $e = $pkg->{pkg}->next; if (!$e->check_name($self)) { die "Names don't match: ", $e->{name}, " ", $self->{name}; } @@ -52,7 +52,7 @@ sub copy_over sub make_alias { my ($self, $wrarc, $prefix, $pkg, $alias) = @_; - my $e = $pkg->{pkg}->next(); + my $e = $pkg->{pkg}->next; if (!$e->check_name($self)) { die "Names don't match: ", $e->{name}, " ", $self->{name}; } diff --git a/usr.sbin/pkg_add/pkg_mklocatedb b/usr.sbin/pkg_add/pkg_mklocatedb index 4d2dbeb5625..3cfd94dccb5 100644 --- a/usr.sbin/pkg_add/pkg_mklocatedb +++ b/usr.sbin/pkg_add/pkg_mklocatedb @@ -28,7 +28,7 @@ package OpenBSD::PackingElement::FileObject; sub print_name { my ($self, $fh, $pkgname) = @_; - print $fh $pkgname, ":", $self->fullname(), "\n"; + print $fh $pkgname, ":", $self->fullname, "\n"; } package main; @@ -42,11 +42,11 @@ sub info my $plist = shift; my $r; if ($opt_a) { - $r = $plist->{extrainfo}->{subdir}.":".$plist->pkgname(); + $r = $plist->{extrainfo}->{subdir}.":".$plist->pkgname; } elsif ($opt_P) { $r = $plist->{extrainfo}->{subdir}; } else { - $r = $plist->pkgname(); + $r = $plist->pkgname; } print STDERR "$r\n" unless $opt_q; return $r; @@ -82,7 +82,7 @@ if ($opt_n or -t STDOUT) { open $fh, "|-", $MKLOCATEDB, $MKLOCATEDB or die "couldn't open pipe: $!"; } if ($opt_s || $opt_x) { - my ($rev, $arch) = split(/ /, `uname -mr`); + my ($rev, $arch) = split(' ', `uname -mr`); chomp $arch; $rev =~ s/\.//; if ($opt_s) { @@ -120,13 +120,13 @@ if ($opt_r) { opendir(my $dir, $opt_r) or next; while (my $e = readdir $dir) { - if ($e =~ m/^(\w+\d\d)\.tgz$/) { + if ($e =~ m/^(\w+\d\d)\.tgz$/o) { my $set = $1; open my $arc, '-|', '/usr/bin/gzip', 'gzip', '-c', '-d', "$opt_r/$e"; my $u = OpenBSD::Ustar->new($arc, '/'); - while (my $f = $u->next()) { + while (my $f = $u->next) { my $name = $f->{name}; - $name =~ s/^\.//; + $name =~ s/^\.//o; print $fh "$set:$name\n"; } close $arc; @@ -151,7 +151,7 @@ if ($opt_p) { } $done = 1; }); - if (defined $plist && defined $plist->pkgname()) { + if (defined $plist && defined $plist->pkgname) { $plist->print_name($fh, info($plist)); } } |