prt-auf: also consider release (not just version) when looking for differences

This commit is contained in:
John McQuah 2022-07-29 14:52:57 -04:00
parent 186a5ffaac
commit 66b2428ee5

View File

@ -41,7 +41,7 @@ if ($osearch{cache}==1) { fill_hashes_from_cache(); }
if ($action !~ /^(quickdep|search|dsearch|fsearch|info|dup|readme|cat)$/) { if ($action !~ /^(quickdep|search|dsearch|fsearch|info|dup|readme|cat)$/) {
open (DB, $pkgdb) or die "Could not open package database!\n"; open (DB, $pkgdb) or die "Could not open package database!\n";
local $/=""; local $/="";
while (<DB>) { $V_INST{$1} = $2 if m/^(.*)\n(.*)-[0-9]+\n/; } while (<DB>) { $V_INST{$1} = $2 if m/^(.*)\n(.*)\n/; }
close (DB); close (DB);
} }
@ -98,11 +98,12 @@ if (($action =~ /^(listinst|listorphans)/)
printf $strf, $result; printf $strf, $result;
} }
} elsif ($action =~ /^(fsearch)/) { } elsif ($action =~ /^(fsearch)/) {
my %hits = %{$hh}; $strf = "%20s %s\n"; my %hits = %{$hh}; $strf = "%20s %s\n"; my @fmatch;
printf $strf, "Found in", "Matching File"; printf $strf, "Found in", "Matching File";
foreach my $fh (keys %hits) { foreach my $fh (keys %hits) {
chomp($hits{$fh}); chomp($hits{$fh});
printf $strf, $fh, (split /\s/, $hits{$fh})[2]; @fmatch = split /\s/, $hits{$fh};
foreach my $fileN (@fmatch) { printf $strf, $fh, $fileN; }
} }
} elsif ($action =~ /^(diff|quickdiff|current|isinst|dup)$/) { } elsif ($action =~ /^(diff|quickdiff|current|isinst|dup)$/) {
exit $ind; exit $ind;
@ -349,8 +350,8 @@ sub fill_hashes_from_cache {
while (1) { while (1) {
$p = <$cf>; last unless defined $p; $p = <$cf>; last unless defined $p;
chomp($p); chomp($p);
$ignored = <$cf>; $V_REPO{$p} = <$cf>; $ignored = <$cf>; $V_REPO{$p} = <$cf>; chomp($V_REPO{$p});
$ignored = <$cf>; $DESC{$p} = <$cf>; $V_REPO{$p} .= <$cf>; $DESC{$p} = <$cf>;
$deps = <$cf>; $deps = <$cf>;
chomp($deps, $DESC{$p}, $V_REPO{$p}); chomp($deps, $DESC{$p}, $V_REPO{$p});
$DEPENDS{$p} = ($deps ne "") ? $deps : " "; $DEPENDS{$p} = ($deps ne "") ? $deps : " ";
@ -366,6 +367,7 @@ sub fill_hashes_from_pkgfiles {
my ($rver, $rrel, $rdesc, $rdeps) = get_pkgfile_fields($pp); my ($rver, $rrel, $rdesc, $rdeps) = get_pkgfile_fields($pp);
$V_REPO{$p} = ($rver) ? $rver : "0"; $V_REPO{$p} = ($rver) ? $rver : "0";
$V_REPO{$p} .= ($rrel) ? "-$rrel" : "-1";
$DEPENDS{$p} = ($rdeps) ? $rdeps : ""; $DEPENDS{$p} = ($rdeps) ? $rdeps : "";
$DEPENDS{$p} =~ s/, / /g; $DEPENDS{$p} =~ s/,/ /g; $DEPENDS{$p} =~ s/, / /g; $DEPENDS{$p} =~ s/,/ /g;
$DESC{$p} = ($rdesc) ? $rdesc : ""; $DESC{$p} = ($rdesc) ? $rdesc : "";
@ -409,8 +411,7 @@ sub find_port_by_file { # for now only used to search footprints, but can be gen
LOCALENTRY: foreach $lp (@localports) { LOCALENTRY: foreach $lp (@localports) {
open ($fh, "$lp/$portfile") or die "cannot open $portfile for $lp\n"; open ($fh, "$lp/$portfile") or die "cannot open $portfile for $lp\n";
while (<$fh>) { while (<$fh>) {
next LOCALENTRY if $hits{$lp}; $hits{$lp} .= (split /\s/, $_)[2]." " if $_ =~ $linewanted;
$hits{$lp} = $_ if $_ =~ $linewanted;
} close ($fh); } close ($fh);
} }
foreach my $collection (@basedirs) { foreach my $collection (@basedirs) {
@ -420,8 +421,7 @@ sub find_port_by_file { # for now only used to search footprints, but can be gen
next if (! -f "$collection/$candidate/$portfile"); next if (! -f "$collection/$candidate/$portfile");
open ($fh, "$collection/$candidate/$portfile") or die "cannot open $portfile in $candidate\n"; open ($fh, "$collection/$candidate/$portfile") or die "cannot open $portfile in $candidate\n";
while (<$fh>) { while (<$fh>) {
next PORTENTRY if $hits{"$prefix$candidate"}; $hits{"$prefix$candidate"} .= (split /\s/, $_)[2]." " if $_ =~ $linewanted;
$hits{"$prefix$candidate"}=$_ if $_ =~ $linewanted;
} close ($fh); } close ($fh);
} closedir(DIR); } closedir(DIR);
} }