prt-auf: fix the handling of locked ports
This commit is contained in:
parent
c8842b786d
commit
8d43e3cd4d
@ -14,7 +14,7 @@ use strict;
|
||||
my $title="prt-auf"; my $version=0.51; my $cache_ver="V5.1";
|
||||
my $CONFDIR = "/var/lib/pkg"; my $prtalias="/etc/prt-get.aliases";
|
||||
my $pkgdb="$CONFDIR/db"; my $prtlocker="$CONFDIR/prt-get.locker";
|
||||
my $prtcache="$CONFDIR/prt-get.cache"; my @LOCKED; my %ALIASES; my %DEPENDS;
|
||||
my $prtcache="$CONFDIR/prt-get.cache"; my %LOCKED; my %ALIASES; my %DEPENDS;
|
||||
my @allports; my %V_REPO; my %V_INST; my %DESC; my %SOFTDEPS;
|
||||
my @results; my $strf; my $ind; my $hh; my $portpath; my $built_pkg;
|
||||
my %osearch = ( cache=>0, regex=>0, path=>0, exact=>0, verbose=>0 );
|
||||
@ -113,7 +113,7 @@ if (($action =~ /^(listinst|listorphans|dependent)/) and
|
||||
if ($action =~ /^(current|isinst)$/) { print "$diffline\n"; next; }
|
||||
my ($diffN, $diffI, $diffR) = split(/ /, $diffline);
|
||||
next if (($osearch{filter}) and ($diffN !~ /$osearch{filter}/));
|
||||
next if ((grep {$_ eq $diffN} @LOCKED) and ($odepends{all}==0));
|
||||
next if (($LOCKED{$diffN}) and ($odepends{all}==0));
|
||||
printf "$format", $diffN, $diffI, $diffR if ($action eq "diff");
|
||||
printf "%s ", $diffN if ($action eq "quickdiff");
|
||||
}
|
||||
@ -140,7 +140,7 @@ if (($action =~ /^(listinst|listorphans|dependent)/) and
|
||||
my @fields = ("Name", "Repository", "Version", "Release", "Description",
|
||||
"Dependencies", "URL", "Optional Deps", "Maintainer",
|
||||
"Readme", "PreInstall", "PostInstall");
|
||||
for (my $i=0; $i<9; $i++) { printf $strf, $fields[$i], $results[$i]; }
|
||||
for (my $i=0; $i<9; $i++) { printf $strf, $fields[$i], $results[$i] unless ($results[$i] =~ /^\s*$/); }
|
||||
} elsif ($action eq "remove") {
|
||||
my %removed = %$ind;
|
||||
my @successes = grep { $removed{$_}==1 } keys %removed;
|
||||
@ -310,8 +310,8 @@ sub get_locked_and_aliased {
|
||||
close (AL);
|
||||
}
|
||||
if (-f $prtlocker) {
|
||||
open (LK, $prtlocker) or return;
|
||||
while (<LK>) { push (@LOCKED, $_) unless /^\s*$/; }
|
||||
open (LK, $prtlocker);
|
||||
while (<LK>) { chomp; $LOCKED{$_}=1 unless /^\s*$/; }
|
||||
close (LK);
|
||||
}
|
||||
}
|
||||
@ -355,7 +355,7 @@ sub printf_ports {
|
||||
foreach my $pp (@targets) {
|
||||
$p = (split /\//, $pp)[-1];
|
||||
@pstats = get_pkgfile_fields($pp,"all");
|
||||
$pstats[12] = (grep /^$p$/, @LOCKED) ? "yes" : "no";
|
||||
$pstats[12] = ($LOCKED{$p}) ? "yes" : "no";
|
||||
$pstats[13] = (grep /^$p$/, keys %V_INST) ? "yes" : "no";
|
||||
if (($pstats[13] eq "yes") and ($V_INST{$p} ne $V_REPO{$p})) {
|
||||
$pstats[13] = "diff" }
|
||||
@ -488,13 +488,13 @@ sub uninstall {
|
||||
foreach my $t (@targets) {
|
||||
($opkg{test} eq "no") ? system($PKGRM,$opkg{rargs},$t) : print "$PKGRM $opkg{rargs} $t\n";
|
||||
$removed{$t}=1 if ($?>>8 == 0);
|
||||
if ((grep /^$t$/, @LOCKED) and ($opkg{test} eq "no")) { port_unlock($t); }
|
||||
if (($LOCKED{$t}) and ($opkg{test} eq "no")) { port_unlock($t); }
|
||||
}
|
||||
return \%removed;
|
||||
}
|
||||
|
||||
sub port_lock {
|
||||
my %oldlocks = map { $_ => "L" } @LOCKED;
|
||||
my %oldlocks = map { $_ => "L" } keys %LOCKED;
|
||||
my @newlocks = grep { ! defined $oldlocks{$_} } @_;
|
||||
if (@newlocks) {
|
||||
open (LK,'>>',$prtlocker) or die "cannot open $prtlocker for writing.\n";
|
||||
@ -507,7 +507,7 @@ sub port_lock {
|
||||
|
||||
sub port_unlock {
|
||||
my %unlocks = map { $_ => "U" } @_;
|
||||
my @newlocks = grep { ! defined $unlocks{$_} } @LOCKED;
|
||||
my @newlocks = grep { ! defined $unlocks{$_} } keys(%LOCKED);
|
||||
open (LL, '>', $prtlocker."-tmp");
|
||||
foreach my $nl (@newlocks) { print LL "$nl\n" unless $nl =~ /^\s*$/; }
|
||||
close (LL);
|
||||
@ -529,7 +529,7 @@ sub list_ports {
|
||||
push (@found, $lp) if (-f "$lp/Pkgfile");
|
||||
}
|
||||
} elsif ($subset eq "inst") { @found = keys %V_INST;
|
||||
} elsif ($subset eq "locked") { @found=@LOCKED;
|
||||
} elsif ($subset eq "locked") { @found = keys %LOCKED;
|
||||
} elsif ($subset =~ /^(orphans|dependent|deptree)$/) {
|
||||
my $seed; my $sseed;
|
||||
our @searchspace=(($subset eq "orphans") or ($odepends{all} == 0)) ?
|
||||
@ -725,7 +725,7 @@ sub deporder { # returns a sorted list of packages required.
|
||||
}
|
||||
|
||||
sub up_inst { # returns scalar references to five arrays
|
||||
my @requested=@_; my @sortedList; my @targets; my %EXEMPT; my %pdirs;
|
||||
my @requested=@_; my @sortedList; my @targets; my %pdirs;
|
||||
my %builtpkg; my %mkcmd; my %addcmd; my %logfile; my %pvars; my $status;
|
||||
my %ok; my %not_ok; my %ok_pre; my %ok_post; my @ok_readme=();
|
||||
my $PKGMK=$opkg{makecommand}; my $PKGADD=$opkg{addcommand};
|
||||
@ -746,8 +746,7 @@ sub up_inst { # returns scalar references to five arrays
|
||||
}
|
||||
|
||||
# exempt any locked ports from being updated
|
||||
%EXEMPT = map { $_ => 1 } @LOCKED;
|
||||
@targets = grep {(! $EXEMPT{$_})} @targets unless $opkg{nolock}==1;
|
||||
@targets = grep {(! $LOCKED{$_})} @targets;
|
||||
|
||||
# first determine the directories from which pkgmk must be called,
|
||||
# the package that will appear after a successful build,
|
||||
|
Loading…
Reference in New Issue
Block a user