diff --git a/scripts/prt-auf b/scripts/prt-auf index e989474..185d7bd 100755 --- a/scripts/prt-auf +++ b/scripts/prt-auf @@ -373,11 +373,12 @@ sub get_pkgfile_fields { sub find_port_by_file { # for now only used to search footprints, but can be generalized my $portfile = shift; my $query = shift; my ($lp, $candidate, $fh); my %hits=(); + $query =~ s/\+/\\\+/g unless ($osearch{regex}==1); + $query =~ s/\./\\\./g unless ($osearch{regex}==1); my $linewanted = qr/$query/is; LOCALENTRY: foreach $lp (@localports) { open ($fh, "$lp/$portfile") or die "cannot open $portfile for $lp\n"; while (<$fh>) { - next if ($portfile eq "Pkgfile" and $_ !~ /^(name=|# Description)/); next LOCALENTRY if $hits{$lp}; $hits{$lp} = $_ if $_ =~ $linewanted; } close ($fh); @@ -409,9 +410,12 @@ sub find_port_by_name { my $query = shift; my $exact=shift; my $fullpath=shift; my $exhaustive=shift; $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 @hits = grep { $_ =~ $pattern } @allports; - @hits = grep { s/^(.*)\/// } @hits if ($fullpath==0); + # my @names_only = map { $_ => (split /\//, $_)[-1] } @allports; + my @hits = grep { $_ =~ $pattern } @allports; + @hits = grep { s/^.*\/// } @hits if ($fullpath==0); + return @hits if ($exhaustive==1); return $hits[0] if ($exhaustive==0); }