Sfoglia il codice sorgente

Add initial support for the Breaks field, by parsing but rejecting it.
Thanks to Ian Jackson <iwj@ubuntu.com>. Closes: #375703

Guillem Jover 20 anni fa
parent
commit
dc01bdfd23
8 ha cambiato i file con 51 aggiunte e 2 eliminazioni
  1. 17 0
      ChangeLog
  2. 4 0
      debian/changelog
  3. 1 0
      lib/dpkg-db.h
  4. 1 0
      lib/fields.c
  5. 1 0
      lib/parse.c
  6. 14 2
      src/depcon.c
  7. 3 0
      src/packages.c
  8. 10 0
      src/processarc.c

+ 17 - 0
ChangeLog

@@ -1,3 +1,20 @@
+2006-08-08  Ian Jackson  <iwj@ubuntu.com>
+
+	* lib/dpkg-db.h (deptype): Add dep_breaks.
+	* lib/fields.c (f_dependency): Bail out if the Breaks field has an
+	alternative through a '|'.
+	* lib/parse.c (fieldinfos): Add support for the Breaks field when
+	parsing them as a depedency field.
+	* src/depcon.c (describedepcon): Support displaying the Breaks
+	relationship.
+	(depisok): Ignore the Breaks field by adding dep_breaks to the assert
+	and returning as succeeded.
+	* src/processarc.c (process_archive): Print a message stating that
+	current dpkg does not support the Breaks field. Do not bail out in
+	case the Breaks references packages to ignore for dependency handling.
+	* src/packages.c (dependencies_ok): Add a place holder comment to
+	be replaced by the code to prevent configuration of Broken packages.
+
 2006-07-07  Nicolas François  <nicolas.francois@centraliens.net>
 
 	* dpkg-deb/build.c: Specify --null before the -T option to avoid

+ 4 - 0
debian/changelog

@@ -1,5 +1,9 @@
 dpkg (1.13.23~) UNRELEASED; urgency=low
 
+  [ Guillem Jover ]
+  * Add initial support for the Breaks field, by parsing but rejecting it.
+    Thanks to Ian Jackson <iwj@ubuntu.com>. Closes: #375703
+
   [ Added dpkg Translations ]
   * Dzongkha (Kinley Tshering)
 

+ 1 - 0
lib/dpkg-db.h

@@ -38,6 +38,7 @@ enum deptype {
   dep_recommends,
   dep_depends,
   dep_predepends,
+  dep_breaks,
   dep_conflicts,
   dep_provides,
   dep_replaces,

+ 1 - 0
lib/fields.c

@@ -439,6 +439,7 @@ void f_dependency(struct pkginfo *pigp, struct pkginfoperfile *pifp,
                  " 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,

+ 1 - 0
lib/parse.c

@@ -61,6 +61,7 @@ const struct fieldinfo fieldinfos[]= {
   { "Pre-Depends",      f_dependency,      w_dependency,     dep_predepends           },
   { "Recommends",       f_dependency,      w_dependency,     dep_recommends           },
   { "Suggests",         f_dependency,      w_dependency,     dep_suggests             },
+  { "Breaks",           f_dependency,      w_dependency,     dep_breaks               },
   { "Conflicts",        f_dependency,      w_dependency,     dep_conflicts            },
   { "Enhances",         f_dependency,      w_dependency,     dep_enhances             },
   { "Conffiles",        f_conffiles,       w_conffiles                                },

+ 14 - 2
src/depcon.c

@@ -153,6 +153,7 @@ void describedepcon(struct varbuf *addto, struct dependency *dep) {
   case dep_depends:     varbufaddstr(addto, _(" depends on "));     break;
   case dep_predepends:  varbufaddstr(addto, _(" pre-depends on ")); break;
   case dep_recommends:  varbufaddstr(addto, _(" recommends "));     break;
+  case dep_breaks:      varbufaddstr(addto, _(" breaks "));         break;
   case dep_conflicts:   varbufaddstr(addto, _(" conflicts with ")); break;
   case dep_suggests:    varbufaddstr(addto, _(" suggests ")); break;
   case dep_enhances:    varbufaddstr(addto, _(" enhances "));       break;
@@ -185,8 +186,9 @@ int depisok(struct dependency *dep, struct varbuf *whynot,
   char linebuf[1024];
 
   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_breaks || dep->type == dep_conflicts ||
+	 dep->type == dep_recommends || dep->type == dep_suggests ||
+	 dep->type == dep_enhances);
   
   /* The dependency is always OK if we're trying to remove the depend*ing*
    * package.
@@ -212,6 +214,16 @@ int depisok(struct dependency *dep, struct varbuf *whynot,
     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, ' ');

+ 3 - 0
src/packages.c

@@ -352,6 +352,9 @@ int dependencies_ok(struct pkginfo *pkg, struct pkginfo *removing,
   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 ...");

+ 10 - 0
src/processarc.c

@@ -252,6 +252,16 @@ void process_archive(const char *filename) {
         }
       }
       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: