I got a working patch, but while testing and trying to get my patch
working, I discovered that the current handling of NORECOMMENDS=0 is
completely broken.

The Perl code in sort_deps to read this value look like this:

  my $norecommends = $ENV{'NORECOMMENDS'} || 1;

When one ask for recommended packages to be included, the
$ENV{'NORECOMMENDS'} content resolve to "0" which is false for perl
and thus trigger the '|| 1' part, causing the opposite of the intended
effect.

This patch seem to solve this:

diff -urw debian-cd.unpatched.squeeze/tools/sort_deps debian-cd/tools/sort_deps
--- debian-cd.unpatched.squeeze/tools/sort_deps 2010-10-23 08:48:16.000000000 
+02
00
+++ debian-cd/tools/sort_deps   2010-10-26 00:01:04.000000000 +0200
@@ -21,7 +21,7 @@
 my $force_firmware = $ENV{'FORCE_FIRMWARE'} || 0;
 my $local = $ENV{'LOCAL'} || 0;
 my $complete = $ENV{'COMPLETE'} || 0;
-my $norecommends = $ENV{'NORECOMMENDS'} || 1;
+my $norecommends = (defined $ENV{'NORECOMMENDS'} ? $ENV{'NORECOMMENDS'} : 1);
 my $nosuggests = $ENV{'NOSUGGESTS'} || 1;

 my $apt = "$ENV{'BASEDIR'}/tools/apt-selection";

Here is the complete patch to add recommended packages, including lots
of debug output I added to try to figure out why everything I tried
failed.  I'll provide a cleaner patch as soon as possible, but thought
it best to get feedback on the current changes.

diff -urw debian-cd.unpatched.squeeze/tools/sort_deps debian-cd/tools/sort_deps
--- debian-cd.unpatched.squeeze/tools/sort_deps 2010-10-23 08:48:16.000000000 
+0200
+++ debian-cd/tools/sort_deps   2010-10-26 00:01:04.000000000 +0200
@@ -21,7 +21,7 @@
 my $force_firmware = $ENV{'FORCE_FIRMWARE'} || 0;
 my $local = $ENV{'LOCAL'} || 0;
 my $complete = $ENV{'COMPLETE'} || 0;
-my $norecommends = $ENV{'NORECOMMENDS'} || 1;
+my $norecommends = (defined $ENV{'NORECOMMENDS'} ? $ENV{'NORECOMMENDS'} : 1);
 my $nosuggests = $ENV{'NOSUGGESTS'} || 1;
 
 my $apt = "$ENV{'BASEDIR'}/tools/apt-selection";
@@ -50,7 +50,7 @@
 my %excluded;
 my %packages;
 
-msg(0, "Running sort_deps to sort packages for $arch:\n");
+msg(0, "Running sort_deps to sort packages for $arch (edu):\n");
 msg(1, "======================================================================
 Here are the settings you've chosen for making the list:
 Architecture: $arch
@@ -63,6 +63,8 @@
 msg(1, yesno($nonfree)."\n");
 msg(1, "Force inclusion of firmware packages: ");
 msg(1, yesno($force_firmware)."\n");
+msg(1, "Include recommended packages: ");
+msg(1, yesno(!$norecommends)."\n");
 msg(1, "======================================================================
 ");
 
@@ -449,7 +451,7 @@
        }
        
        # Get all dependencies (not yet included) of each package
-       my (@dep) = (get_missing ($p));
+       my (@dep) = (get_missing ($p, $add_rec));
 
        # Stop here if apt failed
        if (not scalar(@dep)) {
@@ -477,7 +479,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);
@@ -520,30 +522,38 @@
        my @copy = @{$list}; # A copy is needed since I'll modify the array
        
        foreach $p (@copy) {
-               add_missing($list, $packages{$p}{"Suggests"}, $p);
+               add_missing($list, $packages{$p}{"Suggests"}, $p, 0);
        }
                
 }
 
 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);
        }
                
 }
 
 sub get_missing {
        my $p = shift;
+       my $add_rec = shift; # Do we look for recommends
        my @list = ();
        
-       if (not add_missing (\...@list, $packages{$p}{"Depends"}, $p)) {
+       msg(0, "Looking for Depends for $p (add-rec = $add_rec)\n");
+       if (not add_missing (\...@list, $packages{$p}{"Depends"}, $p, 
$add_rec)) {
                return ();
        }
 
+       if ($add_rec) {
+               msg(0, "Looking for Recommends for $p\n");
+               add_missing (\...@list, $packages{$p}{"Recommends"}, $p, 
$add_rec);
+       }
+
        remove_entry($p, \...@list);
        push @list, $p;
        return (@list);
@@ -554,6 +564,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 +607,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 +633,16 @@
                        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) {
+                               my $reclist = $packages{lc $_}{"Recommends"};
+                               msg(0, "trying to add recommends $reclist 
...\n");
+                               # depends added successfully, add recommends too
+                               add_missing ($list, $reclist, lc $_, $add_rec);
                        }
                        remove_entry(lc $_, $list);
                        push @{$list}, lc $_;


Happy hacking,
-- 
Petter Reinholdtsen



-- 
To UNSUBSCRIBE, email to debian-cd-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/2flaam0kc2j....@login2.uio.no

Reply via email to