summaryrefslogtreecommitdiff
path: root/cmdline
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2011-11-23 11:54:56 +0100
committerMichael Vogt <michael.vogt@ubuntu.com>2011-11-23 11:54:56 +0100
commit4d45b77bab33b9b7d6328dbc9265b5c0971a875d (patch)
treef104aed299aa3e97de6dc9b58310e45fd255f512 /cmdline
parent905693203943283b3c2b1dbf32e40a738392302a (diff)
parent5cbddfa3c7fd1d6be3657bdf2fae39c216fe5eeb (diff)
merged from debian-experimental
Diffstat (limited to 'cmdline')
-rw-r--r--cmdline/apt-cache.cc36
-rw-r--r--cmdline/apt-get.cc47
-rw-r--r--cmdline/apt-mark.cc16
3 files changed, 55 insertions, 44 deletions
diff --git a/cmdline/apt-cache.cc b/cmdline/apt-cache.cc
index 82a31c9b1..65d7b0ccd 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);
@@ -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-get.cc b/cmdline/apt-get.cc
index d2e44aae0..c140d5f5c 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)
{
@@ -3170,14 +3181,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, "");
@@ -3200,7 +3211,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 339cbdf44..dbbef5013 100644
--- a/cmdline/apt-mark.cc
+++ b/cmdline/apt-mark.cc
@@ -34,14 +34,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)
{
@@ -81,7 +81,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"));
@@ -89,7 +89,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)
@@ -157,13 +157,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)
{
@@ -181,7 +181,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());
@@ -201,7 +201,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)
{