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

Bug#216787: virtual package handling in main-menu?



reopen 216787
thanks

On Tue, Oct 21, 2003 at 12:36:33PM +0200, Petter Reinholdtsen wrote:
> 
> [Matt Kraai]
> > Log Message:
> > Do not default to a package that provides a virtual package that is
> > also provided by a package that is already installed (closes:
> > #216787).
> 
> Are you sure this work?

No.

>                          I tried to test it, and it still selected
> lilo-installer after grub-installer completed successfully.

Would you please test the following patch?

Index: main-menu/main-menu.c
===================================================================
RCS file: /cvs/debian-boot/debian-installer/main-menu/main-menu.c,v
retrieving revision 1.100
diff -u -r1.100 main-menu.c
--- main-menu/main-menu.c	21 Oct 2003 00:18:13 -0000	1.100
+++ main-menu/main-menu.c	21 Oct 2003 13:37:59 -0000
@@ -68,12 +68,31 @@
 	}
 }
 
+int provides_installed_virtual_package(di_package *p) {
+	di_slist_node *node1, *node2;
+
+	for (node1 = p->depends.head; node1; node1 = node1->next) {
+		di_package_dependency *d = node1->data;
+
+		if (d->type == di_package_dependency_type_provides)
+			for (node2 = d->ptr->depends.head; node2; node2 = node2->next) {
+				d = node2->data;
+
+				if (d->type == di_package_dependency_type_reverse_provides
+				    && d->ptr->status == di_package_status_installed)
+					return 1;
+			}
+	}
+
+	return 0;
+}
+
 /* Expects a topologically ordered linked list of packages. */
 static di_system_package *
 get_default_menu_item(di_slist *list)
 {
 	di_system_package *p;
-	di_slist_node *node, *node1;
+	di_slist_node *node;
 	int cont;
 
 	/* Traverse the list, return the first menu item that isn't installed */
@@ -87,17 +106,10 @@
 		if (!isdefault(p))
 			continue;
 		cont = 0;
-		/* Check if a "parallel" package is installed
-		 * (netcfg-{static,dhcp} and {lilo,grub}-installer are
-		 * examples of parallel packages */
-		for (node1 = p->p.depends.head; node1; node1 = node1->next) {
-			di_package_dependency *d = node1->data;
-			if (d->type == di_package_dependency_type_provides && d->ptr->status == di_package_status_installed) {
-				cont = 1;
-				break;
-			}
-		}
-		if (!cont)
+		/* Do not default to a package that provides a virtual
+		   package that is provided by a package that is
+		   already installed.  */
+		if (!provides_installed_virtual_package(&p->p))
 			return p;
 	}
 	/* Severely broken, there are no menu items in the sorted list */


-- 
Matt



Reply to: