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

Bug#405886: PATCH: add invocation mode for custom add-on udebs



Package: anna
Severity: wishlist
Tags: patch

This patch actually doesn't do very much, and it doesn't mess with the behavior
of anna on existing invocations at all.

During the development of customization-modules, I found that anna did have some
hardwired behavior which seemed inappropriate for the context.  This therefore
adds a third way of invoking anna, which has a much simpler udeb-selection procedure
than the ordinary methods.  It asks about all of them, except for:
* those already installed, which are skipped
* udebs with mismatching subarch or kernel, which are skipped
* certain kernel packages involving "Provides" which are queued by anna-install
  (which should never happen unless a customization udeb does it)
* possibly certain situtations involving "Enhances"; I didn't mess with that part of
  the code because I think it doesn't work correctly at the moment anyway

I believe this is of sufficient size that my copyright notice *is* necessary.

Index: anna.c
===================================================================
--- anna.c	(revision 43677)
+++ anna.c	(working copy)
@@ -64,7 +64,8 @@
 	return 1;
 }
 
-static int choose_modules(di_packages *status, di_packages **packages) {
+static int choose_modules(bool customizing, 
+                          di_packages *status, di_packages **packages) {
 	char *choose_modules_question = "anna/choose_modules" ;
 	char *question_priority = "medium";
 	char *choices;
@@ -74,9 +75,17 @@
 	bool standard_modules = true;
 	bool lowmem_mode = false;
 
-	/* Test lowmem level to know if packages with want_install status
-	   will be shown */
-	if ( get_lowmem_level() >= 2) {
+	if (customizing) {
+		/* Always ask about all modules (except those for the wrong kernel
+		   version or wrong subarch) when customizing -- and we may need
+		   to ask repeatedly */
+		choose_modules_question = "anna/choose_modules_custom";
+		question_priority = "high";
+		debconf_fset(debconf, "anna/choose_modules_custom", "seen", "false");
+	}
+	else if ( get_lowmem_level() >= 2) {
+		/* Test lowmem level to know if packages with want_install status
+		   will be shown */
 		lowmem_mode = true;
 		choose_modules_question="anna/choose_modules_lowmem";
 		/* force priority to show question even in a non expert mode */
@@ -138,7 +147,11 @@
 			}
 		}
 
-		if (package->priority >= di_package_priority_standard) {
+		if (customizing) {
+			package->status_want = di_package_status_want_unknown;
+			di_log (DI_LOG_LEVEL_DEBUG, "ask for %s, is customization module", package->package);
+		}
+		else if (package->priority >= di_package_priority_standard) {
 			if (standard_modules || ((di_system_package *)package)->kernel_version) {
 				package->status_want = di_package_status_want_install;
 				di_log (DI_LOG_LEVEL_DEBUG, "install %s, priority >= standard", package->package);
@@ -358,6 +371,7 @@
 	di_packages_allocator *status_allocator;
 	struct utsname uts;
 	const char *quiet_env;
+	bool customizing = false;
 
 	debconf = debconfclient_new();
 	debconf_capb(debconf, "backup");
@@ -471,15 +485,23 @@
 		else if (strcmp(argv[2], "default") == 0) {
 			set_retriever(argv[1], 1);
 		}
+		else if (strcmp(argv[2], "custom") == 0) {
+			set_retriever(argv[1], 0);
+			customizing = true;
+		}
 		retriever_config();
 
 		packages = get_packages();
-		if (! packages || ! packages_ok(packages)) {
+		if (! packages ) {
 			retriever_cleanup();
 			return 10;
 		}
+		if (! customizing && ! packages_ok(packages)) {
+			retriever_cleanup();
+			return 10;
+		}
 
-		if (choose_modules(status, &packages) != 0) {
+		if (choose_modules(customizing, status, &packages) != 0) {
 			ret = 10;
 		}
 		else  {
Index: README
===================================================================
--- README	(revision 43677)
+++ README	(working copy)
@@ -12,6 +12,11 @@
 	Same as above, except that the retriever is stored as the default
 	retriever to use.
 
+anna <retriever> custom
+
+	Same as top, except with somewhat different messages and defaults
+	based on the assumption that these are custom third-party udebs.
+
 anna install <udeb ..>
 
 	Uses the default retriever to get the specified udebs and installs
Index: debian/anna.templates
===================================================================
--- debian/anna.templates	(revision 43677)
+++ debian/anna.templates	(working copy)
@@ -23,6 +23,16 @@
  Note that if you select a component that requires others, those
  components will also be loaded.
 
+Template: anna/choose_modules_custom
+Type: multiselect
+Choices: ${CHOICES}
+_Description: Custom installer components to load:
+ The custom installer components from your selected source are
+ listed here.
+ .
+ Note that if you select a component that requires others, those
+ components will also be loaded.
+
 Template: anna/progress_title
 Type: text
 # (Progress bar) title displayed when loading udebs
Index: debian/copyright
===================================================================
--- debian/copyright	(revision 43677)
+++ debian/copyright	(working copy)
@@ -2,3 +2,7 @@
 
 anna is Copyright (C) 2000 by Joey Hess, under the terms of the GPL.
 Apologetically dedicated to my sister, Anna.
+
+Portions copyright 2006 Nathanael Nerode.  These portions are licensed
+under the GNU General Public License, version 2 or later, as published 
+by the Free Software Foundation.



Reply to: