diff options
61 files changed, 425 insertions, 425 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Add.pm b/usr.sbin/pkg_add/OpenBSD/Add.pm index 7b7e778628d..d74c313113d 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.107 2010/04/05 16:07:10 espie Exp $ +# $OpenBSD: Add.pm,v 1.108 2010/05/10 09:17:55 espie Exp $ # # Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org> # @@ -37,8 +37,8 @@ sub manpages_index if ($state->{not}) { $state->say("Merging manpages in $destdir$k: ", join(@l)) if $state->verbose >= 2; } else { - try { - OpenBSD::Makewhatis::merge($destdir.$k, \@l); + try { + OpenBSD::Makewhatis::merge($destdir.$k, \@l); } catchall { $state->errsay("Error in makewhatis: $_"); }; @@ -73,7 +73,7 @@ sub record_partial_installation my $n = $plist->make_shallow_copy($h); my $borked = borked_package($plist->pkgname); $n->set_pkgname($borked); - + # last file may have not copied correctly my $last = $n->{state}->{lastfile}; if (defined $last && defined($last->{d})) { @@ -82,8 +82,8 @@ sub record_partial_installation my $lastname = $last->realname($state); $last->{d} = $last->compute_digest($lastname, $old); if (!$old->equals($last->{d})) { - $state->say("Adjusting ", $old->keyword, - " for $lastname from ", $old->stringize, + $state->say("Adjusting ", $old->keyword, + " for $lastname from ", $old->stringize, " to ", $last->{d}->stringize); } } @@ -253,7 +253,7 @@ sub prepare_for_addition my $ok = $self->check; if (defined $ok) { if ($ok == 0) { - $state->errsay($self->type, " ", $self->name, + $state->errsay($self->type, " ", $self->name, " does not match"); $state->{problems}++; } @@ -283,7 +283,7 @@ sub build_args { my ($self, $l) = @_; - $self->add_entry($l, + $self->add_entry($l, '-u', $self->{uid}, '-g', $self->{group}, '-L', $self->{class}, @@ -327,7 +327,7 @@ sub install } $state->vsystem(OpenBSD::Paths->sysctl, '--', $name.'='.$self->{value}); } - + package OpenBSD::PackingElement::DirBase; sub prepare_for_addition { @@ -379,7 +379,7 @@ sub install } elsif (defined $self->{symlink}) { symlink($self->{symlink}, $destdir.$fullname); } else { - rename($self->{tempname}, $destdir.$fullname) or + rename($self->{tempname}, $destdir.$fullname) or Fatal "Can't move ", $self->{tempname}, " to $fullname: $!"; $state->say("moving ", $self->{tempname}, " -> $destdir$fullname") if $state->verbose >= 5; undef $self->{tempname}; @@ -462,7 +462,7 @@ sub prepare_for_addition { my ($self, $state, $pkgname) = @_; if (!defined $self->{copyfrom}) { - $state->errsay("\@sample element ",$self->fullname, + $state->errsay("\@sample element ",$self->fullname, " does not reference a valid file"); $state->{problems}++; } @@ -613,15 +613,15 @@ sub install sub should_run() { 1 } package OpenBSD::PackingElement::ExecAdd; -sub should_run -{ +sub should_run +{ my ($self, $state) = @_; return !$state->{replacing}; } package OpenBSD::PackingElement::ExecUpdate; -sub should_run -{ +sub should_run +{ my ($self, $state) = @_; return $state->{replacing}; } diff --git a/usr.sbin/pkg_add/OpenBSD/AddDelete.pm b/usr.sbin/pkg_add/OpenBSD/AddDelete.pm index 10d034059fc..0409f5e9919 100644 --- a/usr.sbin/pkg_add/OpenBSD/AddDelete.pm +++ b/usr.sbin/pkg_add/OpenBSD/AddDelete.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: AddDelete.pm,v 1.19 2010/03/22 20:38:44 espie Exp $ +# $OpenBSD: AddDelete.pm,v 1.20 2010/05/10 09:17:55 espie Exp $ # # Copyright (c) 2007-2010 Marc Espie <espie@openbsd.org> # @@ -43,8 +43,8 @@ sub handle_options set_usage(@usage); $state = OpenBSD::State->new; $hash->{h} = sub { Usage(); }; - $hash->{F} = sub { - for my $o (split /\,/o, shift) { + $hash->{F} = sub { + for my $o (split /\,/o, shift) { $defines{$o} = 1; } }; @@ -97,7 +97,7 @@ sub do_the_main_work if ($state->{defines}->{debug}) { &$code; - } else { + } else { eval { &$code; }; } my $dielater = $@; @@ -120,7 +120,7 @@ sub framework $state->progress->clear; $state->log->dump; finish_display(); - if ($state->verbose >= 2 || $opt_s || + if ($state->verbose >= 2 || $opt_s || $state->{defines}->{tally}) { $state->vstat->tally; } diff --git a/usr.sbin/pkg_add/OpenBSD/ArcCheck.pm b/usr.sbin/pkg_add/OpenBSD/ArcCheck.pm index 0d243d8b4e8..f2346e19b54 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.14 2009/11/11 12:59:34 espie Exp $ +# $OpenBSD: ArcCheck.pm,v 1.15 2010/05/10 09:17:55 espie Exp $ # # Copyright (c) 2005-2006 Marc Espie <espie@openbsd.org> # @@ -77,7 +77,7 @@ sub verify_modes if ($o->{gname} ne 'bin' && $o->{gname} ne 'wheel') { if (($o->{mode} & (S_ISUID | S_ISGID | S_IWGRP)) != 0) { print STDERR "Error: no \@group for ", - $item->fullname, " (", $o->{uname}, + $item->fullname, " (", $o->{uname}, "), which has mode ", sprintf("%4o", $o->{mode} & (S_IRWXU | S_IRWXG | S_IRWXO | S_ISUID | S_ISGID)), "\n"; $result = 0; @@ -89,8 +89,8 @@ sub verify_modes } if (!defined $item->{mode} && $o->isFile) { if (($o->{mode} & (S_ISUID | S_ISGID | S_IWOTH)) != 0) { - print STDERR "Error: weird mode for ", - $item->fullname, ": ", + print STDERR "Error: weird mode for ", + $item->fullname, ": ", sprintf("%4o", $o->{mode} & (S_IRWXU | S_IRWXG | S_IRWXO | S_ISUID | S_ISGID)), "\n"; $result = 0; } @@ -105,7 +105,7 @@ sub copy_long if ($self->name =~ m/^LongName(\d+)$/o) { $wrarc->{name_index} = $1 + 1; } - if (length($self->name) > + if (length($self->name) > OpenBSD::Ustar::MAXFILENAME + OpenBSD::Ustar::MAXPREFIX + 1) { $wrarc->{name_index} = 0 if !defined $wrarc->{name_index}; $self->set_name('LongName'.$wrarc->{name_index}++); @@ -132,7 +132,7 @@ sub prepare_long $self->{name_index} = 0 if !defined $self->{name_index}; $entry->set_name('LongName'.$self->{name_index}++); } - if ((defined $entry->{linkname}) && + if ((defined $entry->{linkname}) && length($entry->{linkname}) > MAXLINKNAME) { $self->{linkname_index} = 0 if !defined $self->{linkname_index}; $entry->{linkname} = 'LongLink'.$self->{linkname_index}++; diff --git a/usr.sbin/pkg_add/OpenBSD/CollisionReport.pm b/usr.sbin/pkg_add/OpenBSD/CollisionReport.pm index 3b6c0601555..5deeb7a0838 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.32 2010/01/17 11:56:46 espie Exp $ +# $OpenBSD: CollisionReport.pm,v 1.33 2010/05/10 09:17:55 espie Exp $ # # Copyright (c) 2003-2006 Marc Espie <espie@openbsd.org> # @@ -41,7 +41,7 @@ sub find_collisions } for my $pkg (installed_packages()) { $state->say("Looking for collisions in $pkg") if $verbose; - my $plist = OpenBSD::PackingList->from_installation($pkg, + my $plist = OpenBSD::PackingList->from_installation($pkg, \&OpenBSD::PackingList::FilesOnly); next if !defined $plist; for my $item (@{$plist->{items}}) { @@ -73,7 +73,7 @@ sub collision_report($$) my $clueless_bat; my $clueless_bat2; my $found = 0; - + $state->errsay("Collision: the following files already exist"); if (!$state->{defines}->{dontfindcollisions}) { my $bypkg = find_collisions(\%todo, $state); @@ -133,7 +133,7 @@ sub collision_report($$) if ($dorepair == 1) { for my $f (@$list) { - if ($state->unlink($state->verbose >= 2, + if ($state->unlink($state->verbose >= 2, $destdir.$f->fullname)) { $state->{problems}--; } else { diff --git a/usr.sbin/pkg_add/OpenBSD/Delete.pm b/usr.sbin/pkg_add/OpenBSD/Delete.pm index 3af0e8a33a1..ff93a9119f0 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.99 2010/05/10 09:05:27 espie Exp $ +# $OpenBSD: Delete.pm,v 1.100 2010/05/10 09:17:55 espie Exp $ # # Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org> # @@ -126,10 +126,10 @@ sub unregister_dependencies my $l = OpenBSD::Requiring->new($pkgname); for my $name ($l->list) { - $state->say("remove dependency on $name") + $state->say("remove dependency on $name") if $state->verbose >= 3; local $@; - try { + try { OpenBSD::RequiredBy->new($name)->delete($pkgname); } catchall { $state->errsay($_); @@ -137,7 +137,7 @@ sub unregister_dependencies } $l->erase; } - + sub delete_plist { my ($plist, $state) = @_; @@ -153,7 +153,7 @@ sub delete_plist $plist->get(UNDISPLAY)->prepare($state); } } - + unregister_dependencies($plist, $state); return if $state->{not}; if ($state->{baddelete}) { @@ -161,7 +161,7 @@ sub delete_plist $state->log("Files kept as $borked package\n"); delete $state->{baddelete}; } - + remove_packing_info($plist); delete_installed($pkgname); @@ -339,15 +339,15 @@ sub delete sub should_run() { 1 } package OpenBSD::PackingElement::UnexecDelete; -sub should_run -{ +sub should_run +{ my ($self, $state) = @_; return !$state->{replacing}; } package OpenBSD::PackingElement::UnexecUpdate; -sub should_run -{ +sub should_run +{ my ($self, $state) = @_; return $state->{replacing}; } @@ -401,14 +401,14 @@ sub delete } unless (defined($self->{link}) or $self->{nochecksum} or $state->{quick}) { if (!defined $self->{d}) { - $state->say("Problem: ", + $state->say("Problem: ", $self->fullname, " does not have a checksum\n", "NOT deleting: $realname"); $state->log("Couldn't delete $realname (no checksum)\n"); return; } - my $d = $self->compute_digest($realname, + my $d = $self->compute_digest($realname, $self->{d}); if (!$d->equals($self->{d})) { $state->say("Problem: checksum doesn't match for ", @@ -546,7 +546,7 @@ sub delete $state->log("deleting $realname failed: $!\n"); } } - + package OpenBSD::PackingElement::InfoFile; use File::Basename; @@ -556,7 +556,7 @@ sub delete my ($self, $state) = @_; unless ($state->{not}) { my $fullname = $state->{destdir}.$self->fullname; - $state->vsystem(OpenBSD::Paths->install_info, + $state->vsystem(OpenBSD::Paths->install_info, "--delete", "--info-dir=".dirname($fullname), '--', $fullname); } $self->SUPER::delete($state); @@ -606,7 +606,7 @@ sub delete $state->log("Remember to update $realname\n"); $self->mark_dir($state); } elsif ($state->{extra}) { - unlink($realname) or + unlink($realname) or $state->say("problem deleting extra file $realname"); } else { $state->log("You should also remove $realname\n"); diff --git a/usr.sbin/pkg_add/OpenBSD/Dependencies.pm b/usr.sbin/pkg_add/OpenBSD/Dependencies.pm index 533656a349b..535e385d013 100644 --- a/usr.sbin/pkg_add/OpenBSD/Dependencies.pm +++ b/usr.sbin/pkg_add/OpenBSD/Dependencies.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Dependencies.pm,v 1.125 2010/04/10 11:04:21 espie Exp $ +# $OpenBSD: Dependencies.pm,v 1.126 2010/05/10 09:17:55 espie Exp $ # # Copyright (c) 2005-2010 Marc Espie <espie@openbsd.org> # @@ -53,7 +53,7 @@ sub lookup $dependencies->{$r} = 1; return 1; } - + return 0; } @@ -71,7 +71,7 @@ sub dump my $self = shift; return unless %{$self->{done}}; - print "Full dependency tree is ", join(' ', keys %{$self->{done}}), + print "Full dependency tree is ", join(' ', keys %{$self->{done}}), "\n"; } @@ -91,7 +91,7 @@ sub find_in_already_done my ($self, $solver, $state, $obj) = @_; - my $r = $solver->check_lib_spec($solver->{localbase}, $obj, + my $r = $solver->check_lib_spec($solver->{localbase}, $obj, $self->{known}); if ($r) { $self->say_found($state, $obj, "in package $r"); @@ -125,11 +125,11 @@ sub find_in_new_source } else { OpenBSD::SharedLibs::add_libs_from_installed_package($dep); } - if ($solver->check_lib_spec($solver->{localbase}, $obj, + if ($solver->check_lib_spec($solver->{localbase}, $obj, {$dep => 1})) { $self->say_found($state, $obj, "in package $dep"); return $dep; - } + } return undef; } @@ -139,7 +139,7 @@ sub find_elsewhere for my $n ($solver->{set}->newer) { for my $dep (@{$n->{plist}->{depend}}) { - my $r = $solver->find_old_lib($state, + my $r = $solver->find_old_lib($state, $solver->{localbase}, $dep->{pattern}, $obj); if ($r) { $self->say_found($state, $obj, @@ -455,7 +455,7 @@ sub find_dep_in_stuff_to_install $self->add_dep($set); } if (@candidates == 1) { - $self->set_cache($dep, + $self->set_cache($dep, _cache::to_update->new($candidates[0])); } return $candidates[0]; @@ -513,7 +513,7 @@ sub solve_dependency if (defined $global_cache->{$dep->{pattern}}) { $state->print("Global "); } - $state->say("Cache hit on $dep->{pattern}: ", + $state->say("Cache hit on $dep->{pattern}: ", $self->cached($dep)->pretty); } $v = $self->cached($dep)->do($self, $state, $dep, $package); @@ -524,7 +524,7 @@ sub solve_dependency } if ($state->{allow_replacing}) { - + $v = $self->find_dep_in_self($state, $dep); if ($v) { $self->set_cache($dep, _cache::self->new($v)); @@ -605,8 +605,8 @@ sub check_depends my @bad = (@{$self->{bad}}); for my $dep ($self->dependencies) { - push(@bad, $dep) - unless is_installed($dep) or + push(@bad, $dep) + unless is_installed($dep) or defined $self->{set}->{newer}->{$dep}; } return @bad; @@ -616,11 +616,11 @@ sub dump { my $self = shift; if ($self->dependencies) { - print "Direct dependencies for ", $self->{set}->print, + print "Direct dependencies for ", $self->{set}->print, " resolve to: ", join(' ', $self->dependencies); - print " (todo: ", - join(' ', (map {$_->print} values %{$self->{deplist}})), - ")" + print " (todo: ", + join(' ', (map {$_->print} values %{$self->{deplist}})), + ")" if %{$self->{deplist}}; print "\n"; } @@ -696,15 +696,15 @@ sub solve_wantlibs for my $h ($solver->{set}->newer) { for my $lib (@{$h->{plist}->{wantlib}}) { $solver->{localbase} = $h->{plist}->localbase; - next if $lib_finder->lookup($solver, - $solver->{to_register}->{$h}, $state, + next if $lib_finder->lookup($solver, + $solver->{to_register}->{$h}, $state, $lib->spec); if ($okay) { - $state->errsay("Can't install ", + $state->errsay("Can't install ", $h->pkgname, " because of libraries"); } $okay = 0; - OpenBSD::SharedLibs::report_problem($state, + OpenBSD::SharedLibs::report_problem($state, $lib->spec); } } @@ -723,10 +723,10 @@ sub solve_tags my $tag_finder = OpenBSD::lookup::tag->new($solver); for my $h ($solver->{set}->newer) { for my $tag (keys %{$h->{plist}->{tags}}) { - next if $tag_finder->lookup($solver, + next if $tag_finder->lookup($solver, $solver->{to_register}->{$h}, $state, $tag); - $state->errsay("Can't install ", - $h->pkgname, ": tag definition not found ", + $state->errsay("Can't install ", + $h->pkgname, ": tag definition not found ", $tag); if ($okay) { $solver->dump; diff --git a/usr.sbin/pkg_add/OpenBSD/Error.pm b/usr.sbin/pkg_add/OpenBSD/Error.pm index 09b995bdd89..9d078c2c23c 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.24 2010/04/24 09:27:15 espie Exp $ +# $OpenBSD: Error.pm,v 1.25 2010/05/10 09:17:55 espie Exp $ # # Copyright (c) 2004-2010 Marc Espie <espie@openbsd.org> # @@ -49,7 +49,7 @@ my $handler = sub { kill $sig, $$; }; -sub reset +sub reset { $SIG{'INT'} = $handler; $SIG{'QUIT'} = $handler; @@ -63,7 +63,7 @@ __PACKAGE__->reset; package OpenBSD::Error; require Exporter; our @ISA=qw(Exporter); -our @EXPORT=qw(System VSystem Copy Unlink Fatal Warn Usage set_usage +our @EXPORT=qw(System VSystem Copy Unlink Fatal Warn Usage set_usage try throw catch catchall rethrow); our ($FileName, $Line, $FullMessage); @@ -120,7 +120,7 @@ sub child_error if ($error & 128) { $extra = " (core dumped)"; - } + } if ($error & 127) { return "killed by signal ". find_signal($error & 127).$extra; } else { @@ -132,7 +132,7 @@ sub System { my $r = system(@_); if ($r != 0) { - print "system(", join(", ", @_), ") failed: ", child_error(), + print "system(", join(", ", @_), ") failed: ", child_error(), "\n"; } return $r; @@ -210,7 +210,7 @@ sub fatal my $self = shift; if (defined $self->{pkgname}) { unshift @_, $self->{pkgname}, ':'; - } + } croak @_; } @@ -242,12 +242,12 @@ sub system $self->print($_); } if (!close $grab) { - $self->print("system(", join(", ", @_), ") failed: $! ", + $self->print("system(", join(", ", @_), ") failed: $! ", child_error(), "\n"); } return $?; } else { - $self->print("system(", join(", ", @_), + $self->print("system(", join(", ", @_), ") was not run: $!", child_error(), "\n"); } } @@ -290,14 +290,14 @@ sub dienow } } -sub try(&@) +sub try(&@) { my ($try, $catch) = @_; eval { &$try }; dienow($@, $catch); } -sub throw +sub throw { croak @_; diff --git a/usr.sbin/pkg_add/OpenBSD/ForwardDependencies.pm b/usr.sbin/pkg_add/OpenBSD/ForwardDependencies.pm index 4a1551b4efb..9b1575b31ad 100644 --- a/usr.sbin/pkg_add/OpenBSD/ForwardDependencies.pm +++ b/usr.sbin/pkg_add/OpenBSD/ForwardDependencies.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: ForwardDependencies.pm,v 1.5 2009/12/31 12:36:57 espie Exp $ +# $OpenBSD: ForwardDependencies.pm,v 1.6 2010/05/10 09:17:55 espie Exp $ # # Copyright (c) 2009 Marc Espie <espie@openbsd.org> # @@ -74,7 +74,7 @@ sub check my $result = {}; return $result if @r == 0; - $state->say("Verifying dependencies still match for ", + $state->say("Verifying dependencies still match for ", join(', ', @r)) if $state->verbose >= 2; my @new = ($set->newer_names, $set->kept_names); diff --git a/usr.sbin/pkg_add/OpenBSD/Getopt.pm b/usr.sbin/pkg_add/OpenBSD/Getopt.pm index 9b4da5e339e..0d2d5a3e661 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.6 2009/11/10 11:36:56 espie Exp $ +# $OpenBSD: Getopt.pm,v 1.7 2010/05/10 09:17:55 espie Exp $ # # Copyright (c) 2006 Marc Espie <espie@openbsd.org> # @@ -48,7 +48,7 @@ sub handle_option } } -sub getopts($;$) +sub getopts($;$) { my ($args, $hash) = @_; diff --git a/usr.sbin/pkg_add/OpenBSD/Handle.pm b/usr.sbin/pkg_add/OpenBSD/Handle.pm index bb4f049bc9d..f26befbadf5 100644 --- a/usr.sbin/pkg_add/OpenBSD/Handle.pm +++ b/usr.sbin/pkg_add/OpenBSD/Handle.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Handle.pm,v 1.18 2010/03/20 09:55:05 espie Exp $ +# $OpenBSD: Handle.pm,v 1.19 2010/05/10 09:17:55 espie Exp $ # # Copyright (c) 2007-2009 Marc Espie <espie@openbsd.org> # @@ -67,7 +67,7 @@ sub pkgname } elsif (defined $self->{name}) { require OpenBSD::PackageName; - $self->{pkgname} = + $self->{pkgname} = OpenBSD::PackageName::url2pkgname($self->{name}); } } @@ -229,8 +229,8 @@ sub get_location if (!$location) { $state->print($state->deptree_header($name)); $handle->set_error(NOT_FOUND); - $handle->{tweaked} = - OpenBSD::Add::tweak_package_status($handle->pkgname, + $handle->{tweaked} = + OpenBSD::Add::tweak_package_status($handle->pkgname, $state); if (!$handle->{tweaked}) { $state->say("Can't find $name"); diff --git a/usr.sbin/pkg_add/OpenBSD/IdCache.pm b/usr.sbin/pkg_add/OpenBSD/IdCache.pm index c5ebdd3c68f..ba33ae1a206 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.5 2009/11/10 11:36:56 espie Exp $ +# $OpenBSD: IdCache.pm,v 1.6 2010/05/10 09:17:55 espie Exp $ # # Copyright (c) 2002-2005 Marc Espie <espie@openbsd.org> # @@ -73,7 +73,7 @@ sub convert my @entry = getgrnam($_[1]); return @entry == 0 ? undef : $entry[2]; } - + package OpenBSD::UnameCache; our @ISA=qw(OpenBSD::SimpleIdCache); @@ -89,5 +89,5 @@ sub convert { return getgrgid($_[1]); } - + 1; diff --git a/usr.sbin/pkg_add/OpenBSD/Interactive.pm b/usr.sbin/pkg_add/OpenBSD/Interactive.pm index b6427542244..8a1a8be0341 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.12 2009/11/28 09:41:14 espie Exp $ +# $OpenBSD: Interactive.pm,v 1.13 2010/05/10 09:17:55 espie Exp $ # # Copyright (c) 2005-2007 Marc Espie <espie@openbsd.org> # diff --git a/usr.sbin/pkg_add/OpenBSD/LibSpec.pm b/usr.sbin/pkg_add/OpenBSD/LibSpec.pm index 0b5e676cada..5d8f161dcb8 100644 --- a/usr.sbin/pkg_add/OpenBSD/LibSpec.pm +++ b/usr.sbin/pkg_add/OpenBSD/LibSpec.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: LibSpec.pm,v 1.7 2010/04/24 14:29:55 espie Exp $ +# $OpenBSD: LibSpec.pm,v 1.8 2010/05/10 09:17:55 espie Exp $ # # Copyright (c) 2010 Marc Espie <espie@openbsd.org> # @@ -145,7 +145,7 @@ sub from_string { my ($class, $filename) = @_; if (my ($dir, $stem, $major, $minor) = $filename =~ m/^(.*)\/lib([^\/]+)\.so\.(\d+)\.(\d+)$/o) { - bless { dir => $dir, stem => $stem, major => $major, + bless { dir => $dir, stem => $stem, major => $major, minor => $minor }, $class; } else { return $class->badclass->new($filename); @@ -198,9 +198,9 @@ our @ISA = qw(OpenBSD::LibObject); sub new { my ($class, $dir, $stem, $major, $minor) = @_; - bless { - dir => $dir, stem => $stem, - major => $major, minor => $minor + bless { + dir => $dir, stem => $stem, + major => $major, minor => $minor }, $class; } @@ -283,7 +283,7 @@ sub no_match_shared if ($spec->no_match_major($library)) { return "bad major"; } - if ($spec->major == $library->major && + if ($spec->major == $library->major && $spec->minor > $library->minor) { return "minor is too small"; } diff --git a/usr.sbin/pkg_add/OpenBSD/LibSpec/Build.pm b/usr.sbin/pkg_add/OpenBSD/LibSpec/Build.pm index ad8a97936ca..4c0358bf626 100644 --- a/usr.sbin/pkg_add/OpenBSD/LibSpec/Build.pm +++ b/usr.sbin/pkg_add/OpenBSD/LibSpec/Build.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Build.pm,v 1.1 2010/04/24 14:33:12 espie Exp $ +# $OpenBSD: Build.pm,v 1.2 2010/05/10 09:17:55 espie Exp $ # # Copyright (c) 2010 Marc Espie <espie@openbsd.org> # @@ -41,7 +41,7 @@ sub to_string } sub version { ".a" } - + sub is_static { 1 } sub is_better { 0 } diff --git a/usr.sbin/pkg_add/OpenBSD/Mtree.pm b/usr.sbin/pkg_add/OpenBSD/Mtree.pm index ba287b95547..fe2a774e7dd 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.6 2008/10/20 10:25:16 espie Exp $ +# $OpenBSD: Mtree.pm,v 1.7 2010/05/10 09:17:55 espie Exp $ # # Copyright (c) 2004-2005 Marc Espie <espie@openbsd.org> # @@ -47,7 +47,7 @@ sub parse_fh } } -sub parse +sub parse { my ($mtree, $basedir, $filename) = @_; open my $file, '<', $filename or die "can't open $filename: $!"; diff --git a/usr.sbin/pkg_add/OpenBSD/OldLibs.pm b/usr.sbin/pkg_add/OpenBSD/OldLibs.pm index 4b1b51d8228..340e3a13980 100644 --- a/usr.sbin/pkg_add/OpenBSD/OldLibs.pm +++ b/usr.sbin/pkg_add/OpenBSD/OldLibs.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: OldLibs.pm,v 1.2 2010/03/22 20:38:44 espie Exp $ +# $OpenBSD: OldLibs.pm,v 1.3 2010/05/10 09:17:55 espie Exp $ # # Copyright (c) 2004-2010 Marc Espie <espie@openbsd.org> # @@ -145,7 +145,7 @@ sub adjust_depends_closure { my ($oldname, $plist, $state) = @_; - $state->say("Packages that depend on those shared libraries:") + $state->say("Packages that depend on those shared libraries:") if $state->verbose >= 3; my $write = OpenBSD::RequiredBy->new($plist->pkgname); @@ -168,7 +168,7 @@ sub do_save_libs ($o->{plist}, my $stub_list) = split_libs($o->plist, $libs); my $stub_name = $stub_list->pkgname; my $dest = installed_info($stub_name); - $state->say("Keeping them in $stub_name") + $state->say("Keeping them in $stub_name") if $state->verbose >= 2; @@ -203,7 +203,7 @@ sub save_libs_from_handle my $libs = {}; my $p = {}; - $state->say("Looking for changes in shared libraries") + $state->say("Looking for changes in shared libraries") if $state->verbose >= 2; $o->plist->mark_lib($libs, $p); for my $n ($set->newer) { @@ -214,7 +214,7 @@ sub save_libs_from_handle } if (%$libs) { - $state->say("Libraries to keep: ", + $state->say("Libraries to keep: ", join(",", sort(keys %$libs))) if $state->verbose >= 2; do_save_libs($o, $libs, $state); } else { diff --git a/usr.sbin/pkg_add/OpenBSD/PackageInfo.pm b/usr.sbin/pkg_add/OpenBSD/PackageInfo.pm index c2045cc4a4d..1e84024c4a8 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.44 2009/11/15 09:53:52 espie Exp $ +# $OpenBSD: PackageInfo.pm,v 1.45 2010/05/10 09:17:55 espie Exp $ # # Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org> # @@ -257,7 +257,7 @@ sub solve_installed_names if ($state->{defines}->{ambiguous}) { my @l = map {$_->name} @$r; - $state->say("Ambiguous: $pkgname could be ", + $state->say("Ambiguous: $pkgname could be ", join(' ', @l)); $state->say($msg); push(@$new, @l); diff --git a/usr.sbin/pkg_add/OpenBSD/PackageLocation.pm b/usr.sbin/pkg_add/OpenBSD/PackageLocation.pm index 00d0a435c4a..e7c9ee798b5 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.18 2010/01/12 10:14:37 espie Exp $ +# $OpenBSD: PackageLocation.pm,v 1.19 2010/05/10 09:17:55 espie Exp $ # # Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org> # @@ -80,7 +80,7 @@ sub _opened } my $fh = $self->{repository}->open($self); if (!defined $fh) { - $self->{repository}->parse_problems($self->{errors}) + $self->{repository}->parse_problems($self->{errors}) if defined $self->{errors}; undef $self->{errors}; return; @@ -128,7 +128,7 @@ sub find_fat_contents my $contents = $e->contents; require OpenBSD::PackingList; - my $plist = OpenBSD::PackingList->fromfile(\$contents, + my $plist = OpenBSD::PackingList->fromfile(\$contents, \&OpenBSD::PackingList::FatOnly); if (defined $self->name) { next if $plist->pkgname ne $self->name; @@ -149,7 +149,7 @@ sub contents if (!$self->_opened) { return; } - $self->{contents} = $self->find_contents || + $self->{contents} = $self->find_contents || $self->find_fat_contents; } @@ -226,8 +226,8 @@ sub plist require OpenBSD::PackingList; if (defined $self->{dir} && -f $self->{dir}.CONTENTS) { - my $plist = - OpenBSD::PackingList->fromfile($self->{dir}.CONTENTS, + my $plist = + OpenBSD::PackingList->fromfile($self->{dir}.CONTENTS, $code); $plist->set_infodir($self->{dir}); return $plist; @@ -307,7 +307,7 @@ sub _next } sub unput -{ +{ my $self = shift; $self->{_unput} = 1; } diff --git a/usr.sbin/pkg_add/OpenBSD/PackageLocator.pm b/usr.sbin/pkg_add/OpenBSD/PackageLocator.pm index 5d1ee529828..c6f09b0aa02 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.87 2010/01/10 11:32:41 espie Exp $ +# $OpenBSD: PackageLocator.pm,v 1.88 2010/05/10 09:17:55 espie Exp $ # # Copyright (c) 2003-2010 Marc Espie <espie@openbsd.org> # diff --git a/usr.sbin/pkg_add/OpenBSD/PackageName.pm b/usr.sbin/pkg_add/OpenBSD/PackageName.pm index e326e885587..875c8618aa1 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.43 2010/01/27 15:57:16 espie Exp $ +# $OpenBSD: PackageName.pm,v 1.44 2010/05/10 09:17:55 espie Exp $ # # Copyright (c) 2003-2010 Marc Espie <espie@openbsd.org> # @@ -148,7 +148,7 @@ sub find_partial } return @result; } - + package OpenBSD::PackageName::dewey; my $cache = {}; @@ -199,7 +199,7 @@ sub suffix_compare return -suffix_compare($b, $a); } # order is '', beta, pre, rc - # we know that a < b, + # we know that a < b, if ($a->{suffix} eq '') { return 1; } @@ -313,7 +313,7 @@ sub compare # Simple case: only p number differs if ($a->{dewey} eq $b->{dewey}) { return $a->pnum_compare($b); - } + } return $a->{dewey}->compare($b->{dewey}); } @@ -332,11 +332,11 @@ package OpenBSD::PackageName::versionspec; our @ISA = qw(OpenBSD::PackageName::version); my $ops = { - '<' => 'lt', - '<=' => 'le', + '<' => 'lt', + '<=' => 'le', '>' => 'gt', '>=' => 'ge', - '=' => 'eq' + '=' => 'eq' }; sub from_string @@ -346,7 +346,7 @@ sub from_string if ($s =~ m/^(\>\=|\>|\<\=|\<|\=)(.*)$/) { ($op, $version) = ($1, $2); } - bless $class->SUPER::from_string($version), + bless $class->SUPER::from_string($version), "OpenBSD::PackageName::version::$ops->{$op}"; } @@ -438,7 +438,7 @@ sub flavor_string sub to_string { my $o = shift; - return join('-', $o->{stem}, $o->{version}->to_string, + return join('-', $o->{stem}, $o->{version}->to_string, sort keys %{$o->{flavors}}); } @@ -460,8 +460,8 @@ sub compare sub has_issues { my $self = shift; - return ((map {"flavor $_ can't start with digit"} - grep { /^\d/ } keys %{$self->{flavors}}), + return ((map {"flavor $_ can't start with digit"} + grep { /^\d/ } keys %{$self->{flavors}}), $self->{version}->has_issues); } diff --git a/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm b/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm index 4caf13763e2..394f124f778 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.78 2010/01/10 11:32:41 espie Exp $ +# $OpenBSD: PackageRepository.pm,v 1.79 2010/05/10 09:17:55 espie Exp $ # # Copyright (c) 2003-2010 Marc Espie <espie@openbsd.org> # @@ -169,7 +169,7 @@ sub close waitpid($object->{pid2}, 0); alarm(0); } - $self->parse_problems($object->{errors}, $hint, $object) + $self->parse_problems($object->{errors}, $hint, $object) if defined $object->{errors}; undef $object->{errors}; $object->deref; @@ -321,12 +321,12 @@ sub open_pipe return $fh; } else { open STDERR, ">/dev/null"; - exec {OpenBSD::Paths->gzip} - "gzip", - "-d", - "-c", - "-q", - "-f", + exec {OpenBSD::Paths->gzip} + "gzip", + "-d", + "-c", + "-q", + "-f", $self->relative_url($object->{name}) or die "Can't run gzip"; } @@ -389,12 +389,12 @@ sub open_pipe return $fh; } else { open STDERR, ">/dev/null"; - exec {OpenBSD::Paths->gzip} - "gzip", - "-d", - "-c", - "-q", - "-f", + exec {OpenBSD::Paths->gzip} + "gzip", + "-d", + "-c", + "-q", + "-f", "-" or die "can't run gzip"; } @@ -416,7 +416,7 @@ sub parse_url # same heuristics as ftp(1): # find host part, rest is parsed as a local url if (my ($host, $path) = $$r =~ m/^\/\/(.*?)(\/.*)$/) { - + $$r = $path; my $o = $class->SUPER::parse_url($r); $o->{host} = $host; @@ -509,12 +509,12 @@ sub open_pipe open(STDIN, '<&', $rdfh) or die "Bad dup"; close($rdfh); close($wrfh); - exec {OpenBSD::Paths->gzip} - "gzip", - "-d", - "-c", - "-q", - "-" + exec {OpenBSD::Paths->gzip} + "gzip", + "-d", + "-c", + "-q", + "-" or die "can't run gzip"; } my $pid2 = fork(); @@ -570,10 +570,10 @@ sub grab_object { my ($self, $object) = @_; my ($ftp, @extra) = split(/\s+/, OpenBSD::Paths->ftp); - exec {$ftp} + exec {$ftp} $ftp, @extra, - "-o", + "-o", "-", $self->url($object->{name}) or die "can't run ".OpenBSD::Paths->ftp; } @@ -629,8 +629,8 @@ sub find { my ($self, $pkgname, @extra) = @_; - return $self->try_until_success($pkgname, - sub { + return $self->try_until_success($pkgname, + sub { return $self->SUPER::find($pkgname, @extra); }); } @@ -639,8 +639,8 @@ sub grabPlist { my ($self, $pkgname, @extra) = @_; - return $self->try_until_success($pkgname, - sub { + return $self->try_until_success($pkgname, + sub { return $self->SUPER::grabPlist($pkgname, @extra); }); } @@ -702,8 +702,8 @@ sub list $self->{list} = $self->obtain_list($error); $self->parse_problems($error); if ($self->{no_such_dir}) { - print STDERR $self->{path}, - ": Directory does not exist on ", $self->{host}, + print STDERR $self->{path}, + ": Directory does not exist on ", $self->{host}, "\n"; $self->{lasterror} = 404; } diff --git a/usr.sbin/pkg_add/OpenBSD/PackageRepository/Installed.pm b/usr.sbin/pkg_add/OpenBSD/PackageRepository/Installed.pm index c4b6b21d759..569cc6274e5 100644 --- a/usr.sbin/pkg_add/OpenBSD/PackageRepository/Installed.pm +++ b/usr.sbin/pkg_add/OpenBSD/PackageRepository/Installed.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Installed.pm,v 1.21 2010/03/06 11:55:31 espie Exp $ +# $OpenBSD: Installed.pm,v 1.22 2010/05/10 09:17:55 espie Exp $ # # Copyright (c) 2007-2010 Marc Espie <espie@openbsd.org> # @@ -39,7 +39,7 @@ sub parse_url $path = $$r; $$r = ''; } - + $path .= '/' unless $path =~ m/\/$/; bless { path => $path }, $class; } @@ -150,7 +150,7 @@ sub urlscheme return 'inst'; } -use OpenBSD::PackageInfo (qw(is_installed installed_info +use OpenBSD::PackageInfo (qw(is_installed installed_info installed_packages installed_stems installed_name)); my $singleton = bless {}, __PACKAGE__; diff --git a/usr.sbin/pkg_add/OpenBSD/PackageRepository/SCP.pm b/usr.sbin/pkg_add/OpenBSD/PackageRepository/SCP.pm index ab581f206a6..3f7ebbc4633 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.20 2010/01/05 11:31:07 espie Exp $ +# $OpenBSD: SCP.pm,v 1.21 2010/05/10 09:17:55 espie Exp $ # # Copyright (c) 2003-2006 Marc Espie <espie@openbsd.org> # @@ -40,7 +40,7 @@ sub initiate my ($rdfh, $wrfh); - $self->{controller} = open2($rdfh, $wrfh, OpenBSD::Paths->ssh, + $self->{controller} = open2($rdfh, $wrfh, OpenBSD::Paths->ssh, $self->{host}, 'perl', '-x'); $self->{cmdfh} = $wrfh; $self->{getfh} = $rdfh; @@ -56,8 +56,8 @@ sub initiate } seek(DATA, 0, 0); } - - + + sub may_exist { my ($self, $name) = @_; @@ -92,7 +92,7 @@ sub grab_object my $n; do { - $n = read($getfh, $buffer, + $n = read($getfh, $buffer, $remaining < $buffsize ? $remaining :$buffsize); if (!defined $n) { die "Error reading\n"; diff --git a/usr.sbin/pkg_add/OpenBSD/PackageRepository/Source.pm b/usr.sbin/pkg_add/OpenBSD/PackageRepository/Source.pm index 41333db5d43..50da7f072c9 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.10 2010/01/09 09:37:45 espie Exp $ +# $OpenBSD: Source.pm,v 1.11 2010/05/10 09:17:55 espie Exp $ # # Copyright (c) 2003-2006 Marc Espie <espie@openbsd.org> # diff --git a/usr.sbin/pkg_add/OpenBSD/PackageRepositoryList.pm b/usr.sbin/pkg_add/OpenBSD/PackageRepositoryList.pm index e5b72cfe3d6..2f81f58ce38 100644 --- a/usr.sbin/pkg_add/OpenBSD/PackageRepositoryList.pm +++ b/usr.sbin/pkg_add/OpenBSD/PackageRepositoryList.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: PackageRepositoryList.pm,v 1.21 2010/01/09 14:49:53 espie Exp $ +# $OpenBSD: PackageRepositoryList.pm,v 1.22 2010/05/10 09:17:55 espie Exp $ # # Copyright (c) 2003-2006 Marc Espie <espie@openbsd.org> # diff --git a/usr.sbin/pkg_add/OpenBSD/PackingElement.pm b/usr.sbin/pkg_add/OpenBSD/PackingElement.pm index 4e2ab84a2c7..78424881ba9 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.175 2010/04/05 16:07:10 espie Exp $ +# $OpenBSD: PackingElement.pm,v 1.176 2010/05/10 09:17:55 espie Exp $ # # Copyright (c) 2003-2010 Marc Espie <espie@openbsd.org> # @@ -45,7 +45,7 @@ sub create } } -sub register_with_factory +sub register_with_factory { my ($class, $k, $o) = @_; if (!defined $k) { @@ -53,7 +53,7 @@ sub register_with_factory } if (!defined $o) { $o = $class; - } + } $keyword{$k} = $o; } @@ -72,7 +72,7 @@ sub clone my %h = %$object; bless \%h, ref($object); } - + sub register_manpage { @@ -99,7 +99,7 @@ sub add } sub needs_keyword() { 1 } - + sub write { my ($self, $fh) = @_; @@ -394,12 +394,12 @@ sub check_digest my ($self, $file, $state) = @_; return if $self->{link} or $self->{symlink}; if (!defined $self->{d}) { - $state->log->fatal($self->fullname, + $state->log->fatal($self->fullname, " does not have a signature"); } my $d = $self->compute_digest($file->{destdir}.$file->name); if (!$d->equals($self->{d})) { - $state->log->fatal("checksum for ", $self->fullname, + $state->log->fatal("checksum for ", $self->fullname, " does not match"); } if ($state->verbose >= 3) { @@ -553,7 +553,7 @@ sub mark_ldconfig_directory require OpenBSD::SharedLibs; my ($self, $destdir) = @_; - OpenBSD::SharedLibs::mark_ldconfig_directory($self->fullname, + OpenBSD::SharedLibs::mark_ldconfig_directory($self->fullname, $destdir); } @@ -638,7 +638,7 @@ __PACKAGE__->register_with_factory('md5'); sub add { my ($class, $plist, $args) = @_; - + require OpenBSD::md5; $plist->{state}->{lastchecksummable}->add_digest(OpenBSD::md5->fromstring($args)); @@ -653,7 +653,7 @@ __PACKAGE__->register_with_factory('sha'); sub add { my ($class, $plist, $args) = @_; - + require OpenBSD::md5; $plist->{state}->{lastchecksummable}->add_digest(OpenBSD::sha->fromstring($args)); @@ -691,9 +691,9 @@ sub new { my ($class, $args) = @_; my ($tag, $condition, @command) = split(/\s+/, $args); - bless { - name => $tag, - when => $condition, + bless { + name => $tag, + when => $condition, command => join(' ', @command) }, $class; } @@ -701,7 +701,7 @@ sub new sub stringize { my $self = shift; - return join(' ', map { $self->{$_}} + return join(' ', map { $self->{$_}} (qw(name when command))); } @@ -783,10 +783,10 @@ sub new package OpenBSD::PackingElement::UniqueOption; our @ISA=qw(OpenBSD::PackingElement::Unique OpenBSD::PackingElement::Option); -sub stringize -{ +sub stringize +{ my $self = shift; - return $self->category; + return $self->category; } sub new @@ -910,14 +910,14 @@ sub new { my ($class, $args) = @_; my ($pkgpath, $pattern, $def) = split /\:/o, $args; - bless { name => $def, pkgpath => $pkgpath, pattern => $pattern, + bless { name => $def, pkgpath => $pkgpath, pattern => $pattern, def => $def }, $class; } sub stringize { my $self = shift; - return join(':', map { $self->{$_}} + return join(':', map { $self->{$_}} (qw(pkgpath pattern def))); } @@ -991,7 +991,7 @@ sub new sub stringize { my $self = shift; - return join(' ', map { $self->{$_}} + return join(' ', map { $self->{$_}} (qw(pattern message))); } @@ -1028,17 +1028,17 @@ __PACKAGE__->register_with_factory; sub new { my ($class, $args) = @_; - my ($name, $uid, $group, $loginclass, $comment, $home, $shell) = + my ($name, $uid, $group, $loginclass, $comment, $home, $shell) = split /\:/o, $args; - bless { name => $name, uid => $uid, group => $group, - class => $loginclass, + bless { name => $name, uid => $uid, group => $group, + class => $loginclass, comment => $comment, home => $home, shell => $shell }, $class; } sub check { my $self = shift; - my ($name, $passwd, $uid, $gid, $quota, $class, $gcos, $dir, $shell, + my ($name, $passwd, $uid, $gid, $quota, $class, $gcos, $dir, $shell, $expire) = getpwnam($self->name); return unless defined $name; if ($self->{uid} =~ m/^\!(.*)$/o) { @@ -1070,7 +1070,7 @@ sub check sub stringize { my $self = shift; - return join(':', map { $self->{$_}} + return join(':', map { $self->{$_}} (qw(name uid group class comment home shell))); } @@ -1104,7 +1104,7 @@ sub check sub stringize($) { my $self = $_[0]; - return join(':', map { $self->{$_}} + return join(':', map { $self->{$_}} (qw(name gid))); } @@ -1250,9 +1250,9 @@ sub run my ($self, $state) = @_; OpenBSD::PackingElement::Lib::ensure_ldconfig($state); - $state->say($self->keyword, " ", $self->{expanded}) + $state->say($self->keyword, " ", $self->{expanded}) if $state->verbose >= 2; - $state->log->system(OpenBSD::Paths->sh, '-c', $self->{expanded}) + $state->log->system(OpenBSD::Paths->sh, '-c', $self->{expanded}) unless $state->{not}; } @@ -1322,7 +1322,7 @@ sub destate $state->{lastdir} = $self; $self->SUPER::destate($state); } - + sub stringize { @@ -1432,7 +1432,7 @@ sub finish_fontdirs require OpenBSD::Error; map { update_fontalias($_) } @l unless $state->{not}; - $state->say("You may wish to update your font path for ", + $state->say("You may wish to update your font path for ", join(' ', @l)); return if $state->{not}; run_if_exists($state, OpenBSD::Paths->mkfontscale, '--', @l); @@ -1564,7 +1564,7 @@ sub run return if $state->{dont_run_scripts}; OpenBSD::PackingElement::Lib::ensure_ldconfig($state); - $state->say($self->beautify, " script: $name $pkgname ", + $state->say($self->beautify, " script: $name $pkgname ", join(' ', @args)) if $state->verbose >= 2; return if $state->{not}; chmod 0755, $name; @@ -1614,7 +1614,7 @@ sub prepare next if m/^\+\-+\s*$/o; s/^[+-] //o; $state->log($_); - } + } } else { $state->errsay("Can't open $fname: $!"); } @@ -1695,7 +1695,7 @@ sub time_to_iso8601 { my $time = shift; my ($sec, $min, $hour, $day, $month, $year, @rest) = gmtime($time); - return sprintf("%04d-%02d-%02dT%02d:%02d:%02dZ", + return sprintf("%04d-%02d-%02dT%02d:%02d:%02dZ", $year+1900, $month+1, $day, $hour, $min, $sec); } @@ -1733,19 +1733,19 @@ sub new_x509 my ($class) = @_; bless { key => 'x509', timestamp => time, b64sig => '' }, $class; } - + sub stringize { my $self = shift; - return join(':', $self->{key}, time_to_iso8601($self->{timestamp}), + return join(':', $self->{key}, time_to_iso8601($self->{timestamp}), $self->{b64sig}); } sub write_no_sig { my ($self, $fh) = @_; - print $fh "\@", $self->keyword, " ", $self->{key}, ":", + print $fh "\@", $self->keyword, " ", $self->{key}, ":", time_to_iso8601($self->{timestamp}), "\n"; } @@ -1785,7 +1785,7 @@ sub register_old_keyword $class->register_with_factory($k, bless \$k, $class); } -for my $k (qw(src display mtree ignore_inst dirrm pkgcfl pkgdep newdepend +for my $k (qw(src display mtree ignore_inst dirrm pkgcfl pkgdep newdepend libdepend ignore)) { __PACKAGE__->register_old_keyword($k); } diff --git a/usr.sbin/pkg_add/OpenBSD/PackingList.pm b/usr.sbin/pkg_add/OpenBSD/PackingList.pm index c314b705314..a9379a51131 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.104 2010/04/19 10:22:59 espie Exp $ +# $OpenBSD: PackingList.pm,v 1.105 2010/05/10 09:17:55 espie Exp $ # # Copyright (c) 2003-2010 Marc Espie <espie@openbsd.org> # @@ -24,8 +24,8 @@ my $dot = '.'; sub new { my $class = shift; - bless { default_owner=>'root', - default_group=>'bin', + bless { default_owner=>'root', + default_group=>'bin', default_mode=> 0444, cwd=>\$dot}, $class; } @@ -50,7 +50,7 @@ sub match { my ($h, $plist) = @_; return - defined $plist->fullpkgpath && + defined $plist->fullpkgpath && $h->{$plist->fullpkgpath}; } @@ -133,7 +133,7 @@ sub conflict_list require OpenBSD::PkgCfl; my $self = shift; - + $self->{conflict_list} //= OpenBSD::PkgCfl->make_conflict_list($self); return $self->{conflict_list}; } @@ -330,7 +330,7 @@ MAINLOOP: &$cont($_); while(<$fh>) { redo MAINLOOP unless m/^\@(?:sha|md5|size|symlink|link)\b/o; - m/^\@size\b/o || m/^\@symlink\b/o || + m/^\@size\b/o || m/^\@symlink\b/o || m/^\@link\b/o; &$cont($_); } @@ -452,7 +452,7 @@ sub pkgpath { my $self = shift; if (!defined $self->{_hashpath}) { - my $h = $self->{_hashpath} = + my $h = $self->{_hashpath} = bless {}, "OpenBSD::PackingList::hashpath"; if (defined $self->fullpkgpath) { $h->{$self->fullpkgpath} = 1; @@ -469,7 +469,7 @@ sub pkgpath sub match_pkgpath { my ($self, $plist2) = @_; - return $self->pkgpath->match($plist2) || + return $self->pkgpath->match($plist2) || $plist2->pkgpath->match($self); } @@ -477,12 +477,12 @@ our @unique_categories = (qw(name url digital-signature no-default-conflict manual-installation always-update explicit-update extrainfo localbase arch)); our @list_categories = - (qw(conflict pkgpath incompatibility ask-update updateset depend + (qw(conflict pkgpath incompatibility ask-update updateset depend wantlib define-tag groups users items)); our @cache_categories = (qw(depend wantlib)); - + sub visit { my ($self, $method, @l) = @_; @@ -527,7 +527,7 @@ sub from_installation my $plist = $o->fromfile($filename, $code); if (defined $plist && $code == \&DependOnly) { $plist_cache->{$pkgname} = $plist; - } + } if (defined $plist) { $plist->set_infodir(OpenBSD::PackageInfo::installed_info($pkgname)); } diff --git a/usr.sbin/pkg_add/OpenBSD/Paths.pm b/usr.sbin/pkg_add/OpenBSD/Paths.pm index 28e7e20b671..7e7b413a2b4 100644 --- a/usr.sbin/pkg_add/OpenBSD/Paths.pm +++ b/usr.sbin/pkg_add/OpenBSD/Paths.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Paths.pm,v 1.10 2010/04/24 09:28:19 espie Exp $ +# $OpenBSD: Paths.pm,v 1.11 2010/05/10 09:17:55 espie Exp $ # # Copyright (c) 2007 Marc Espie <espie@openbsd.org> # diff --git a/usr.sbin/pkg_add/OpenBSD/PkgCfl.pm b/usr.sbin/pkg_add/OpenBSD/PkgCfl.pm index eeb4516d1d3..5d9b4a46e49 100644 --- a/usr.sbin/pkg_add/OpenBSD/PkgCfl.pm +++ b/usr.sbin/pkg_add/OpenBSD/PkgCfl.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: PkgCfl.pm,v 1.29 2009/12/12 17:18:11 espie Exp $ +# $OpenBSD: PkgCfl.pm,v 1.30 2010/05/10 09:17:55 espie Exp $ # # Copyright (c) 2003-2005 Marc Espie <espie@openbsd.org> # @@ -71,7 +71,7 @@ sub fill_conflict_lists($) { my $state = shift; for my $pkg (installed_packages()) { - my $plist = OpenBSD::PackingList->from_installation($pkg, + my $plist = OpenBSD::PackingList->from_installation($pkg, \&OpenBSD::PackingList::ConflictOnly); next unless defined $plist; if (!defined $plist->pkgname) { diff --git a/usr.sbin/pkg_add/OpenBSD/PkgConfig.pm b/usr.sbin/pkg_add/OpenBSD/PkgConfig.pm index 8dc33792cc9..9ab59cf89e4 100644 --- a/usr.sbin/pkg_add/OpenBSD/PkgConfig.pm +++ b/usr.sbin/pkg_add/OpenBSD/PkgConfig.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: PkgConfig.pm,v 1.13 2009/11/10 11:36:56 espie Exp $ +# $OpenBSD: PkgConfig.pm,v 1.14 2010/05/10 09:17:55 espie Exp $ # # Copyright (c) 2006 Marc Espie <espie@openbsd.org> # @@ -23,7 +23,7 @@ package OpenBSD::PkgConfig; # specific properties may have specific needs. my $parse = { - Requires => sub { + Requires => sub { [split qr{ (?<![<=>]) # not preceded by <=> [,\s]+ # delimiter @@ -43,9 +43,9 @@ sub new { my $class = shift; - return bless { - variables => {}, - vlist => [], + return bless { + variables => {}, + vlist => [], properties => {}, proplist => [] }, $class; @@ -111,7 +111,7 @@ sub read_fh } } if (defined $cfg->{properties}->{Libs}) { - $cfg->{properties}->{Libs} = + $cfg->{properties}->{Libs} = $cfg->compress_list($cfg->{properties}->{Libs}); } return $cfg; @@ -139,7 +139,7 @@ sub write_fh if (defined $write->{$property}) { print $fh $write->{$property}($p); } else { - print $fh (map { " $_" } @$p); + print $fh (map { " $_" } @$p); } print $fh "\n"; } @@ -184,7 +184,7 @@ sub expanded my ($self, $v, $extra) = @_; $extra = {} if !defined $extra; - my $get_value = + my $get_value = sub { my $var = shift; if (defined $extra->{$var}) { diff --git a/usr.sbin/pkg_add/OpenBSD/PkgSpec.pm b/usr.sbin/pkg_add/OpenBSD/PkgSpec.pm index 250ba48931b..c3fab091d74 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.27 2010/01/07 13:11:21 espie Exp $ +# $OpenBSD: PkgSpec.pm,v 1.28 2010/05/10 09:17:55 espie Exp $ # # Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org> # @@ -194,7 +194,7 @@ sub add_version_constraints # non constraint } else { for my $c (split /\,/, $vspec) { - push(@$constraints, + push(@$constraints, OpenBSD::PkgSpec::versionspec->new($c)); } } @@ -207,7 +207,7 @@ sub add_flavor_constraints if ($flavorspec eq '') { # non constraint } else { - push(@$constraints, + push(@$constraints, OpenBSD::PkgSpec::flavorspec->new($flavorspec)); } } @@ -223,10 +223,10 @@ sub new $class->add_version_constraints($constraints, $r->{vspec}); $class->add_flavor_constraints($constraints, $r->{flavorspec}); - my $o = bless { - exactstem => qr{^$stemspec$}, - fuzzystem => qr{^$stemspec\-\d.*$}, - constraints => $constraints, + my $o = bless { + exactstem => qr{^$stemspec$}, + fuzzystem => qr{^$stemspec\-\d.*$}, + constraints => $constraints, }, $class; if (defined $r->{e}) { $o->{e} = 1; @@ -251,7 +251,7 @@ LOOP1: } push(@result, $s); } - + return @result; } @@ -269,7 +269,7 @@ LOOP2: } push(@$result, $s); } - + return $result; } @@ -284,7 +284,7 @@ sub subpattern_class sub new { my ($class, $pattern) = @_; - my @l = map { $class->subpattern_class->new($_) } + my @l = map { $class->subpattern_class->new($_) } (split /\|/o, $pattern); if (@l == 1) { return $l[0]; diff --git a/usr.sbin/pkg_add/OpenBSD/ProgressMeter.pm b/usr.sbin/pkg_add/OpenBSD/ProgressMeter.pm index e637b8bd24a..9aa2e118d32 100644 --- a/usr.sbin/pkg_add/OpenBSD/ProgressMeter.pm +++ b/usr.sbin/pkg_add/OpenBSD/ProgressMeter.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: ProgressMeter.pm,v 1.30 2010/03/22 20:38:44 espie Exp $ +# $OpenBSD: ProgressMeter.pm,v 1.31 2010/05/10 09:17:55 espie Exp $ # # Copyright (c) 2010 Marc Espie <espie@openbsd.org> # diff --git a/usr.sbin/pkg_add/OpenBSD/ProgressMeter/Term.pm b/usr.sbin/pkg_add/OpenBSD/ProgressMeter/Term.pm index a3cb3717342..1791fca25a5 100644 --- a/usr.sbin/pkg_add/OpenBSD/ProgressMeter/Term.pm +++ b/usr.sbin/pkg_add/OpenBSD/ProgressMeter/Term.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Term.pm,v 1.2 2010/03/23 08:11:04 espie Exp $ +# $OpenBSD: Term.pm,v 1.3 2010/05/10 09:17:55 espie Exp $ # # Copyright (c) 2004-2007 Marc Espie <espie@openbsd.org> # @@ -67,7 +67,7 @@ sub init return unless defined $ENV{TERM} || defined $ENV{TERMCAP}; my $termios = POSIX::Termios->new; $termios->getattr(0); - $self->{terminal} = Term::Cap->Tgetent({ OSPEED => + $self->{terminal} = Term::Cap->Tgetent({ OSPEED => $termios->getospeed}); $self->{glitch} = $self->{terminal}->Tputs("xn", 1); $self->{cleareol} = $self->{terminal}->Tputs("ce", 1); @@ -86,7 +86,7 @@ sub find_window_size $sizeof{'struct winsize'} = 8; require 'sys/ttycom.ph'; if (ioctl(STDOUT, &TIOCGWINSZ, $r)) { - my ($rows, $cols, $xpix, $ypix) = + my ($rows, $cols, $xpix, $ypix) = unpack($wsz_format, $r); $self->{width} = $cols; } else { @@ -156,7 +156,7 @@ sub _show } my $prefix; if (!$self->{continued} && defined $self->{hpa}) { - if (defined $stars && defined $self->{stars}) { + if (defined $stars && defined $self->{stars}) { $prefix = length($self->{header})+1+$self->{stars}; } else { $prefix = length($self->{header}); @@ -262,7 +262,7 @@ sub visit_with_size $progress->show($donesize + $done, $plist->{totsize}); }; } - $plist->size_and($progress, \$donesize, $plist->{totsize}, + $plist->size_and($progress, \$donesize, $plist->{totsize}, $method, $state, @r); } @@ -272,7 +272,7 @@ sub visit_with_count $plist->{total} //= compute_count($plist); my $count = 0; $progress->show($count, $plist->{total}); - $plist->count_and($progress, \$count, $plist->{total}, + $plist->count_and($progress, \$count, $plist->{total}, $method, $state, @r); } 1; diff --git a/usr.sbin/pkg_add/OpenBSD/Replace.pm b/usr.sbin/pkg_add/OpenBSD/Replace.pm index 593c144ee5f..079371757b2 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.70 2010/03/22 20:38:44 espie Exp $ +# $OpenBSD: Replace.pm,v 1.71 2010/05/10 09:17:55 espie Exp $ # # Copyright (c) 2004-2010 Marc Espie <espie@openbsd.org> # @@ -25,7 +25,7 @@ sub can_update my ($self, $installing, $state) = @_; my $issue = $self->update_issue($installing); - + if (defined $issue) { push(@{$state->{journal}}, $issue); } @@ -55,7 +55,7 @@ sub extract $state->{archive}->skip; return; } - + $self->SUPER::extract($state); # figure out a safe directory where to put the temp file @@ -66,7 +66,7 @@ sub extract $d = dirname($d); } if ($state->{not}) { - $state->say("extracting tempfile under $d") + $state->say("extracting tempfile under $d") if $state->verbose >= 3; $state->{archive}->skip; } else { @@ -95,7 +95,7 @@ sub extract return if -e $destdir.$fullname; $self->SUPER::extract($state); - $state->say("new directory ", $destdir, $fullname) + $state->say("new directory ", $destdir, $fullname) if $state->verbose >= 3; return if $state->{not}; File::Path::mkpath($destdir.$fullname); @@ -114,14 +114,14 @@ sub extract package OpenBSD::PackingElement::ScriptFile; sub update_issue -{ +{ my ($self, $installing) = @_; return $self->name." script"; } package OpenBSD::PackingElement::FINSTALL; sub update_issue -{ +{ my ($self, $installing) = @_; return if !$installing; return $self->SUPER::update_issue($installing); @@ -129,7 +129,7 @@ sub update_issue package OpenBSD::PackingElement::FDEINSTALL; sub update_issue -{ +{ my ($self, $installing) = @_; return if $installing; return $self->SUPER::update_issue($installing); @@ -137,7 +137,7 @@ sub update_issue package OpenBSD::PackingElement::Exec; sub update_issue -{ +{ my ($self, $installing) = @_; return if !$installing; return '@'.$self->keyword.' '.$self->{expanded}; @@ -148,7 +148,7 @@ sub update_issue { undef } package OpenBSD::PackingElement::Unexec; sub update_issue -{ +{ my ($self, $installing) = @_; return if $installing; @@ -179,7 +179,7 @@ sub check_plist_exec $plist->can_update($new, $state); return 1 if @{$state->{journal}} == 0; - $state->errsay($new ? "New": "Old", " package ", $plist->pkgname, + $state->errsay($new ? "New": "Old", " package ", $plist->pkgname, " contains potentially unsafe operations"); for my $i (@{$state->{journal}}) { $state->errsay("| ", $i); @@ -228,7 +228,7 @@ sub is_set_safe return 0; } } else { - $state->errsay("Cannot install ", $set->print, + $state->errsay("Cannot install ", $set->print, " (use -D update)"); return 0; } diff --git a/usr.sbin/pkg_add/OpenBSD/RequiredBy.pm b/usr.sbin/pkg_add/OpenBSD/RequiredBy.pm index 337cd34d8ce..5551e1aa3fc 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.20 2010/01/17 12:01:00 espie Exp $ +# $OpenBSD: RequiredBy.pm,v 1.21 2010/05/10 09:17:55 espie Exp $ # # Copyright (c) 2003-2005 Marc Espie <espie@openbsd.org> # @@ -29,8 +29,8 @@ sub fill_entries my $l = $self->{entries} = {}; if (-f $self->{filename}) { - open(my $fh, '<', $self->{filename}) or - croak ref($self), + open(my $fh, '<', $self->{filename}) or + croak ref($self), ": reading $self->{filename}: $!"; my $_; while(<$fh>) { @@ -70,7 +70,7 @@ sub synch $self->{nonempty} = 0; } return $self; -} +} sub list { diff --git a/usr.sbin/pkg_add/OpenBSD/Search.pm b/usr.sbin/pkg_add/OpenBSD/Search.pm index 278a53f4908..d3d186ebfab 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.21 2010/01/05 12:20:47 espie Exp $ +# $OpenBSD: Search.pm,v 1.22 2010/05/10 09:17:55 espie Exp $ # # Copyright (c) 2007 Marc Espie <espie@openbsd.org> # @@ -23,7 +23,7 @@ sub match_locations { my ($self, $o) = @_; require OpenBSD::PackageLocation; - + my @l = map {$o->new_location($_)} $self->match($o); return \@l; } @@ -133,7 +133,7 @@ sub filter require OpenBSD::PackageName; for my $pkg (@l) { if ($self->_keep(OpenBSD::PackageName::splitstem($pkg))) { - push(@result, $pkg); + push(@result, $pkg); } } return @result; @@ -230,7 +230,7 @@ sub { if ($f->pkgname->{version}->compare($e->pkgname->{version}) < 0) { $f = $e; - } + } $keep = 0; last; diff --git a/usr.sbin/pkg_add/OpenBSD/SharedItems.pm b/usr.sbin/pkg_add/OpenBSD/SharedItems.pm index 2b0b01cd545..63c75146e3f 100644 --- a/usr.sbin/pkg_add/OpenBSD/SharedItems.pm +++ b/usr.sbin/pkg_add/OpenBSD/SharedItems.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: SharedItems.pm,v 1.21 2009/12/24 14:37:28 espie Exp $ +# $OpenBSD: SharedItems.pm,v 1.22 2010/05/10 09:17:55 espie Exp $ # # Copyright (c) 2004-2006 Marc Espie <espie@openbsd.org> # @@ -36,7 +36,7 @@ sub find_items_in_installed_packages my $done = 0; for my $e (@list) { $state->progress->show($done, $total); - my $plist = OpenBSD::PackingList->from_installation($e, + my $plist = OpenBSD::PackingList->from_installation($e, \&OpenBSD::PackingList::SharedItemsOnly) or next; next if !defined $plist; $plist->record_shared($db, $e); @@ -90,7 +90,7 @@ sub cleanup $state->progress->show($done, $total); next if $remaining->{users}->{$user}; if ($state->{extra}) { - $state->system(OpenBSD::Paths->userdel, '--', + $state->system(OpenBSD::Paths->userdel, '--', $user); } else { $state->log->set_context($pkgname); diff --git a/usr.sbin/pkg_add/OpenBSD/SharedLibs.pm b/usr.sbin/pkg_add/OpenBSD/SharedLibs.pm index 64749c3de72..b25da036c7d 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.47 2010/01/24 15:31:38 espie Exp $ +# $OpenBSD: SharedLibs.pm,v 1.48 2010/05/10 09:17:55 espie Exp $ # # Copyright (c) 2003-2010 Marc Espie <espie@openbsd.org> # @@ -128,7 +128,7 @@ sub add_libs_from_installed_package my $pkgname = shift; return if $done_plist->{$pkgname}; $done_plist->{$pkgname} = 1; - my $plist = OpenBSD::PackingList->from_installation($pkgname, + my $plist = OpenBSD::PackingList->from_installation($pkgname, \&OpenBSD::PackingList::LibraryOnly); return if !defined $plist; diff --git a/usr.sbin/pkg_add/OpenBSD/Signature.pm b/usr.sbin/pkg_add/OpenBSD/Signature.pm index dfaaaf0fe8f..3b783c82338 100644 --- a/usr.sbin/pkg_add/OpenBSD/Signature.pm +++ b/usr.sbin/pkg_add/OpenBSD/Signature.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Signature.pm,v 1.5 2010/03/22 20:38:44 espie Exp $ +# $OpenBSD: Signature.pm,v 1.6 2010/05/10 09:17:55 espie Exp $ # # Copyright (c) 2010 Marc Espie <espie@openbsd.org> # @@ -175,7 +175,7 @@ package OpenBSD::LibSpec; sub compare { my ($a, $b) = @_; - + if ($a->key ne $b->key) { return undef; } diff --git a/usr.sbin/pkg_add/OpenBSD/Subst.pm b/usr.sbin/pkg_add/OpenBSD/Subst.pm index 78944305a02..a591b803c7d 100644 --- a/usr.sbin/pkg_add/OpenBSD/Subst.pm +++ b/usr.sbin/pkg_add/OpenBSD/Subst.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Subst.pm,v 1.8 2009/11/10 11:36:56 espie Exp $ +# $OpenBSD: Subst.pm,v 1.9 2010/05/10 09:17:55 espie Exp $ # # Copyright (c) 2008 Marc Espie <espie@openbsd.org> # diff --git a/usr.sbin/pkg_add/OpenBSD/Temp.pm b/usr.sbin/pkg_add/OpenBSD/Temp.pm index b3e9e67c829..c002d024a9b 100644 --- a/usr.sbin/pkg_add/OpenBSD/Temp.pm +++ b/usr.sbin/pkg_add/OpenBSD/Temp.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Temp.pm,v 1.17 2010/01/09 16:37:03 espie Exp $ +# $OpenBSD: Temp.pm,v 1.18 2010/05/10 09:17:55 espie Exp $ # # Copyright (c) 2003-2005 Marc Espie <espie@openbsd.org> # @@ -50,7 +50,7 @@ sub dir my $caught; my $h = sub { $caught = shift; }; my $dir; - + { local $SIG{'INT'} = $h; local $SIG{'QUIT'} = $h; @@ -71,7 +71,7 @@ sub file my $caught; my $h = sub { $caught = shift; }; my ($fh, $file); - + { local $SIG{'INT'} = $h; local $SIG{'QUIT'} = $h; diff --git a/usr.sbin/pkg_add/OpenBSD/Tracker.pm b/usr.sbin/pkg_add/OpenBSD/Tracker.pm index 3c10b52f851..78ffe09b130 100644 --- a/usr.sbin/pkg_add/OpenBSD/Tracker.pm +++ b/usr.sbin/pkg_add/OpenBSD/Tracker.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Tracker.pm,v 1.19 2009/12/30 17:37:36 espie Exp $ +# $OpenBSD: Tracker.pm,v 1.20 2010/05/10 09:17:55 espie Exp $ # # Copyright (c) 2009 Marc Espie <espie@openbsd.org> # @@ -25,7 +25,7 @@ # - otherwise, in update mode, put a request to update the package (e.g., # create a new UpdateSet. -# the Tracker object does maintain that information globally so that +# the Tracker object does maintain that information globally so that # Update/Dependencies can do its job. use strict; diff --git a/usr.sbin/pkg_add/OpenBSD/Update.pm b/usr.sbin/pkg_add/OpenBSD/Update.pm index e7e1675187f..b36cca1ed88 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.134 2010/01/26 15:03:39 espie Exp $ +# $OpenBSD: Update.pm,v 1.135 2010/05/10 09:17:55 espie Exp $ # # Copyright (c) 2004-2010 Marc Espie <espie@openbsd.org> # @@ -64,7 +64,7 @@ sub add_location { my ($self, $set, $handle, $location) = @_; - $self->add_handle($set, $handle, + $self->add_handle($set, $handle, OpenBSD::Handle->from_location($location)); } @@ -94,7 +94,7 @@ sub process_handle }; return 1 if $h->{update_found}; - my $plist = OpenBSD::PackingList->from_installation($pkgname, + my $plist = OpenBSD::PackingList->from_installation($pkgname, \&OpenBSD::PackingList::UpdateInfoOnly); if (!defined $plist) { Fatal("Can't locate $pkgname"); @@ -124,11 +124,11 @@ sub process_handle }; my $oldfound = 0; - # XXX this is nasty: maybe we added an old set to update - # because of conflicts, in which case the pkgpath + + # XXX this is nasty: maybe we added an old set to update + # because of conflicts, in which case the pkgpath + # conflict should be enough to "match". for my $n ($set->newer) { - if (($state->{hard_replace} || + if (($state->{hard_replace} || $n->location->update_info->match_pkgpath($plist)) && $n->plist->conflict_list->conflicts_with($sname)) { $self->add_handle($set, $h, $n); @@ -186,16 +186,16 @@ sub process_handle $h->{update_found} = $h; $set->move_kept($h); - $self->progress_message($state, + $self->progress_message($state, "No need to update $pkgname"); - + return 0; } return undef; } - $state->say("Update candidates: $pkgname -> ", + $state->say("Update candidates: $pkgname -> ", join(' ', map {$_->name} @$l), $state->ntogo) if $state->verbose; - + my $r = $state->choose_location($pkgname, $l); if (defined $r) { $self->add_location($set, $h, $r); @@ -267,7 +267,7 @@ sub process_hint2 ($repo, $pkgname) = OpenBSD::PackageLocator->path_parse($pkgname); $set->add_repositories($repo); }; - my $l = $state->updater->stem2location($set, $pkgname, $state, + my $l = $state->updater->stem2location($set, $pkgname, $state, $set->{quirks}); if (defined $l) { $self->add_location($set, $hint, $l); @@ -297,15 +297,15 @@ sub process_set if (@problems > 0) { $state->tracker->cant($set) if !$set->{quirks}; if ($set->{updates} != 0) { - $state->say("Can't update ", $set->print, - ": no update found for ", + $state->say("Can't update ", $set->print, + ": no update found for ", join(',', @problems)); } return 0; } elsif ($set->{updates} == 0) { $state->tracker->uptodate($set); return 0; - } + } $state->tracker->add_set($set); return 1; } @@ -319,5 +319,5 @@ sub stem2location } return $state->choose_location($name, $l, $is_quirks); } - + 1; diff --git a/usr.sbin/pkg_add/OpenBSD/UpdateSet.pm b/usr.sbin/pkg_add/OpenBSD/UpdateSet.pm index 8347fabad2a..e17fd345cfd 100644 --- a/usr.sbin/pkg_add/OpenBSD/UpdateSet.pm +++ b/usr.sbin/pkg_add/OpenBSD/UpdateSet.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: UpdateSet.pm,v 1.54 2010/04/05 16:07:10 espie Exp $ +# $OpenBSD: UpdateSet.pm,v 1.55 2010/05/10 09:17:55 espie Exp $ # # Copyright (c) 2007-2010 Marc Espie <espie@openbsd.org> # @@ -65,14 +65,14 @@ package OpenBSD::UpdateSet; sub new { my $class = shift; - return bless {newer => {}, older => {}, kept => {}, hints => [], updates => 0}, + return bless {newer => {}, older => {}, kept => {}, hints => [], updates => 0}, $class; } sub path { my $set = shift; - + return $set->{path}; } @@ -241,8 +241,8 @@ sub hint_names sub older_to_do { my $self = shift; - # XXX in `combined' updates, some dependencies may remove extra - # packages, so we do a double-take on the list of packages we + # XXX in `combined' updates, some dependencies may remove extra + # packages, so we do a double-take on the list of packages we # are actually replacing... for now, until we merge update sets. require OpenBSD::PackageInfo; my @l = (); @@ -307,7 +307,7 @@ sub validate_plists $state->vstat->tally; # okay, let's retry the other way around if we haven't yet if (!defined $state->{delete_first}) { - if ($state->{defines}->{deletefirst} || + if ($state->{defines}->{deletefirst} || $state->confirm("Delete older packages first", 0)) { $state->{delete_first} = 1; $state->vstat->drop_changes; diff --git a/usr.sbin/pkg_add/OpenBSD/Ustar.pm b/usr.sbin/pkg_add/OpenBSD/Ustar.pm index 80348f9e8e2..1a5db7210b2 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.55 2010/03/22 20:38:44 espie Exp $ +# $OpenBSD: Ustar.pm,v 1.56 2010/05/10 09:17:55 espie Exp $ # # Copyright (c) 2002-2007 Marc Espie <espie@openbsd.org> # @@ -146,7 +146,7 @@ sub next $prefix =~ s/\0*$//o; $name = "$prefix/$name"; } - + $size = oct($size); my $result= $self->new_object({ name => $name, @@ -182,7 +182,7 @@ sub split_name my $l = length $name; if ($l > MAXFILENAME && $l <= MAXFILENAME+MAXPREFIX+1) { - while (length($name) > MAXFILENAME && + while (length($name) > MAXFILENAME && $name =~ m/^(.*?\/)(.*)$/o) { $prefix .= $1; $name = $2; @@ -247,7 +247,7 @@ sub mkheader my $header; my $cksum = ' 'x8; for (1 .. 2) { - $header = pack(USTAR_HEADER, + $header = pack(USTAR_HEADER, $name, sprintf("%07o", $entry->{mode}), sprintf("%07o", $entry->{uid}), @@ -274,11 +274,11 @@ sub prepare my $realname = "$self->{destdir}/$filename"; - my ($dev, $ino, $mode, $uid, $gid, $rdev, $size, $mtime) = + my ($dev, $ino, $mode, $uid, $gid, $rdev, $size, $mtime) = (lstat $realname)[0,1,2,4,5,6, 7,9]; my $entry = $self->new_object({ - key => "$dev/$ino", + key => "$dev/$ino", name => $filename, realname => $realname, mode => $mode, @@ -448,7 +448,7 @@ sub isFifo() { 0 } sub isLink() { 0 } sub isSymLink() { 0 } sub isHardLink() { 0 } - + package OpenBSD::Ustar::Dir; our @ISA=qw(OpenBSD::Ustar::Object); @@ -504,7 +504,7 @@ sub create { my $self = shift; $self->make_basedir($self->name); - symlink $self->{linkname}, $self->{destdir}.$self->name or + symlink $self->{linkname}, $self->{destdir}.$self->name or die "Can't symlink $self->{linkname} to $self->{destdir}", $self->name, ": $!"; } @@ -537,8 +537,8 @@ sub create { my $self = shift; $self->make_basedir($self->name); - system(OpenBSD::Paths->mknod, - '-m', $self->{mode}, '--', $self->{destdir}.$self->name, + system(OpenBSD::Paths->mknod, + '-m', $self->{mode}, '--', $self->{destdir}.$self->name, $self->devicetype, $self->{major}, $self->{minor}); $self->set_modes; } @@ -599,7 +599,7 @@ START: $i += $bs; $seek_forward += $bs; } - defined(sysseek($fh, $seek_forward, 1)) + defined(sysseek($fh, $seek_forward, 1)) or return 0; $buffer = substr($buffer, $i); if (length $buffer == 0) { @@ -663,11 +663,11 @@ sub create die "Error writing to $self->{destdir}", $self->name, ": $!"; } - + $toread -= $actual; $self->todo($toread); } - $out->close or die "Error closing $self->{destdir}", $self->name, + $out->close or die "Error closing $self->{destdir}", $self->name, ": $!"; $self->set_modes; } @@ -712,12 +712,12 @@ sub write_contents unless (print $out $buffer) { die "Error writing to archive: $!"; } - + $toread -= $actual; $self->todo($toread); } if ($size % 512) { - print $out "\0" x (512 - $size % 512) or + print $out "\0" x (512 - $size % 512) or die "Error writing to archive: $!"; } } @@ -743,11 +743,11 @@ sub copy_contents unless (print $out $buffer) { die "Error writing to archive $!"; } - + $toread -= $actual; } if ($size % 512) { - print $out "\0" x (512 - $size % 512) or + print $out "\0" x (512 - $size % 512) or die "Error writing to archive: $!"; } $self->alias($arc, $self->name); diff --git a/usr.sbin/pkg_add/OpenBSD/Vstat.pm b/usr.sbin/pkg_add/OpenBSD/Vstat.pm index efa2c70c7bf..c0f726afd52 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.57 2010/04/05 13:46:24 espie Exp $ +# $OpenBSD: Vstat.pm,v 1.58 2010/05/10 09:17:55 espie Exp $ # # Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org> # @@ -358,7 +358,7 @@ sub noexec sub new { my ($class, $dev, $opts) = @_; - my $n = bless { commited_use => 0, used => 0, delayed => 0, + my $n = bless { commited_use => 0, used => 0, delayed => 0, hw => 0, dev => $dev }, $class; if (defined $opts) { $n->parse_opts($opts); @@ -384,7 +384,7 @@ sub report_ro my ($s, $state, $fname) = @_; if ($state->verbose >= 3 or ++($s->{problems}) < 4) { - $state->errsay("Error: ", $s->name, + $state->errsay("Error: ", $s->name, " is read-only ($fname)"); } elsif ($s->{problems} == 4) { $state->errsay("Error: ... more files on ", $s->name); @@ -400,7 +400,7 @@ sub report_overflow $state->errsay("Error: ", $s->name, " is not large enough ($fname)"); } elsif ($s->{problems} == 4) { - $state->errsay("Error: ... more files do not fit on ", + $state->errsay("Error: ... more files do not fit on ", $s->name); } $state->{problems}++; @@ -440,7 +440,7 @@ sub tally return if $data->{used} == 0; $state->print($data->name, ": ", $data->{used}, " bytes"); - my $avail = $data->avail; + my $avail = $data->avail; if ($avail < 0) { $state->print(" (missing ", int(-$avail+1), " blocks)"); } elsif ($data->{hw} >0 && $data->{hw} > $data->{used}) { diff --git a/usr.sbin/pkg_add/OpenBSD/md5.pm b/usr.sbin/pkg_add/OpenBSD/md5.pm index 90d84fbb1a5..22448acd390 100644 --- a/usr.sbin/pkg_add/OpenBSD/md5.pm +++ b/usr.sbin/pkg_add/OpenBSD/md5.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: md5.pm,v 1.8 2009/12/31 11:31:03 espie Exp $ +# $OpenBSD: md5.pm,v 1.9 2010/05/10 09:17:55 espie Exp $ # # Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org> # diff --git a/usr.sbin/pkg_add/OpenBSD/x509.pm b/usr.sbin/pkg_add/OpenBSD/x509.pm index 532489c0f3c..c300ebefe60 100644 --- a/usr.sbin/pkg_add/OpenBSD/x509.pm +++ b/usr.sbin/pkg_add/OpenBSD/x509.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: x509.pm,v 1.4 2009/12/20 22:38:45 espie Exp $ +# $OpenBSD: x509.pm,v 1.5 2010/05/10 09:17:55 espie Exp $ # # Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org> # @@ -33,8 +33,8 @@ sub compute_signature open my $fh, ">", $plist->infodir.CONTENTS; $plist->write_no_sig($fh); close $fh; - open(my $sighandle, "-|", OpenBSD::Paths->openssl, "smime", "-sign", - "-binary", "-signer", $cert ,"-in", $plist->infodir.CONTENTS, + open(my $sighandle, "-|", OpenBSD::Paths->openssl, "smime", "-sign", + "-binary", "-signer", $cert ,"-in", $plist->infodir.CONTENTS, "-inkey", $key, "-outform", "DEM") or die; my $sig; sysread($sighandle, $sig, 16384); @@ -47,10 +47,10 @@ sub dump_certificate_info { my $fname2 = shift; - open my $fh, "-|", OpenBSD::Paths->openssl, "asn1parse", + open my $fh, "-|", OpenBSD::Paths->openssl, "asn1parse", "-inform", "DEM", "-in", $fname2; - my %want = map {($_, 1)} - qw(countryName localityName organizationName + my %want = map {($_, 1)} + qw(countryName localityName organizationName organizationalUnitName commonName emailAddress); while (<$fh>) { if (m/\sprim\:\s+OBJECT\s*\:(.*)\s*$/) { @@ -105,7 +105,7 @@ sub check_signature print $fh2 decode_base64($sig->{b64sig}); close $fh; close $fh2; - if (system_quiet (OpenBSD::Paths->openssl, "smime", "-verify", + if (system_quiet (OpenBSD::Paths->openssl, "smime", "-verify", "-binary", "-inform", "DEM", "-in", $fname2, "-content", $fname, "-CAfile", OpenBSD::Paths->pkgca, "-out", "/dev/null") != 0) { $state->log->warn("Bad signature"); diff --git a/usr.sbin/pkg_add/pkg b/usr.sbin/pkg_add/pkg index 0f6d8dc2d60..ee4c327c40c 100644 --- a/usr.sbin/pkg_add/pkg +++ b/usr.sbin/pkg_add/pkg @@ -1,6 +1,6 @@ #! /usr/bin/perl # ex:ts=8 sw=4: -# $OpenBSD: pkg,v 1.11 2009/11/10 11:36:56 espie Exp $ +# $OpenBSD: pkg,v 1.12 2010/05/10 09:17:54 espie Exp $ # # Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org> # diff --git a/usr.sbin/pkg_add/pkg.1 b/usr.sbin/pkg_add/pkg.1 index db9ebcd5462..939697fcb63 100644 --- a/usr.sbin/pkg_add/pkg.1 +++ b/usr.sbin/pkg_add/pkg.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: pkg.1,v 1.3 2007/05/31 19:20:26 jmc Exp $ +.\" $OpenBSD: pkg.1,v 1.4 2010/05/10 09:17:54 espie Exp $ .\" .\" Copyright (c) 2001-2004 Marc Espie <espie@openbsd.org> .\" @@ -14,7 +14,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: May 31 2007 $ +.Dd $Mdocdate: May 10 2010 $ .Dt PKG 1 .Os .Sh NAME diff --git a/usr.sbin/pkg_add/pkg_add b/usr.sbin/pkg_add/pkg_add index b9add7619bf..09ac8fcb993 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.477 2010/04/17 16:07:18 espie Exp $ +# $OpenBSD: pkg_add,v 1.478 2010/05/10 09:17:54 espie Exp $ # # Copyright (c) 2003-2010 Marc Espie <espie@openbsd.org> # @@ -43,7 +43,7 @@ sub uses_old_libs my $plist = shift; require OpenBSD::RequiredBy; - return grep {/^\.libs\d*\-/o} + return grep {/^\.libs\d*\-/o} OpenBSD::Requiring->new($plist->pkgname)->list; } @@ -54,7 +54,7 @@ sub has_different_sig my $n = OpenBSD::PackingList->from_installation($plist->pkgname)->signature; my $o = $plist->signature; my $r = $n->compare($o); - $state->print("Comparing full signature for ", + $state->print("Comparing full signature for ", $plist->pkgname, " \"", $o->string, "\" vs. \"", $n->string,"\": ") if $state->verbose >= 3; @@ -204,7 +204,7 @@ sub setup_header if (!defined $info) { $header = "Adding $header"; } - if (defined $state->{lastheader} && + if (defined $state->{lastheader} && $header eq $state->{lastheader}) { return; } @@ -227,10 +227,10 @@ sub complete my $pkgname = $n->pkgname; my $plist = $n->plist; return 1 if !defined $plist; - if (is_installed($pkgname) && - (!$state->{allow_replacing} || + if (is_installed($pkgname) && + (!$state->{allow_replacing} || !$state->{defines}->{installed} && - !$plist->has_different_sig($state) && + !$plist->has_different_sig($state) && !$plist->uses_old_libs)) { my $o = $set->{older}->{$pkgname}; if (!defined $o) { @@ -239,12 +239,12 @@ sub complete } $o->{update_found} = $o; $set->move_kept($o); - $o->{tweaked} = + $o->{tweaked} = OpenBSD::Add::tweak_package_status($pkgname, $state); $state->updater->progress_message($state, "No change in $pkgname"); delete $set->{newer}->{$pkgname}; $n->cleanup; - } + } return 1 if $n->has_error; } for my $o ($set->older) { @@ -337,7 +337,7 @@ sub install_issues if (!$state->{allow_replacing}) { if (grep { !/^.libs\d*\-/ && !/^partial\-/ } @conflicts) { if (!$set->is_an_update_from(@conflicts)) { - $state->errsay("Can't install ", $set->print, + $state->errsay("Can't install ", $set->print, " because of conflicts (", join(',', @conflicts), ")"); return "conflicts"; @@ -348,7 +348,7 @@ sub install_issues my $later = 0; for my $toreplace (@conflicts) { if ($state->tracker->is_installed($toreplace)) { - $state->errsay("Cannot replace $toreplace in ", + $state->errsay("Cannot replace $toreplace in ", $set->print, ": just got installed"); return "replacing just installed"; } @@ -361,7 +361,7 @@ sub install_issues if (defined $s && $s ne $set) { $set->merge($state->tracker, $s); } else { - $set->add_older(OpenBSD::Handle->create_old($toreplace, + $set->add_older(OpenBSD::Handle->create_old($toreplace, $state)); } } @@ -373,7 +373,7 @@ sub install_issues for my $old ($set->older) { my $name = $old->pkgname; - + if ($old->has_error(OpenBSD::Handle::NOT_FOUND)) { Fatal "Can't find $name as an installed package\n"; } @@ -450,7 +450,7 @@ sub check_forward_dependencies sub recheck_conflicts { my ($set, $state) = @_; - + # no conflicts between newer sets nor kept sets for my $h ($set->newer, $set->kept) { for my $h2 ($set->newer, $set->kept) { @@ -559,7 +559,7 @@ sub check_x509_signature } else { require OpenBSD::x509; - if (!OpenBSD::x509::check_signature($plist, + if (!OpenBSD::x509::check_signature($plist, $state)) { Fatal "fatal issues in ", $set->print; } @@ -590,7 +590,7 @@ sub delete_old_packages } catchall { $state->errprint($_); Fatal partial_install( - "Deinstallation of $oldname failed", + "Deinstallation of $oldname failed", $set, $state); }; @@ -617,13 +617,13 @@ sub really_add } $set->setup_header($state); - # XXX in `combined' updates, some dependencies may remove extra - # packages, so we do a double-take on the list of packages we + # XXX in `combined' updates, some dependencies may remove extra + # packages, so we do a double-take on the list of packages we # are actually replacing. my $replacing = 0; if ($set->older_to_do) { $replacing = 1; - } + } # if (defined $plist->{old_libs}) { # $replacing = 1; # } @@ -652,7 +652,7 @@ sub really_add $set->setup_header($state, $handle, "extracting"); try { - OpenBSD::Replace::perform_extraction($handle, + OpenBSD::Replace::perform_extraction($handle, $state); } catchall { unless ($state->{interrupted}) { @@ -741,7 +741,7 @@ sub newer_has_errors if ($handle->has_error) { $state->set_name_from_handle($handle); $state->log("Can't install ", $handle->pkgname, ": ", - $handle->error_message, "\n"); + $handle->error_message, "\n"); $bad++; $set->cleanup($handle->has_error); $state->tracker->cant($set); @@ -809,7 +809,7 @@ sub install_set $set->cleanup(OpenBSD::Handle::CANT_INSTALL); $state->tracker->cant($set); return (); - } + } if ($r == 0) { return $set; } @@ -861,7 +861,7 @@ sub install_set if (!$set->validate_plists($state)) { $bad++; - $set->cleanup(OpenBSD::Handle::CANT_INSTALL, + $set->cleanup(OpenBSD::Handle::CANT_INSTALL, "file issues"); $state->tracker->cant($set); return (); @@ -896,7 +896,7 @@ if ($opt_P) { if ($opt_P eq 'cdrom') { $state->{cdrom_only} = 1; } - elsif ($opt_P eq 'ftp') { + elsif ($opt_P eq 'ftp') { $state->{ftp_only} = 1; } else { @@ -1020,7 +1020,7 @@ sub process_parameters # actual names for my $pkgname (@ARGV) { next if $pkgname =~ m/^quirks\-\d/; - push(@todo2, + push(@todo2, OpenBSD::UpdateSet->new->$add_hints($pkgname)); } } @@ -1033,16 +1033,16 @@ sub finish_display # and display delayed thingies. if ($state->{packages_with_sig}) { - $state->print("Packages with signatures: ", + $state->print("Packages with signatures: ", $state->{packages_with_sig}); if ($state->{packages_without_sig}) { - print ". UNSIGNED PACKAGES: ", + print ". UNSIGNED PACKAGES: ", join(', ', keys %{$state->{packages_without_sig}}); } print "\n"; } if (defined $state->{updatedepends} && %{$state->{updatedepends}}) { - print "Forced updates, bogus dependencies for ", + print "Forced updates, bogus dependencies for ", join(' ', sort(keys %{$state->{updatedepends}})), " may remain\n"; } diff --git a/usr.sbin/pkg_add/pkg_audit b/usr.sbin/pkg_add/pkg_audit index 084d047e2d0..73a1c7b32f0 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.7 2009/11/10 11:36:56 espie Exp $ +# $OpenBSD: pkg_audit,v 1.8 2010/05/10 09:17:55 espie Exp $ # # Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org> # @@ -27,7 +27,7 @@ my %found; print "Scanning packages\n"; for my $pkg (installed_packages()) { - my $plist = OpenBSD::PackingList->from_installation($pkg, + my $plist = OpenBSD::PackingList->from_installation($pkg, \&OpenBSD::PackingList::FilesOnly); print "$pkg...\n"; for my $item (@{$plist->{items}}) { @@ -42,7 +42,7 @@ find(sub { if ($found{$File::Find::name}) { delete $found{$File::Find::name}; } else { - print $File::Find::name, "\n" + print $File::Find::name, "\n" } }, '/usr/local'); diff --git a/usr.sbin/pkg_add/pkg_create b/usr.sbin/pkg_add/pkg_create index 902f1fa9521..c91a3bececa 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.138 2010/04/05 16:07:10 espie Exp $ +# $OpenBSD: pkg_create,v 1.139 2010/05/10 09:17:55 espie Exp $ # # Copyright (c) 2003-2010 Marc Espie <espie@openbsd.org> # @@ -35,7 +35,7 @@ package OpenBSD::State; sub new { my $class = shift; - bless {progress => OpenBSD::ProgressMeter->new, + bless {progress => OpenBSD::ProgressMeter->new, errors => 0, stash => {}}, $class; } @@ -60,7 +60,7 @@ sub error # Extra stuff needed to archive files package OpenBSD::PackingElement; -sub create_package +sub create_package { my ($self, $state) = @_; @@ -145,14 +145,14 @@ sub verify_checksum_with_base if ((defined $check->{$field} && defined $self->{$field} && $check->{$field} ne $self->{$field}) || (defined $check->{$field} xor defined $self->{$field})) { - $state->error("Error: $field inconsistency for ", + $state->error("Error: $field inconsistency for ", $self->fullname); } } if ((defined $check->{d} && defined $self->{d} && !$check->{d}->equals($self->{d})) || (defined $check->{d} xor defined $self->{d})) { - $state->error("Error: checksum inconsistency for ", + $state->error("Error: checksum inconsistency for ", $self->fullname); } } @@ -340,7 +340,7 @@ sub avert_duplicates_and_other_checks { my ($self, $state) = @_; if (!$self->spec->is_valid) { - $state->error("Error in packing-list: invalid \@", + $state->error("Error in packing-list: invalid \@", $self->keyword, " ", $self->stringize); } $self->SUPER::avert_duplicates_and_other_checks($state); @@ -359,7 +359,7 @@ sub avert_duplicates_and_other_checks my @issues = OpenBSD::PackageName->from_string($self->{def})->has_issues; if (@issues > 0) { - $state->error("Error in packing-list: invalid \@", + $state->error("Error in packing-list: invalid \@", $self->keyword, " ", $self->stringize, "\n", "$self->{def}: , ", join(' ', @issues)); } @@ -374,7 +374,7 @@ sub avert_duplicates_and_other_checks my @issues = OpenBSD::PackageName->from_string($self->name)->has_issues; if (@issues > 0) { - $state->error("Bad packagename ", $self->name, ":", + $state->error("Bad packagename ", $self->name, ":", join(' ', @issues)); } $self->SUPER::avert_duplicates_and_other_checks($state); @@ -483,7 +483,7 @@ sub read_fragments if (m/^(\@comment\s+\$(?:Open)BSD\$)$/o) { $_ = '@comment $'.'OpenBSD: '.basename($file->name).',v$'; } - if (m/^\@lib\s+(.*)$/o && + if (m/^\@lib\s+(.*)$/o && OpenBSD::PackingElement::Lib->parse($1)) { $state->error("Shared library without SHARED_LIBS: $_"); } @@ -559,10 +559,10 @@ set_usage( '-d desc -D COMMENT=value -f packinglist -p prefix pkg-name'); my $plist = new OpenBSD::PackingList; -try { - getopts('p:f:d:vM:U:hs:A:L:B:D:P:W:nqQx', - {'D' => - sub { +try { + getopts('p:f:d:vM:U:hs:A:L:B:D:P:W:nqQx', + {'D' => + sub { $subst->parse_option(shift); }, 'f' => @@ -581,7 +581,7 @@ try { 's' => sub { push(@signature_params, shift); } - }); + }); } catchall { Usage($_); }; @@ -593,7 +593,7 @@ if (@ARGV == 0) { $regen_package = 1; } elsif (@ARGV != 1) { if (@contents || @signature_params == 0) { - Usage "Exactly one single package name is required: ", + Usage "Exactly one single package name is required: ", join(' ', @ARGV); } } @@ -601,7 +601,7 @@ if (@ARGV == 0) { try { if (@signature_params > 0) { - if (@signature_params != 3 || $signature_params[0] ne 'x509' || + if (@signature_params != 3 || $signature_params[0] ne 'x509' || !-f $signature_params[1] || !-f $signature_params[2]) { Usage "Signature only works as -s x509 -s cert -s privkey"; } @@ -632,7 +632,7 @@ if ($regen_package) { } else { $plist->set_infodir(dirname($contents[0])); } - $plist->fromfile($contents[0]) or + $plist->fromfile($contents[0]) or Fatal "Can't read packing list $contents[0]"; } elsif ($sign_only) { if ($opt_n) { @@ -649,7 +649,7 @@ if ($regen_package) { $plist->set_infodir($dir); my $sig = OpenBSD::PackingElement::DigitalSignature->new_x509; $sig->add_object($plist); - $sig->{b64sig} = OpenBSD::x509::compute_signature($plist, + $sig->{b64sig} = OpenBSD::x509::compute_signature($plist, $cert, $privkey); $plist->save; my $tmp = OpenBSD::Temp::permanent_file(".", "pkg"); @@ -660,7 +660,7 @@ if ($regen_package) { $wrarc->close; $true_package->wipe_info; unlink($plist->pkgname.".tgz"); - rename($tmp, $plist->pkgname.".tgz") or + rename($tmp, $plist->pkgname.".tgz") or die "Can't create final signed package $!"; } exit(0); @@ -698,7 +698,7 @@ if ($regen_package) { $plist->set_pkgname($pkgname); } my $fullpkgpath = $subst->value('FULLPKGPATH'); - my $cdrom = $subst->value('PERMIT_PACKAGE_CDROM') || + my $cdrom = $subst->value('PERMIT_PACKAGE_CDROM') || $subst->value('CDROM');; my $ftp = $subst->value('PERMIT_PACKAGE_FTP') || $subst->value('FTP'); @@ -709,7 +709,7 @@ if ($regen_package) { $cdrom = 'yes' if $cdrom =~ m/^yes$/io; $ftp = 'yes' if $ftp =~ m/^yes$/io; - OpenBSD::PackingElement::ExtraInfo->add($plist, + OpenBSD::PackingElement::ExtraInfo->add($plist, $fullpkgpath, $cdrom, $ftp); } else { Warn "Package without FULLPKGPATH\n"; @@ -724,10 +724,10 @@ if ($regen_package) { } } for my $contentsfile (@contents) { - read_fragments($plist, $contentsfile) or + read_fragments($plist, $contentsfile) or Fatal "Can't read packing list $contentsfile"; } -} +} my $base = '/'; @@ -792,7 +792,7 @@ if (defined $cert) { $sig->{b64sig} = OpenBSD::x509::compute_signature($plist, $cert, $privkey); $plist->save if $regen_package; } - + my $wname; if ($regen_package) { $wname = $plist->pkgname.".tgz"; @@ -806,8 +806,8 @@ if ($opt_n) { $plist->pretend_to_archive($state); } else { print "Creating gzip'd tar ball in '$wname'\n" if $opt_v; - my $h = sub { - unlink $wname; + my $h = sub { + unlink $wname; my $caught = shift; $SIG{$caught} = 'DEFAULT'; kill $caught, $$; diff --git a/usr.sbin/pkg_add/pkg_create.1 b/usr.sbin/pkg_add/pkg_create.1 index d012dade90f..75b94ea7b1a 100644 --- a/usr.sbin/pkg_add/pkg_create.1 +++ b/usr.sbin/pkg_add/pkg_create.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: pkg_create.1,v 1.60 2010/02/28 15:35:41 jmc Exp $ +.\" $OpenBSD: pkg_create.1,v 1.61 2010/05/10 09:17:55 espie Exp $ .\" .\" Documentation and design originally from FreeBSD. All the code has .\" been rewritten since. We keep the documentation's notice: @@ -21,7 +21,7 @@ .\" [jkh] Took John's changes back and made some additional extensions for .\" better integration with FreeBSD's new ports collection. .\" -.Dd $Mdocdate: February 28 2010 $ +.Dd $Mdocdate: May 10 2010 $ .Dt PKG_CREATE 1 .Os .Sh NAME diff --git a/usr.sbin/pkg_add/pkg_delete b/usr.sbin/pkg_add/pkg_delete index b0fba068f20..fefb945016c 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.133 2010/01/10 21:27:59 espie Exp $ +# $OpenBSD: pkg_delete,v 1.134 2010/05/10 09:17:55 espie Exp $ # # Copyright (c) 2003-2010 Marc Espie <espie@openbsd.org> # @@ -69,7 +69,7 @@ my @todo; sub process_parameters { - OpenBSD::PackageInfo::solve_installed_names(\@ARGV, \@realnames, + OpenBSD::PackageInfo::solve_installed_names(\@ARGV, \@realnames, "(removing them all)", $state); @todo = OpenBSD::RequiredBy->compute_closure(@realnames); @@ -78,7 +78,7 @@ sub process_parameters my $details = $state->verbose >= 2 || $defines{verbosedeps}; my $show = sub { my ($p, $d) = @_; - $state->say("Can't remove ", join(' ', @$p), + $state->say("Can't remove ", join(' ', @$p), " without also removing:\n", join(' ', @$d)); }; @@ -88,7 +88,7 @@ sub process_parameters delete $deps{$p}; } &$show([@realnames], [keys %deps]); - if (@realnames > 1 && (keys %deps) > 1 && + if (@realnames > 1 && (keys %deps) > 1 && $state->confirm("Do you want details", 1)) { $details = 1; } @@ -102,7 +102,7 @@ sub process_parameters } } my $them = @todo > 1 ? 'them' : 'it'; - if ($defines{dependencies} or + if ($defines{dependencies} or $state->confirm("Do you want to remove $them as well", 0)) { $state->say("(removing $them as well)"); } else { @@ -153,9 +153,9 @@ sub { $state->status->object($pkgname); if (!$state->progress->set_header($pkgname)) { - $state->say($state->{not} ? - "Pretending to delete " : - "Deleting ", + $state->say($state->{not} ? + "Pretending to delete " : + "Deleting ", $pkgname) if $state->verbose; } $state->log->set_context('-'.$pkgname); diff --git a/usr.sbin/pkg_add/pkg_info b/usr.sbin/pkg_add/pkg_info index 9927bfb1d01..52ca8b1b366 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.93 2010/01/11 10:16:20 jmc Exp $ +# $OpenBSD: pkg_info,v 1.94 2010/05/10 09:17:55 espie Exp $ # # Copyright (c) 2003-2010 Marc Espie <espie@openbsd.org> # @@ -119,7 +119,7 @@ sub find_pkg my ($pkgname, $code) = @_; require OpenBSD::PackageRepository::Installed; - if (find_pkg_in(OpenBSD::PackageRepository::Installed->new, $pkgname, + if (find_pkg_in(OpenBSD::PackageRepository::Installed->new, $pkgname, $code)) { return; } @@ -128,7 +128,7 @@ sub find_pkg my $repo; if ($pkgname =~ m/[\/\:]/o) { - ($repo, $pkgname) = + ($repo, $pkgname) = OpenBSD::PackageLocator->path_parse($pkgname); } else { $repo = 'OpenBSD::PackageLocator'; @@ -202,12 +202,12 @@ sub filter_files my $search = shift; my @result = (); for my $arg (@_) { - find_pkg($arg, + find_pkg($arg, sub { my ($pkgname, $handle) = @_; my $plist = $handle->plist(\&OpenBSD::PackingList::FilesOnly); - + $plist->hunt_file($search, $pkgname, \@result); }); } @@ -220,12 +220,12 @@ sub manual_filter my @result = (); for my $arg (@_) { - find_pkg($arg, + find_pkg($arg, sub { my ($pkgname, $handle) = @_; my $plist = $handle->plist(\&OpenBSD::PackingList::ConflictOnly); - + push(@result, $pkgname) if $plist->has('manual-installation'); }); } @@ -238,7 +238,7 @@ sub add_to_path_info { my ($path, $pkgname) = @_; - $path_info->{$path} = [] unless + $path_info->{$path} = [] unless defined $path_info->{$path}; push(@{$path_info->{$path}}, $pkgname); } @@ -262,7 +262,7 @@ sub find_by_path } if ($plist->has('pkgpath')) { for my $p (@{$plist->{pkgpath}}) { - add_to_path_info($p->name, + add_to_path_info($p->name, $plist->pkgname); } } @@ -275,7 +275,7 @@ sub find_by_path } } -our ($opt_c, $opt_C, $opt_d, $opt_f, $opt_I, $opt_K, +our ($opt_c, $opt_C, $opt_d, $opt_f, $opt_I, $opt_K, $opt_L, $opt_Q, $opt_q, $opt_R, $opt_s, $opt_v, $opt_h, $opt_l, $opt_a, $opt_m, $opt_M, $opt_U, $opt_A, $opt_S, $opt_P, $opt_t); my $terse = 0; @@ -346,7 +346,7 @@ sub print_info } else { $plist = $handle->plist(\&OpenBSD::PackingList::FilesOnly); } - Fatal "Bad packing list for", $handle->url + Fatal "Bad packing list for", $handle->url unless defined $plist; } if ($opt_L) { @@ -390,7 +390,7 @@ sub print_info if (defined $plist->fullpkgpath) { print $plist->fullpkgpath; } else { - print STDERR $plist->pkgname, + print STDERR $plist->pkgname, " has no FULLPKGPATH\n"; } print "\n"; @@ -411,7 +411,7 @@ set_usage('pkg_info [-AaCcdfIKLMmPqRSstUv] [-E filename] [-e pkg-name] [-l str] my %defines; my $locked; -try { +try { getopts('cCdfF:hIKLmPQ:qRsSUve:E:Ml:aAt', {'e' => sub { @@ -431,8 +431,8 @@ try { push(@ARGV, @list); $terse = 1; }, - 'F' => sub { - for my $o (split /\,/o, shift) { + 'F' => sub { + for my $o (split /\,/o, shift) { $defines{$o} = 1; } }, @@ -444,15 +444,15 @@ try { push(@sought_files, File::Spec->rel2abs(shift)); } - }); + }); } catchall { Usage($_); }; lock_db(1, $opt_q) unless $locked or $defines{nolock}; -unless ($opt_c || $opt_M || $opt_U || $opt_d || $opt_f || $opt_I || - $opt_L || $opt_R || $opt_s || +unless ($opt_c || $opt_M || $opt_U || $opt_d || $opt_f || $opt_I || + $opt_L || $opt_R || $opt_s || $opt_S || $opt_P || $terse) { if (@ARGV == 0) { $opt_I = $opt_a = 1; diff --git a/usr.sbin/pkg_add/pkg_info.1 b/usr.sbin/pkg_add/pkg_info.1 index a3a7d4e2edd..1eedf10b59d 100644 --- a/usr.sbin/pkg_add/pkg_info.1 +++ b/usr.sbin/pkg_add/pkg_info.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: pkg_info.1,v 1.37 2010/01/11 10:16:20 jmc Exp $ +.\" $OpenBSD: pkg_info.1,v 1.38 2010/05/10 09:17:55 espie Exp $ .\" .\" Documentation and design originally from FreeBSD. All the code has .\" been rewritten since. We keep the documentation's notice: @@ -15,7 +15,7 @@ .\" Jordan K. Hubbard .\" .\" -.Dd $Mdocdate: January 11 2010 $ +.Dd $Mdocdate: May 10 2010 $ .Dt PKG_INFO 1 .Os .Sh NAME diff --git a/usr.sbin/pkg_add/pkg_merge b/usr.sbin/pkg_add/pkg_merge index cf75a12b05b..280df066fdf 100644 --- a/usr.sbin/pkg_add/pkg_merge +++ b/usr.sbin/pkg_add/pkg_merge @@ -1,11 +1,11 @@ #! /usr/bin/perl # Copyright (c) 2005-2007 Marc Espie <espie@openbsd.org> -# $OpenBSD: pkg_merge,v 1.13 2009/11/10 11:36:56 espie Exp $ -# +# $OpenBSD: pkg_merge,v 1.14 2010/05/10 09:17:55 espie Exp $ +# # 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 diff --git a/usr.sbin/pkg_add/pkg_merge.1 b/usr.sbin/pkg_add/pkg_merge.1 index ec0265241d9..1fdb3fe23c1 100644 --- a/usr.sbin/pkg_add/pkg_merge.1 +++ b/usr.sbin/pkg_add/pkg_merge.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: pkg_merge.1,v 1.6 2009/10/22 12:35:53 sobrado Exp $ +.\" $OpenBSD: pkg_merge.1,v 1.7 2010/05/10 09:17:55 espie Exp $ .\" Copyright (c) 2005 Marc Espie <espie@openbsd.org> .\" .\" Permission to use, copy, modify, and distribute this software for any @@ -13,7 +13,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: October 22 2009 $ +.Dd $Mdocdate: May 10 2010 $ .Dt PKG_MERGE 1 .Os .Sh NAME diff --git a/usr.sbin/pkg_add/pkg_mklocatedb b/usr.sbin/pkg_add/pkg_mklocatedb index 237c4cda531..769c9217a1b 100644 --- a/usr.sbin/pkg_add/pkg_mklocatedb +++ b/usr.sbin/pkg_add/pkg_mklocatedb @@ -1,11 +1,11 @@ #! /usr/bin/perl # Copyright (c) 2005-2010 Marc Espie <espie@openbsd.org> -# $OpenBSD: pkg_mklocatedb,v 1.23 2010/01/11 12:20:45 espie Exp $ -# +# $OpenBSD: pkg_mklocatedb,v 1.24 2010/05/10 09:17:55 espie Exp $ +# # 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 diff --git a/usr.sbin/pkg_add/pkg_mklocatedb.1 b/usr.sbin/pkg_add/pkg_mklocatedb.1 index b6c897dc941..615b65752fa 100644 --- a/usr.sbin/pkg_add/pkg_mklocatedb.1 +++ b/usr.sbin/pkg_add/pkg_mklocatedb.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: pkg_mklocatedb.1,v 1.10 2008/05/16 22:01:27 jmc Exp $ +.\" $OpenBSD: pkg_mklocatedb.1,v 1.11 2010/05/10 09:17:55 espie Exp $ .\" Copyright (c) 2005-2007 Marc Espie <espie@openbsd.org> .\" .\" Permission to use, copy, modify, and distribute this software for any @@ -13,7 +13,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: May 16 2008 $ +.Dd $Mdocdate: May 10 2010 $ .Dt PKG_MKLOCATEDB 1 .Os .Sh NAME |