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

Re: udpkg wierdness



Glenn McGrath wrote:
> The situation is that we put all the package information into a binary
> tree, and search for stuff using the package name.
> Anything in either the Packages (for real packages) or Provides (for
> virtual packages) field is a added to the tree as it is considered to be
> a package.
> 
> We search the binary tree using the structs package name field, but the
> problem package names occur twice (as virtual and real packages), so the
> first search isnt neccessarily going to produce a correct result.

Um, they shouldn't appear twice. The virtual package insertian code uses
tsearch to add a virtual package if no package by that name exists in the
tree.

The package adding code currently does the same thing, so if a provides is
seen *before* a real package by the same name, the real package's info is
ignored. Ok, so all we should need to do is change the code so if a real
package is seen after a virtual package, the virtual package is just deleted
out of the tree first.

Index: status.c
===================================================================
RCS file: /cvs/debian-boot/debian-installer/tools/udpkg/status.c,v
retrieving revision 1.19
diff -u -r1.19 status.c
--- status.c	2000/12/31 01:24:51	1.19
+++ status.c	2001/02/09 22:25:09
@@ -153,6 +153,12 @@
 		control_read(f, m);
 		if (m->package)
 		{
+			/*
+			 * If there is an item in the tree by this name,
+			 * it must be a virtual package; insert real
+			 * package in preference.
+			 */
+			tdelete(m, &status, package_compare);
 			tsearch(m, &status, package_compare);
 			if (m->provides)
 			{

I haven't committed this since I don't have a test case handy. Please test
and commit if it works..

> A few ways we can go
> 
> 1) Dont add virtual packages to the tree.

Breaks dependancy checks, badly.

> 2) Dont add virtual packages that are also real packages to the tree

Yup.

-- 
see shy jo



Reply to: