prt-auf: fix the handling of sysup --softdeps
This commit is contained in:
parent
f014d86816
commit
1165eb8dae
@ -554,9 +554,9 @@ sub list_ports {
|
|||||||
if ($subset eq "orphans") {
|
if ($subset eq "orphans") {
|
||||||
my %not_orphans = map { $_ => 0 } @searchspace;
|
my %not_orphans = map { $_ => 0 } @searchspace;
|
||||||
foreach my $port (@searchspace) {
|
foreach my $port (@searchspace) {
|
||||||
map { $not_orphans{$_} = 1 } split(/ /, $DEPENDS{$port});
|
map { $not_orphans{$_} = 1 } split(/[ ,]/, $DEPENDS{$port});
|
||||||
if ($odepends{soft} == 1) {
|
if ($odepends{soft} == 1) {
|
||||||
map { $not_orphans{$_} = 1 } split(/ /, $SOFTDEPS{$port});
|
map { $not_orphans{$_} = 1 } split(/[ ,]/, $SOFTDEPS{$port});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@found = grep { $not_orphans{$_} eq 0 } keys %V_INST;
|
@found = grep { $not_orphans{$_} eq 0 } keys %V_INST;
|
||||||
@ -671,39 +671,41 @@ sub port_diff { # find differences between the pkgdb and the repo
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub deporder { # returns a sorted list of packages required.
|
sub deporder { # returns a sorted list of packages required.
|
||||||
my $type=shift; my @seeds=@_; our @treewalk=(); our @missing;
|
my $type=shift; my @seeds=@_; our @treewalk=(); our %missing;
|
||||||
our %numPred; our %children; my @result; our %SEEDS = map { $_ => 1 } @seeds;
|
our %numPred = map { $_ => 0 } @seeds; our %children; my @result;
|
||||||
|
|
||||||
# determine the minimal set of targets needed to satisfy all dependencies
|
# determine the minimal set of targets needed to satisfy all dependencies
|
||||||
foreach my $t (@seeds) {
|
foreach my $t (@seeds) { recurse_deptree(0,$t); }
|
||||||
($V_REPO{$t}) ? recurse_deptree(0,$t) : push (@missing, $t);
|
|
||||||
}
|
|
||||||
|
|
||||||
sub recurse_deptree {
|
sub recurse_deptree {
|
||||||
my $greedy=shift; my $s=shift; my %curdeps; my @optionals;
|
my $greedy=shift; my $s=shift; my %curdeps;
|
||||||
|
|
||||||
if ((! $numPred{$s}) and ($greedy==0)) { $numPred{$s} = 0; }
|
# detect any dependencies that have been dropped from the repositories
|
||||||
|
if (! $V_REPO{$s}) { $missing{$s}=1; undef $numPred{$s}; return; }
|
||||||
|
|
||||||
# cycle detection
|
# cycle detection
|
||||||
( grep /^$s$/, @treewalk ) ? return : push(@treewalk, $s);
|
( grep /^$s$/, @treewalk ) ? return : push(@treewalk, $s);
|
||||||
|
|
||||||
%curdeps = map { $_ => 0 } split /[ ,]/, $DEPENDS{$s};
|
%curdeps = map { $_ => 0 } split /[ ,]/, $DEPENDS{$s};
|
||||||
# if the user toggles --softdeps, consider only the optional dependencies
|
|
||||||
|
# if the user toggles --softdeps, consider the optional dependencies
|
||||||
# that are already installed or are given on the command line
|
# that are already installed or are given on the command line
|
||||||
if ($odepends{soft} == 1) {
|
if ($odepends{soft} == 1) {
|
||||||
@optionals = grep { ($V_INST{$_}) or ($SEEDS{$_}) } split /[ ,]/, $SOFTDEPS{$s};
|
foreach (grep { ($V_INST{$_}) or ($numPred{$_}) }
|
||||||
foreach (@optionals) { $curdeps{$_} = 1; }
|
split /[ ,]/, $SOFTDEPS{$s}) {
|
||||||
|
$curdeps{$_} = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach my $sd (keys %curdeps) {
|
foreach my $sd (keys %curdeps) {
|
||||||
my $subit = who_aliased_to($sd);
|
my $subit = who_aliased_to($sd);
|
||||||
if ($subit) {
|
if ($subit) {
|
||||||
$children{$s} .= " $subit ";
|
$children{$s} .= " $subit ";
|
||||||
$numPred{$subit} += 1;
|
$numPred{$subit} += 1 unless ($greedy == 1);
|
||||||
recurse_deptree($curdeps{$sd},$subit);
|
recurse_deptree($curdeps{$sd},$subit);
|
||||||
} else {
|
} else {
|
||||||
$children{$s} .= " $sd ";
|
$children{$s} .= " $sd ";
|
||||||
$numPred{$sd} += 1;
|
$numPred{$sd} += 1 unless ($greedy == 1);
|
||||||
recurse_deptree($curdeps{$sd},$sd);
|
recurse_deptree($curdeps{$sd},$sd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -728,7 +730,7 @@ sub deporder { # returns a sorted list of packages required.
|
|||||||
# support), and must be reversed.
|
# support), and must be reversed.
|
||||||
@result = reverse @result;
|
@result = reverse @result;
|
||||||
|
|
||||||
if (($#missing>-1) and ($type ne "quickdep")) { push (@result, "MISSING", @missing); }
|
if ((keys %missing > 0) and ($type ne "quickdep")) { push (@result, "MISSING", sort(keys %missing)); }
|
||||||
return @result;
|
return @result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user