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

Re: [PROPOSED] Change package relations policy to remove references to non-free from main



On Sat, Dec 04, 1999 at 01:31:50AM +1000, Anthony Towns wrote: [in response
to Raul]
> > Once again: why are we talking about making our package meta-data
> > specification more complicated to support a small subset of non-free
> > packages?
> Eh? The only `specification' change that I'd even vaguely want would be
> an addition to the Packaging Manual section 8.2 something like: [...]

To be more explicit, what seems best to me is just stopping dselect from
whining about any Suggestion it can't satisfy. So if you have a package
that, say,
	Suggests: gzip, bzip2, lha, zip | unzip
it'll pop up a dependency resolution screen to suggest gzip or bzip2, but
if you already have both of those installed, it won't complain about the
lha or zip/unzip dependencies.

The following patch to dselect tries to implement this. It appears to succeed,
but could be buggy, I'm not entirely clear on what's going on. Maybe some
of the -dpkg people could comment?

Note that if you have a dependency like:

	Suggests: bzip2 | zip | unzip

dselect will still mention the non-free packages when saying:

	`foo suggests bzip2 or zip or unzip'

Cheers,
aj

diff -ur ../dpkg-1.4.1.11-real/dselect/pkgdepcon.cc dselect/pkgdepcon.cc
--- ../dpkg-1.4.1.11-real/dselect/pkgdepcon.cc	Mon Nov  2 02:04:48 1998
+++ dselect/pkgdepcon.cc	Sat Dec  4 15:00:05 1999
@@ -202,6 +202,7 @@
   perpackagestate *best, *fixbyupgrade;
   deppossi *possi, *provider;
   int r, foundany;
+  int rdone;
 
   if (depdebug && debug) {
     fprintf(debug,"packagelist[%p]::resolvedepcon([%p] %s --%s-->",
@@ -244,9 +245,12 @@
     if (possi) return 0;
 
     // Ensures all in the recursive list; adds info strings; ups priorities
-    r= add(depends, depends->type == dep_suggests ? dp_may : dp_must);
-
-    if (depends->type == dep_suggests) return r;
+    if (depends->type == dep_suggests) {
+      rdone = 0;
+    } else {
+      r= add(depends, depends->type == dep_suggests ? dp_may : dp_must);
+      rdone = 1;
+    }
 
     if (fixbyupgrade) {
       if (depdebug && debug) fprintf(debug,"packagelist[%p]::resolvedepcon([%p]): "
@@ -259,29 +263,44 @@
            possi= possi->next) {
         foundany= 0;
         if (possi->ed->clientdata) foundany= 1;
-        if (dep_update_best_to_change_stop(best, possi->ed)) goto mustdeselect;
+        if (depends->type != dep_suggests &&
+            dep_update_best_to_change_stop(best, possi->ed))
+        {
+          goto mustdeselect;
+        }
         for (provider= possi->ed->available.valid ? possi->ed->available.depended : 0;
              provider;
              provider= provider->nextrev) {
           if (provider->up->type != dep_provides) continue;
           if (provider->up->up->clientdata) foundany= 1;
+          if (depends->type == dep_suggests) continue;
           if (dep_update_best_to_change_stop(best, provider->up->up)) goto mustdeselect;
         }
-        if (!foundany) addunavailable(possi);
+        if (!foundany && depends->type != dep_suggests) addunavailable(possi);
+        if (foundany && !rdone) {
+          r= add(depends, depends->type == dep_suggests ? dp_may : dp_must);
+          rdone = 1;
+        }
+
+        
       }
       if (!best) {
         if (depdebug && debug) fprintf(debug,"packagelist[%p]::resolvedepcon([%p]): "
                               "mustdeselect nobest\n", this,depends);
-        return r;
+        return rdone ? r : 0;
       }
     }
     if (depdebug && debug)
       fprintf(debug,"packagelist[%p]::resolvedepcon([%p]): select best=%s{%d}\n",
               this,depends, best->pkg->name, best->spriority);
-    if (best->spriority >= sp_selecting) return r;
-    best->selected= best->suggested= pkginfo::want_install;
-    best->spriority= sp_selecting;
-    return 2;
+    if (depends->type == dep_suggests) {
+      return rdone ? r : 0;
+    } else {
+      if (best->spriority >= sp_selecting) return r;
+      best->selected= best->suggested= pkginfo::want_install;
+      best->spriority= sp_selecting;
+      return 2;
+    } 
     
   mustdeselect:
     best= depends->up->clientdata;


-- 
Anthony Towns <aj@humbug.org.au> <http://azure.humbug.org.au/~aj/>
I don't speak for anyone save myself. GPG encrypted mail preferred.

 ``The thing is: trying to be too generic is EVIL. It's stupid, it 
        results in slower code, and it results in more bugs.''
                                        -- Linus Torvalds

Attachment: pgpXe1u3Qr2Y2.pgp
Description: PGP signature


Reply to: