Okay. I'm sure this is going to be buggy. But it seems to work. :-/

Basically, when constructing the dependency/conflict resolution screen,
instead of just immediately saying `hey, foo recommends bar', we don't
instead don't say anything about it until we've gone through and found
something to satisfy that recommendation.

Ditto for suggestions.

So if you have a package in main that recommends a non-free package,
but you don't put non-free in your sources.list, with this patch
dselect will let you select the main package without stopping and
mentioning the non-free thing at all.

I'd really appreciate it if someone could work through the logic, though.
It seems to make sense, but I'm not really clear on how other bits of
dselect work :(

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;

Cheers,
aj

-- 
Anthony Towns <[EMAIL PROTECTED]> <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: pgpwIstKXvR7F.pgp
Description: PGP signature

Reply via email to