From dc01bdfd232b9730eb365bb1498aafc662b16adf Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Tue, 8 Aug 2006 01:43:22 +0000 Subject: [PATCH] Add initial support for the Breaks field, by parsing but rejecting it. Thanks to Ian Jackson . Closes: #375703 --- ChangeLog | 17 +++++++++++++++++ debian/changelog | 4 ++++ lib/dpkg-db.h | 1 + lib/fields.c | 1 + lib/parse.c | 1 + src/depcon.c | 16 ++++++++++++++-- src/packages.c | 3 +++ src/processarc.c | 10 ++++++++++ 8 files changed, 51 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 020ed1dc..09f72e4b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2006-08-08 Ian Jackson + + * 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 * dpkg-deb/build.c: Specify --null before the -T option to avoid diff --git a/debian/changelog b/debian/changelog index ddd23887..d1de123f 100644 --- a/debian/changelog +++ b/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 . Closes: #375703 + [ Added dpkg Translations ] * Dzongkha (Kinley Tshering) diff --git a/lib/dpkg-db.h b/lib/dpkg-db.h index 763c6956..3c0e5ffe 100644 --- a/lib/dpkg-db.h +++ b/lib/dpkg-db.h @@ -38,6 +38,7 @@ enum deptype { dep_recommends, dep_depends, dep_predepends, + dep_breaks, dep_conflicts, dep_provides, dep_replaces, diff --git a/lib/fields.c b/lib/fields.c index ec35e5ac..aa01b277 100644 --- a/lib/fields.c +++ b/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, diff --git a/lib/parse.c b/lib/parse.c index 1925e860..1a95cf96 100644 --- a/lib/parse.c +++ b/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 }, diff --git a/src/depcon.c b/src/depcon.c index 38530fab..835c90cc 100644 --- a/src/depcon.c +++ b/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, ' '); diff --git a/src/packages.c b/src/packages.c index 2706dd3f..8e5a77b5 100644 --- a/src/packages.c +++ b/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 : ""); 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 --git a/src/processarc.c b/src/processarc.c index d8d6d023..537a0ecd 100644 --- a/src/processarc.c +++ b/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: -- 2.39.5