From 864201bea42d2d1d2c284e63800f8cb7ac2841fb Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Wed, 8 Aug 2007 04:57:16 +0300 Subject: [PATCH] Fix Breaks commit. Enable depisok for the Breaks case. Remove comments stating Breaks needs to be implemented. And split functions calls which had different arguments depending on a variable. --- ChangeLog | 13 +++++++++++++ src/cleanup.c | 28 ++++++++++++++++++--------- src/depcon.c | 10 ---------- src/packages.c | 4 +--- src/processarc.c | 49 ++++++++++++++++++++++++++++-------------------- 5 files changed, 62 insertions(+), 42 deletions(-) diff --git a/ChangeLog b/ChangeLog index cde65a76..41a56ee7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2007-08-08 Guillem Jover + + * src/cleanup.c (cu_prermdeconfigure): Split call to + maintainer_script_installed depending on the conflictor variable. + * src/packages.c (dependencies_ok): Remove comment stating that + Breaks needs to be implemented. + * src/depcon.c (depisok): Likewise. Remove return at the beggining + of the function checking for a Breaks dependency, that was + efectively making it a no-op in that case. + * src/processarc.c (process_archive): Fix indentation. Split calls + in deconfigure code to printf and maintainer_script_installed + depending on the removing variable. + 2007-08-07 Guillem Jover * src/query.c (listpackages): Instead of allocating an additional diff --git a/src/cleanup.c b/src/cleanup.c index 6a96836f..09619929 100644 --- a/src/cleanup.c +++ b/src/cleanup.c @@ -132,15 +132,25 @@ void cu_prermdeconfigure(int argc, void **argv) { struct pkginfo *conflictor= (struct pkginfo*)argv[1]; /* may be 0 */ struct pkginfo *infavour= (struct pkginfo*)argv[2]; - maintainer_script_installed(deconf,POSTINSTFILE,"post-installation", - "abort-deconfigure", "in-favour", infavour->name, - versiondescribe(&infavour->available.version, - vdew_nonambig), - conflictor ? "removing" : (char*)0, - conflictor ? conflictor->name : (char*)0, - conflictor ? versiondescribe(&conflictor->installed.version, - vdew_nonambig) : (char*)0, - (char*)0); + if (conflictor) { + maintainer_script_installed(deconf, POSTINSTFILE, "post-installation", + "abort-deconfigure", + "in-favour", infavour->name, + versiondescribe(&infavour->available.version, + vdew_nonambig), + "removing", conflictor->name, + versiondescribe(&conflictor->installed.version, + vdew_nonambig), + (char*)0); + } else { + maintainer_script_installed(deconf, POSTINSTFILE, "post-installation", + "abort-deconfigure", + "in-favour", infavour->name, + versiondescribe(&infavour->available.version, + vdew_nonambig), + (char*)0); + } + deconf->status= stat_installed; modstatdb_note(deconf); } diff --git a/src/depcon.c b/src/depcon.c index 24f93aea..5f7f2854 100644 --- a/src/depcon.c +++ b/src/depcon.c @@ -243,16 +243,6 @@ 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 ebbd5a90..467a6d48 100644 --- a/src/packages.c +++ b/src/packages.c @@ -425,9 +425,7 @@ 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 31f28e94..4c1d0573 100644 --- a/src/processarc.c +++ b/src/processarc.c @@ -398,34 +398,43 @@ void process_archive(const char *filename) { modstatdb_note(pkg); } - for (deconpil= deconfigure; deconpil; deconpil= deconpil->next) { - struct pkginfo *removing= deconpil->xinfo; + for (deconpil= deconfigure; deconpil; deconpil= deconpil->next) { + struct pkginfo *removing= deconpil->xinfo; - printf(removing ? - _("De-configuring %s, to allow removal of %s ...\n") : - _("De-configuring %s ...\n"), - deconpil->pkg->name, removing ? removing->name : 0); + if (removing) + printf(_("De-configuring %s, to allow removal of %s ...\n"), + deconpil->pkg->name, removing->name); + else + printf(_("De-configuring %s ...\n"), deconpil->pkg->name); - deconpil->pkg->status= stat_halfconfigured; - modstatdb_note(deconpil->pkg); - /* This means that we *either* go and run postinst abort-deconfigure, - * *or* queue the package for later configure processing, depending - * on which error cleanup route gets taken. - */ - push_cleanup(cu_prermdeconfigure,~ehflag_normaltidy, - ok_prermdeconfigure,ehflag_normaltidy, - 3,(void*)deconpil->pkg, - (void*)removing, (void*)pkg); + deconpil->pkg->status= stat_halfconfigured; + modstatdb_note(deconpil->pkg); + + /* This means that we *either* go and run postinst abort-deconfigure, + * *or* queue the package for later configure processing, depending + * on which error cleanup route gets taken. + */ + push_cleanup(cu_prermdeconfigure, ~ehflag_normaltidy, + ok_prermdeconfigure, ehflag_normaltidy, + 3, (void*)deconpil->pkg, (void*)removing, (void*)pkg); + + if (removing) { + maintainer_script_installed(deconpil->pkg, PRERMFILE, "pre-removal", + "deconfigure", "in-favour", pkg->name, + versiondescribe(&pkg->available.version, + vdew_nonambig), + "removing", removing->name, + versiondescribe(&removing->installed.version, + vdew_nonambig), + (char*)0); + } else { maintainer_script_installed(deconpil->pkg, PRERMFILE, "pre-removal", "deconfigure", "in-favour", pkg->name, versiondescribe(&pkg->available.version, vdew_nonambig), - removing ? "removing" : (char*)0, - removing ? removing->name : (char*)0, - removing ? versiondescribe(&removing->installed.version, - vdew_nonambig) : (char*)0, (char*)0); } + } for (i = 0 ; i < cflict_index; i++) { if (!(conflictor[i]->status == stat_halfconfigured || -- 2.39.5