Просмотр исходного кода

* apt-pkg/deb/deblistparser.cc:
- create foo:any provides for all architectures for an allowed package

David Kalnischkies лет назад: 15
Родитель
Сommit
60dcec6d51
4 измененных файлов с 22 добавлено и 18 удалено
  1. 13 12
      apt-pkg/deb/deblistparser.cc
  2. 1 0
      apt-pkg/deb/deblistparser.h
  3. 5 5
      apt-pkg/pkgcache.cc
  4. 3 1
      debian/changelog

+ 13 - 12
apt-pkg/deb/deblistparser.cc

@@ -632,7 +632,7 @@ bool debListParser::ParseDepends(pkgCache::VerIterator &Ver,
 
 
    while (1)
    while (1)
    {
    {
-      Start = ParseDepends(Start,Stop,Package,Version,Op);
+      Start = ParseDepends(Start,Stop,Package,Version,Op,false,!MultiArchEnabled);
       if (Start == 0)
       if (Start == 0)
 	 return _error->Error("Problem parsing dependency %s",Tag);
 	 return _error->Error("Problem parsing dependency %s",Tag);
 
 
@@ -685,27 +685,28 @@ bool debListParser::ParseProvides(pkgCache::VerIterator &Ver)
       }
       }
    }
    }
 
 
-   if (Ver->MultiArch == pkgCache::Version::Allowed || Ver->MultiArch == pkgCache::Version::AllAllowed)
+   if (MultiArchEnabled == false)
+      return true;
+   else if (Ver->MultiArch == pkgCache::Version::Allowed || Ver->MultiArch == pkgCache::Version::AllAllowed)
    {
    {
       string const Package = string(Ver.ParentPkg().Name()).append(":").append("any");
       string const Package = string(Ver.ParentPkg().Name()).append(":").append("any");
-      NewProvides(Ver, Package, "any", Ver.VerStr());
+      return NewProvidesAllArch(Ver, Package, Ver.VerStr());
    }
    }
+   else if (Ver->MultiArch == pkgCache::Version::Foreign || Ver->MultiArch == pkgCache::Version::AllForeign)
+      return NewProvidesAllArch(Ver, Ver.ParentPkg().Name(), Ver.VerStr());
 
 
-   if (Ver->MultiArch != pkgCache::Version::Foreign && Ver->MultiArch != pkgCache::Version::AllForeign)
-      return true;
-
-   if (MultiArchEnabled == false)
-      return true;
-
-   string const Package = Ver.ParentPkg().Name();
-   string const Version = Ver.VerStr();
+   return true;
+}
+									/*}}}*/
+// ListParser::NewProvides - add provides for all architectures		/*{{{*/
+bool debListParser::NewProvidesAllArch(pkgCache::VerIterator &Ver, string const &Package,
+				string const &Version) {
    for (std::vector<string>::const_iterator a = Architectures.begin();
    for (std::vector<string>::const_iterator a = Architectures.begin();
 	a != Architectures.end(); ++a)
 	a != Architectures.end(); ++a)
    {
    {
       if (NewProvides(Ver, Package, *a, Version) == false)
       if (NewProvides(Ver, Package, *a, Version) == false)
 	 return false;
 	 return false;
    }
    }
-
    return true;
    return true;
 }
 }
 									/*}}}*/
 									/*}}}*/

+ 1 - 0
apt-pkg/deb/deblistparser.h

@@ -40,6 +40,7 @@ class debListParser : public pkgCacheGenerator::ListParser
    bool ParseDepends(pkgCache::VerIterator &Ver,const char *Tag,
    bool ParseDepends(pkgCache::VerIterator &Ver,const char *Tag,
 		     unsigned int Type);
 		     unsigned int Type);
    bool ParseProvides(pkgCache::VerIterator &Ver);
    bool ParseProvides(pkgCache::VerIterator &Ver);
+   bool NewProvidesAllArch(pkgCache::VerIterator &Ver, string const &Package, string const &Version);
    static bool GrabWord(string Word,WordList *List,unsigned char &Out);
    static bool GrabWord(string Word,WordList *List,unsigned char &Out);
    
    
    public:
    public:

+ 5 - 5
apt-pkg/pkgcache.cc

@@ -317,6 +317,11 @@ pkgCache::PkgIterator pkgCache::GrpIterator::FindPkg(string Arch) const {
 	if (unlikely(IsGood() == false || S->FirstPackage == 0))
 	if (unlikely(IsGood() == false || S->FirstPackage == 0))
 		return PkgIterator(*Owner, 0);
 		return PkgIterator(*Owner, 0);
 
 
+	/* If we accept any package we simply return the "first"
+	   package in this group (the last one added). */
+	if (Arch == "any")
+		return PkgIterator(*Owner, Owner->PkgP + S->FirstPackage);
+
 	static string const myArch = _config->Find("APT::Architecture");
 	static string const myArch = _config->Find("APT::Architecture");
 	/* Most of the time the package for our native architecture is
 	/* Most of the time the package for our native architecture is
 	   the one we add at first to the cache, but this would be the
 	   the one we add at first to the cache, but this would be the
@@ -328,11 +333,6 @@ pkgCache::PkgIterator pkgCache::GrpIterator::FindPkg(string Arch) const {
 			return PkgIterator(*Owner, Pkg);
 			return PkgIterator(*Owner, Pkg);
 	}
 	}
 
 
-	/* If we accept any package we simply return the "first"
-	   package in this group (the last one added). */
-	if (Arch == "any")
-		return PkgIterator(*Owner, Owner->PkgP + S->FirstPackage);
-
 	/* Iterate over the list to find the matching arch
 	/* Iterate over the list to find the matching arch
 	   unfortunately this list includes "package noise"
 	   unfortunately this list includes "package noise"
 	   (= different packages with same calculated hash),
 	   (= different packages with same calculated hash),

+ 3 - 1
debian/changelog

@@ -27,8 +27,10 @@ apt (0.8.13.1) UNRELEASED; urgency=low
       if non is specified with APT::Architectures (Closes: #612958)
       if non is specified with APT::Architectures (Closes: #612958)
   * cmdline/apt-get.cc:
   * cmdline/apt-get.cc:
     - do not show simulation notice for non-root commands (Closes: #619072)
     - do not show simulation notice for non-root commands (Closes: #619072)
+  * apt-pkg/deb/deblistparser.cc:
+    - create foo:any provides for all architectures for an allowed package
 
 
- -- David Kalnischkies <kalnischkies@gmail.com>  Sat, 26 Mar 2011 12:53:00 +0100
+ -- David Kalnischkies <kalnischkies@gmail.com>  Mon, 28 Mar 2011 12:28:21 +0200
 
 
 apt (0.8.13) unstable; urgency=low
 apt (0.8.13) unstable; urgency=low