bool DefRemove = false;
if (strcasecmp(CmdL.FileList[0],"remove") == 0)
DefRemove = true;
- for (const char **I = CmdL.FileList + 1; *I != 0; I++)
+
+ else if (strcasecmp(CmdL.FileList[0], "autoremove") == 0)
{
- // Duplicate the string
- unsigned int Length = strlen(*I);
- char S[300];
- if (Length >= sizeof(S))
- continue;
- strcpy(S,*I);
-
- // See if we are removing and special indicators..
- bool Remove = DefRemove;
- char *VerTag = 0;
- bool VerIsRel = false;
-
- // this is a task!
- if (Length >= 1 && S[Length - 1] == '^')
- {
- S[--Length] = 0;
- // tasks must always be confirmed
- ExpectedInst += 1000;
- // see if we can install it
- TryInstallTask(Cache, Fix, BrokenFix, ExpectedInst, S);
- continue;
- }
+ _config->Set("APT::Get::AutomaticRemove", "true");
+ DefRemove = true;
+ }
- while (Cache->FindPkg(S).end() == true)
+ // new scope for the ActionGroup
+ {
+ pkgDepCache::ActionGroup group(Cache);
+ for (const char **I = CmdL.FileList + 1; *I != 0; I++)
{
- // Handle an optional end tag indicating what to do
- if (Length >= 1 && S[Length - 1] == '-')
- {
- Remove = true;
- S[--Length] = 0;
+ // Duplicate the string
+ unsigned int Length = strlen(*I);
+ char S[300];
+ if (Length >= sizeof(S))
continue;
- }
-
- if (Length >= 1 && S[Length - 1] == '+')
+ strcpy(S,*I);
+
+ // See if we are removing and special indicators..
+ bool Remove = DefRemove;
+ char *VerTag = 0;
+ bool VerIsRel = false;
++
++ // this is a task!
++ if (Length >= 1 && S[Length - 1] == '^')
+ {
- Remove = false;
+ S[--Length] = 0;
++ // tasks must always be confirmed
++ ExpectedInst += 1000;
++ // see if we can install it
++ TryInstallTask(Cache, Fix, BrokenFix, ExpectedInst, S);
+ continue;
+ }
+
- char *Slash = strchr(S,'=');
- if (Slash != 0)
+ while (Cache->FindPkg(S).end() == true)
{
- VerIsRel = false;
- *Slash = 0;
- VerTag = Slash + 1;
- }
+ // Handle an optional end tag indicating what to do
+ if (Length >= 1 && S[Length - 1] == '-')
+ {
+ Remove = true;
+ S[--Length] = 0;
+ continue;
+ }
- Slash = strchr(S,'/');
- if (Slash != 0)
- {
- VerIsRel = true;
- *Slash = 0;
- VerTag = Slash + 1;
- }
+ if (Length >= 1 && S[Length - 1] == '+')
+ {
+ Remove = false;
+ S[--Length] = 0;
+ continue;
+ }
- break;
- }
+ char *Slash = strchr(S,'=');
+ if (Slash != 0)
+ {
+ VerIsRel = false;
+ *Slash = 0;
+ VerTag = Slash + 1;
+ }
+
+ Slash = strchr(S,'/');
+ if (Slash != 0)
+ {
+ VerIsRel = true;
+ *Slash = 0;
+ VerTag = Slash + 1;
+ }
+
+ break;
+ }
- // Locate the package
- pkgCache::PkgIterator Pkg = Cache->FindPkg(S);
- Packages++;
- if (Pkg.end() == true)
- {
- // Check if the name is a regex
- const char *I;
- for (I = S; *I != 0; I++)
- if (*I == '?' || *I == '*' || *I == '|' ||
- *I == '[' || *I == '^' || *I == '$')
- break;
- if (*I == 0)
- return _error->Error(_("Couldn't find package %s"),S);
+ // Locate the package
+ pkgCache::PkgIterator Pkg = Cache->FindPkg(S);
+ Packages++;
+ if (Pkg.end() == true)
+ {
+ // Check if the name is a regex
+ const char *I;
+ for (I = S; *I != 0; I++)
+ if (*I == '?' || *I == '*' || *I == '|' ||
+ *I == '[' || *I == '^' || *I == '$')
+ break;
+ if (*I == 0)
+ return _error->Error(_("Couldn't find package %s"),S);
- // Regexs must always be confirmed
- ExpectedInst += 1000;
+ // Regexs must always be confirmed
+ ExpectedInst += 1000;
- // Compile the regex pattern
- regex_t Pattern;
- int Res;
- if ((Res = regcomp(&Pattern,S,REG_EXTENDED | REG_ICASE |
- REG_NOSUB)) != 0)
- {
- char Error[300];
- regerror(Res,&Pattern,Error,sizeof(Error));
- return _error->Error(_("Regex compilation error - %s"),Error);
- }
+ // Compile the regex pattern
+ regex_t Pattern;
+ int Res;
+ if ((Res = regcomp(&Pattern,S,REG_EXTENDED | REG_ICASE |
+ REG_NOSUB)) != 0)
+ {
+ char Error[300];
+ regerror(Res,&Pattern,Error,sizeof(Error));
+ return _error->Error(_("Regex compilation error - %s"),Error);
+ }
- // Run over the matches
- bool Hit = false;
- for (Pkg = Cache->PkgBegin(); Pkg.end() == false; Pkg++)
- {
- if (regexec(&Pattern,Pkg.Name(),0,0,0) != 0)
- continue;
+ // Run over the matches
+ bool Hit = false;
+ for (Pkg = Cache->PkgBegin(); Pkg.end() == false; Pkg++)
+ {
+ if (regexec(&Pattern,Pkg.Name(),0,0,0) != 0)
+ continue;
+
+ ioprintf(c1out,_("Note, selecting %s for regex '%s'\n"),
+ Pkg.Name(),S);
- ioprintf(c1out,_("Note, selecting %s for regex '%s'\n"),
- Pkg.Name(),S);
+ if (VerTag != 0)
+ if (TryToChangeVer(Pkg,Cache,VerTag,VerIsRel) == false)
+ return false;
+ Hit |= TryToInstall(Pkg,Cache,Fix,Remove,BrokenFix,
+ ExpectedInst,false);
+ }
+ regfree(&Pattern);
+
+ if (Hit == false)
+ return _error->Error(_("Couldn't find package %s"),S);
+ }
+ else
+ {
++
if (VerTag != 0)
if (TryToChangeVer(Pkg,Cache,VerTag,VerIsRel) == false)
return false;
CommandLine::Dispatch Cmds[] = {{"update",&DoUpdate},
{"upgrade",&DoUpgrade},
{"install",&DoInstall},
- {"installtask",&DoInstallTask},
{"remove",&DoInstall},
+ {"autoremove",&DoInstall},
{"dist-upgrade",&DoDistUpgrade},
{"dselect-upgrade",&DoDSelectUpgrade},
{"build-dep",&DoBuildDep},
msgid "File not found"
msgstr ""
-#: methods/copy.cc:42 methods/gpgv.cc:281 methods/gzip.cc:134
-#: methods/gzip.cc:143
+#: methods/copy.cc:42 methods/gpgv.cc:281 methods/gzip.cc:133
- #: methods/gzip.cc:142
++#: methods/gzip.cc:142 methods/gzip.cc:134 methods/gzip.cc:143
msgid "Failed to stat"
msgstr ""
-#: methods/copy.cc:79 methods/gpgv.cc:278 methods/gzip.cc:140
+#: methods/copy.cc:79 methods/gpgv.cc:278 methods/gzip.cc:139
++#: methods/gzip.cc:140
msgid "Failed to set modification time"
msgstr ""
msgid "Dependency generation"
msgstr ""
-#: apt-pkg/tagfile.cc:73
+#: apt-pkg/depcache.cc:152 apt-pkg/depcache.cc:171 apt-pkg/depcache.cc:175
+msgid "Reading state information"
+msgstr ""
+
+#: apt-pkg/depcache.cc:199
+#, c-format
+msgid "Failed to open StateFile %s"
+msgstr ""
+
+#: apt-pkg/depcache.cc:205
+#, c-format
+msgid "Failed to write temporary StateFile %s"
+msgstr ""
+
- #: apt-pkg/tagfile.cc:85 apt-pkg/tagfile.cc:92
++#: apt-pkg/tagfile.cc:85 apt-pkg/tagfile.cc:92 apt-pkg/tagfile.cc:73
#, c-format
msgid "Unable to parse package file %s (1)"
msgstr ""
- #: apt-pkg/tagfile.cc:186
-#: apt-pkg/tagfile.cc:160
++#: apt-pkg/tagfile.cc:186 apt-pkg/tagfile.cc:160
#, c-format
msgid "Unable to parse package file %s (2)"
msgstr ""