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

Bug#201396: anna: udebs in udeb_exclude will be installed anyway



tags 201396 + patch
thanks

On Tue, Jul 15, 2003 at 12:41:07PM +0200, Sebastian Ley wrote:
> Modules in udeb_exclude that provide a virtual package will still be
> installed automatically by anna even if there is another module that can
> satisfy that dependecy.

Here is a fix, to be applied after the patch in #222500 (which in turn
needs the one in #219888). The trick here is to make includes and
excludes change the priority of the package rather than its wanted
status. Then apply the computations, and things will work.

BTW, I think we should someday replace udeb_include/exclude by an
override file (similar to the ones used by ftpmasters).

-- 
Jeremie Koenig <sprite@sprite.fr.eu.org>
diff -ur anna.state-engine/anna.c anna/anna.c
--- anna.state-engine/anna.c	Sat Nov 29 17:57:13 2003
+++ anna/anna.c	Sun Nov 30 02:34:17 2003
@@ -104,6 +104,10 @@
     if (uname(&uts) == 0)
         running_kernel = uts.release;
 
+    /* Correct packages priorities depending on includes/excludes. */
+    take_includes(packages);
+    drop_excludes(packages);
+
     /* XXX enhances is not a legal field for udebs, so why is this here?
      *    -- JEH */
     for (node = status->list.head; node; node = node->next) {
@@ -165,12 +169,6 @@
             di_log (DI_LOG_LEVEL_DEBUG, "ask for %s, is installer item", package->package);
         }
     }
-
-    /* Include packages in udeb_include */
-    take_includes(packages);
-
-    /* Drop packages in udeb_exclude */
-    drop_excludes(packages);
 
     di_packages_resolve_dependencies_mark(packages);
 
diff -ur anna.state-engine/util.c anna/util.c
--- anna.state-engine/util.c	Sat Nov 29 15:47:13 2003
+++ anna/util.c	Sun Nov 30 02:31:12 2003
@@ -313,14 +313,14 @@
 }
 
 void
-take_includes(di_packages *packages)
+tweak_priority(di_packages *packages, char *file, di_package_priority np)
 {
     di_package *p;
     FILE *fp;
     char buf[1024], *ptr;
     di_slist_node *node;
 
-    if ((fp = fopen(INCLUDE_FILE, "r")) == NULL)
+    if ((fp = fopen(file, "r")) == NULL)
         return;
     while (fgets(buf, sizeof(buf), fp) != NULL) {
         if (buf[0] == '#')
@@ -330,42 +330,26 @@
 
 	/* XXX old code had this, but it never seemed to find a package:
 	 * p = di_packages_get_package(packages, ptr, 0);
-	 * if (p)
-	 *   p->status_want = di_package_status_want_install;
 	 */
 	for (node = packages->list.head; node; node = node->next) {
-		p = node->data;
-		if (strcmp(p->package, buf) == 0)
-			p->status_want = di_package_status_want_install;
+            p = node->data;
+            if (strcmp(p->package, buf) == 0)
+                p->priority = np;
 	}
     }
     fclose(fp);
 }
 
 void
-drop_excludes(di_packages *packages)
+take_includes(di_packages *packages)
 {
-    di_package *p;
-    FILE *fp;
-    char buf[1024], *ptr;
-    di_slist_node *node;
+    tweak_priority(packages, INCLUDE_FILE, di_package_priority_standard);
+}
 
-    if ((fp = fopen(EXCLUDE_FILE, "r")) == NULL)
-        return;
-    while (fgets(buf, sizeof(buf), fp) != NULL) {
-        if (buf[0] == '#')
-            continue;
-        if ((ptr = strchr(buf, '\n')) != NULL)
-            *ptr = '\0';
-	
-	/* XXX see comment in take_includes. */
-	for (node = packages->list.head; node; node = node->next) {
-		p = node->data;
-		if (strcmp(p->package, buf) == 0)
-			p->status_want = di_package_status_want_deinstall;
-	}
-    }
-    fclose(fp);
+void
+drop_excludes(di_packages *packages)
+{
+    tweak_priority(packages, EXCLUDE_FILE, di_package_priority_optional);
 }
 
 int

Reply to: