Backport the fix for #518145: broken deps handling
This commit is contained in:
parent
81533edb78
commit
7d694ded67
|
@ -530,12 +530,14 @@ sub add_recommends {
|
|||
|
||||
sub get_missing {
|
||||
my $p = shift;
|
||||
my @list = ($p);
|
||||
my @list = ();
|
||||
|
||||
if (not add_missing (\@list, $packages{$p}{"Depends"}, $p)) {
|
||||
return ();
|
||||
}
|
||||
|
||||
|
||||
remove_entry($p, \@list);
|
||||
push @list, $p;
|
||||
return (@list);
|
||||
}
|
||||
|
||||
|
@ -583,6 +585,8 @@ sub add_missing {
|
|||
push (@{$list}, $pkg);
|
||||
if (add_missing ($list, $packages{$pkg}{"Depends"}, $pkg)) {
|
||||
$or_ok = 1;
|
||||
remove_entry($pkg, $list);
|
||||
push @{$list}, $pkg;
|
||||
} else {
|
||||
pop @{$list};
|
||||
}
|
||||
|
@ -594,6 +598,7 @@ sub add_missing {
|
|||
}
|
||||
# Else it's a simple dependency
|
||||
} else {
|
||||
msg(1, " Looking at adding $_ to satisfy dep\n");
|
||||
if (not exists $packages{lc $_}) {
|
||||
msg(1, " $_ doesn't exist...\n");
|
||||
msg(1, " $pkgin failed, couldn't satisfy dep on $_\n");
|
||||
|
@ -609,12 +614,17 @@ sub add_missing {
|
|||
pop @{$list};
|
||||
$ok = 0;
|
||||
}
|
||||
remove_entry(lc $_, $list);
|
||||
push @{$list}, lc $_;
|
||||
}
|
||||
}
|
||||
# If a problem has come up, then restore the original list
|
||||
if (not $ok) {
|
||||
@{$list} = @backup;
|
||||
}
|
||||
if (not is_in(lc $pkgin, $list)) {
|
||||
push @{$list}, lc $pkgin;
|
||||
}
|
||||
return $ok;
|
||||
}
|
||||
|
||||
|
@ -628,6 +638,19 @@ sub is_in {
|
|||
return 0;
|
||||
}
|
||||
|
||||
# Remove an antry from @{$array}
|
||||
sub remove_entry {
|
||||
my $value = shift;
|
||||
my $array = shift;
|
||||
my $i;
|
||||
|
||||
foreach $i (0 .. $#$array) {
|
||||
if (@{$array}[$i] eq $value) {
|
||||
splice(@{$array}, $i, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# The size of a group of packages
|
||||
sub get_size {
|
||||
my $arrayref = shift;
|
||||
|
|
Loading…
Reference in New Issue