prt-auf: another quick fix of find_port_by_name()

This commit is contained in:
John McQuah 2022-06-10 18:52:27 -04:00
parent b06ebe46a4
commit 6356b9f98c

View File

@ -43,7 +43,7 @@ if ($action !~ /^(quickdep|search|dsearch|fsearch|info|dup|readme|cat)$/) {
close (DB);
}
if ($action =~ /^(diff|quickdiff|depends|deptree|install|update|depinst|sysup)$/) {
if ($action =~ /^(diff|quickdiff|listlocked|depends|deptree|install|update|depinst|sysup)$/) {
get_locked_and_aliased();
}
@ -96,6 +96,7 @@ if (($action =~ /^(listinst|listorphans)/)
} elsif ($action =~ /^(list|search|dsearch|path|dependent)/) {
exit 1 if ($#results < 0);
foreach my $result (@results) {
chomp($result); next if ($result =~ /^\s*$/);
$result =~ s/.*\/(.*)$/$1/ if (($action ne "path") and ($osearch{path}==0));
$result .= " $V_REPO{$result}" if $osearch{verbose}==1;
$result .= " $V_REPO{$result}\n$DESC{$result}\n" if $osearch{verbose}>1;
@ -411,7 +412,7 @@ sub find_port_by_name {
$query =~ s/\+/\\\+/g unless ($osearch{regex}==1);
$query =~ s/\./\\\./g unless ($osearch{regex}==1);
# $query =~ s/\^/\// if (($osearch{regex}==1) and ($exact==0));
my $pattern = ($exact==1) ? qr/\/$query$/s : qr/$query/is;
my $pattern = ($exact==1) ? qr/^$query$/s : qr/$query/is;
my %names_only = map { ($_ => (split /\//, $_)[-1]) } @allports;
my @hits = grep { $names_only{$_} =~ $pattern } @allports;
@hits = map { $names_only{$_} } @hits if $fullpath==0;
@ -537,7 +538,7 @@ sub port_diff { # returns a scalar indicating how many differences were found
if ($dtype !~ /^(current|isinst|utd)/) {
printf "$format", "Port", "Installed", "In Repository" if (! $dtype);
foreach my $p (keys %V_INST) {
next if ((" $LOCKED " =~ / $p /) and ($odepends{all}==0));
next if (($LOCKED =~ /$p/) and ($odepends{all}==0));
$lastcol = ($V_REPO{$p}) ? $V_REPO{$p} : "MISSING!";
if ($lastcol ne $V_INST{$p}) {