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

[PATCH] better handling of non-free CDs



The following patch does something I've wanted for a while: move
non-free binary packages off onto an extra separate final CD. This
makes life much easier for those of us trying to keep images around
for multiple options. Please try it out.

I'll post a similar patch for source soon. Then I'd like to do
something similar for non-US. Ideally I'd like to get away from the
following set of (binary) images we need to keep around for all
possible build options:

binary 1/2/3   (no non-US, no non-free)
binary 1/2/3/4 (no non-US, non-free)
binary 1/2/3   (non-US, no non-free)
binary 1/2/3/4 (non-US, non-free)

to something like:

binary 1 (no non-US)
binary 1 (free non-US)
binary 2/3 (completely free)
binary 4 (non-free with non-US non-free)
binary 4 (non-free without non-US)

In other words, 6 images instead of 14. Or if we're not bothered about
non-free, 4 images instead of 6.

Here's patch #1:

-- 
Steve McIntyre, Cambridge, UK.                   stevem@chiark.greenend.org.uk
			"Whenever you eat, chew"
"Can't keep my eyes from the circling sky,                 +------------------
"Tongue-tied & twisted, Just an earth-bound misfit, I..."  |Finger for PGP key
--- list2cds.old	Mon Jun  5 02:03:13 2000
+++ list2cds	Mon Jun  5 02:15:55 2000
@@ -24,6 +24,8 @@
 my $adir = "$ENV{'APTTMP'}/$ENV{'CODENAME'}-$ENV{'ARCH'}";
 my $dir = "$ENV{'TDIR'}/$ENV{'CODENAME'}-$ENV{'ARCH'}";
 my $verbose = $ENV{'VERBOSE'} || 0;
+my $extranonfree = 1;
+my $doing_nonfree = 0;
 
 $| = 1; # Autoflush for debugging
 
@@ -210,6 +212,23 @@
 }
 msg(0, "CD $cd will only be filled with $cd_size bytes ...\n");
 
+# And now add the non-free packages to separate non-free CDs
+if ($nonfree and $extranonfree) {
+    my $p;
+    $doing_nonfree=1;
+    $cd++;
+    $cd_size = 0;
+    # New limit
+    $limit = $ENV{"SIZELIMIT$cd"} || $deflimit;
+    msg(0, "Limit for non-free CD $cd is $limit.\n");
+    foreach $p (sort { ($packages{$a}{"Section"} cmp $packages{$b}{"Section"})
+		       || ($a cmp $b) }
+	      grep { not ($included{$_} or $excluded{$_}) } keys %packages) {
+        add_package ($p, 0);
+    }
+}
+msg(0, "CD $cd will only be filled with $cd_size bytes ...\n");
+
 # Remove old files
 foreach (glob("$dir/*.packages")) {
 	unlink $_;
@@ -349,6 +368,7 @@
 sub add_package {
 	my $p = shift;
 	my $add_rec = shift; # Do we look for recommends/suggests
+	my $q;
 	
 	msg(2, "+ Trying to add $p...\n");
 	if ($included{$p}) {
@@ -388,30 +408,33 @@
 		msg(3, "  \@dep after checklist2 = @dep\n");
 	}
 	
-	# All packages are ok, now check for the size issue
-	$size = get_size (\@dep);
-
-	# Creation of a new CD when needed
-	if ($cd_size + $size > $limit) {
-		msg(0, "CD $cd filled with $cd_size bytes ... ",
-		       "(limit was $limit)\n");
-		$cd++;
-		$cd_size = 0;
-		# New limit
-		$limit = $ENV{"SIZELIMIT$cd"} || $deflimit;
-		msg(2, "Limit for CD $cd is $limit.\n");
-	}
-
-	msg(2, "  \$cd_size = $cd_size, \$size = $size\n");
-
-	$cd_size += $size;
-	$total_size += $size;
-
-	add_to_cd ($cd, \@dep);
-
 	# Mark the packages included
-	foreach (@dep) {
-		$included{$_} = $cd;
+	foreach $q (@dep) {
+	    if (!$doing_nonfree and $extranonfree and grep { $packages{$q}{"Section"} =~ /non-free/ } (keys %packages)) {
+	        msg(3, "Ignoring non-free reference to '$q'\n");
+	    } else {
+	        # All packages are ok, now check for the size issue
+	        $size = get_size ([$q]);
+
+	        # Creation of a new CD when needed
+	        if ($cd_size + $size > $limit) {
+		  msg(0, "CD $cd filled with $cd_size bytes ... ",
+		      "(limit was $limit)\n");
+		  $cd++;
+		  $cd_size = 0;
+		  # New limit
+		  $limit = $ENV{"SIZELIMIT$cd"} || $deflimit;
+		  msg(2, "Limit for CD $cd is $limit.\n");
+	        }
+	        
+	        msg(2, "  \$cd_size = $cd_size, \$size = $size\n");
+	        
+	        $cd_size += $size;
+	        $total_size += $size;
+
+	        add_to_cd ($cd, [$q]);
+	        $included{$q} = $cd;
+	    }
 	}
 }
 

Reply to: