Remove dead code in sort_deps and improve log messages
The dependency tree created by parsing the output of "apt-cache depends" always generates an array of array. The old representation of a simple dependency as an hash is gone in favor of an OR with a single entry (so the hash is the only element within the array). So all the code in add_missing() that was dealing with the case of the hash was never triggered. I tweaked the OR case so that the generated log messages actually mention "OR" only if it's a true OR dependency (i.e. with multiple entries in the array).
This commit is contained in:
parent
ca9ac8deac
commit
e77ade6033
|
@ -19,6 +19,7 @@ debian-cd (3.1.36) UNRELEASED; urgency=medium
|
||||||
* Fix install_firmwares_initrd to not fail when the firmware is not found.
|
* Fix install_firmwares_initrd to not fail when the firmware is not found.
|
||||||
* Implement recursive lookup of Recommends and Suggests in sort_deps.
|
* Implement recursive lookup of Recommends and Suggests in sort_deps.
|
||||||
Closes: #601203
|
Closes: #601203
|
||||||
|
* Remove dead code in sort_deps and improve generated log messages
|
||||||
|
|
||||||
[ Wolfgang Schweer ]
|
[ Wolfgang Schweer ]
|
||||||
* data/bookworm: Use Debian Edu 12 installer logo and syslinux splash image
|
* data/bookworm: Use Debian Edu 12 installer logo and syslinux splash image
|
||||||
|
|
|
@ -978,11 +978,16 @@ sub add_missing {
|
||||||
# Check all dependencies
|
# Check all dependencies
|
||||||
foreach my $thisdep (@{$new}) {
|
foreach my $thisdep (@{$new}) {
|
||||||
my $textout = "";
|
my $textout = "";
|
||||||
|
my $type_rel = "simple";
|
||||||
|
|
||||||
|
if ("ARRAY" ne ref($thisdep)) {
|
||||||
|
die "add_missing: $thisdep should be an array!\n";
|
||||||
|
}
|
||||||
|
|
||||||
# Print out status
|
# Print out status
|
||||||
if ("ARRAY" eq ref($thisdep)) {
|
|
||||||
if (scalar(@{$thisdep} > 1)) {
|
if (scalar(@{$thisdep} > 1)) {
|
||||||
$textout = "(OR ";
|
$textout = "(OR ";
|
||||||
|
$type_rel = "OR";
|
||||||
}
|
}
|
||||||
foreach my $orpkg (@{$thisdep}) {
|
foreach my $orpkg (@{$thisdep}) {
|
||||||
$textout .= dump_depend($orpkg) . " ";
|
$textout .= dump_depend($orpkg) . " ";
|
||||||
|
@ -990,11 +995,6 @@ sub add_missing {
|
||||||
if (scalar(@{$thisdep} > 1)) {
|
if (scalar(@{$thisdep} > 1)) {
|
||||||
$textout .= ")";
|
$textout .= ")";
|
||||||
}
|
}
|
||||||
} elsif ("HASH" eq ref($thisdep)) {
|
|
||||||
$textout = dump_depend($thisdep);
|
|
||||||
} else {
|
|
||||||
die "add_missing: $thisdep should be an array or hash!\n";
|
|
||||||
}
|
|
||||||
msg(3, " $pkgname Dep: $textout soft_depend $soft_depend\n");
|
msg(3, " $pkgname Dep: $textout soft_depend $soft_depend\n");
|
||||||
|
|
||||||
# Bail out early if we can!
|
# Bail out early if we can!
|
||||||
|
@ -1003,8 +1003,6 @@ sub add_missing {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Still work to do...
|
# Still work to do...
|
||||||
# If it's an OR
|
|
||||||
if ("ARRAY" eq ref($thisdep)) {
|
|
||||||
my $or_ok = 0;
|
my $or_ok = 0;
|
||||||
|
|
||||||
# First check all the OR packages up-front with no
|
# First check all the OR packages up-front with no
|
||||||
|
@ -1022,7 +1020,7 @@ sub add_missing {
|
||||||
|
|
||||||
# Already installed?
|
# Already installed?
|
||||||
if (dep_satisfied($pkg, $check_backports, $need_udeb)) {
|
if (dep_satisfied($pkg, $check_backports, $need_udeb)) {
|
||||||
msg(3, " OR relationship already installed: " . dump_depend($pkg) . "\n");
|
msg(3, " $type_rel relationship already installed: " . dump_depend($pkg) . "\n");
|
||||||
$or_ok = 1;
|
$or_ok = 1;
|
||||||
last;
|
last;
|
||||||
}
|
}
|
||||||
|
@ -1031,7 +1029,7 @@ sub add_missing {
|
||||||
# depth-first search? (yes, we have to cope with
|
# depth-first search? (yes, we have to cope with
|
||||||
# circular dependencies here...)
|
# circular dependencies here...)
|
||||||
if (is_in_dep_list($pkg, $list, $soft_depend)) {
|
if (is_in_dep_list($pkg, $list, $soft_depend)) {
|
||||||
msg(3, " OR relationship already satisfied by current list " . dump_depend($pkg) . "\n");
|
msg(3, " $type_rel relationship already satisfied by current list " . dump_depend($pkg) . "\n");
|
||||||
$or_ok = 1;
|
$or_ok = 1;
|
||||||
last;
|
last;
|
||||||
}
|
}
|
||||||
|
@ -1048,7 +1046,7 @@ sub add_missing {
|
||||||
# available should be good enough for all cases we care
|
# available should be good enough for all cases we care
|
||||||
# about.
|
# about.
|
||||||
if (not $or_ok) {
|
if (not $or_ok) {
|
||||||
msg(3, " OR relationship not already satisfied, looking at alternatives in order, check_backports $check_backports\n");
|
msg(3, " $type_rel relationship not already satisfied, looking at alternatives in order, check_backports $check_backports\n");
|
||||||
|
|
||||||
foreach my $pkg (@{$thisdep}) {
|
foreach my $pkg (@{$thisdep}) {
|
||||||
my %t = %$pkg;
|
my %t = %$pkg;
|
||||||
|
@ -1061,12 +1059,7 @@ sub add_missing {
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
# Check we don't already have the package
|
|
||||||
if (is_in_dep_list($pkg, $list, $soft_depend)) {
|
|
||||||
$or_ok = 1;
|
|
||||||
last;
|
|
||||||
# Otherwise try to add it
|
|
||||||
} else {
|
|
||||||
# Stop after the first
|
# Stop after the first
|
||||||
# package that is
|
# package that is
|
||||||
# added successfully
|
# added successfully
|
||||||
|
@ -1088,65 +1081,16 @@ sub add_missing {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
$ok &&= $or_ok;
|
$ok &&= $or_ok;
|
||||||
if (not $ok) {
|
if (not $ok) {
|
||||||
$pkgname = $pkgin{"Package"};
|
$pkgname = $pkgin{"Package"};
|
||||||
if ($soft_depend) {
|
if ($soft_depend) {
|
||||||
msg(1, " $pkgname failed, couldn't satisfy OR dep (but it's a soft dep, so ignoring...)\n");
|
msg(1, " $pkgname failed, couldn't satisfy $type_rel dep (but it's a soft dep, so ignoring...)\n");
|
||||||
$ok = 1;
|
$ok = 1;
|
||||||
} else {
|
} else {
|
||||||
msg(1, " $pkgname failed, couldn't satisfy OR dep\n");
|
msg(1, " $pkgname failed, couldn't satisfy $type_rel dep\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
# Else it's a simple dependency
|
|
||||||
} else {
|
|
||||||
my %t = %{$thisdep};
|
|
||||||
my $pt = dump_depend(\%t);
|
|
||||||
msg(1, " Looking at adding $pt to satisfy dep\n");
|
|
||||||
|
|
||||||
if (not exists $packages{lc $t{"Package"}}) {
|
|
||||||
msg(1, " $pt doesn't exist...\n");
|
|
||||||
if ($soft_depend) {
|
|
||||||
msg(1, " soft dep: $pkgname ok, despite missing dep on $pt\n");
|
|
||||||
$ok = 1;
|
|
||||||
} else {
|
|
||||||
msg(1, " $pkgname failed, couldn't satisfy dep on $pt\n");
|
|
||||||
$ok = 0;
|
|
||||||
last;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (dep_satisfied(\%t, $check_backports, $need_udeb)) {
|
|
||||||
msg(1, " $pt already included\n");
|
|
||||||
next; # Already included, don't worry
|
|
||||||
}
|
|
||||||
if (is_in_dep_list(\%t, $list, $soft_depend)) {
|
|
||||||
msg(1, " $pt already in dep list\n");
|
|
||||||
next;
|
|
||||||
}
|
|
||||||
push @{$list}, \%t;
|
|
||||||
if (not add_missing ($list, $packages{$t{"Package"}}{"Depends"}, \%t, $soft_depend, $check_backports)) {
|
|
||||||
my $pkgname = $pkgin{"Package"};
|
|
||||||
msg(1, "couldn't add $pt ...\n");
|
|
||||||
if ($soft_depend) {
|
|
||||||
msg(1, "soft dep: $pkgname ok, despite missing dep on $pt\n");
|
|
||||||
$ok = 1;
|
|
||||||
} else {
|
|
||||||
msg(1, "$pkgname failed, couldn't satisfy dep on $pt\n");
|
|
||||||
pop @{$list};
|
|
||||||
$ok = 0;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if ($add_rec) {
|
|
||||||
add_missing ($list, $packages{$t{"Package"}}{"Recommends"}, \%t, 1, $check_backports);
|
|
||||||
}
|
|
||||||
if ($add_sug) {
|
|
||||||
add_missing ($list, $packages{$t{"Package"}}{"Suggests"}, \%t, 1, $check_backports);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
remove_entry(\%t, $list);
|
|
||||||
push @{$list}, \%t;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
# If a problem has come up, then restore the original list
|
# If a problem has come up, then restore the original list
|
||||||
if (not $ok) {
|
if (not $ok) {
|
||||||
|
|
Loading…
Reference in New Issue