[Aptitude-devel] r3207 - in branches/aptitude-0.3/aptitude: . src/cmdline
Daniel Burrows
dburrows@costa.debian.org
Sat, 30 Apr 2005 19:37:03 +0000
Author: dburrows
Date: Sat Apr 30 19:37:00 2005
New Revision: 3207
Modified:
branches/aptitude-0.3/aptitude/ChangeLog
branches/aptitude-0.3/aptitude/src/cmdline/cmdline_action.cc
branches/aptitude-0.3/aptitude/src/cmdline/cmdline_common.h
branches/aptitude-0.3/aptitude/src/cmdline/cmdline_prompt.cc
branches/aptitude-0.3/aptitude/src/cmdline/cmdline_resolver.cc
Log:
Add support for manipulating the automatic flag from the command-line prompt.
Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog (original)
+++ branches/aptitude-0.3/aptitude/ChangeLog Sat Apr 30 19:37:00 2005
@@ -1,5 +1,10 @@
2005-04-30 Daniel Burrows <dburrows@debian.org>
+ * src/cmdline/cmdline_action.cc, src/cmdline/cmdline_common.h, src/cmdline/cmdline_prompt.cc, src/cmdline/cmdline_resolver.h:
+
+ Add support for manipulating the automatic flag from the
+ command-line prompt.
+
* src/cmdline/cmdline_resolver.cc:
Add a space after the resolver prompt string.
Modified: branches/aptitude-0.3/aptitude/src/cmdline/cmdline_action.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/cmdline/cmdline_action.cc (original)
+++ branches/aptitude-0.3/aptitude/src/cmdline/cmdline_action.cc Sat Apr 30 19:37:00 2005
@@ -85,6 +85,7 @@
switch(action)
{
+ case cmdline_installauto:
case cmdline_install:
if(pkg.CurrentVer()!=ver || pkg->CurrentState!=pkgCache::State::Installed)
to_install.insert(pkg);
@@ -136,6 +137,7 @@
switch(action)
{
+ case cmdline_installauto:
case cmdline_install:
case cmdline_reinstall:
if(action==cmdline_reinstall && pkg.CurrentVer().end())
@@ -143,6 +145,8 @@
(*apt_cache_file)->set_candidate_version(ver, NULL);
(*apt_cache_file)->mark_install(pkg, true, action == cmdline_reinstall, NULL);
+ if(action == cmdline_installauto)
+ (*apt_cache_file)->mark_auto_installed(pkg, true, NULL);
break;
case cmdline_remove:
(*apt_cache_file)->mark_delete(pkg, false, false, NULL);
@@ -351,6 +355,64 @@
return rval;
}
+/** \return \b false iff the beginning of s doesn't look like an
+ * action specifier.
+ */
+static bool parse_action_str(const string &s,
+ string::size_type &loc,
+ cmdline_pkgaction_type &action)
+{
+ if(loc<s.size())
+ {
+ switch(s[loc])
+ {
+ case '_':
+ action=cmdline_purge;
+ ++loc;
+ break;
+ case '-':
+ action=cmdline_remove;
+ ++loc;
+ break;
+ case '=':
+ action=cmdline_hold;
+ ++loc;
+ break;
+ case '+':
+ action=cmdline_install;
+ ++loc;
+ if(loc<s.size() && s[loc]=='M')
+ {
+ action=cmdline_installauto;
+ ++loc;
+ }
+ break;
+ case '&':
+ ++loc;
+ if(loc<s.size())
+ switch(s[loc])
+ {
+ case 'M':
+ action=cmdline_markauto;
+ ++loc;
+ break;
+ case 'm':
+ action=cmdline_unmarkauto;
+ ++loc;
+ break;
+ default:
+ return false;
+ }
+ break;
+ default:
+ return false;
+ }
+ return true;
+ }
+ else
+ return false;
+}
+
void cmdline_parse_action(string s,
pkgset &to_install, pkgset &to_hold,
pkgset &to_remove, pkgset &to_purge,
@@ -366,55 +428,20 @@
cmdline_pkgaction_type action;
- switch(s[loc])
+ if(!parse_action_str(s, loc, action))
{
- case '_':
- action=cmdline_purge;
- break;
- case '-':
- action=cmdline_remove;
- break;
- case '=':
- action=cmdline_hold;
- break;
- case '+':
- action=cmdline_install;
- break;
- case ':':
- action=cmdline_keep;
- break;
- default:
printf(_("Bad action character '%c'\n"), s[0]);
return;
}
- ++loc;
-
while(loc<s.size())
{
while(loc<s.size() && isspace(s[loc]))
++loc;
if(loc<s.size())
- switch(s[loc])
- {
- case '_':
- action=cmdline_purge;
- ++loc;
- break;
- case '-':
- action=cmdline_remove;
- ++loc;
- break;
- case '=':
- action=cmdline_hold;
- ++loc;
- break;
- case '+':
- action=cmdline_install;
- ++loc;
- break;
- default:
+ {
+ if(!parse_action_str(s, loc, action))
{
string pkgname;
while(loc<s.size() && !isspace(s[loc]))
@@ -426,6 +453,6 @@
verbose))
return;
}
- }
+ }
}
}
Modified: branches/aptitude-0.3/aptitude/src/cmdline/cmdline_common.h
==============================================================================
--- branches/aptitude-0.3/aptitude/src/cmdline/cmdline_common.h (original)
+++ branches/aptitude-0.3/aptitude/src/cmdline/cmdline_common.h Sat Apr 30 19:37:00 2005
@@ -22,9 +22,10 @@
typedef std::vector<string> strvector;
enum cmdline_pkgaction_type
- {cmdline_install, cmdline_remove, cmdline_purge, cmdline_hold,
- cmdline_unhold, cmdline_markauto, cmdline_unmarkauto,
- cmdline_forbid_version, cmdline_reinstall, cmdline_keep};
+ {cmdline_install, cmdline_installauto, cmdline_remove,
+ cmdline_purge, cmdline_hold, cmdline_unhold, cmdline_markauto,
+ cmdline_unmarkauto, cmdline_forbid_version, cmdline_reinstall,
+ cmdline_keep};
enum cmdline_version_source {cmdline_version_cand,
cmdline_version_archive,
Modified: branches/aptitude-0.3/aptitude/src/cmdline/cmdline_prompt.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/cmdline/cmdline_prompt.cc (original)
+++ branches/aptitude-0.3/aptitude/src/cmdline/cmdline_prompt.cc Sat Apr 30 19:37:00 2005
@@ -676,11 +676,14 @@
"additional actions; each will be applied to all packages that follow it)\n"
"\n"
"Actions:\n"
- " '+' : Install\n"
- " '-' : Remove\n"
- " '_' : Purge\n"
- " '=' : Hold\n"
- " ':' : Keep\n"));
+ " '+' : Install\n"
+ " '+M' : Install + mark Auto \n"
+ " '-' : Remove\n"
+ " '_' : Purge\n"
+ " '=' : Hold\n"
+ " ':' : Keep\n"
+ " '&M : Mark Auto\n"
+ " '&m : Un-mark Auto\n"));
break;
default:
printf(_("Invalid response. Please enter a valid command or '?' for help.\n"));
Modified: branches/aptitude-0.3/aptitude/src/cmdline/cmdline_resolver.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/cmdline/cmdline_resolver.cc (original)
+++ branches/aptitude-0.3/aptitude/src/cmdline/cmdline_resolver.cc Sat Apr 30 19:37:00 2005
@@ -97,6 +97,9 @@
"%F"
"%F"
"%F"
+ "%F"
+ "%F"
+ "%F"
"%F"),
flowindentbox(0, 3,
fragf(_("accept the proposed changes"))),
@@ -113,6 +116,8 @@
flowindentbox(0, 4,
fragf(_("'+' to install packages"))),
flowindentbox(0, 4,
+ fragf(_("'+M' to install packages and immediately flag them as automatically installed"))),
+ flowindentbox(0, 4,
fragf(_("'-' to remove packages"))),
flowindentbox(0, 4,
fragf(_("'_' to purge packages"))),
@@ -120,6 +125,10 @@
fragf(_("'=' to place packages on hold"))),
flowindentbox(0, 4,
fragf(_("':' to keep packages in their current state without placing them on hold"))),
+ flowindentbox(0, 4,
+ fragf(_("'&M' to mark packages as automatically installed"))),
+ flowindentbox(0, 4,
+ fragf(_("'&m' to mark packages as manually installed"))),
flowindentbox(0, 3,
fragf(_("Adjustments will cause the current solution to be discarded and recalculated as necessary."))))));