summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Burrows <dburrows@debian.org>2009-09-06 09:55:37 -0700
committerDaniel Burrows <dburrows@debian.org>2009-09-06 09:55:37 -0700
commit44f0de6a1cc353cd4ba7c7d475baccdb7b175f78 (patch)
treea22638262bd1e6c062339698ca398a74a1017a62
parent6485255a6c60d537de1935099e4fdd505ff9b961 (diff)
parentdce1458307b2a3d4d2d7d266a500144fa49bba52 (diff)
downloadaptitude-44f0de6a1cc353cd4ba7c7d475baccdb7b175f78.tar.gz
Merge with the head branch.
-rw-r--r--doc/en/aptitude.xml93
-rw-r--r--doc/en/manpage.xml60
-rw-r--r--doc/fr/Makefile.am2
-rw-r--r--doc/ja/Makefile.am2
-rw-r--r--src/broken_indicator.cc4
-rw-r--r--src/cmdline/cmdline_do_action.cc10
-rw-r--r--src/generic/apt/aptcache.cc23
-rw-r--r--src/generic/apt/matching/parse.cc5
-rw-r--r--src/main.cc59
-rw-r--r--src/solution_screen.cc1
-rw-r--r--src/ui.cc40
-rw-r--r--src/ui.h6
-rw-r--r--tests/test_matching.cc44
13 files changed, 255 insertions, 94 deletions
diff --git a/doc/en/aptitude.xml b/doc/en/aptitude.xml
index e9001c29..887b38bc 100644
--- a/doc/en/aptitude.xml
+++ b/doc/en/aptitude.xml
@@ -4797,16 +4797,9 @@ e: Examine !: Apply .: Next ,: Previous</screen>
<para>
Text with no leading <quote>?</quote> also forms a search
pattern: &aptitude; will treat each word (or quoted string)
- as the argument to a &Sterm; pattern, which performs a
- full-text search against the package
- database.<footnote><para>Previous versions of &aptitude;
- would instead treat text with no leading <quote>?</quote> as
- a &Sname; pattern.</para></footnote> For instance, the
- search pattern <quote><literal>algebra</literal></quote>
- will match any package that contains the keyword
- <literal>algebra</literal>, producing the same effect as the
- search pattern
- <quote><literal>&Sterm;(algebra)</literal></quote>.
+ as the argument to a &Sname; pattern, which searches for a
+ package whose name matches the text when the text is
+ interpreted as a regular expression.
</para>
</note>
@@ -4818,7 +4811,7 @@ e: Examine !: Apply .: Next ,: Previous</screen>
future releases; scripts that invoke
<literal>aptitude</literal> should explicitly name the
search strategy they want to use. That is, scripts should
- search for <quote><literal>&Sterm;(coq)</literal></quote>
+ search for <quote><literal>&Sname;(coq)</literal></quote>
rather than <quote><literal>coq</literal></quote>).
</para>
</warning>
@@ -10217,6 +10210,35 @@ e: Examine !: Apply .: Next ,: Previous</screen>
<segtitle>Default</segtitle>
<segtitle>Description</segtitle>
+ <seglistitem id='configApt-AutoRemove-RecommendsImportant'>
+ <seg><literal>Apt::AutoRemove::RecommendsImportant</literal></seg>
+ <seg><literal>true</literal></seg>
+
+ <seg>
+ If this option is <literal>true</literal>, then
+ &aptitude; will not consider packages to be unused
+ (and thus will not automatically remove them) as long
+ as any installed package recommends them, even if
+ <literal><link
+ linkend='configAptInstall-Recommends'>Apt::Install-Recommends</link></literal>
+ is <literal>false</literal>. For more information,
+ see <xref linkend='secAutoInstall'/>.
+ </seg>
+ </seglistitem>
+
+ <seglistitem id='configApt-AutoRemove-SuggestsImportant'>
+ <seg><literal>Apt::AutoRemove::SuggestsImportant</literal></seg>
+ <seg><literal>false</literal></seg>
+
+ <seg>
+ If this option is <literal>true</literal>, then
+ &aptitude; will not consider packages to be unused
+ (and thus will not automatically remove them) as long
+ as any installed package suggests them. For more
+ information, see <xref linkend='secAutoInstall'/>.
+ </seg>
+ </seglistitem>
+
<seglistitem id='configAptInstall-Recommends'>
<seg><literal>Apt::Install-Recommends</literal></seg>
<seg><literal>true</literal></seg>
@@ -10289,10 +10311,22 @@ e: Examine !: Apply .: Next ,: Previous</screen>
<seg><literal>Aptitude::Auto-Install</literal></seg>
<seg><literal>true</literal></seg>
<seg>
- If this option is <literal>true</literal>,
- &aptitude; will automatically attempt to fulfill
- the dependencies of a package when you select it
- for installation.
+ If this option is <literal>true</literal>, &aptitude;
+ will automatically attempt to fulfill the dependencies
+ of a package when you mark a package to be installed
+ or upgraded.
+ </seg>
+ </seglistitem>
+
+ <seglistitem id='configAuto-Install-Remove-Ok'>
+ <seg><literal>Aptitude::Auto-Install-Remove-Ok</literal></seg>
+ <seg><literal>false</literal></seg>
+ <seg>
+ If this option is <literal>true</literal>, &aptitude;
+ will automatically remove conflicting packages when
+ you mark a package to be installed or upgraded.
+ Normally these conflicts are flagged and you must
+ handle them manually.
</seg>
</seglistitem>
@@ -10798,14 +10832,13 @@ e: Examine !: Apply .: Next ,: Previous</screen>
<seg><literal>false</literal></seg>
<seg>
- If this option is <literal>true</literal>, then
- &aptitude; will not consider packages to be unused
- (and thus will not automatically remove them) as long
- as any installed package recommends them, even if
+ This is an obsolete option; use <literal><link
+ linkend='configApt-AutoRemove-RecommendsImportant'>Apt::AutoRemove::Recommends-Important</link></literal>
+ instead. Setting this option to
+ <literal>true</literal> has the same effect as setting
<literal><link
- linkend='configAptInstall-Recommends'>Apt::Install-Recommends</link></literal>
- is <literal>false</literal>. For more information,
- see <xref linkend='secAutoInstall'/>.
+ linkend='configApt-AutoRemove-RecommendsImportant'>Apt::AutoRemove::Recommends-Important</link></literal>
+ to <literal>true</literal>.
</seg>
</seglistitem>
@@ -10815,11 +10848,13 @@ e: Examine !: Apply .: Next ,: Previous</screen>
<seg><literal>false</literal></seg>
<seg>
- If this option is <literal>true</literal>, then
- &aptitude; will not consider packages to be unused
- (and thus will not automatically remove them) as long
- as any installed package suggests them. For more
- information, see <xref linkend='secAutoInstall'/>.
+ This is an obsolete option; use <literal><link
+ linkend='configApt-AutoRemove-SuggestsImportant'>Apt::AutoRemove::Suggests-Important</link></literal>
+ instead. Setting this option to
+ <literal>true</literal> has the same effect as setting
+ <literal><link
+ linkend='configApt-AutoRemove-SuggestsImportant'>Apt::AutoRemove::Suggests-Important</link></literal>
+ to <literal>true</literal>.
</seg>
</seglistitem>
@@ -11590,11 +11625,11 @@ e: Examine !: Apply .: Next ,: Previous</screen>
<seg>
This is an obsolete option; use <literal><link
- linkend='configKeep-Suggests'>Aptitude::Keep-Suggests</link></literal>
+ linkend='configApt-AutoRemove-SuggestsImportant'>Apt::AutoRemove::Suggests-Important</link></literal>
instead. Setting this option to
<literal>true</literal> has the same effect as setting
<literal><link
- linkend='configKeep-Suggests'>Aptitude::Keep-Suggests</link></literal>
+ linkend='configApt-AutoRemove-SuggestsImportant'>Apt::AutoRemove::Suggests-Important</link></literal>
to <literal>true</literal>.
</seg>
</seglistitem>
diff --git a/doc/en/manpage.xml b/doc/en/manpage.xml
index ed319e69..b8c02b28 100644
--- a/doc/en/manpage.xml
+++ b/doc/en/manpage.xml
@@ -165,8 +165,12 @@
<cmdsynopsis>
<command>aptitude</command>
<arg choice='opt'>-S <replaceable>fname</replaceable></arg>
- <group choice='opt'><arg choice='plain'>-u</arg> <arg
- choice='plain'>-i</arg></group>
+ <group choice='opt'>
+ <arg choice='plain'>--autoclean-on-startup</arg>
+ <arg choice='plain'>--clean-on-startup</arg>
+ <arg choice='plain'>-i</arg>
+ <arg choice='plain'>-u</arg>
+ </group>
</cmdsynopsis>
<cmdsynopsis>
@@ -1561,7 +1565,7 @@ libdbix-fulltextsearch-perl 0.73-10</screen>
</para>
<para>
- This corresponds to the pair of configuration options <literal><link linkend='configAptInstall-Recommends'>Apt::Install-Recommends</link></literal> and <literal><link linkend='configKeep-Recommends'>Aptitude::Keep-Recommends</link></literal>.
+ This corresponds to the pair of configuration options <literal><link linkend='configAptInstall-Recommends'>Apt::Install-Recommends</link></literal> and <literal><link linkend='configApt-AutoRemove-InstallRecommends'>Apt::AutoRemove::InstallRecommends</link></literal>.
</para>
</listitem>
</varlistentry>
@@ -2057,14 +2061,53 @@ The following packages will be REMOVED:
<variablelist>
<varlistentry>
+ <term><literal>--autoclean-on-startup</literal></term>
+
+ <listitem>
+ <para>
+ Deletes old downloaded files when the program starts
+ (equivalent to starting the program and immediately
+ selecting
+ <menuchoice><guimenu>Actions</guimenu><guimenuitem>Clean
+ obsolete files</guimenuitem></menuchoice>). You cannot
+ use this option and
+ <quote><literal>--autoclean-on-startup</literal></quote>,
+ <quote><literal>-i</literal></quote>, or
+ <quote><literal>-u</literal></quote> at the same time.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><literal>--clean-on-startup</literal></term>
+
+ <listitem>
+ <para>
+ Cleans the package cache when the program starts
+ (equivalent to starting the program and immediately
+ selecting
+ <menuchoice><guimenu>Actions</guimenu><guimenuitem>Clean
+ package cache</guimenuitem></menuchoice>). You cannot use
+ this option and
+ <quote><literal>--autoclean-on-startup</literal></quote>,
+ <quote><literal>-i</literal></quote>, or
+ <quote><literal>-u</literal></quote> at the same time.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
<term><literal>-i</literal></term>
<listitem>
<para>
Displays a download preview when the program starts
(equivalent to starting the program and immediately
- pressing <quote><keycap>g</keycap></quote>). You
- cannot use this option and <quote><literal>-u</literal></quote> at the same time.
+ pressing <quote><keycap>g</keycap></quote>). You cannot
+ use this option and
+ <quote><literal>--autoclean-on-startup</literal></quote>,
+ <quote><literal>--clean-on-startup</literal></quote>, or
+ <quote><literal>-u</literal></quote> at the same time.
</para>
</listitem>
</varlistentry>
@@ -2085,8 +2128,11 @@ The following packages will be REMOVED:
<listitem>
<para>
- Begins updating the package lists as soon as the
- program starts. You cannot use this option and <literal>-i</literal> at the same time.
+ Begins updating the package lists as soon as the program
+ starts. You cannot use this option and
+ <quote><literal>--autoclean-on-startup</literal></quote>,
+ <quote><literal>--clean-on-startup</literal></quote>, or
+ <quote><literal>-i</literal></quote> at the same time.
</para>
</listitem>
</varlistentry>
diff --git a/doc/fr/Makefile.am b/doc/fr/Makefile.am
index 05957116..a71e6048 100644
--- a/doc/fr/Makefile.am
+++ b/doc/fr/Makefile.am
@@ -7,7 +7,7 @@ LANGCODE=fr
MANPAGE=aptitude.$(LANGCODE).8
# How much of the manual is actually translated.
PERCENT_TRANSLATED=45
-MANPAGE_PERCENT_TRANSLATED=40
+MANPAGE_PERCENT_TRANSLATED=38
IMAGES = $(wildcard images/*.png)
diff --git a/doc/ja/Makefile.am b/doc/ja/Makefile.am
index fce605b6..43834750 100644
--- a/doc/ja/Makefile.am
+++ b/doc/ja/Makefile.am
@@ -9,7 +9,7 @@ MANPAGE=aptitude.$(LANGCODE).8
README=README.$(LANGCODE)
XMLSOURCES=aptitude.xml manpage.xml
PERCENT_TRANSLATED=30
-MANPAGE_PERCENT_TRANSLATED=33
+MANPAGE_PERCENT_TRANSLATED=32
# Put documentation in /usr/share/doc/aptitude (by default)
docdir=$(datadir)/doc/$(PACKAGE)
diff --git a/src/broken_indicator.cc b/src/broken_indicator.cc
index da89858f..3c7dc9b8 100644
--- a/src/broken_indicator.cc
+++ b/src/broken_indicator.cc
@@ -320,6 +320,10 @@ public:
for(choice_set::const_iterator i = sol.get_choices().begin();
i != sol.get_choices().end(); ++i)
{
+ // Ignore broken recommendations for now.
+ if(i->get_type() != choice::install_version)
+ continue;
+
pkgCache::PkgIterator pkg = i->get_ver().get_pkg();
pkgCache::VerIterator curver=pkg.CurrentVer();
pkgCache::VerIterator instver=(*apt_cache_file)[pkg].InstVerIter(*apt_cache_file);
diff --git a/src/cmdline/cmdline_do_action.cc b/src/cmdline/cmdline_do_action.cc
index 80ce4b49..7bf43a29 100644
--- a/src/cmdline/cmdline_do_action.cc
+++ b/src/cmdline/cmdline_do_action.cc
@@ -95,7 +95,11 @@ int cmdline_do_action(int argc, char *argv[],
!strcasecmp(argv[0], "upgrade"))
{
default_action = cmdline_upgrade;
- upgrade_mode = safe_upgrade;
+ // If safe-upgrade is the only argument, we treat this as a full
+ // upgrade; otherwise we treat it as an install-type action that
+ // applies only to the packages listed on the command-line.
+ if(argc == 1)
+ upgrade_mode = safe_upgrade;
if(resolver_mode == resolver_mode_default)
resolver_mode = resolver_mode_safe;
}
@@ -164,14 +168,14 @@ int cmdline_do_action(int argc, char *argv[],
pkgset to_upgrade, to_install, to_hold, to_remove, to_purge;
- if(upgrade_mode == full_upgrade)
+ if(upgrade_mode == full_upgrade || upgrade_mode == safe_upgrade)
{
bool ignore_removed = (upgrade_mode == safe_upgrade);
(*apt_cache_file)->get_upgradable(ignore_removed, to_install);
bool use_autoinst = (resolver_mode != resolver_mode_safe);
- (*apt_cache_file)->mark_all_upgradable(use_autoinst, false, NULL);
+ (*apt_cache_file)->mark_all_upgradable(use_autoinst, ignore_removed, NULL);
}
/*else if(argc==1 && default_action==cmdline_install)
{
diff --git a/src/generic/apt/aptcache.cc b/src/generic/apt/aptcache.cc
index 23c4165b..409def42 100644
--- a/src/generic/apt/aptcache.cc
+++ b/src/generic/apt/aptcache.cc
@@ -2356,15 +2356,20 @@ bool aptitudeDepCache::IsDeleteOk(const pkgCache::PkgIterator &pkg,
unsigned long Depth,
bool FromUser)
{
- const aptitude_state &estate = get_ext_state(pkg);
-
- if(estate.selection_state == pkgCache::State::Hold)
+ if(!aptcfg->FindB(PACKAGE "::Auto-Install-Remove-Ok", false))
+ return false;
+ else
{
- LOG_INFO(Loggers::getAptitudeAptCache(),
- "Refusing to remove the held package "
- << pkg.Name());
- return false;
- }
+ const aptitude_state &estate = get_ext_state(pkg);
- return true;
+ if(estate.selection_state == pkgCache::State::Hold)
+ {
+ LOG_INFO(Loggers::getAptitudeAptCache(),
+ "Refusing to remove the held package "
+ << pkg.Name());
+ return false;
+ }
+
+ return true;
+ }
}
diff --git a/src/generic/apt/matching/parse.cc b/src/generic/apt/matching/parse.cc
index d28dcb31..a1fc768b 100644
--- a/src/generic/apt/matching/parse.cc
+++ b/src/generic/apt/matching/parse.cc
@@ -1323,10 +1323,7 @@ ref_ptr<pattern> parse_atom(string::const_iterator &start,
{
std::string s = parse_substr(start, end, terminators, true);
- if(partial && start == end)
- return pattern::make_term_prefix(s);
- else
- return pattern::make_term(s);
+ return pattern::make_name(s);
}
}
diff --git a/src/main.cc b/src/main.cc
index 50f92b20..b8bc9586 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -199,7 +199,9 @@ static void usage()
" strong dependencies\n"));
printf(_(" -S fname Read the aptitude extended status info from fname.\n"));
printf(_(" -u Download new package lists on startup.\n"));
+ printf(_(" (terminal interface only)"));
printf(_(" -i Perform an install run on startup.\n"));
+ printf(_(" (terminal interface only)"));
printf("\n");
printf(_(" This aptitude does not have Super Cow Powers.\n"));
}
@@ -232,7 +234,9 @@ enum {
OPTION_LOG_FILE,
OPTION_LOG_CONFIG_FILE,
OPTION_LOG_RESOLVER,
- OPTION_SHOW_SUMMARY
+ OPTION_SHOW_SUMMARY,
+ OPTION_AUTOCLEAN_ON_STARTUP,
+ OPTION_CLEAN_ON_STARTUP
};
int getopt_result;
@@ -282,6 +286,8 @@ option opts[]={
{"log-config-file", 1, &getopt_result, OPTION_LOG_CONFIG_FILE},
{"log-resolver", 0, &getopt_result, OPTION_LOG_RESOLVER},
{"show-summary", 2, &getopt_result, OPTION_SHOW_SUMMARY},
+ {"autoclean-on-startup", 0, &getopt_result, OPTION_AUTOCLEAN_ON_STARTUP},
+ {"clean-on-startup", 0, &getopt_result, OPTION_CLEAN_ON_STARTUP},
{0,0,0,0}
};
@@ -534,6 +540,8 @@ int main(int argc, char *argv[])
bool arch_only = aptcfg->FindB("Apt::Get::Arch-Only", false);
bool update_only=false, install_only=false, queue_only=false;
+ bool autoclean_only = false;
+ bool clean_only = false;
bool assume_yes=aptcfg->FindB(PACKAGE "::CmdLine::Assume-Yes", false);
bool fix_broken=aptcfg->FindB(PACKAGE "::CmdLine::Fix-Broken", false);
bool safe_upgrade_no_new_installs = aptcfg->FindB(PACKAGE "::CmdLine::Safe-Upgrade::No-New-Installs", false);
@@ -662,7 +670,7 @@ int main(int argc, char *argv[])
break;
case 'R':
aptcfg->SetNoUser("Apt::Install-Recommends", "false");
- aptcfg->SetNoUser(PACKAGE "::Keep-Recommends", "true");
+ aptcfg->SetNoUser("Apt::AutoRemove::RecommendsImportant", "true");
break;
case 't':
aptcfg->SetNoUser("APT::Default-Release", optarg);
@@ -829,6 +837,14 @@ int main(int argc, char *argv[])
show_why_summary_mode = optarg;
break;
+ case OPTION_AUTOCLEAN_ON_STARTUP:
+ autoclean_only = true;
+ break;
+
+ case OPTION_CLEAN_ON_STARTUP:
+ clean_only = true;
+ break;
+
default:
fprintf(stderr, "%s",
_("WEIRDNESS: unknown option code received\n"));
@@ -896,18 +912,30 @@ int main(int argc, char *argv[])
aptcfg->SetNoUser(PACKAGE "::Simulate", true);
// Sanity-check
- if(update_only && install_only)
- {
- fprintf(stderr, "%s",
- _("Only one of -u and -i may be specified\n"));
- usage();
- exit(1);
- }
+ {
+ int num_startup_actions = 0;
+ if(update_only)
+ ++num_startup_actions;
+ if(install_only)
+ ++num_startup_actions;
+ if(autoclean_only)
+ ++num_startup_actions;
+ if(clean_only)
+ ++num_startup_actions;
+
+ if(num_startup_actions > 1)
+ {
+ fprintf(stderr, "%s",
+ _("Only one of --auto-clean-on-startup, --clean-on-startup, -i, and -u may be specified\n"));
+ usage();
+ exit(1);
+ }
+ }
- if((update_only || install_only) && optind!=argc)
+ if((update_only || install_only || autoclean_only || clean_only) && optind != argc)
{
fprintf(stderr, "%s\n",
- _("-u and -i may not be specified in command-line mode (eg, with 'install')"));
+ _("-u, -i, and --clean-on-startup may not be specified in command-line mode (eg, with 'install')"));
usage();
exit(1);
}
@@ -925,10 +953,10 @@ int main(int argc, char *argv[])
signal(SIGWINCH, update_screen_width);
update_screen_width();
- if(update_only || install_only)
+ if(update_only || install_only || autoclean_only || clean_only)
{
fprintf(stderr, "%s\n",
- _("-u and -i may not be specified with a command"));
+ _("-u, -i, and --clean-on-startup may not be specified with a command"));
usage();
exit(1);
}
@@ -1099,7 +1127,10 @@ int main(int argc, char *argv[])
do_update_lists();
else if(install_only)
do_package_run_or_show_preview();
- //install_or_remove_packages();
+ else if(autoclean_only)
+ do_autoclean();
+ else if(clean_only)
+ do_clean();
ui_main();
}
diff --git a/src/solution_screen.cc b/src/solution_screen.cc
index c9fb744c..e4cc3825 100644
--- a/src/solution_screen.cc
+++ b/src/solution_screen.cc
@@ -110,6 +110,7 @@ void bin_actions(const aptitude_solution &sol,
default:
abort();
}
+ break;
case choice::break_soft_dep:
unresolved_actions.push_back(*it);
diff --git a/src/ui.cc b/src/ui.cc
index 0e038dcb..7593cfdb 100644
--- a/src/ui.cc
+++ b/src/ui.cc
@@ -487,7 +487,7 @@ static void do_su_to_root(string args)
if(protocol == "su")
{
std::ostringstream cmdbuf;
- cmdbuf << argv0 << " -S "
+ cmdbuf << argv0 << "--no-gui -S "
<< statusname.get_name() << " "
<< args;
execl(root_program.c_str(), root_program.c_str(), "-c", cmdbuf.str().c_str(), NULL);
@@ -498,7 +498,7 @@ static void do_su_to_root(string args)
{
std::vector<std::string> cmdlist;
// Split whitespace in the input command.
- std::string command = root_program + " " + argv0 + " -S " + statusname.get_name() + " " + args;
+ std::string command = root_program + " " + argv0 + " --no-gui -S " + statusname.get_name() + " " + args;
std::string::const_iterator it = command.begin();
while(it != command.end() && isspace(*it))
++it;
@@ -1701,7 +1701,7 @@ static void do_sweep()
add_main_widget(cmine::create(), _("Minesweeper"), _("Waste time trying to find mines"), _("Minesweeper"));
}
-static void do_clean()
+static void really_do_clean()
{
if(active_download)
// Erk! That's weird!
@@ -1726,6 +1726,22 @@ static void do_clean()
}
}
+void do_clean()
+{
+ if(getuid()==0 || !aptcfg->FindB(PACKAGE "::Warn-Not-Root", true))
+ really_do_clean();
+ else
+ {
+ popup_widget(cw::dialogs::yesno(wrapbox(cw::text_fragment(_("Cleaning the package cache requires administrative privileges, which you currently do not have. Would you like to change to the root account?"))),
+ cw::util::arg(sigc::bind(sigc::ptr_fun(&do_su_to_root),
+ "--clean-on-startup")),
+ W_("Become root"),
+ cw::util::arg(sigc::ptr_fun(&really_do_update_lists)),
+ W_("Don't become root"),
+ cw::get_style("Error")));
+ }
+}
+
// Ok, this is, uh, weird. Erase has to be overridden to at least
// call unlink()
//
@@ -1759,7 +1775,7 @@ static bool do_autoclean_enabled()
return apt_cache_file != NULL;
}
-static void do_autoclean()
+static void really_do_autoclean()
{
if(apt_cache_file == NULL)
_error->Error(_("The apt cache file is not available; cannot auto-clean."));
@@ -1793,6 +1809,22 @@ static void do_autoclean()
}
}
+void do_autoclean()
+{
+ if(getuid()==0 || !aptcfg->FindB(PACKAGE "::Warn-Not-Root", true))
+ really_do_autoclean();
+ else
+ {
+ popup_widget(cw::dialogs::yesno(wrapbox(cw::text_fragment(_("Deleting obsolete files requires administrative privileges, which you currently do not have. Would you like to change to the root account?"))),
+ cw::util::arg(sigc::bind(sigc::ptr_fun(&do_su_to_root),
+ "--autoclean-on-startup")),
+ W_("Become root"),
+ cw::util::arg(sigc::ptr_fun(&really_do_update_lists)),
+ W_("Don't become root"),
+ cw::get_style("Error")));
+ }
+}
+
static bool do_mark_upgradable_enabled()
{
return apt_cache_file != NULL;
diff --git a/src/ui.h b/src/ui.h
index 63b4a688..af402f28 100644
--- a/src/ui.h
+++ b/src/ui.h
@@ -371,6 +371,12 @@ void install_or_remove_packages();
void do_update_lists();
// Updates the package lists.
+/** \brief Delete obsolete downloaded files. */
+void do_autoclean();
+
+/** \brief Clean the package cache. */
+void do_clean();
+
void do_forget_new();
// Forgets which packages are "new".
diff --git a/tests/test_matching.cc b/tests/test_matching.cc
index b59f5aae..768eb55f 100644
--- a/tests/test_matching.cc
+++ b/tests/test_matching.cc
@@ -136,9 +136,9 @@ namespace
pattern::make_broken_type(pkgCache::Dep::Depends)),
pattern::make_archive("stable")) },
- { "?any-version(~Tasdf)", "?any-version(?true ?term(\"asdf\"))",
+ { "?any-version(~Tasdf)", "?any-version(?true ?name(\"asdf\"))",
pattern::make_any_version(pattern::make_and(pattern::make_true(),
- pattern::make_term("asdf"))) },
+ pattern::make_name("asdf"))) },
{ "?any-version(~i)", "?any-version(?installed)",
pattern::make_any_version(pattern::make_installed()) },
@@ -149,13 +149,13 @@ namespace
{ "?archive(^asdf.*asdf$)", "?archive(\"^asdf.*asdf$\")",
pattern::make_archive("^asdf.*asdf$") },
- { "?automatic test", "?automatic ?term(\"test\")",
+ { "?automatic test", "?automatic ?name(\"test\")",
pattern::make_and(pattern::make_automatic(),
- pattern::make_term("test")) },
+ pattern::make_name("test")) },
- { "~M test", "?automatic ?term(\"test\")",
+ { "~M test", "?automatic ?name(\"test\")",
pattern::make_and(pattern::make_automatic(),
- pattern::make_term("test")) },
+ pattern::make_name("test")) },
{ "?for x: ?depends(?for y: ?bind(y, ?source-package(argle~~)))",
"?for x: ?depends(?for y: ?bind(y, ?source-package(\"argle~\")))",
@@ -181,9 +181,9 @@ namespace
{ "?broken", "?broken", pattern::make_broken() },
- { "~basdf", "?broken ?term(\"asdf\")",
+ { "~basdf", "?broken ?name(\"asdf\")",
pattern::make_and(pattern::make_broken(),
- pattern::make_term("asdf")) },
+ pattern::make_name("asdf")) },
{ "?broken-depends", "?broken-depends",
pattern::make_broken_type(pkgCache::Dep::Depends) },
@@ -424,28 +424,28 @@ namespace
// No test for ?for; it was tested above.
- { "?garbage asdf", "?garbage ?term(\"asdf\")",
+ { "?garbage asdf", "?garbage ?name(\"asdf\")",
pattern::make_and(pattern::make_garbage(),
- pattern::make_term("asdf")) },
+ pattern::make_name("asdf")) },
- { "~g asdf", "?garbage ?term(\"asdf\")",
+ { "~g asdf", "?garbage ?name(\"asdf\")",
pattern::make_and(pattern::make_garbage(),
- pattern::make_term("asdf")) },
+ pattern::make_name("asdf")) },
- { "?installed asdf", "?installed ?term(\"asdf\")",
+ { "?installed asdf", "?installed ?name(\"asdf\")",
pattern::make_and(pattern::make_installed(),
- pattern::make_term("asdf")) },
+ pattern::make_name("asdf")) },
- { "~i asdf", "?installed ?term(\"asdf\")",
+ { "~i asdf", "?installed ?name(\"asdf\")",
pattern::make_and(pattern::make_installed(),
- pattern::make_term("asdf")) },
+ pattern::make_name("asdf")) },
{ "?maintainer(dburrows@debian.org)", "?maintainer(\"dburrows@debian.org\")",
pattern::make_maintainer("dburrows@debian.org") },
- { "~m\tdburrows@debian.org asdf", "?maintainer(\"dburrows@debian.org\") ?term(\"asdf\")",
+ { "~m\tdburrows@debian.org asdf", "?maintainer(\"dburrows@debian.org\") ?name(\"asdf\")",
pattern::make_and(pattern::make_maintainer("dburrows@debian.org"),
- pattern::make_term("asdf")) },
+ pattern::make_name("asdf")) },
{ "?narrow(?broken, ?version(5\\.43\\.2))",
"?narrow(?broken, ?version(\"5\\\\.43\\\\.2\"))",
@@ -463,13 +463,13 @@ namespace
{ "~nelsi~ nore", "?name(\"elsi nore\")",
pattern::make_name("elsi nore") },
- { "?new FOO", "?new ?term(\"FOO\")",
+ { "?new FOO", "?new ?name(\"FOO\")",
pattern::make_and(pattern::make_new(),
- pattern::make_term("FOO")) },
+ pattern::make_name("FOO")) },
- { "~N FOO", "?new ?term(\"FOO\")",
+ { "~N FOO", "?new ?name(\"FOO\")",
pattern::make_and(pattern::make_new(),
- pattern::make_term("FOO")) },
+ pattern::make_name("FOO")) },
{ "?obsolete", "?obsolete", pattern::make_obsolete() },