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

Re: Change how debian-cd include recommended packages?



[Petter Reinholdtsen]
> Any comments?  Any idea how to change debian-cd to make it behave
> this way?

I believe this patch solve it.  It will first check all the packages
listed in the OR list to see if any of them are already included.  If
none of them are included, the first of the acceptable packages is
added.  I'm testing this with Debian Edu now.  It got rid of quite a
few unwanted packages. :)

diff -Nur --exclude=debian-installer-etch --exclude=debian-installer+kernel-etch --exclude=unexclude-CD2-etch --exclude=.svn --exclude=sid debian-cd.unpatched/tools/list2cds debian-cd/tools/list2cds
--- debian-cd.unpatched/tools/list2cds
+++ debian-cd/tools/list2cds
@@ -564,7 +573,9 @@
 		# If it's an OR
 		if (ref) {
 			my $or_ok = 0;
-			# Loop over each package in the OR
+			# Loop over each package in the OR, see if one of them
+			# already is included
+			my @candidate = ();
 			foreach my $pkg (@{$_}) {
 				next if not accepted ($pkg);
 				# If the package is already included
@@ -577,14 +588,17 @@
 				if (is_in ($pkg, $list)) {
 					$or_ok = 1;
 					last;
-				# Otherwise try to add it
-				} else {
-					#Instead of doing a bad choice I'm
-					#including all packages that do
-					#fit to the needs
+				}
+				push @candidate, $pkg;
+			}
+			# If non of the OR-ed packages are included,
+			# include the first non-excluded one that work.
+			if (!$or_ok) {
+				foreach my $pkg (@candidate) {
 					push (@{$list}, $pkg);
 					if (add_missing ($list, $packages{$pkg}{"Depends"}, $pkg)) {
 						$or_ok = 1;
+						last;
 					} else {
 						pop @{$list};
 					}


Happy hacking,
-- 
Petter Reinholdtsen



Reply to: