Package: dpkg
Version: 1.13.21
Severity: wishlist
Tags: patch

As discussed on debian-dpkg, I enclose the first step towards
supporting Breaks.  If you approve of the the patch I think it should
be applied in sid immediately: although we don't have a clear
deployment plan for Debian yet, this change is almost certain to be a
necessary first step and this new behaviour (rejecting Breaks) is
certainly a step in the right direction.

Thanks,
Ian.

diff --exclude='*~' -ruN orig/dpkg-1.13.21ubuntu1/debian/changelog 
dpkg-1.13.21ubuntu1/debian/changelog
--- orig/dpkg-1.13.21ubuntu1/debian/changelog   2006-06-08 11:32:56.000000000 
+0100
+++ dpkg-1.13.21ubuntu1/debian/changelog        2006-06-27 18:14:53.000000000 
+0100
@@ -1,3 +1,17 @@
+dpkg (1.13.21ubuntu2) edgy; urgency=low
+
+  * `Breaks': Implement step 1 of PackageDependencyFieldBreaks:
+     - Parse Breaks as a dependency field where `|' is not allowed,
+       and know how to display it, etc.
+     - Refuse to install an archive which contains Breaks unless
+       --force-depends is specified (I think --force-depends is right
+       rather than --force-conflicts or a new --force-breaks for this).
+     - Explicitly ignore Breaks in the handful of places where that's
+       needed, so that if a package with Breaks is somehow installed the
+       Breaks field will not cause trouble (it will be ignored).
+
+ -- Ian Jackson <[EMAIL PROTECTED]>  Tue, 27 Jun 2006 18:14:46 +0100
+
 dpkg (1.13.21ubuntu1) edgy; urgency=low
 
   * Resynchronise with Debian. One change remains, namely IWJ's
diff --exclude='*~' -ruN orig/dpkg-1.13.21ubuntu1/lib/dpkg-db.h 
dpkg-1.13.21ubuntu1/lib/dpkg-db.h
--- orig/dpkg-1.13.21ubuntu1/lib/dpkg-db.h      2006-02-11 06:25:06.000000000 
+0000
+++ dpkg-1.13.21ubuntu1/lib/dpkg-db.h   2006-06-27 11:55:52.000000000 +0100
@@ -41,7 +41,8 @@
   dep_conflicts,
   dep_provides,
   dep_replaces,
-  dep_enhances
+  dep_enhances,
+  dep_breaks
 };
 
 enum depverrel {
diff --exclude='*~' -ruN orig/dpkg-1.13.21ubuntu1/lib/fields.c 
dpkg-1.13.21ubuntu1/lib/fields.c
--- orig/dpkg-1.13.21ubuntu1/lib/fields.c       2006-02-11 06:25:06.000000000 
+0000
+++ dpkg-1.13.21ubuntu1/lib/fields.c    2006-06-27 11:51:37.000000000 +0100
@@ -439,6 +439,7 @@
                  " error after reference to package `%.255s'"),
                  fip->name, dop->ed->name);
       if (fip->integer == dep_conflicts ||
+          fip->integer == dep_breaks ||
           fip->integer == dep_provides ||
           fip->integer == dep_replaces)
         parseerr(NULL,filename,lno, warnto,warncount,pigp,0,
diff --exclude='*~' -ruN orig/dpkg-1.13.21ubuntu1/lib/parse.c 
dpkg-1.13.21ubuntu1/lib/parse.c
--- orig/dpkg-1.13.21ubuntu1/lib/parse.c        2006-01-19 00:24:24.000000000 
+0000
+++ dpkg-1.13.21ubuntu1/lib/parse.c     2006-06-27 11:50:43.000000000 +0100
@@ -63,6 +63,7 @@
   { "Suggests",         f_dependency,      w_dependency,     dep_suggests      
       },
   { "Conflicts",        f_dependency,      w_dependency,     dep_conflicts     
       },
   { "Enhances",         f_dependency,      w_dependency,     dep_enhances      
       },
+  { "Breaks",           f_dependency,      w_dependency,     dep_breaks        
       },
   { "Conffiles",        f_conffiles,       w_conffiles                         
       },
   { "Filename",         f_filecharf,       w_filecharf,      FILEFOFF(name)    
       },
   { "Size",             f_filecharf,       w_filecharf,      FILEFOFF(size)    
       },
diff --exclude='*~' -ruN orig/dpkg-1.13.21ubuntu1/src/depcon.c 
dpkg-1.13.21ubuntu1/src/depcon.c
--- orig/dpkg-1.13.21ubuntu1/src/depcon.c       2006-06-04 13:51:24.000000000 
+0100
+++ dpkg-1.13.21ubuntu1/src/depcon.c    2006-06-27 11:55:42.000000000 +0100
@@ -156,6 +156,7 @@
   case dep_conflicts:   varbufaddstr(addto, _(" conflicts with ")); break;
   case dep_suggests:    varbufaddstr(addto, _(" suggests ")); break;
   case dep_enhances:    varbufaddstr(addto, _(" enhances "));       break;
+  case dep_breaks:      varbufaddstr(addto, _(" breaks "));         break;
   default:              internerr("unknown deptype");
   }
   varbufdependency(addto, dep);
@@ -186,7 +187,8 @@
 
   assert(dep->type == dep_depends || dep->type == dep_predepends ||
          dep->type == dep_conflicts || dep->type == dep_recommends ||
-        dep->type == dep_suggests || dep->type == dep_enhances );
+        dep->type == dep_suggests || dep->type == dep_enhances ||
+        dep->type == dep_breaks );
   
   /* The dependency is always OK if we're trying to remove the depend*ing*
    * package.
@@ -212,6 +214,16 @@
     internerr("unknown istobe depending");
   }
 
+  if (dep->type == dep_breaks)
+    /* We don't implement this and we can only be in this state
+     * if either a Breaks-ignorant or a Breaks-supporting dpkg
+     * installed the package.  In both cases it's probably too
+     * late to do anything useful about it now in this version
+     * so we just ignore it and hope.
+     * fixme-implement-Breaks
+     */
+    return 1;
+
   /* Describe the dependency, in case we have to moan about it. */
   varbufreset(whynot);
   varbufaddc(whynot, ' ');
diff --exclude='*~' -ruN orig/dpkg-1.13.21ubuntu1/src/packages.c 
dpkg-1.13.21ubuntu1/src/packages.c
--- orig/dpkg-1.13.21ubuntu1/src/packages.c     2006-05-17 00:29:42.000000000 
+0100
+++ dpkg-1.13.21ubuntu1/src/packages.c  2006-06-27 12:04:39.000000000 +0100
@@ -352,6 +352,9 @@
   debug(dbg_depcon,"checking dependencies of %s (- %s)",
         pkg->name, removing ? removing->name : "<none>");
   assert(pkg->installed.valid);
+  /* To implement Breaks we need to add code here which prevents
+   * configuration of Broken packages.
+   * fixme-implement-Breaks */
   for (dep= pkg->installed.depends; dep; dep= dep->next) {
     if (dep->type != dep_depends && dep->type != dep_predepends) continue;
     debug(dbg_depcondetail,"  checking group ...");
diff --exclude='*~' -ruN orig/dpkg-1.13.21ubuntu1/src/processarc.c 
dpkg-1.13.21ubuntu1/src/processarc.c
--- orig/dpkg-1.13.21ubuntu1/src/processarc.c   2006-05-31 03:01:49.000000000 
+0100
+++ dpkg-1.13.21ubuntu1/src/processarc.c        2006-06-27 18:00:25.000000000 
+0100
@@ -252,6 +252,16 @@
         }
       }
       break;
+    case dep_breaks:
+      fprintf(stderr, _("dpkg: regarding %s containing %s:\n"
+                       " package uses Breaks; not supported in this dpkg\n"),
+             pfilename, pkg->name);
+      if (!force_depends(dsearch->list))
+       ohshit(_("unsupported dependency problem - not installing %.250s"),
+              pkg->name);
+      fprintf(stderr, _("dpkg: warning - ignoring Breaks !\n"));
+      /* fixme-implement-Breaks */
+      break;
     case dep_suggests:
     case dep_recommends:
     case dep_depends:


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to