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

Extra non-free support... please test !



Hi,

since people wanted this change rapidly, i've done it. And i committed it
but I didn't test it !!! So please test it ... and tell me if it works.

For convenience, I've attached the complete patch i've used. I've
rewritten most of the previous patch ... this one looks cleaner to me,
with EXTRANONFREE=0 it does *exactly* the same than before ...

There's a little change in the logic, NONFREE and EXTRANONFREE can't be
set at the same time.

For the non-US stuff, I've written nothing yet. I don't know how I'll do
it. Maybe i'll add FORCENONUSONCD1 variable that will include complete
NON-US on CD1. For generating the US set you simply need to use the same
*.packages files but with non-US packages removed ... I don't know how I
will integrate all this... if you have a nice idea, please let me know. :)

Cheers,
-- 
Raphaël Hertzog -+- http://strasbourg.linuxfr.org/~raphael/
diff -ur debian-cd-backup/CONF.sh debian-cd/CONF.sh
--- debian-cd-backup/CONF.sh	Thu May 18 19:07:28 2000
+++ debian-cd/CONF.sh	Tue Jun  6 19:03:23 2000
@@ -43,8 +43,12 @@
 # This cannot reside on an NFS mount.
 export APTTMP=/ftp/tmp/apt
 
-# Do I want to have NONFREE
+# Do I want to have NONFREE merged in the CD set
 # export NONFREE=1
+
+# Do I want to have NONFREE on a separate CD (the last CD of the CD set)
+# WARNING: Don't use NONFREE and EXTRANONFREE at the same time !
+# export EXTRANONFREE=1
 
 # If you have a $MIRROR/dists/$CODENAME/local/binary-$ARCH dir with 
 # local packages that you want to put on the CD set then
diff -ur debian-cd-backup/Makefile debian-cd/Makefile
--- debian-cd-backup/Makefile	Sat May 20 21:40:55 2000
+++ debian-cd/Makefile	Tue Jun  6 19:00:08 2000
@@ -113,6 +113,12 @@
 ifndef OUT
 ok=false
 endif
+# Never use NONFREE and EXTRANONFREE at the same time
+ifdef NONFREE
+ifdef EXTRANONFREE
+ok=false
+endif
+endif
 
 default:
 	@echo "Please refer to the README file for more information"
diff -ur debian-cd-backup/README debian-cd/README
--- debian-cd-backup/README	Thu May 18 19:00:15 2000
+++ debian-cd/README	Tue Jun  6 18:34:38 2000
@@ -102,6 +102,10 @@
     if you have one)
   - if NONFREE is set, then packages from non-free will be allowed
     (NONFREE must be exported to all sub-shells)
+  - if EXTRANONFREE is set, then non-free packages will be included
+    on an extra CD (the last CD in fact). Don't use NONFREE and
+    EXTRANONFREE at the same time !
+    (EXTRANONFREE must be exported to all sub-shells)
   - if COMPLETE is set, all packages that are not listed in the
     selected task file will be included at the end
   - if SIZELIMIT is set, it will be used as the maximum size that
diff -ur debian-cd-backup/debian/CONF.sh debian-cd/debian/CONF.sh
--- debian-cd-backup/debian/CONF.sh	Thu May 18 19:11:56 2000
+++ debian-cd/debian/CONF.sh	Tue Jun  6 17:33:54 2000
@@ -38,8 +38,12 @@
 # This cannot reside on an NFS mount.
 export APTTMP=/home/ftp/tmp/apt
 
-# Do I want to have NONFREE
+# Do I want to have NONFREE merged in the CD set
 # export NONFREE=1
+
+# Do I want to have NONFREE on a separate CD (the last CD of the CD set)
+# WARNING: Don't use NONFREE and EXTRANONFREE at the same time !
+# export EXTRANONFREE=1
 
 # If you have a $MIRROR/dists/$CODENAME/local/binary-$ARCH dir with 
 # local packages that you want to put on the CD set then
diff -ur debian-cd-backup/debian/changelog debian-cd/debian/changelog
--- debian-cd-backup/debian/changelog	Sun Jun  4 02:12:00 2000
+++ debian-cd/debian/changelog	Tue Jun  6 19:09:16 2000
@@ -6,6 +6,9 @@
   * Update for m68k, they should at least build now.
   * Include upgrade-{i386,sparc,alpha,m68k} dir when available.
   * Updated README.html.in (new version provided by Anne Bezemer).
