From 6356b9f98c1d48415519963e6ce88c45564d6cbc Mon Sep 17 00:00:00 2001 From: John McQuah Date: Fri, 10 Jun 2022 18:52:27 -0400 Subject: [PATCH] prt-auf: another quick fix of find_port_by_name() --- scripts/prt-auf | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/prt-auf b/scripts/prt-auf index 1d9ce7b..3bc6be4 100755 --- a/scripts/prt-auf +++ b/scripts/prt-auf @@ -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}) {