diff options
author | Daniel Hartwig <mandyke@gmail.com> | 2012-06-20 17:22:11 +0800 |
---|---|---|
committer | Daniel Hartwig <mandyke@gmail.com> | 2012-06-20 17:22:11 +0800 |
commit | 2f544c3c351591f0f30e9f3bdf2cc905f54b906a (patch) | |
tree | 730dba9d73ae88b95e487d6d52e33c384bf7e4b3 | |
parent | a88745bf22c3e83e5d78331a69f813e451c895a0 (diff) | |
download | aptitude-2f544c3c351591f0f30e9f3bdf2cc905f54b906a.tar.gz |
Do not do FixMissing automatically for command-line actions
When a package is not available or fails to download
incorrectly aptitude would try to continue without it.
This made it hard to detect errors automatically using
the exit status.
This behaviour is no longer the default, instead if there
are missing packages an error will be displayed and the
program exit with failure (100). If the user wishes to
continue anyway, they can use --fix-missing or configure
Aptitude::CmdLine::Fix-Missing in apt.conf.
* [cmdline]: An install run will no longer proceed if any
package was unavailable or failed to download
correctly, instead an error will be shown
and exit with non-zero status (100).
(Closes: #121313, #302784)
The old behaviour can be obtained with the new
--fix-missing option or setting
Aptitude::CmdLine::Fix-Missing.
Closes: #121313
Closes: #302784
-rw-r--r-- | NEWS | 11 | ||||
-rw-r--r-- | doc/en/aptitude.xml | 15 | ||||
-rw-r--r-- | doc/en/manpage.xml | 27 | ||||
-rw-r--r-- | src/cmdline/cmdline_do_action.cc | 1 | ||||
-rw-r--r-- | src/generic/apt/download_install_manager.cc | 12 | ||||
-rw-r--r-- | src/generic/apt/download_install_manager.h | 5 | ||||
-rw-r--r-- | src/gtk/gui.cc | 1 | ||||
-rw-r--r-- | src/main.cc | 2 | ||||
-rw-r--r-- | src/ui.cc | 1 |
9 files changed, 74 insertions, 1 deletions
@@ -79,6 +79,17 @@ behaviour is desirable for two reasons: which is not available for every package it applies to (Closes: #590686); + * [cmdline]: An install run will no longer proceed if any + package was unavailable or failed to download + correctly, instead an error will be shown + and exit with non-zero status (100). + (Closes: #121313, #302784) + + The old behaviour can be obtained with the new + --fix-missing option or setting + Aptitude::CmdLine::Fix-Missing. + + * [cmdline]: changelog exits with non-zero status on any error (Closes: #675833) diff --git a/doc/en/aptitude.xml b/doc/en/aptitude.xml index cb673b39..3c3711b5 100644 --- a/doc/en/aptitude.xml +++ b/doc/en/aptitude.xml @@ -10804,6 +10804,21 @@ e: Examine !: Apply .: Next ,: Previous</screen> </seg> </seglistitem> + <seglistitem id='configCmdLine-Fix-Missing'> + <seg><literal>Aptitude::CmdLine::Fix-Missing</literal></seg> + <seg><literal>false</literal></seg> + <seg> + In command-line mode, if a package is unavailable of + fails to download to correctly and this option is + <literal>true</literal>, &aptitude; will try to + continue installing other packages without it. The + package will still be marked for later installation, + as though <literal>--schedule-only</literal> had been + used. Command-line Option: <literal><link + linkend='cmdlineOptionFixMissing'>--fix-missing</link></literal>. + </seg> + </seglistitem> + <seglistitem id='configCmdLine-Versions-Group-By'> <seg><literal>Aptitude::CmdLine::Versions-Group-By</literal></seg> diff --git a/doc/en/manpage.xml b/doc/en/manpage.xml index 8b03d591..c6933eb6 100644 --- a/doc/en/manpage.xml +++ b/doc/en/manpage.xml @@ -1533,6 +1533,33 @@ libdbix-fulltextsearch-perl 0.73-10</screen> </listitem> </varlistentry> + <varlistentry id='cmdlineOptionFixMissing'> + <term> + <literal>-m</literal>, <literal>--ignore-missing</literal>, + <literal>--fix-missing</literal> + </term> + + <listitem> + <para> + If a package is unavailable or fails to download correctly + try to continue installing packages without it. The + package will still be marked for later installation, as + though <literal>--schedule-only</literal> had been used. + Configuration Item: <literal><link + linkend='configCmdLine-Fix-Missing'>Aptitude::CmdLine::Fix-Missing</link></literal>. + </para> + + <note> + <para> + This was the default behaviour in previous versions of + &aptitude; however it caused problems when trying to + detect errors using the exit status and was prone to + resulting in undesired effects. + </para> + </note> + </listitem> + </varlistentry> + <varlistentry id='cmdlineOptionNoNewInstalls'> <term> <literal>--no-new-installs</literal> diff --git a/src/cmdline/cmdline_do_action.cc b/src/cmdline/cmdline_do_action.cc index 36ded861..a7b2ce3f 100644 --- a/src/cmdline/cmdline_do_action.cc +++ b/src/cmdline/cmdline_do_action.cc @@ -384,6 +384,7 @@ int cmdline_do_action(int argc, char *argv[], aptitude::cmdline::apply_user_tags(user_tags); download_install_manager m(download_only, + aptcfg->FindB(PACKAGE "::CmdLine::Fix-Missing", false), sigc::ptr_fun(&run_dpkg_directly)); // FIXME: Temporary work-around for bug #677175 in apt. diff --git a/src/generic/apt/download_install_manager.cc b/src/generic/apt/download_install_manager.cc index 7c9aa835..a499faa5 100644 --- a/src/generic/apt/download_install_manager.cc +++ b/src/generic/apt/download_install_manager.cc @@ -38,8 +38,11 @@ using namespace std; download_install_manager::download_install_manager(bool _download_only, + bool _fix_missing, const run_dpkg_in_terminal_func &_run_dpkg_in_terminal) - : log(NULL), download_only(_download_only), + : log(NULL), + download_only(_download_only), + fix_missing(_fix_missing), pm(new pkgDPkgPM(*apt_cache_file)), run_dpkg_in_terminal(_run_dpkg_in_terminal) { @@ -139,6 +142,13 @@ download_manager::result download_install_manager::finish_pre_dpkg(pkgAcquire::R } } + if(failed == true && fix_missing == false) + { + _error->Error(_("Unable to fetch some archives, maybe run aptitude" + " update or try with --fix-missing?")); + return failure; + } + if(failed && !pm->FixMissing()) { _error->Error(_("Unable to correct for unavailable packages")); diff --git a/src/generic/apt/download_install_manager.h b/src/generic/apt/download_install_manager.h index 24989883..069a1a41 100644 --- a/src/generic/apt/download_install_manager.h +++ b/src/generic/apt/download_install_manager.h @@ -59,6 +59,10 @@ class download_install_manager : public download_manager /** If \b true, don't actually invoke the package manager. */ bool download_only; + /** If \b true, attempt to correct for packages which fail + to download or are unavailable. */ + bool fix_missing; + /** The package manager object used when installing packages */ pkgPackageManager *pm; @@ -112,6 +116,7 @@ public: * \param _run_dpkg_in_terminal how to set up the terminal for dpkg. */ download_install_manager(bool _download_only, + bool _fix_missing, const run_dpkg_in_terminal_func &_run_dpkg_in_terminal); ~download_install_manager(); diff --git a/src/gtk/gui.cc b/src/gtk/gui.cc index d44a8499..b1715bb5 100644 --- a/src/gtk/gui.cc +++ b/src/gtk/gui.cc @@ -956,6 +956,7 @@ namespace gui boost::shared_ptr<download_install_manager> m = boost::make_shared<download_install_manager>(false, + true, sigc::ptr_fun(&gui_run_dpkg)); start_download(m, diff --git a/src/main.cc b/src/main.cc index 47b305d4..baf1b0fc 100644 --- a/src/main.cc +++ b/src/main.cc @@ -313,6 +313,8 @@ CommandLine::Args opts[] = { {0, "group-by", PACKAGE "::CmdLine::Versions-Group-By", CommandLine::HasArg}, {0, "show-package-names", PACKAGE "::CmdLine::Versions-Show-Package-Names", CommandLine::HasArg}, {'f', "fix-broken", PACKAGE "::CmdLine::Fix-Broken", 0}, + {'m', "ignore-missing", PACKAGE "::CmdLine::Fix-Missing", 0}, + {0, "fix-missing", PACKAGE "::CmdLine::Fix-Missing", 0}, {'Z', "show-size-changes", PACKAGE "::CmdLine::Show-Size-Changes", 0}, {'S', "pkgstates", PACKAGE "::%::pkgstates.in", CommandLine::HasArg}, {'c', "config-file", 0, CommandLine::ConfigFile}, @@ -1258,6 +1258,7 @@ void install_or_remove_packages() { boost::shared_ptr<download_install_manager> m = boost::make_shared<download_install_manager>(false, + true, sigc::ptr_fun(&run_dpkg_with_cwidget_suspended)); m->post_forget_new_hook.connect(package_states_changed.make_slot()); |