prt-auf: fix some bugs in 'dependent'
This commit is contained in:
parent
038a0ef742
commit
f90978bcd8
@ -83,10 +83,11 @@ if ($action eq "path") { @results = find_port_by_name($query[0],1,1,0);
|
||||
|
||||
#################### Post-transaction reports #######################
|
||||
$strf = "%s\n";
|
||||
if ($action =~ /^(listinst|listorphans)/) {
|
||||
if (($action =~ /^(listinst|listorphans|dependent)/) and
|
||||
($odepends{tree}==0)) {
|
||||
foreach my $result (sort @results) {
|
||||
$result .= " $V_INST{$result}" if $osearch{verbose}==1;
|
||||
$result .= " $V_INST{$result}\n$DESC{$result}\n" if $osearch{verbose}>1;
|
||||
$result = ($osearch{verbose}==1) ? " $result: $V_INST{$result}" : " $result";
|
||||
$result = ($osearch{verbose}>1) ? " $result: $V_INST{$result}\n$DESC{$result}\n" : $result;
|
||||
printf $strf, $result;
|
||||
}
|
||||
} elsif ($action =~ /^(list|search|dsearch|path)/) {
|
||||
@ -114,7 +115,7 @@ if ($action =~ /^(listinst|listorphans)/) {
|
||||
next if (($osearch{filter}) and ($diffN !~ /$osearch{filter}/));
|
||||
next if ((grep {$_ eq $diffN} @LOCKED) and ($odepends{all}==0));
|
||||
printf "$format", $diffN, $diffI, $diffR if ($action eq "diff");
|
||||
printf "%s ", $diffN if ($action eq "quickdiff" and $diffR ne "MISSING!");
|
||||
printf "%s ", $diffN if (($action eq "quickdiff") and ($diffR ne "MISSING"));
|
||||
}
|
||||
print "\n" if ($action eq "quickdiff");
|
||||
exit $ind;
|
||||
@ -187,7 +188,8 @@ sub parse_args {
|
||||
} elsif ($arg eq "grpinst") { $action = "install"; $opkg{group} = "yes";
|
||||
print "Warning: grpinst is obsolescent, using install --group\n";
|
||||
} elsif ($arg =~ /^(lock|unlock|listlocked|current|isinst)$/) { $action = $1;
|
||||
} elsif ($arg =~ /^(diff|quickdiff|printf|listinst|listorphans)$/) { $action = $1;
|
||||
} elsif ($arg =~ /^(diff|quickdiff|printf|listinst|listorphans)$/) {
|
||||
$action = $1; $odepends{tree} = 0;
|
||||
} elsif ($arg =~ /^(depends|quickdep|dup|dependent)$/) { $action = $1;
|
||||
} elsif ($arg eq "deptree") { $action = $arg; $odepends{tree} = 1;
|
||||
} elsif ($arg =~ /^(readme|cat|edit|ls|help|version|cache)$/) { $action = $1;
|
||||
@ -529,8 +531,8 @@ sub list_ports {
|
||||
} elsif ($subset eq "locked") { @found=@LOCKED;
|
||||
} elsif ($subset =~ /^(orphans|dependent|deptree)$/) {
|
||||
my $seed; my $sseed;
|
||||
our @searchspace=(($subset ne "orphans") and ($odepends{all} != 0)) ?
|
||||
keys %V_REPO : keys %V_INST;
|
||||
our @searchspace=(($subset eq "orphans") or ($odepends{all} == 0)) ?
|
||||
keys %V_INST : keys %V_REPO ;
|
||||
@searchspace = grep { defined $DEPENDS{$_} } @searchspace;
|
||||
|
||||
if ($subset =~ /^dep/) {
|
||||
@ -543,7 +545,7 @@ sub list_ports {
|
||||
}
|
||||
|
||||
if ($subset eq "orphans") {
|
||||
my %not_orphans = map { $_ => 0 } keys %V_INST;
|
||||
my %not_orphans = map { $_ => 0 } @searchspace;
|
||||
foreach my $port (@searchspace) {
|
||||
map { $not_orphans{$_} = 1 } split(/ /, $DEPENDS{$port});
|
||||
if ($odepends{soft} == 1) {
|
||||
@ -553,15 +555,16 @@ sub list_ports {
|
||||
@found = grep { $not_orphans{$_} eq 0 } keys %V_INST;
|
||||
} elsif (($subset eq "dependent") and ($odepends{recursive}==0)) {
|
||||
@found = grep { " $DEPENDS{$_} " =~ / $sseed / } @searchspace;
|
||||
if ($odepends{tree}==1) {
|
||||
@found = grep { s/^/ / } @found; unshift (@found, "$seed");
|
||||
if ($odepends{soft}==1) { push (@found,
|
||||
grep{ " $SOFTDEPS{$_} " =~ / $sseed / } @searchspace);
|
||||
}
|
||||
if ($odepends{tree}==1) { unshift (@found, "$seed"); }
|
||||
} elsif ($subset =~ /^dep(endent|tree)/) {
|
||||
our $direction = ($subset eq "deptree") ? "fwd" : "rev";
|
||||
my $header = (($subset eq "deptree") and ($odepends{tree} == 1)) ?
|
||||
"-- dependencies ([i] = installed, '-->' = already shown)\n":
|
||||
"-- reverse dependencies ('-->' = already shown)\n";
|
||||
if (($subset eq "deptree") and ($odepends{soft} == 1)) {
|
||||
if (($direction eq "fwd") and ($odepends{soft} == 1)) {
|
||||
$header =~ s/installed,/installed, [s] = installed softdep,/;
|
||||
}
|
||||
print $header unless ($odepends{tree} == 0);
|
||||
@ -571,10 +574,10 @@ sub list_ports {
|
||||
$ind = ($V_INST{$seed}) ? "[i]" : "[ ]";
|
||||
print "$ind $seed\n" if (($odepends{tree}==1) or ($odepends{all}==1));
|
||||
$seen{$seed} = 1;
|
||||
my @children = ($subset eq "deptree") ? split /[ ,]/, $DEPENDS{$sseed}:
|
||||
my @children = ($direction eq "fwd") ? split /[ ,]/, $DEPENDS{$sseed}:
|
||||
grep { " $DEPENDS{$_} " =~ / $sseed / } @searchspace;
|
||||
if ($odepends{soft}==1) {
|
||||
@fosters = ($subset eq "deptree") ?
|
||||
@fosters = ($direction eq "fwd") ?
|
||||
grep { ($V_INST{$_}) } split /[ ,]/, $SOFTDEPS{$sseed}:
|
||||
grep { " $SOFTDEPS{$_} " =~ / $sseed / } @searchspace;
|
||||
}
|
||||
@ -587,7 +590,7 @@ sub list_ports {
|
||||
my $ps = (($seen{$s}) and ($odepends{all} !=1)) ? "-->\n" : "\n";
|
||||
$ind = ($V_INST{$s}) ? "[i]" : "[ ]";
|
||||
$ind = (($ind eq "[i]") and ($greedy)) ? "[s]" : $ind;
|
||||
print $ind.(${indent}x(1+$height))."$s".$ps unless ($odepends{tree}==0);
|
||||
print $ind.(${indent}x(1+$height))."$s".$ps if ($odepends{tree}==1);
|
||||
return if (($seen{$s}) and ($odepends{all} !=1));
|
||||
$seen{$s} = 1;
|
||||
my %curdeps = ($direction eq "fwd") ?
|
||||
|
Loading…
Reference in New Issue
Block a user