+  * Added EXTRANONFREE support. It allows to generate an extra non-free CD.
+    The first CDs are totally free and the last(s) CD(s) contains 
+    only non-free and possibly some files from contrib.
 
  -- Raphael Hertzog <hertzog@debian.org>  Sat, 20 May 2000 23:42:58 +0200
 
diff -ur debian-cd-backup/tools/add_dirs debian-cd/tools/add_dirs
--- debian-cd-backup/tools/add_dirs	Tue Mar  7 15:39:26 2000
+++ debian-cd/tools/add_dirs	Tue Jun  6 18:25:58 2000
@@ -8,6 +8,12 @@
 
 set -e
 
+# There's no difference between NONFREE and EXTRANONFREE for this script
+if [ -n "$EXTRANONFREE" ]
+then
+	NONFREE=1
+fi
+
 cd $1
 
 ln -sf . debian
diff -ur debian-cd-backup/tools/apt-selection debian-cd/tools/apt-selection
--- debian-cd-backup/tools/apt-selection	Tue Mar 14 19:12:18 2000
+++ debian-cd/tools/apt-selection	Tue Jun  6 18:30:14 2000
@@ -27,7 +27,7 @@
 	  -o Dir::Etc=$APTTMP/$CODENAME-$ARCH/apt/ \
 	  -o APT::Architecture=$ARCH "
 
-if [ -n "$NONFREE" ]; then
+if [ -n "$NONFREE" -o -n "$EXTRANONFREE" ]; then
 	sections="main contrib non-free"
 else
 	sections="main contrib"
diff -ur debian-cd-backup/tools/cds2src debian-cd/tools/cds2src
--- debian-cd-backup/tools/cds2src	Sat Apr  1 21:36:31 2000
+++ debian-cd/tools/cds2src	Tue Jun  6 19:01:46 2000
@@ -14,7 +14,8 @@
 my $deflimit = $ENV{'SRCSIZELIMIT'} || $ENV{'SIZELIMIT'} || shift || 629145600;
 my $limit = $ENV{'SRCSIZELIMIT1'} || $deflimit;
 
-my $nonfree = $ENV{'NONFREE'};
+my $nonfree = $ENV{'NONFREE'} || 0;
+my $extranonfree = $ENV{'EXTRANONFREE'} || 0;
 my $nonus = $ENV{'NONUS'} || 0;
 my $complete = $ENV{'COMPLETE'} || 0;
 my $local = $ENV{'LOCAL'} || 0;
@@ -42,6 +43,7 @@
 my %bin2src;
 my %sources;
 my %included;
+my %excluded;
 
 # Get the information from the good Sources.gz files
 my @SOURCES = ("$mirror/dists/$codename/main/source/Sources.gz",
@@ -52,7 +54,7 @@
              "$nonus/dists/$codename/non-US/main/source/Sources.gz",
              "$nonus/dists/$codename/non-US/contrib/source/Sources.gz";
 } 
-if ($nonfree) {
+if ($nonfree or $extranonfree) {
 	push @SOURCES, "$mirror/dists/$codename/non-free/source/Sources.gz";
 	if ($nonus and ($codename ne "slink")) {
 	  push @SOURCES,
@@ -88,6 +90,19 @@
 		(m/^$re: (.*?)\s*$/m and $sources{$p}{$re} = $1)
 		|| msg(1, "Header field '$re' missing for source '$p'\n");
 	}
+	# Avoid a perl warning for sources packages without section header
+	if (! exists $sources{$p}{"Section"})
+	{
+		$sources{$p}{"Section"} = "No section";
+	}
+	# Generate the list of non-free source packages to exclude
+	if ((! $nonfree) and ($sources{$p}{"Section"} =~ /non-free/))
+	{
+		$excluded{$p} = "nonfree";
+	} else {
+		$excluded{$p} = 0;
+	}
+	# Match between source & binary packages
 	foreach $bin (split (/,\s+/, $sources{$p}{"Binary"})) {
 		$bin2src{$bin} = $p;
 	}
@@ -135,6 +150,7 @@
 		msg(0, "ERROR: Source `$src' does not exist ... (ignored)\n");
 		next;
 	}
+	next if $excluded{$src};
 	next if $included{$src};
 	add_src ($src);
 }
@@ -143,11 +159,38 @@
     msg(0, "Now we'll add the sources not yet included ...\n");
     foreach $p (sort { ($sources{$a}{"Section"} cmp $sources{$b}{"Section"})
                        || ($a cmp $b) }
-                grep { not $included{$_} } keys %sources) 
+                grep { not ($included{$_} or $excluded{$_}) } keys %sources) 
     {
 	add_src ($p);
     }
