summaryrefslogtreecommitdiff
path: root/cmdline
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2012-01-16 22:17:23 +0100
committerMichael Vogt <michael.vogt@ubuntu.com>2012-01-16 22:17:23 +0100
commite70c1d067335bfa686fa0c6e75e32afb095e1aaa (patch)
treee985e74ed4d613126b24839d710e4b49db753824 /cmdline
parente75aa33384d52635fba502bed628bc68f9cb5066 (diff)
parent85e1885525977809ff6a3b70abb84d3a63e41817 (diff)
merged from debian-experimental2
Diffstat (limited to 'cmdline')
-rw-r--r--cmdline/apt-cache.cc38
-rw-r--r--cmdline/apt-config.cc16
-rw-r--r--cmdline/apt-extracttemplates.h10
-rw-r--r--cmdline/apt-get.cc47
-rw-r--r--cmdline/apt-mark.cc16
5 files changed, 78 insertions, 49 deletions
diff --git a/cmdline/apt-cache.cc b/cmdline/apt-cache.cc
index 82a31c9b1..1cd5080cc 100644
--- a/cmdline/apt-cache.cc
+++ b/cmdline/apt-cache.cc
@@ -65,12 +65,12 @@ public:
return CacheSetHelper::canNotFindNewestVer(Cache, Pkg);
}
- virtual APT::VersionSet canNotFindAllVer(pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg) {
+ virtual void canNotFindAllVer(APT::VersionContainerInterface * vci, pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg) {
virtualPkgs.insert(Pkg);
- return CacheSetHelper::canNotFindAllVer(Cache, Pkg);
+ CacheSetHelper::canNotFindAllVer(vci, Cache, Pkg);
}
- CacheSetHelperVirtuals(bool const &ShowErrors = true, GlobalError::MsgType const &ErrorType = GlobalError::NOTICE) : CacheSetHelper(ShowErrors, ErrorType) {}
+ CacheSetHelperVirtuals(bool const ShowErrors = true, GlobalError::MsgType const &ErrorType = GlobalError::NOTICE) : CacheSetHelper(ShowErrors, ErrorType) {}
};
/*}}}*/
// LocalitySort - Sort a version list by package file locality /*{{{*/
@@ -108,7 +108,7 @@ void LocalitySort(pkgCache::DescFile **begin,
// UnMet - Show unmet dependencies /*{{{*/
// ---------------------------------------------------------------------
/* */
-bool ShowUnMet(pkgCache::VerIterator const &V, bool const &Important)
+bool ShowUnMet(pkgCache::VerIterator const &V, bool const Important)
{
bool Header = false;
for (pkgCache::DepIterator D = V.DependsList(); D.end() == false;)
@@ -199,9 +199,9 @@ bool UnMet(CommandLine &CmdL)
else
{
CacheSetHelperVirtuals helper(true, GlobalError::NOTICE);
- APT::VersionSet verset = APT::VersionSet::FromCommandLine(CacheFile, CmdL.FileList + 1,
- APT::VersionSet::CANDIDATE, helper);
- for (APT::VersionSet::iterator V = verset.begin(); V != verset.end(); ++V)
+ APT::VersionList verset = APT::VersionList::FromCommandLine(CacheFile, CmdL.FileList + 1,
+ APT::VersionList::CANDIDATE, helper);
+ for (APT::VersionList::iterator V = verset.begin(); V != verset.end(); ++V)
if (ShowUnMet(V, Important) == false)
return false;
}
@@ -215,9 +215,9 @@ bool DumpPackage(CommandLine &CmdL)
{
pkgCacheFile CacheFile;
APT::CacheSetHelper helper(true, GlobalError::NOTICE);
- APT::PackageSet pkgset = APT::PackageSet::FromCommandLine(CacheFile, CmdL.FileList + 1, helper);
+ APT::PackageList pkgset = APT::PackageList::FromCommandLine(CacheFile, CmdL.FileList + 1, helper);
- for (APT::PackageSet::const_iterator Pkg = pkgset.begin(); Pkg != pkgset.end(); ++Pkg)
+ for (APT::PackageList::const_iterator Pkg = pkgset.begin(); Pkg != pkgset.end(); ++Pkg)
{
cout << "Package: " << Pkg.FullName(true) << endl;
cout << "Versions: " << endl;
@@ -588,7 +588,7 @@ bool ShowDepends(CommandLine &CmdL, bool const RevDepends)
return false;
CacheSetHelperVirtuals helper(false);
- APT::VersionSet verset = APT::VersionSet::FromCommandLine(CacheFile, CmdL.FileList + 1, APT::VersionSet::CANDIDATE, helper);
+ APT::VersionList verset = APT::VersionList::FromCommandLine(CacheFile, CmdL.FileList + 1, APT::VersionList::CANDIDATE, helper);
if (verset.empty() == true && helper.virtualPkgs.empty() == true)
return _error->Error(_("No packages found"));
std::vector<bool> Shown(Cache->Head().PackageCount);
@@ -1143,7 +1143,7 @@ bool DisplayRecord(pkgCacheFile &CacheFile, pkgCache::VerIterator V)
return _error->Error(_("Package file %s is out of sync."),I.FileName());
FileFd PkgF;
- if (PkgF.Open(I.FileName(), FileFd::ReadOnlyGzip) == false)
+ if (PkgF.Open(I.FileName(), FileFd::ReadOnly, FileFd::Extension) == false)
return false;
// Read the record
@@ -1365,10 +1365,10 @@ bool ShowPackage(CommandLine &CmdL)
{
pkgCacheFile CacheFile;
CacheSetHelperVirtuals helper(true, GlobalError::NOTICE);
- APT::VersionSet::Version const select = _config->FindB("APT::Cache::AllVersions", true) ?
- APT::VersionSet::ALL : APT::VersionSet::CANDIDATE;
- APT::VersionSet const verset = APT::VersionSet::FromCommandLine(CacheFile, CmdL.FileList + 1, select, helper);
- for (APT::VersionSet::const_iterator Ver = verset.begin(); Ver != verset.end(); ++Ver)
+ APT::VersionList::Version const select = _config->FindB("APT::Cache::AllVersions", true) ?
+ APT::VersionList::ALL : APT::VersionList::CANDIDATE;
+ APT::VersionList const verset = APT::VersionList::FromCommandLine(CacheFile, CmdL.FileList + 1, select, helper);
+ for (APT::VersionList::const_iterator Ver = verset.begin(); Ver != verset.end(); ++Ver)
if (DisplayRecord(CacheFile, Ver) == false)
return false;
@@ -1531,8 +1531,8 @@ bool Policy(CommandLine &CmdL)
// Print out detailed information for each package
APT::CacheSetHelper helper(true, GlobalError::NOTICE);
- APT::PackageSet pkgset = APT::PackageSet::FromCommandLine(CacheFile, CmdL.FileList + 1, helper);
- for (APT::PackageSet::const_iterator Pkg = pkgset.begin(); Pkg != pkgset.end(); ++Pkg)
+ APT::PackageList pkgset = APT::PackageList::FromCommandLine(CacheFile, CmdL.FileList + 1, helper);
+ for (APT::PackageList::const_iterator Pkg = pkgset.begin(); Pkg != pkgset.end(); ++Pkg)
{
cout << Pkg.FullName(true) << ":" << endl;
@@ -1608,8 +1608,8 @@ bool Madison(CommandLine &CmdL)
for (const char **I = CmdL.FileList + 1; *I != 0; I++)
{
_error->PushToStack();
- APT::PackageSet pkgset = APT::PackageSet::FromString(CacheFile, *I, helper);
- for (APT::PackageSet::const_iterator Pkg = pkgset.begin(); Pkg != pkgset.end(); ++Pkg)
+ APT::PackageList pkgset = APT::PackageList::FromString(CacheFile, *I, helper);
+ for (APT::PackageList::const_iterator Pkg = pkgset.begin(); Pkg != pkgset.end(); ++Pkg)
{
for (pkgCache::VerIterator V = Pkg.VersionList(); V.end() == false; ++V)
{
diff --git a/cmdline/apt-config.cc b/cmdline/apt-config.cc
index 94f6ee9b0..47bedfe3f 100644
--- a/cmdline/apt-config.cc
+++ b/cmdline/apt-config.cc
@@ -134,6 +134,22 @@ int main(int argc,const char *argv[]) /*{{{*/
for (std::vector<std::string>::const_iterator a = archs.begin(); a != archs.end(); ++a)
_config->Set("APT::Architectures::", *a);
+ std::vector<APT::Configuration::Compressor> const compressors = APT::Configuration::getCompressors();
+ _config->Clear("APT::Compressor");
+ string conf = "APT::Compressor::";
+ for (std::vector<APT::Configuration::Compressor>::const_iterator c = compressors.begin(); c != compressors.end(); ++c)
+ {
+ string comp = conf + c->Name + "::";
+ _config->Set(comp + "Name", c->Name);
+ _config->Set(comp + "Extension", c->Extension);
+ _config->Set(comp + "Binary", c->Binary);
+ _config->Set(std::string(comp + "Cost").c_str(), c->Cost);
+ for (std::vector<std::string>::const_iterator a = c->CompressArgs.begin(); a != c->CompressArgs.end(); ++a)
+ _config->Set(comp + "CompressArg::", *a);
+ for (std::vector<std::string>::const_iterator a = c->UncompressArgs.begin(); a != c->UncompressArgs.end(); ++a)
+ _config->Set(comp + "UncompressArg::", *a);
+ }
+
// Match the operation
CmdL.DispatchArg(Cmds);
diff --git a/cmdline/apt-extracttemplates.h b/cmdline/apt-extracttemplates.h
index d0f90d3f4..6d07a09c2 100644
--- a/cmdline/apt-extracttemplates.h
+++ b/cmdline/apt-extracttemplates.h
@@ -14,6 +14,8 @@
#include <apt-pkg/pkgcache.h>
#include <apt-pkg/dirstream.h>
+#include <string>
+
class DebFile : public pkgDirStream
{
FileFd File;
@@ -31,11 +33,11 @@ public:
bool Go();
bool ParseInfo();
- static string GetInstalledVer(const string &package);
+ static std::string GetInstalledVer(const std::string &package);
- string Package;
- string Version;
- string DepVer, PreDepVer;
+ std::string Package;
+ std::string Version;
+ std::string DepVer, PreDepVer;
unsigned int DepOp, PreDepOp;
char *Config;
diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc
index 1925dea87..ca1169401 100644
--- a/cmdline/apt-get.cc
+++ b/cmdline/apt-get.cc
@@ -628,20 +628,18 @@ public:
explicitlyNamed = true;
}
- virtual void showTaskSelection(APT::PackageSet const &pkgset, string const &pattern) {
- for (APT::PackageSet::const_iterator Pkg = pkgset.begin(); Pkg != pkgset.end(); ++Pkg)
- ioprintf(out, _("Note, selecting '%s' for task '%s'\n"),
- Pkg.FullName(true).c_str(), pattern.c_str());
+ virtual void showTaskSelection(pkgCache::PkgIterator const &Pkg, string const &pattern) {
+ ioprintf(out, _("Note, selecting '%s' for task '%s'\n"),
+ Pkg.FullName(true).c_str(), pattern.c_str());
explicitlyNamed = false;
}
- virtual void showRegExSelection(APT::PackageSet const &pkgset, string const &pattern) {
- for (APT::PackageSet::const_iterator Pkg = pkgset.begin(); Pkg != pkgset.end(); ++Pkg)
- ioprintf(out, _("Note, selecting '%s' for regex '%s'\n"),
- Pkg.FullName(true).c_str(), pattern.c_str());
+ virtual void showRegExSelection(pkgCache::PkgIterator const &Pkg, string const &pattern) {
+ ioprintf(out, _("Note, selecting '%s' for regex '%s'\n"),
+ Pkg.FullName(true).c_str(), pattern.c_str());
explicitlyNamed = false;
}
virtual void showSelectedVersion(pkgCache::PkgIterator const &Pkg, pkgCache::VerIterator const Ver,
- string const &ver, bool const &verIsRel) {
+ string const &ver, bool const verIsRel) {
if (ver == Ver.VerStr())
return;
selectedByRelease.push_back(make_pair(Ver, ver));
@@ -707,7 +705,7 @@ public:
APT::VersionSet const verset = tryVirtualPackage(Cache, Pkg, APT::VersionSet::CANDIDATE);
if (verset.empty() == false)
return *(verset.begin());
- if (ShowError == true) {
+ else if (ShowError == true) {
_error->Error(_("Package '%s' has no installation candidate"),Pkg.FullName(true).c_str());
virtualPkgs.insert(Pkg);
}
@@ -744,6 +742,19 @@ public:
Prov = PPkg;
found_one = true;
} else if (PPkg != Prov) {
+ // same group, so it's a foreign package
+ if (PPkg->Group == Prov->Group) {
+ // do we already have the requested arch?
+ if (strcmp(Pkg.Arch(), Prov.Arch()) == 0 ||
+ strcmp(Prov.Arch(), "all") == 0 ||
+ unlikely(strcmp(PPkg.Arch(), Prov.Arch()) == 0)) // packages have only on candidate, but just to be sure
+ continue;
+ // see which architecture we prefer more and switch to it
+ std::vector<std::string> archs = APT::Configuration::getArchitectures();
+ if (std::find(archs.begin(), archs.end(), PPkg.Arch()) < std::find(archs.begin(), archs.end(), Prov.Arch()))
+ Prov = PPkg;
+ continue;
+ }
found_one = false; // we found at least two
break;
}
@@ -769,7 +780,7 @@ struct TryToInstall {
unsigned long AutoMarkChanged;
APT::PackageSet doAutoInstallLater;
- TryToInstall(pkgCacheFile &Cache, pkgProblemResolver *PM, bool const &FixBroken) : Cache(&Cache), Fix(PM),
+ TryToInstall(pkgCacheFile &Cache, pkgProblemResolver *PM, bool const FixBroken) : Cache(&Cache), Fix(PM),
FixBroken(FixBroken), AutoMarkChanged(0) {};
void operator() (pkgCache::VerIterator const &Ver) {
@@ -2295,8 +2306,8 @@ bool DoDownload(CommandLine &CmdL)
return false;
APT::CacheSetHelper helper(c0out);
- APT::VersionSet verset = APT::VersionSet::FromCommandLine(Cache,
- CmdL.FileList + 1, APT::VersionSet::CANDIDATE, helper);
+ APT::VersionList verset = APT::VersionList::FromCommandLine(Cache,
+ CmdL.FileList + 1, APT::VersionList::CANDIDATE, helper);
if (verset.empty() == true)
return false;
@@ -2308,7 +2319,7 @@ bool DoDownload(CommandLine &CmdL)
pkgRecords Recs(Cache);
pkgSourceList *SrcList = Cache.GetSourceList();
- for (APT::VersionSet::const_iterator Ver = verset.begin();
+ for (APT::VersionList::const_iterator Ver = verset.begin();
Ver != verset.end();
++Ver)
{
@@ -3167,14 +3178,14 @@ bool DoChangelog(CommandLine &CmdL)
return false;
APT::CacheSetHelper helper(c0out);
- APT::VersionSet verset = APT::VersionSet::FromCommandLine(Cache,
- CmdL.FileList + 1, APT::VersionSet::CANDIDATE, helper);
+ APT::VersionList verset = APT::VersionList::FromCommandLine(Cache,
+ CmdL.FileList + 1, APT::VersionList::CANDIDATE, helper);
if (verset.empty() == true)
return false;
pkgAcquire Fetcher;
if (_config->FindB("APT::Get::Print-URIs", false) == true)
- for (APT::VersionSet::const_iterator Ver = verset.begin();
+ for (APT::VersionList::const_iterator Ver = verset.begin();
Ver != verset.end(); ++Ver)
return DownloadChangelog(Cache, Fetcher, Ver, "");
@@ -3197,7 +3208,7 @@ bool DoChangelog(CommandLine &CmdL)
return _error->Errno("mkdtemp", "mkdtemp failed");
}
- for (APT::VersionSet::const_iterator Ver = verset.begin();
+ for (APT::VersionList::const_iterator Ver = verset.begin();
Ver != verset.end();
++Ver)
{
diff --git a/cmdline/apt-mark.cc b/cmdline/apt-mark.cc
index 9a628d714..c7d9b6f6a 100644
--- a/cmdline/apt-mark.cc
+++ b/cmdline/apt-mark.cc
@@ -35,14 +35,14 @@ bool DoAuto(CommandLine &CmdL)
if (unlikely(Cache == NULL || DepCache == NULL))
return false;
- APT::PackageSet pkgset = APT::PackageSet::FromCommandLine(CacheFile, CmdL.FileList + 1);
+ APT::PackageList pkgset = APT::PackageList::FromCommandLine(CacheFile, CmdL.FileList + 1);
if (pkgset.empty() == true)
return _error->Error(_("No packages found"));
bool MarkAuto = strcasecmp(CmdL.FileList[0],"auto") == 0;
int AutoMarkChanged = 0;
- for (APT::PackageSet::const_iterator Pkg = pkgset.begin(); Pkg != pkgset.end(); ++Pkg)
+ for (APT::PackageList::const_iterator Pkg = pkgset.begin(); Pkg != pkgset.end(); ++Pkg)
{
if (Pkg->CurrentVer == 0)
{
@@ -82,7 +82,7 @@ bool DoMarkAuto(CommandLine &CmdL)
if (unlikely(Cache == NULL || DepCache == NULL))
return false;
- APT::PackageSet pkgset = APT::PackageSet::FromCommandLine(CacheFile, CmdL.FileList + 1);
+ APT::PackageList pkgset = APT::PackageList::FromCommandLine(CacheFile, CmdL.FileList + 1);
if (pkgset.empty() == true)
return _error->Error(_("No packages found"));
@@ -90,7 +90,7 @@ bool DoMarkAuto(CommandLine &CmdL)
bool const Verbose = _config->FindB("APT::MarkAuto::Verbose", false);
int AutoMarkChanged = 0;
- for (APT::PackageSet::const_iterator Pkg = pkgset.begin(); Pkg != pkgset.end(); ++Pkg)
+ for (APT::PackageList::const_iterator Pkg = pkgset.begin(); Pkg != pkgset.end(); ++Pkg)
{
if (Pkg->CurrentVer == 0 ||
(((*DepCache)[Pkg].Flags & pkgCache::Flag::Auto) == pkgCache::Flag::Auto) == MarkAuto)
@@ -158,13 +158,13 @@ bool DoHold(CommandLine &CmdL)
if (unlikely(Cache == NULL))
return false;
- APT::PackageSet pkgset = APT::PackageSet::FromCommandLine(CacheFile, CmdL.FileList + 1);
+ APT::PackageList pkgset = APT::PackageList::FromCommandLine(CacheFile, CmdL.FileList + 1);
if (pkgset.empty() == true)
return _error->Error(_("No packages found"));
bool const MarkHold = strcasecmp(CmdL.FileList[0],"hold") == 0;
- for (APT::PackageSet::iterator Pkg = pkgset.begin(); Pkg != pkgset.end(); ++Pkg)
+ for (APT::PackageList::iterator Pkg = pkgset.begin(); Pkg != pkgset.end(); ++Pkg)
{
if ((Pkg->SelectedState == pkgCache::State::Hold) == MarkHold)
{
@@ -182,7 +182,7 @@ bool DoHold(CommandLine &CmdL)
if (_config->FindB("APT::Mark::Simulate", false) == true)
{
- for (APT::PackageSet::iterator Pkg = pkgset.begin(); Pkg != pkgset.end(); ++Pkg)
+ for (APT::PackageList::iterator Pkg = pkgset.begin(); Pkg != pkgset.end(); ++Pkg)
{
if (MarkHold == false)
ioprintf(c1out,_("%s set on hold.\n"), Pkg.FullName(true).c_str());
@@ -202,7 +202,7 @@ bool DoHold(CommandLine &CmdL)
if (dpkg == NULL)
return _error->Errno("DoHold", "fdopen on dpkg stdin failed");
- for (APT::PackageSet::iterator Pkg = pkgset.begin(); Pkg != pkgset.end(); ++Pkg)
+ for (APT::PackageList::iterator Pkg = pkgset.begin(); Pkg != pkgset.end(); ++Pkg)
{
if (MarkHold == true)
{