[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#601203: debian-cd: Recommended packages should be included recursively for apt to find



Package:  debian-cd
Version:  3.1.3
Tags:     patch
User:     debian-edu@lists.debian.org
UserTags: debian-edu

In Debian Edu, I have discovered that the set of packages installed
when we install using our DVD is not the same set of packages
installed when installing using the netinst CD.

I've tracked down the cause, and it is the fact that the packages we
want on the DVD do not get all their recommended packages added to the
DVD, making apt fail to find all the packages it find when using the
netinst CD.  The NORECOMMENDS=0 setting in debian-cd only take effect
for the packages directly listed in the task lists.  Their recommended
packages do not get their recommended packages included on the DVD.

I have written this (untested) patch to try to get debian-cd to behave
more like apt, and include recommended packages recursively when the
NORECOMMENDS=0 flag is set.

Including it here for feedback and comments.  I'll test the patch and
see how it affect the Debian Edu DVD build. :)

--- debian-cd.unpatched.squeeze/tools/sort_deps	(revision 2074)
+++ debian-cd.new/tools/sort_deps	(working copy)
@@ -477,7 +477,7 @@
 	
 	if ($add_rec) {
 	    #TODO: Look for recommends (not yet included !!)
-	    add_recommends (\@dep);
+	    add_recommends (\@dep, $add_rec);
 	    # Check again but doesn't fail if one of the package cannot be
 	    # installed, just ignore it (it will be removed from @dep)
 		($ok, $reasons) = check_list (\@dep, 0);
@@ -527,11 +527,12 @@
 
 sub add_recommends {
 	my $list = shift;
+	my $add_rec = shift; # Do we look for recommends
 	my $p; # = shift;
 	my @copy = @{$list}; # A copy is needed since I'll modify the array
 	
 	foreach $p (@copy) {
-		add_missing($list, $packages{$p}{"Recommends"}, $p);
+		add_missing($list, $packages{$p}{"Recommends"}, $p, $add_rec);
 	}
 		
 }
@@ -554,6 +555,7 @@
 	my $list = shift;
 	my $new = shift;
 	my $pkgin = shift;
+	my $add_rec = shift; # Do we look for recommends
 	my @backup = @{$list};
 	my $ok = 1;
 	
@@ -596,7 +598,7 @@
 					# Stop after the first package that is
 					# added successfully
 					push (@{$list}, $pkg);
-					if (add_missing ($list, $packages{$pkg}{"Depends"}, $pkg)) {
+					if (add_missing ($list, $packages{$pkg}{"Depends"}, $pkg, $add_rec)) {
 						$or_ok = 1;
 						remove_entry($pkg, $list);
 						push @{$list}, $pkg;
@@ -622,11 +624,14 @@
 			next if $included{lc $_}; # Already included, don't worry
 			next if is_in (lc $_, $list);
 			push @{$list}, lc $_;
-			if (not add_missing ($list, $packages{lc $_}{"Depends"}, lc $_)) {
+			if (not add_missing ($list, $packages{lc $_}{"Depends"}, lc $_, $add_rec)) {
 				msg(1, "couldn't add $_ ...\n");
 				msg(1, "$pkgin failed, couldn't satisfy dep on $_\n");
 				pop @{$list};
 				$ok = 0;
+			} elsif ($add_rec) {
+				# depends added successfully, add recommends too
+				missing ($list, $packages{lc $_}{"Recommends"}, lc $_, $add_rec);
 			}
 			remove_entry(lc $_, $list);
 			push @{$list}, lc $_;

Happy hacking,
-- 
Petter Reinholdtsen



Reply to: