diff options
author | Guillem Jover <guillem@debian.org> | 2016-02-20 09:21:49 +0100 |
---|---|---|
committer | Guillem Jover <guillem@debian.org> | 2016-02-27 00:18:59 +0100 |
commit | 3e3458881624cf349e8c0684d3b69111c37c720d (patch) | |
tree | 6254b94f9b654a9dd3ea7e6b7b86c3628cc79868 /src | |
parent | b2d2b8a433a8e947fd6a820b9fa77a6a250d0b02 (diff) | |
download | dpkg-3e3458881624cf349e8c0684d3b69111c37c720d.tar.gz |
dpkg: Refactor pkg_deconfigure_others()
Diffstat (limited to 'src')
-rw-r--r-- | src/unpack.c | 99 |
1 files changed, 53 insertions, 46 deletions
diff --git a/src/unpack.c b/src/unpack.c index 31ec7d259..6b9b9f41c 100644 --- a/src/unpack.c +++ b/src/unpack.c @@ -197,6 +197,58 @@ get_control_dir(char *cidir) return cidir; } +static void +pkg_deconfigure_others(struct pkginfo *pkg) +{ + struct pkg_deconf_list *deconpil; + + for (deconpil = deconfigure; deconpil; deconpil = deconpil->next) { + struct pkginfo *removing = deconpil->pkg_removal; + + if (removing) + printf(_("De-configuring %s (%s), to allow removal of %s (%s) ...\n"), + pkg_name(deconpil->pkg, pnaw_nonambig), + versiondescribe(&deconpil->pkg->installed.version, vdew_nonambig), + pkg_name(removing, pnaw_nonambig), + versiondescribe(&removing->installed.version, vdew_nonambig)); + else + printf(_("De-configuring %s (%s) ...\n"), + pkg_name(deconpil->pkg, pnaw_nonambig), + versiondescribe(&deconpil->pkg->installed.version, vdew_nonambig)); + + trig_activate_packageprocessing(deconpil->pkg); + pkg_set_status(deconpil->pkg, PKG_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) { + maintscript_installed(deconpil->pkg, PRERMFILE, "pre-removal", + "deconfigure", "in-favour", + pkgbin_name(pkg, &pkg->available, pnaw_nonambig), + versiondescribe(&pkg->available.version, + vdew_nonambig), + "removing", + pkg_name(removing, pnaw_nonambig), + versiondescribe(&removing->installed.version, + vdew_nonambig), + NULL); + } else { + maintscript_installed(deconpil->pkg, PRERMFILE, "pre-removal", + "deconfigure", "in-favour", + pkgbin_name(pkg, &pkg->available, pnaw_nonambig), + versiondescribe(&pkg->available.version, + vdew_nonambig), + NULL); + } + } +} + /** * Read the conffiles, and copy the hashes across. */ @@ -964,7 +1016,6 @@ void process_archive(const char *filename) { struct dependency *dsearch; struct deppossi *psearch; struct stat stab; - struct pkg_deconf_list *deconpil; struct pkginfo *fixbytrigaw; cleanup_pkg_failed= cleanup_conflictor_failed= 0; @@ -1191,51 +1242,7 @@ void process_archive(const char *filename) { modstatdb_note(pkg); } - for (deconpil= deconfigure; deconpil; deconpil= deconpil->next) { - struct pkginfo *removing = deconpil->pkg_removal; - - if (removing) - printf(_("De-configuring %s (%s), to allow removal of %s (%s) ...\n"), - pkg_name(deconpil->pkg, pnaw_nonambig), - versiondescribe(&deconpil->pkg->installed.version, vdew_nonambig), - pkg_name(removing, pnaw_nonambig), - versiondescribe(&removing->installed.version, vdew_nonambig)); - else - printf(_("De-configuring %s (%s) ...\n"), - pkg_name(deconpil->pkg, pnaw_nonambig), - versiondescribe(&deconpil->pkg->installed.version, vdew_nonambig)); - - trig_activate_packageprocessing(deconpil->pkg); - pkg_set_status(deconpil->pkg, PKG_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) { - maintscript_installed(deconpil->pkg, PRERMFILE, "pre-removal", - "deconfigure", "in-favour", - pkgbin_name(pkg, &pkg->available, pnaw_nonambig), - versiondescribe(&pkg->available.version, - vdew_nonambig), - "removing", - pkg_name(removing, pnaw_nonambig), - versiondescribe(&removing->installed.version, - vdew_nonambig), - NULL); - } else { - maintscript_installed(deconpil->pkg, PRERMFILE, "pre-removal", - "deconfigure", "in-favour", - pkgbin_name(pkg, &pkg->available, pnaw_nonambig), - versiondescribe(&pkg->available.version, - vdew_nonambig), - NULL); - } - } + pkg_deconfigure_others(pkg); for (conflictor_iter = conflictors.head; conflictor_iter; |