prt-auf: prevent locked ports from affecting the exit status of 'diff'

fix some post-transaction reports
This commit is contained in:
John McQuah 2023-06-26 15:22:03 -04:00
parent 8b6807d7f8
commit 69b9a3dc2b

View File

@ -75,8 +75,8 @@ if ($action eq "path") { @results = find_port_by_name($query[0],1,1,0);
} elsif ($action eq "install") { @results = up_inst(@query);
} elsif ($action eq "dup") { $ind=find_dups(@query);
} elsif ($action eq "remove") { $ind=uninstall(@query);
} elsif ($action =~ /^(isinst|current|sysup)$/) { @results = port_diff($1,@query);
} elsif ($action =~ /(.*)diff$/) { @results = port_diff($1);
} elsif ($action =~ /^(isinst|current|sysup)$/) { ($ind, @results) = port_diff($1,@query);
} elsif ($action =~ /(.*)diff$/) { ($ind, @results) = port_diff($1);
} elsif ($action =~ /^list(.*)/) { @results = list_ports($1);
} elsif ($action eq "help") { print_help();
} elsif ($action eq "version") { print "$title $version\n";
@ -108,10 +108,10 @@ if (($action =~ /^(listinst|listorphans|dependent)/)
foreach my $fileN (@fmatch) { printf $strf, $fh, $fileN; }
}
} elsif ($action =~ /^(current|isinst|dup|diff|quickdiff)$/) {
my $format = "%20s %15s %20s\n"; my $ind = shift(@results);
if (! @results) {
my $format = "%20s %15s %20s\n";
if ($ind == 0) {
($action !~ /diff$/) or print "No differences found\n";
exit 0;
($action =~ /^(current|isinst)/) or exit 0;
} elsif ($action eq "diff") {
printf $format, "Port", "Installed", "Available in Repo"
}
@ -656,9 +656,11 @@ sub port_diff { # find differences between the pkgdb and the repo
if ($dtype !~ /^(current|isinst|utd)/) {
foreach my $p (sort(keys %V_INST)) {
if (($V_REPO{$p}) and ($V_REPO{$p} ne $V_INST{$p})) {
$retval++ unless ($LOCKED{$p});
($dtype =~ /^(quick|sysup)/) ? push @outfile, "$p" :
push @outfile, "$p $V_INST{$p} $V_REPO{$p}";
} elsif ((! $V_REPO{$p}) and ($dtype !~ /^(quick|sysup)/)) {
$retval++;
push @outfile, "$p $V_INST{$p} MISSING";
}
}