* apt-pkg/cacheiterators.h:
authorDavid Kalnischkies <kalnischkies@gmail.com>
Sun, 10 Jun 2012 23:31:27 +0000 (01:31 +0200)
committerDavid Kalnischkies <kalnischkies@gmail.com>
Sun, 10 Jun 2012 23:31:27 +0000 (01:31 +0200)
  - add an IsMultiArchImplicit() method for Dep- and PrvIterator

apt-pkg/cacheiterators.h
apt-pkg/edsp.cc
apt-pkg/pkgcache.cc
debian/changelog

index d5e018b..dcd3531 100644 (file)
@@ -285,6 +285,7 @@ class pkgCache::DepIterator : public Iterator<Dependency, DepIterator> {
        bool IsNegative() const;
        bool IsIgnorable(PrvIterator const &Prv) const;
        bool IsIgnorable(PkgIterator const &Pkg) const;
+       bool IsMultiArchImplicit() const;
        void GlobOr(DepIterator &Start,DepIterator &End);
        Version **AllTargets() const;
        bool SmartTargetPkg(PkgIterator &Result) const;
@@ -329,8 +330,9 @@ class pkgCache::PrvIterator : public Iterator<Provides, PrvIterator> {
        inline VerIterator OwnerVer() const {return VerIterator(*Owner,Owner->VerP + S->Version);};
        inline PkgIterator OwnerPkg() const {return PkgIterator(*Owner,Owner->PkgP + Owner->VerP[S->Version].ParentPkg);};
 
-       inline PrvIterator() : Iterator<Provides, PrvIterator>(), Type(PrvVer) {};
+       bool IsMultiArchImplicit() const;
 
+       inline PrvIterator() : Iterator<Provides, PrvIterator>(), Type(PrvVer) {};
        inline PrvIterator(pkgCache &Owner, Provides *Trg, Version*) :
                Iterator<Provides, PrvIterator>(Owner, Trg), Type(PrvVer) {
                if (S == 0)
index 791aac7..adb8788 100644 (file)
@@ -118,8 +118,7 @@ void EDSP::WriteScenarioDependency(pkgDepCache &Cache, FILE* output, pkgCache::P
    bool orGroup = false;
    for (pkgCache::DepIterator Dep = Ver.DependsList(); Dep.end() == false; ++Dep)
    {
-      // Ignore implicit dependencies for multiarch here
-      if (strcmp(Pkg.Arch(), Dep.TargetPkg().Arch()) != 0)
+      if (Dep.IsMultiArchImplicit() == true)
         continue;
       if (orGroup == false)
         dependencies[Dep->Type].append(", ");
@@ -140,8 +139,7 @@ void EDSP::WriteScenarioDependency(pkgDepCache &Cache, FILE* output, pkgCache::P
    string provides;
    for (pkgCache::PrvIterator Prv = Ver.ProvidesList(); Prv.end() == false; ++Prv)
    {
-      // Ignore implicit provides for multiarch here
-      if (strcmp(Pkg.Arch(), Prv.ParentPkg().Arch()) != 0 || strcmp(Pkg.Name(),Prv.Name()) == 0)
+      if (Prv.IsMultiArchImplicit() == true)
         continue;
       provides.append(", ").append(Prv.Name());
    }
@@ -159,8 +157,7 @@ void EDSP::WriteScenarioLimitedDependency(pkgDepCache &Cache, FILE* output,
    bool orGroup = false;
    for (pkgCache::DepIterator Dep = Ver.DependsList(); Dep.end() == false; ++Dep)
    {
-      // Ignore implicit dependencies for multiarch here
-      if (strcmp(Pkg.Arch(), Dep.TargetPkg().Arch()) != 0)
+      if (Dep.IsMultiArchImplicit() == true)
         continue;
       if (orGroup == false)
       {
@@ -193,8 +190,7 @@ void EDSP::WriteScenarioLimitedDependency(pkgDepCache &Cache, FILE* output,
    string provides;
    for (pkgCache::PrvIterator Prv = Ver.ProvidesList(); Prv.end() == false; ++Prv)
    {
-      // Ignore implicit provides for multiarch here
-      if (strcmp(Pkg.Arch(), Prv.ParentPkg().Arch()) != 0 || strcmp(Pkg.Name(),Prv.Name()) == 0)
+      if (Prv.IsMultiArchImplicit() == true)
         continue;
       if (pkgset.find(Prv.ParentPkg()) == pkgset.end())
         continue;
index 997c707..e06e745 100644 (file)
@@ -708,6 +708,18 @@ bool pkgCache::DepIterator::IsIgnorable(PrvIterator const &Prv) const
    return false;
 }
                                                                        /*}}}*/
+// DepIterator::IsMultiArchImplicit - added by the cache generation    /*{{{*/
+// ---------------------------------------------------------------------
+/* MultiArch can be translated to SingleArch for an resolver and we did so,
+   by adding dependencies to help the resolver understand the problem, but
+   sometimes it is needed to identify these to ignore them… */
+bool pkgCache::DepIterator::IsMultiArchImplicit() const
+{
+   if (ParentPkg()->Arch != TargetPkg()->Arch)
+      return true;
+   return false;
+}
+                                                                       /*}}}*/
 // ostream operator to handle string representation of a dependecy     /*{{{*/
 // ---------------------------------------------------------------------
 /* */
@@ -946,3 +958,17 @@ pkgCache::DescIterator pkgCache::VerIterator::TranslatedDescription() const
 };
 
                                                                        /*}}}*/
+// PrvIterator::IsMultiArchImplicit - added by the cache generation    /*{{{*/
+// ---------------------------------------------------------------------
+/* MultiArch can be translated to SingleArch for an resolver and we did so,
+   by adding provides to help the resolver understand the problem, but
+   sometimes it is needed to identify these to ignore them… */
+bool pkgCache::PrvIterator::IsMultiArchImplicit() const
+{
+   pkgCache::PkgIterator const Owner = OwnerPkg();
+   pkgCache::PkgIterator const Parent = ParentPkg();
+   if (Owner->Arch != Parent->Arch || Owner->Name == Parent->Name)
+      return true;
+   return false;
+}
+                                                                       /*}}}*/
index ee108b0..1b33daa 100644 (file)
@@ -37,6 +37,8 @@ apt (0.9.5.2) UNRELEASED; urgency=low
   * apt-pkg/aptconfiguration.cc:
     - if APT::Languages=none save "none" in allCodes so that the detected
       configuration is cached as intended (Closes: #674690, LP: #1004947)
+  * apt-pkg/cacheiterators.h:
+    - add an IsMultiArchImplicit() method for Dep- and PrvIterator
 
   [ Justin B Rye ]
   * doc/apt-cdrom.8.xml: