summaryrefslogtreecommitdiff
path: root/cmdline
diff options
context:
space:
mode:
Diffstat (limited to 'cmdline')
-rw-r--r--cmdline/apt-get.cc99
-rwxr-xr-xcmdline/apt-key6
-rw-r--r--cmdline/makefile6
3 files changed, 89 insertions, 22 deletions
diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc
index 4bd66383f..b47c2ec09 100644
--- a/cmdline/apt-get.cc
+++ b/cmdline/apt-get.cc
@@ -650,7 +650,7 @@ bool CacheFile::CheckDeps(bool AllowBroken)
// upgrade all policy-broken packages with ForceImportantDeps=True
for (pkgCache::PkgIterator I = Cache->PkgBegin(); !I.end(); I++)
if ((*DCache)[I].NowPolicyBroken() == true)
- DCache->MarkInstall(I,true,0,false, true);
+ DCache->MarkInstall(I,true,0, false, true);
}
}
@@ -1419,31 +1419,47 @@ bool DoUpdate(CommandLine &CmdL)
/* Remove unused automatic packages */
bool DoAutomaticRemove(CacheFile &Cache)
{
- if(_config->FindI("Debug::pkgAutoRemove",false))
- std::cout << "DoAutomaticRemove()" << std::endl;
+ bool Debug = _config->FindI("Debug::pkgAutoRemove",false);
+ bool doAutoRemove = _config->FindB("APT::Get::AutomaticRemove", false);
+ pkgDepCache::ActionGroup group(*Cache);
+
- if (_config->FindB("APT::Get::Remove",true) == false)
- return _error->Error(_("We are not supposed to delete stuff, can't "
- "start AutoRemover"));
+ if(Debug)
+ std::cout << "DoAutomaticRemove()" << std::endl;
+ if (_config->FindB("APT::Get::Remove",true) == false &&
+ doAutoRemove == true)
{
- pkgDepCache::ActionGroup group(*Cache);
-
- // look over the cache to see what can be removed
- for (pkgCache::PkgIterator Pkg = Cache->PkgBegin(); ! Pkg.end(); ++Pkg)
- {
- if (Cache[Pkg].Garbage)
- {
- if(Pkg.CurrentVer() != 0 || Cache[Pkg].Install())
- fprintf(stdout,"We could delete %s\n", Pkg.Name());
+ c1out << _("We are not supposed to delete stuff, can't start "
+ "AutoRemover") << std::endl;
+ doAutoRemove = false;
+ }
- if(Pkg.CurrentVer() != 0 && Pkg->CurrentState != pkgCache::State::ConfigFiles)
+ string autoremovelist, autoremoveversions;
+ // look over the cache to see what can be removed
+ for (pkgCache::PkgIterator Pkg = Cache->PkgBegin(); ! Pkg.end(); ++Pkg)
+ {
+ if (Cache[Pkg].Garbage)
+ {
+ if(Pkg.CurrentVer() != 0 || Cache[Pkg].Install())
+ if(Debug)
+ std::cout << "We could delete %s" << Pkg.Name() << std::endl;
+
+ autoremovelist += string(Pkg.Name()) + " ";
+ autoremoveversions += string(Cache[Pkg].CandVersion) + " ";
+ if (doAutoRemove)
+ {
+ if(Pkg.CurrentVer() != 0 &&
+ Pkg->CurrentState != pkgCache::State::ConfigFiles)
Cache->MarkDelete(Pkg, _config->FindB("APT::Get::Purge", false));
- else
+ else
Cache->MarkKeep(Pkg, false, false);
- }
- }
+ }
+ }
}
+ ShowList(c1out, _("The following packages were automatically installed and are no longer required:"), autoremovelist, autoremoveversions);
+ if (!doAutoRemove && autoremovelist.size() > 0)
+ c1out << _("Use 'apt-get autoremove' to remove them.") << std::endl;
// Now see if we destroyed anything
if (Cache->BrokenCount() != 0)
@@ -1480,6 +1496,51 @@ bool DoUpgrade(CommandLine &CmdL)
return InstallPackages(Cache,true);
}
/*}}}*/
+// DoInstallTask - Install task from the command line /*{{{*/
+// ---------------------------------------------------------------------
+/* Install named task */
+bool TryInstallTask(pkgDepCache &Cache, pkgProblemResolver &Fix,
+ bool BrokenFix,
+ unsigned int& ExpectedInst,
+ const char *taskname)
+{
+ const char *start, *end;
+ pkgCache::PkgIterator Pkg;
+ char buf[64*1024];
+ regex_t Pattern;
+
+ // get the records
+ pkgRecords Recs(Cache);
+
+ // build regexp for the task
+ char S[300];
+ snprintf(S, sizeof(S), "^Task:.*[^a-z]%s[^a-z].*\n", taskname);
+ regcomp(&Pattern,S, REG_EXTENDED | REG_NOSUB | REG_NEWLINE);
+
+ bool found = false;
+ bool res = true;
+ for (Pkg = Cache.PkgBegin(); Pkg.end() == false; Pkg++)
+ {
+ pkgCache::VerIterator ver = Cache[Pkg].CandidateVerIter(Cache);
+ if(ver.end())
+ continue;
+ pkgRecords::Parser &parser = Recs.Lookup(ver.FileList());
+ parser.GetRec(start,end);
+ strncpy(buf, start, end-start);
+ buf[end-start] = 0x0;
+ if (regexec(&Pattern,buf,0,0,0) != 0)
+ continue;
+ res &= TryToInstall(Pkg,Cache,Fix,false,BrokenFix,ExpectedInst);
+ found = true;
+ }
+
+ if(!found)
+ _error->Error(_("Couldn't find task %s"),taskname);
+
+ regfree(&Pattern);
+ return res;
+}
+
// DoInstall - Install packages from the command line /*{{{*/
// ---------------------------------------------------------------------
/* Install named packages */
diff --git a/cmdline/apt-key b/cmdline/apt-key
index be2b19a1a..7460a24be 100755
--- a/cmdline/apt-key
+++ b/cmdline/apt-key
@@ -9,14 +9,14 @@ GPG_CMD="gpg --no-options --no-default-keyring --secret-keyring /etc/apt/secring
GPG="$GPG_CMD --keyring /etc/apt/trusted.gpg"
-ARCHIVE_KEYRING=/usr/share/keyrings/ubuntu-archive-keyring.gpg
-REMOVED_KEYS=/usr/share/keyrings/ubuntu-archive-removed-keys.gpg
+ARCHIVE_KEYRING=/usr/share/keyrings/debian-archive-keyring.gpg
+REMOVED_KEYS=/usr/share/keyrings/debian-archive-removed-keys.gpg
update() {
if [ ! -f $ARCHIVE_KEYRING ]; then
echo >&2 "ERROR: Can't find the archive-keyring"
- echo >&2 "Is the ubuntu-keyring package installed?"
+ echo >&2 "Is the debian-archive-keyring package installed?"
exit 1
fi
diff --git a/cmdline/makefile b/cmdline/makefile
index 882a0e1b5..49035be44 100644
--- a/cmdline/makefile
+++ b/cmdline/makefile
@@ -52,3 +52,9 @@ SOURCE=apt-key
TO=$(BIN)
TARGET=program
include $(COPY_H)
+
+# The apt-mark program
+SOURCE=apt-mark
+TO=$(BIN)
+TARGET=program
+include $(COPY_H)