+}
+msg(0, "CD $cd will only be filled with $cd_size bytes ...\n");
+
+# Now generate the extra non-free CD
+if ($extranonfree and (! $nonfree))
+{
+	my ($p, @toinclude);
+	
+	# Finally accept non-free packages
+	foreach $p (grep { $excluded{$p} eq "nonfree" } (keys %sources))
+	{
+		$excluded{$p} = 0;
+		push @toinclude, $p;
+	}
+
+	# Start a new CD
+	$cd++;
+	$cd_size = 0;
+	$limit = $ENV{"SRCSIZELIMIT$cd"} || $deflimit;
+	msg(0, "Limit for non-free source CD $cd is $limit.\n");
+
+	# Include non-free source packages
+	foreach $p (@toinclude)
+	{
+		add_src ($p);
+	}
 
+	msg(0, "CD $cd will only be filled with $cd_size bytes ...\n");
 }
 
 # Now write the lists down
diff -ur debian-cd-backup/tools/list2cds debian-cd/tools/list2cds
--- debian-cd-backup/tools/list2cds	Mon May  1 10:50:36 2000
+++ debian-cd/tools/list2cds	Tue Jun  6 17:31:14 2000
@@ -15,6 +15,7 @@
 my $limit = $ENV{'SIZELIMIT1'} || $deflimit;
 
 my $nonfree = $ENV{'NONFREE'} || 0;
+my $extranonfree = $ENV{'EXTRANONFREE'} || 0;
 my $nonus = $ENV{'NONUS'} || 0;
 my $local = $ENV{'LOCAL'} || 0;
 my $complete = $ENV{'COMPLETE'} || 0;
@@ -209,6 +210,65 @@
     }
 }
 msg(0, "CD $cd will only be filled with $cd_size bytes ...\n");
+
+# Now select the non-free packages for an extra CD
+if ($extranonfree and (! $nonfree))
+{
+	my ($p, @toinclude);
+	
+	# Finally accept non-free packages ...
+	foreach $p (grep { $excluded{$_} eq "nonfree" } (keys %excluded))
+	{
+		$excluded{$p} = 0;
+		push @toinclude, $p;
+	}
+	
+	# Start a new CD
+	$cd++;
+	$cd_size = 0;
+	$limit = $ENV{"SIZELIMIT$cd"} || $deflimit;
+	msg(0, "Limit for non-free CD $cd is $limit.\n");
+	
+	# Include non-free packages
+	foreach $p (@toinclude)
+	{
+		add_package($p, 1);
+	}
+
+	# If a contrib package was listed in the list of packages to
+	# include and if COMPLETE=0 there's a chance that the package
+	# will not get included in any CD ... so I'm checking the complete
+	# list again
+	open (LIST, "< $list") || die "Can't open $list : $!\n";
+	while (defined($_=<LIST>)) {
+		chomp;
+		next if m/^\s*$/;
+		next if $included{$_};
+		next if $excluded{$_};
+		if (not exists $packages{$_}) { 
+		  msg(1, "WARNING: '$_' does not appear to be available ... " . 
+	          	 "(ignored)\n");
+		  next;
+		}
+		add_package ($_, 1);
+	}
+	close LIST;
+
+	# Try to include other packages that could not be included
+	# before (because they depends on excluded non-free packages)
+	if ($complete)
+	{
+	    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")) {
diff -ur debian-cd-backup/tools/scanpackages debian-cd/tools/scanpackages
--- debian-cd-backup/tools/scanpackages	Tue Mar  7 18:05:22 2000
+++ debian-cd/tools/scanpackages	Tue Jun  6 18:27:06 2000
@@ -11,7 +11,7 @@
 
 PREFIX=$2
 NUM=${PREFIX##$TDIR/$CODENAME-$ARCH/}
-if [ -n "$NONFREE" ]; then
+if [ -n "$NONFREE" -o -n "$EXTRANONFREE" ]; then
   SECTIONS="main contrib non-free"
 else
   SECTIONS="main contrib"
diff -ur debian-cd-backup/tools/scansources debian-cd/tools/scansources
--- debian-cd-backup/tools/scansources	Tue Mar  7 18:06:35 2000
+++ debian-cd/tools/scansources	Tue Jun  6 18:27:44 2000
@@ -9,7 +9,7 @@
 set -e
 
 PREFIX=$1
-if [ -n "$NONFREE" ]; then
+if [ -n "$NONFREE" -o -n "$EXTRANONFREE" ]; then
   SECTIONS="main contrib non-free"
 else
   SECTIONS="main contrib"

Reply to: