summaryrefslogtreecommitdiff
path: root/apt-private
diff options
context:
space:
mode:
Diffstat (limited to 'apt-private')
-rw-r--r--apt-private/makefile2
-rw-r--r--apt-private/private-cmndline.cc13
-rw-r--r--apt-private/private-download.cc96
-rw-r--r--apt-private/private-download.h9
-rw-r--r--apt-private/private-install.cc161
-rw-r--r--apt-private/private-install.h3
-rw-r--r--apt-private/private-list.cc15
-rw-r--r--apt-private/private-output.cc38
-rw-r--r--apt-private/private-search.cc6
-rw-r--r--apt-private/private-show.cc7
-rw-r--r--apt-private/private-upgrade.cc21
11 files changed, 215 insertions, 156 deletions
diff --git a/apt-private/makefile b/apt-private/makefile
index 8feb1ce6c..1d179f0b2 100644
--- a/apt-private/makefile
+++ b/apt-private/makefile
@@ -17,7 +17,7 @@ MAJOR=0.0
MINOR=0
SLIBS=$(PTHREADLIB) -lapt-pkg
-PRIVATES=list install output cachefile cacheset update upgrade cmndline moo search show main
+PRIVATES=list install download output cachefile cacheset update upgrade cmndline moo search show main
SOURCE += $(foreach private, $(PRIVATES), private-$(private).cc)
HEADERS += $(foreach private, $(PRIVATES), private-$(private).h)
diff --git a/apt-private/private-cmndline.cc b/apt-private/private-cmndline.cc
index aceb865d5..8ba6629a8 100644
--- a/apt-private/private-cmndline.cc
+++ b/apt-private/private-cmndline.cc
@@ -62,8 +62,12 @@ bool addArgumentsAPTCache(std::vector<CommandLine::Args> &Args, char const * con
{
addArg(0, "all-names", "APT::Cache::AllNames", 0);
}
+ else if (CmdMatches("unmet"))
+ {
+ addArg('i', "important", "APT::Cache::Important", 0);
+ }
else if (CmdMatches("gencaches", "showsrc", "showpkg", "stats", "dump",
- "dumpavail", "unmet", "showauto", "policy", "madison"))
+ "dumpavail", "showauto", "policy", "madison"))
;
else
return false;
@@ -114,9 +118,9 @@ bool addArgumentsAPTConfig(std::vector<CommandLine::Args> &Args, char const * co
bool addArgumentsAPTGet(std::vector<CommandLine::Args> &Args, char const * const Cmd)/*{{{*/
{
if (CmdMatches("install", "remove", "purge", "upgrade", "dist-upgrade",
- "deselect-upgrade", "autoremove"))
+ "dselect-upgrade", "autoremove"))
{
- addArg(0, "dpkg-progress", "DpkgPM::Progress", 0);
+ addArg(0, "show-progress", "DpkgPM::Progress", 0);
addArg('f', "fix-broken", "APT::Get::Fix-Broken", 0);
addArg(0, "purge", "APT::Get::Purge", 0);
addArg('V',"verbose-versions","APT::Get::Show-Versions",0);
@@ -125,7 +129,8 @@ bool addArgumentsAPTGet(std::vector<CommandLine::Args> &Args, char const * const
addArg(0, "solver", "APT::Solver", CommandLine::HasArg);
if (CmdMatches("upgrade"))
{
- addArg(0, "allow-new", "APT::Get::UpgradeAllowNew", 0);
+ addArg(0, "new-pkgs", "APT::Get::Upgrade-Allow-New",
+ CommandLine::Boolean);
}
}
else if (CmdMatches("update"))
diff --git a/apt-private/private-download.cc b/apt-private/private-download.cc
new file mode 100644
index 000000000..f02991cde
--- /dev/null
+++ b/apt-private/private-download.cc
@@ -0,0 +1,96 @@
+// Include Files /*{{{*/
+#include <config.h>
+
+#include <apt-pkg/acquire.h>
+#include <apt-pkg/acquire-item.h>
+#include <apt-pkg/configuration.h>
+#include <apt-pkg/error.h>
+#include <apt-pkg/strutl.h>
+
+#include "private-output.h"
+
+#include <locale.h>
+
+#include <fstream>
+#include <string>
+#include <vector>
+
+#include <apti18n.h>
+ /*}}}*/
+
+// CheckAuth - check if each download comes form a trusted source /*{{{*/
+bool CheckAuth(pkgAcquire& Fetcher, bool const PromptUser)
+{
+ std::string UntrustedList;
+ for (pkgAcquire::ItemIterator I = Fetcher.ItemsBegin(); I < Fetcher.ItemsEnd(); ++I)
+ if (!(*I)->IsTrusted())
+ UntrustedList += std::string((*I)->ShortDesc()) + " ";
+
+ if (UntrustedList == "")
+ return true;
+
+ ShowList(c2out,_("WARNING: The following packages cannot be authenticated!"),UntrustedList,"");
+
+ if (_config->FindB("APT::Get::AllowUnauthenticated",false) == true)
+ {
+ c2out << _("Authentication warning overridden.\n");
+ return true;
+ }
+
+ if (PromptUser == false)
+ return _error->Error(_("Some packages could not be authenticated"));
+
+ if (_config->FindI("quiet",0) < 2
+ && _config->FindB("APT::Get::Assume-Yes",false) == false)
+ {
+ c2out << _("Install these packages without verification?") << std::flush;
+ if (!YnPrompt(false))
+ return _error->Error(_("Some packages could not be authenticated"));
+
+ return true;
+ }
+ else if (_config->FindB("APT::Get::Force-Yes",false) == true)
+ return true;
+
+ return _error->Error(_("There are problems and -y was used without --force-yes"));
+}
+ /*}}}*/
+bool AcquireRun(pkgAcquire &Fetcher, int const PulseInterval, bool * const Failure, bool * const TransientNetworkFailure)/*{{{*/
+{
+ pkgAcquire::RunResult res;
+ if(PulseInterval > 0)
+ res = Fetcher.Run(PulseInterval);
+ else
+ res = Fetcher.Run();
+
+ if (res == pkgAcquire::Failed)
+ return false;
+
+ for (pkgAcquire::ItemIterator I = Fetcher.ItemsBegin();
+ I != Fetcher.ItemsEnd(); ++I)
+ {
+
+ if ((*I)->Status == pkgAcquire::Item::StatDone &&
+ (*I)->Complete == true)
+ continue;
+
+ if (TransientNetworkFailure != NULL && (*I)->Status == pkgAcquire::Item::StatIdle)
+ {
+ *TransientNetworkFailure = true;
+ continue;
+ }
+
+ ::URI uri((*I)->DescURI());
+ uri.User.clear();
+ uri.Password.clear();
+ std::string descUri = std::string(uri);
+ _error->Error(_("Failed to fetch %s %s\n"), descUri.c_str(),
+ (*I)->ErrorText.c_str());
+
+ if (Failure != NULL)
+ *Failure = true;
+ }
+
+ return true;
+}
+ /*}}}*/
diff --git a/apt-private/private-download.h b/apt-private/private-download.h
new file mode 100644
index 000000000..b8cc8da1e
--- /dev/null
+++ b/apt-private/private-download.h
@@ -0,0 +1,9 @@
+#ifndef APT_PRIVATE_DOWNLOAD_H
+#define APT_PRIVATE_DOWNLOAD_H
+
+#include <apt-pkg/acquire.h>
+
+bool CheckAuth(pkgAcquire& Fetcher, bool const PromptUser);
+bool AcquireRun(pkgAcquire &Fetcher, int const PulseInterval, bool * const Failure, bool * const TransientNetworkFailure);
+
+#endif
diff --git a/apt-private/private-install.cc b/apt-private/private-install.cc
index d5052fcc0..643a6b370 100644
--- a/apt-private/private-install.cc
+++ b/apt-private/private-install.cc
@@ -42,6 +42,7 @@
#include <sstream>
#include "private-install.h"
+#include "private-download.h"
#include "private-cachefile.h"
#include "private-output.h"
#include "private-cacheset.h"
@@ -50,52 +51,6 @@
#include <apti18n.h>
/*}}}*/
-// CheckAuth - check if each download comes form a trusted source /*{{{*/
-// ---------------------------------------------------------------------
-/* */
-static bool CheckAuth(pkgAcquire& Fetcher)
-{
- std::string UntrustedList;
- for (pkgAcquire::ItemIterator I = Fetcher.ItemsBegin(); I < Fetcher.ItemsEnd(); ++I)
- {
- if (!(*I)->IsTrusted())
- {
- UntrustedList += std::string((*I)->ShortDesc()) + " ";
- }
- }
-
- if (UntrustedList == "")
- {
- return true;
- }
-
- ShowList(c2out,_("WARNING: The following packages cannot be authenticated!"),UntrustedList,"");
-
- if (_config->FindB("APT::Get::AllowUnauthenticated",false) == true)
- {
- c2out << _("Authentication warning overridden.\n");
- return true;
- }
-
- if (_config->FindI("quiet",0) < 2
- && _config->FindB("APT::Get::Assume-Yes",false) == false)
- {
- c2out << _("Install these packages without verification?") << std::flush;
- if (!YnPrompt(false))
- return _error->Error(_("Some packages could not be authenticated"));
-
- return true;
- }
- else if (_config->FindB("APT::Get::Force-Yes",false) == true)
- {
- return true;
- }
-
- return _error->Error(_("There are problems and -y was used without --force-yes"));
-}
- /*}}}*/
-
-
// InstallPackages - Actually download and install the packages /*{{{*/
// ---------------------------------------------------------------------
/* This displays the informative messages describing what is going to
@@ -301,12 +256,12 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask, bool Safety)
{
pkgAcquire::UriIterator I = Fetcher.UriBegin();
for (; I != Fetcher.UriEnd(); ++I)
- c1out << '\'' << I->URI << "' " << flNotDir(I->Owner->DestFile) << ' ' <<
+ std::cout << '\'' << I->URI << "' " << flNotDir(I->Owner->DestFile) << ' ' <<
I->Owner->FileSize << ' ' << I->Owner->HashSum() << std::endl;
return true;
}
- if (!CheckAuth(Fetcher))
+ if (!CheckAuth(Fetcher, true))
return false;
/* Unlock the dpkg lock if we are not going to be doing an install
@@ -338,29 +293,10 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask, bool Safety)
I = Fetcher.ItemsBegin();
}
}
-
- if (Fetcher.Run() == pkgAcquire::Failed)
- return false;
-
- // Print out errors
- bool Failed = false;
- for (pkgAcquire::ItemIterator I = Fetcher.ItemsBegin(); I != Fetcher.ItemsEnd(); ++I)
- {
- if ((*I)->Status == pkgAcquire::Item::StatDone &&
- (*I)->Complete == true)
- continue;
-
- if ((*I)->Status == pkgAcquire::Item::StatIdle)
- {
- Transient = true;
- // Failed = true;
- continue;
- }
- fprintf(stderr,_("Failed to fetch %s %s\n"),(*I)->DescURI().c_str(),
- (*I)->ErrorText.c_str());
- Failed = true;
- }
+ bool Failed = false;
+ if (AcquireRun(Fetcher, 0, &Failed, &Transient) == false)
+ return false;
/* If we are in no download mode and missing files and there were
'failures' then the user must specify -m. Furthermore, there
@@ -429,8 +365,6 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask, bool Safety)
return true;
}
/*}}}*/
-
-
// DoAutomaticRemove - Remove all automatic unused packages /*{{{*/
// ---------------------------------------------------------------------
/* Remove unused automatic packages */
@@ -504,15 +438,15 @@ bool DoAutomaticRemove(CacheFile &Cache)
do {
Changed = false;
for (APT::PackageSet::const_iterator Pkg = tooMuch.begin();
- Pkg != tooMuch.end() && Changed == false; ++Pkg)
+ Pkg != tooMuch.end(); ++Pkg)
{
APT::PackageSet too;
too.insert(*Pkg);
for (pkgCache::PrvIterator Prv = Cache[Pkg].CandidateVerIter(Cache).ProvidesList();
Prv.end() == false; ++Prv)
too.insert(Prv.ParentPkg());
- for (APT::PackageSet::const_iterator P = too.begin();
- P != too.end() && Changed == false; ++P) {
+ for (APT::PackageSet::const_iterator P = too.begin(); P != too.end(); ++P)
+ {
for (pkgCache::DepIterator R = P.RevDependsList();
R.end() == false; ++R)
{
@@ -531,7 +465,11 @@ bool DoAutomaticRemove(CacheFile &Cache)
Changed = true;
break;
}
+ if (Changed == true)
+ break;
}
+ if (Changed == true)
+ break;
}
} while (Changed == true);
}
@@ -576,32 +514,28 @@ bool DoAutomaticRemove(CacheFile &Cache)
return true;
}
/*}}}*/
+// DoCacheManipulationFromCommandLine /*{{{*/
+static const unsigned short MOD_REMOVE = 1;
+static const unsigned short MOD_INSTALL = 2;
-
-
-
-// DoInstall - Install packages from the command line /*{{{*/
-// ---------------------------------------------------------------------
-/* Install named packages */
-bool DoInstall(CommandLine &CmdL)
+bool DoCacheManipulationFromCommandLine(CommandLine &CmdL, CacheFile &Cache)
{
- CacheFile Cache;
- if (Cache.OpenForInstall() == false ||
- Cache.CheckDeps(CmdL.FileSize() != 1) == false)
- return false;
-
+ std::map<unsigned short, APT::VersionSet> verset;
+ return DoCacheManipulationFromCommandLine(CmdL, Cache, verset);
+}
+bool DoCacheManipulationFromCommandLine(CommandLine &CmdL, CacheFile &Cache,
+ std::map<unsigned short, APT::VersionSet> &verset)
+{
+
// Enter the special broken fixing mode if the user specified arguments
bool BrokenFix = false;
if (Cache->BrokenCount() != 0)
BrokenFix = true;
- pkgProblemResolver* Fix = NULL;
+ SPtr<pkgProblemResolver> Fix;
if (_config->FindB("APT::Get::CallResolver", true) == true)
Fix = new pkgProblemResolver(Cache);
- static const unsigned short MOD_REMOVE = 1;
- static const unsigned short MOD_INSTALL = 2;
-
unsigned short fallback = MOD_INSTALL;
if (strcasecmp(CmdL.FileList[0],"remove") == 0)
fallback = MOD_REMOVE;
@@ -622,14 +556,12 @@ bool DoInstall(CommandLine &CmdL)
mods.push_back(APT::VersionSet::Modifier(MOD_REMOVE, "-",
APT::VersionSet::Modifier::POSTFIX, APT::VersionSet::NEWEST));
CacheSetHelperAPTGet helper(c0out);
- std::map<unsigned short, APT::VersionSet> verset = APT::VersionSet::GroupedFromCommandLine(Cache,
+ verset = APT::VersionSet::GroupedFromCommandLine(Cache,
CmdL.FileList + 1, mods, fallback, helper);
if (_error->PendingError() == true)
{
helper.showVirtualPackageErrors(Cache);
- if (Fix != NULL)
- delete Fix;
return false;
}
@@ -663,8 +595,6 @@ bool DoInstall(CommandLine &CmdL)
if (_error->PendingError() == true)
{
- if (Fix != NULL)
- delete Fix;
return false;
}
@@ -675,8 +605,6 @@ bool DoInstall(CommandLine &CmdL)
{
c1out << _("You might want to run 'apt-get -f install' to correct these:") << std::endl;
ShowBroken(c1out,Cache,false);
- if (Fix != NULL)
- delete Fix;
return _error->Error(_("Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution)."));
}
@@ -684,7 +612,6 @@ bool DoInstall(CommandLine &CmdL)
{
// Call the scored problem resolver
Fix->Resolve(true);
- delete Fix;
}
// Now we check the state of the packages,
@@ -718,6 +645,33 @@ bool DoInstall(CommandLine &CmdL)
if (!DoAutomaticRemove(Cache))
return false;
+ // if nothing changed in the cache, but only the automark information
+ // we write the StateFile here, otherwise it will be written in
+ // cache.commit()
+ if (InstallAction.AutoMarkChanged > 0 &&
+ Cache->DelCount() == 0 && Cache->InstCount() == 0 &&
+ Cache->BadCount() == 0 &&
+ _config->FindB("APT::Get::Simulate",false) == false)
+ Cache->writeStateFile(NULL);
+
+ return true;
+}
+ /*}}}*/
+// DoInstall - Install packages from the command line /*{{{*/
+// ---------------------------------------------------------------------
+/* Install named packages */
+bool DoInstall(CommandLine &CmdL)
+{
+ CacheFile Cache;
+ if (Cache.OpenForInstall() == false ||
+ Cache.CheckDeps(CmdL.FileSize() != 1) == false)
+ return false;
+
+ std::map<unsigned short, APT::VersionSet> verset;
+
+ if(!DoCacheManipulationFromCommandLine(CmdL, Cache, verset))
+ return false;
+
/* Print out a list of packages that are going to be installed extra
to what the user asked */
if (Cache->InstCount() != verset[MOD_INSTALL].size())
@@ -833,15 +787,6 @@ bool DoInstall(CommandLine &CmdL)
}
- // if nothing changed in the cache, but only the automark information
- // we write the StateFile here, otherwise it will be written in
- // cache.commit()
- if (InstallAction.AutoMarkChanged > 0 &&
- Cache->DelCount() == 0 && Cache->InstCount() == 0 &&
- Cache->BadCount() == 0 &&
- _config->FindB("APT::Get::Simulate",false) == false)
- Cache->writeStateFile(NULL);
-
// See if we need to prompt
// FIXME: check if really the packages in the set are going to be installed
if (Cache->InstCount() == verset[MOD_INSTALL].size() && Cache->DelCount() == 0)
diff --git a/apt-private/private-install.h b/apt-private/private-install.h
index fcf4cbced..439c89712 100644
--- a/apt-private/private-install.h
+++ b/apt-private/private-install.h
@@ -14,6 +14,9 @@
bool DoInstall(CommandLine &Cmd);
+bool DoCacheManipulationFromCommandLine(CommandLine &CmdL, CacheFile &Cache,
+ std::map<unsigned short, APT::VersionSet> &verset);
+bool DoCacheManipulationFromCommandLine(CommandLine &CmdL, CacheFile &Cache);
bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask = true,
bool Safety = true);
diff --git a/apt-private/private-list.cc b/apt-private/private-list.cc
index c3a21aafc..8c61fcae8 100644
--- a/apt-private/private-list.cc
+++ b/apt-private/private-list.cc
@@ -42,7 +42,7 @@
#include <apti18n.h>
/*}}}*/
-struct PackageSortAlphabetic
+struct PackageSortAlphabetic /*{{{*/
{
bool operator () (const pkgCache::PkgIterator &p_lhs,
const pkgCache::PkgIterator &p_rhs)
@@ -52,12 +52,12 @@ struct PackageSortAlphabetic
return (l_name < r_name);
}
};
-
+ /*}}}*/
+class PackageNameMatcher : public Matcher /*{{{*/
+{
#ifdef PACKAGE_MATCHER_ABI_COMPAT
#define PackageMatcher PackageNameMatchesFnmatch
#endif
-class PackageNameMatcher : public Matcher
-{
public:
PackageNameMatcher(const char **patterns)
{
@@ -98,9 +98,8 @@ private:
std::vector<APT::CacheFilter::PackageMatcher*>::const_iterator J;
#undef PackageMatcher
};
-
-
-void ListAllVersions(pkgCacheFile &CacheFile, pkgRecords &records,
+ /*}}}*/
+void ListAllVersions(pkgCacheFile &CacheFile, pkgRecords &records, /*{{{*/
pkgCache::PkgIterator P,
std::ostream &outs)
{
@@ -108,7 +107,7 @@ void ListAllVersions(pkgCacheFile &CacheFile, pkgRecords &records,
Ver.end() == false; Ver++)
ListSingleVersion(CacheFile, records, Ver, outs);
}
-
+ /*}}}*/
// list - list package based on criteria /*{{{*/
// ---------------------------------------------------------------------
bool List(CommandLine &Cmd)
diff --git a/apt-private/private-output.cc b/apt-private/private-output.cc
index 659975476..6fadf7274 100644
--- a/apt-private/private-output.cc
+++ b/apt-private/private-output.cc
@@ -28,8 +28,7 @@ std::ostream c2out(0);
std::ofstream devnull("/dev/null");
unsigned int ScreenWidth = 80 - 1; /* - 1 for the cursor */
-
-bool InitOutput()
+bool InitOutput() /*{{{*/
{
c0out.rdbuf(cout.rdbuf());
c1out.rdbuf(cout.rdbuf());
@@ -60,8 +59,8 @@ bool InitOutput()
return true;
}
-
-std::string GetArchiveSuite(pkgCacheFile &CacheFile, pkgCache::VerIterator ver)
+ /*}}}*/
+std::string GetArchiveSuite(pkgCacheFile &CacheFile, pkgCache::VerIterator ver) /*{{{*/
{
std::string suite = "";
if (ver && ver.FileList() && ver.FileList())
@@ -77,8 +76,8 @@ std::string GetArchiveSuite(pkgCacheFile &CacheFile, pkgCache::VerIterator ver)
}
return suite;
}
-
-std::string GetFlagsStr(pkgCacheFile &CacheFile, pkgCache::PkgIterator P)
+ /*}}}*/
+std::string GetFlagsStr(pkgCacheFile &CacheFile, pkgCache::PkgIterator P)/*{{{*/
{
pkgDepCache *DepCache = CacheFile.GetDepCache();
pkgDepCache::StateCache &state = (*DepCache)[P];
@@ -94,23 +93,23 @@ std::string GetFlagsStr(pkgCacheFile &CacheFile, pkgCache::PkgIterator P)
flags_str = "-";
return flags_str;
}
-
-std::string GetCandidateVersion(pkgCacheFile &CacheFile, pkgCache::PkgIterator P)
+ /*}}}*/
+std::string GetCandidateVersion(pkgCacheFile &CacheFile, pkgCache::PkgIterator P)/*{{{*/
{
pkgPolicy *policy = CacheFile.GetPolicy();
pkgCache::VerIterator cand = policy->GetCandidateVer(P);
return cand ? cand.VerStr() : "(none)";
}
-
-std::string GetInstalledVersion(pkgCacheFile &CacheFile, pkgCache::PkgIterator P)
+ /*}}}*/
+std::string GetInstalledVersion(pkgCacheFile &CacheFile, pkgCache::PkgIterator P)/*{{{*/
{
pkgCache::VerIterator inst = P.CurrentVer();
return inst ? inst.VerStr() : "(none)";
}
-
-std::string GetVersion(pkgCacheFile &CacheFile, pkgCache::VerIterator V)
+ /*}}}*/
+std::string GetVersion(pkgCacheFile &CacheFile, pkgCache::VerIterator V)/*{{{*/
{
pkgCache::PkgIterator P = V.ParentPkg();
if (V == P.CurrentVer())
@@ -127,8 +126,8 @@ std::string GetVersion(pkgCacheFile &CacheFile, pkgCache::VerIterator V)
return DeNull(V.VerStr());
return "(none)";
}
-
-std::string GetArchitecture(pkgCacheFile &CacheFile, pkgCache::PkgIterator P)
+ /*}}}*/
+std::string GetArchitecture(pkgCacheFile &CacheFile, pkgCache::PkgIterator P)/*{{{*/
{
pkgPolicy *policy = CacheFile.GetPolicy();
pkgCache::VerIterator inst = P.CurrentVer();
@@ -136,8 +135,8 @@ std::string GetArchitecture(pkgCacheFile &CacheFile, pkgCache::PkgIterator P)
return inst ? inst.Arch() : cand.Arch();
}
-
-std::string GetShortDescription(pkgCacheFile &CacheFile, pkgRecords &records, pkgCache::PkgIterator P)
+ /*}}}*/
+std::string GetShortDescription(pkgCacheFile &CacheFile, pkgRecords &records, pkgCache::PkgIterator P)/*{{{*/
{
pkgPolicy *policy = CacheFile.GetPolicy();
@@ -157,8 +156,8 @@ std::string GetShortDescription(pkgCacheFile &CacheFile, pkgRecords &records, pk
}
return ShortDescription;
}
-
-void ListSingleVersion(pkgCacheFile &CacheFile, pkgRecords &records,
+ /*}}}*/
+void ListSingleVersion(pkgCacheFile &CacheFile, pkgRecords &records, /*{{{*/
pkgCache::VerIterator V, std::ostream &out)
{
pkgCache::PkgIterator P = V.ParentPkg();
@@ -230,8 +229,7 @@ void ListSingleVersion(pkgCacheFile &CacheFile, pkgRecords &records,
<< std::endl;
}
}
-
-
+ /*}}}*/
// ShowList - Show a list /*{{{*/
// ---------------------------------------------------------------------
/* This prints out a string of space separated words with a title and
diff --git a/apt-private/private-search.cc b/apt-private/private-search.cc
index 6881f482f..ff4140fa7 100644
--- a/apt-private/private-search.cc
+++ b/apt-private/private-search.cc
@@ -1,3 +1,4 @@
+// Includes /*{{{*/
#include <apt-pkg/error.h>
#include <apt-pkg/cachefile.h>
#include <apt-pkg/cachefilter.h>
@@ -34,9 +35,9 @@
#include "private-search.h"
#include "private-cacheset.h"
+ /*}}}*/
-
-bool FullTextSearch(CommandLine &CmdL)
+bool FullTextSearch(CommandLine &CmdL) /*{{{*/
{
pkgCacheFile CacheFile;
pkgCache *Cache = CacheFile.GetPkgCache();
@@ -97,3 +98,4 @@ bool FullTextSearch(CommandLine &CmdL)
return true;
}
+ /*}}}*/
diff --git a/apt-private/private-show.cc b/apt-private/private-show.cc
index e26a2b30a..ddc75dbeb 100644
--- a/apt-private/private-show.cc
+++ b/apt-private/private-show.cc
@@ -1,3 +1,4 @@
+// Includes /*{{{*/
#include <apt-pkg/error.h>
#include <apt-pkg/cachefile.h>
#include <apt-pkg/cachefilter.h>
@@ -23,6 +24,7 @@
#include "private-output.h"
#include "private-cacheset.h"
+ /*}}}*/
namespace APT {
namespace Cmd {
@@ -87,8 +89,7 @@ bool DisplayRecord(pkgCacheFile &CacheFile, pkgCache::VerIterator V,
return true;
}
/*}}}*/
-
-bool ShowPackage(CommandLine &CmdL)
+bool ShowPackage(CommandLine &CmdL) /*{{{*/
{
pkgCacheFile CacheFile;
CacheSetHelperVirtuals helper(true, GlobalError::NOTICE);
@@ -102,7 +103,7 @@ bool ShowPackage(CommandLine &CmdL)
Pkg != helper.virtualPkgs.end(); ++Pkg)
{
c1out << "Package: " << Pkg.FullName(true) << std::endl;
- c1out << "State: " << _("not a real pacakge (virtual)") << std::endl;
+ c1out << "State: " << _("not a real package (virtual)") << std::endl;
// FIXME: show providers, see private-cacheset.h
// CacheSetHelperAPTGet::showVirtualPackageErrors()
}
diff --git a/apt-private/private-upgrade.cc b/apt-private/private-upgrade.cc
index eb546e3e3..9a5286b57 100644
--- a/apt-private/private-upgrade.cc
+++ b/apt-private/private-upgrade.cc
@@ -1,21 +1,18 @@
-
+// Includes /*{{{*/
#include <apt-pkg/algorithms.h>
#include "private-install.h"
#include "private-cachefile.h"
#include "private-upgrade.h"
#include "private-output.h"
+ /*}}}*/
-
-// DoUpgradeNoNewPackages - Upgrade all packages /*{{{*/
+// DoUpgradeNoNewPackages - Upgrade all packages /*{{{*/
// ---------------------------------------------------------------------
/* Upgrade all packages without installing new packages or erasing old
packages */
bool DoUpgradeNoNewPackages(CommandLine &CmdL)
{
- if (CmdL.FileSize() != 1)
- return _error->Error(_("The upgrade command takes no arguments"));
-
CacheFile Cache;
if (Cache.OpenForInstall() == false || Cache.CheckDeps() == false)
return false;
@@ -26,17 +23,17 @@ bool DoUpgradeNoNewPackages(CommandLine &CmdL)
ShowBroken(c1out,Cache,false);
return _error->Error(_("Internal error, AllUpgrade broke stuff"));
}
+
+ // parse additional cmdline pkg manipulation switches
+ if(!DoCacheManipulationFromCommandLine(CmdL, Cache))
+ return false;
return InstallPackages(Cache,true);
}
/*}}}*/
-
// DoSafeUpgrade - Upgrade all packages with install but not remove /*{{{*/
bool DoUpgradeWithAllowNewPackages(CommandLine &CmdL)
{
- if (CmdL.FileSize() != 1)
- return _error->Error(_("The upgrade command takes no arguments"));
-
CacheFile Cache;
if (Cache.OpenForInstall() == false || Cache.CheckDeps() == false)
return false;
@@ -47,6 +44,10 @@ bool DoUpgradeWithAllowNewPackages(CommandLine &CmdL)
ShowBroken(c1out,Cache,false);
return _error->Error(_("Internal error, AllUpgrade broke stuff"));
}
+
+ // parse additional cmdline pkg manipulation switches
+ if(!DoCacheManipulationFromCommandLine(CmdL, Cache))
+ return false;
return InstallPackages(Cache,true);
}