From: David Kalnischkies <kalnischkies@gmail.com>
Date: Fri, 12 Feb 2010 16:17:16 +0000 (+0100)
Subject: In SingleArch environments we don't need the arch "all" pseudo package
X-Git-Tag: 0.8.0~9^2~64^2~20^2~22^2~1
X-Git-Url: https://git.saurik.com/apt.git/commitdiff_plain/42d71ab5fe58953a680bd300a99d173e23430d7c?ds=inline

In SingleArch environments we don't need the arch "all" pseudo package
for handling arch:all packages, so we create only one package and stop
calling it a pseudo package.
---

diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc
index b3d95164a..1948aedf3 100644
--- a/apt-pkg/deb/deblistparser.cc
+++ b/apt-pkg/deb/deblistparser.cc
@@ -158,7 +158,7 @@ bool debListParser::NewVersion(pkgCache::VerIterator Ver)
 	 the architecture bound versions coming in and out on regular basis. */
       if (strcmp(Ver.Arch(true),"all") == 0)
 	 return true;
-      else
+      else if (Ver.Pseudo() == true)
       {
 	 // our pseudo packages have no size to not confuse the fetcher
 	 Ver->Size = 0;
diff --git a/apt-pkg/pkgcache.cc b/apt-pkg/pkgcache.cc
index 04a2c7234..d4268b31c 100644
--- a/apt-pkg/pkgcache.cc
+++ b/apt-pkg/pkgcache.cc
@@ -657,8 +657,13 @@ bool pkgCache::VerIterator::Automatic() const
    are a problem everytime we need to download/install something. */
 bool pkgCache::VerIterator::Pseudo() const
 {
-   return (S->MultiArch == pkgCache::Version::All &&
-	   strcmp(Arch(true),"all") != 0);
+   if (S->MultiArch == pkgCache::Version::All &&
+	   strcmp(Arch(true),"all") != 0)
+   {
+	   GrpIterator const Grp = ParentPkg().Group();
+	   return (Grp->LastPackage != Grp->FirstPackage);
+   }
+   return false;
 }
 									/*}}}*/
 // VerIterator::NewestFile - Return the newest file version relation	/*{{{*/
diff --git a/apt-pkg/pkgcachegen.cc b/apt-pkg/pkgcachegen.cc
index c1b546a00..6d103c6b6 100644
--- a/apt-pkg/pkgcachegen.cc
+++ b/apt-pkg/pkgcachegen.cc
@@ -117,7 +117,8 @@ bool pkgCacheGenerator::MergeList(ListParser &List,
       std::vector<string> genArch;
       if (List.ArchitectureAll() == true) {
 	 genArch = APT::Configuration::getArchitectures();
-	 genArch.push_back("all");
+	 if (genArch.size() != 1)
+	    genArch.push_back("all");
       } else
 	 genArch.push_back(List.Architecture());
 
diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc
index 93065004c..343226bc3 100644
--- a/cmdline/apt-get.cc
+++ b/cmdline/apt-get.cc
@@ -585,6 +585,9 @@ void Stats(ostream &out,pkgDepCache &Dep)
    unsigned long ReInstall = 0;
    for (pkgCache::PkgIterator I = Dep.PkgBegin(); I.end() == false; I++)
    {
+      if (pkgCache::VerIterator(Dep, Dep[I].CandidateVer).Pseudo() == true)
+	 continue;
+
       if (Dep[I].NewInstall() == true)
 	 Install++;
       else