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

populate the Architecture field for PackageFiles

This is mainly visible in the policy, so that you can now pin by b= and
let it only effect Packages files of this architecture and hence the
packages coming from it (which do not need to be from this architecture,
but very likely are in a normal repository setup).

If you should pin by architecture in this way is a different question…

Closes: 687255
David Kalnischkies лет назад: 11
Родитель
Сommit
e185d8b3e3
4 измененных файлов с 16 добавлено и 6 удалено
  1. 4 4
      apt-pkg/deb/debindexfile.cc
  2. 1 1
      apt-pkg/edsp/edspindexfile.cc
  3. 10 0
      apt-pkg/pkgcachegen.cc
  4. 1 1
      apt-pkg/pkgcachegen.h

+ 4 - 4
apt-pkg/deb/debindexfile.cc

@@ -128,7 +128,7 @@ bool debPackagesIndex::Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const
    if (Dist.empty())
    if (Dist.empty())
       Dist = "/";
       Dist = "/";
    ::URI Tmp(URI);
    ::URI Tmp(URI);
-   if (Gen.SelectFile(PackageFile, *this, Target.Option(IndexTarget::COMPONENT)) == false)
+   if (Gen.SelectFile(PackageFile, *this, Target.Option(IndexTarget::ARCHITECTURE), Target.Option(IndexTarget::COMPONENT)) == false)
       return _error->Error("Problem with SelectFile %s",PackageFile.c_str());
       return _error->Error("Problem with SelectFile %s",PackageFile.c_str());
 
 
    // Store the IMS information
    // Store the IMS information
@@ -203,7 +203,7 @@ bool debTranslationsIndex::Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const
 
 
      if (Prog != NULL)
      if (Prog != NULL)
 	Prog->SubProgress(0, Target.Description);
 	Prog->SubProgress(0, Target.Description);
-     if (Gen.SelectFile(TranslationFile, *this, Target.Option(IndexTarget::COMPONENT), pkgCache::Flag::NotSource) == false)
+     if (Gen.SelectFile(TranslationFile, *this, "", Target.Option(IndexTarget::COMPONENT), pkgCache::Flag::NotSource) == false)
        return _error->Error("Problem with SelectFile %s",TranslationFile.c_str());
        return _error->Error("Problem with SelectFile %s",TranslationFile.c_str());
 
 
      // Store the IMS information
      // Store the IMS information
@@ -284,7 +284,7 @@ bool debStatusIndex::Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const
 
 
    if (Prog != NULL)
    if (Prog != NULL)
       Prog->SubProgress(0,File);
       Prog->SubProgress(0,File);
-   if (Gen.SelectFile(File, *this, "now", pkgCache::Flag::NotSource) == false)
+   if (Gen.SelectFile(File, *this, "", "now", pkgCache::Flag::NotSource) == false)
       return _error->Error("Problem with SelectFile %s",File.c_str());
       return _error->Error("Problem with SelectFile %s",File.c_str());
 
 
    // Store the IMS information
    // Store the IMS information
@@ -409,7 +409,7 @@ bool debDebPkgFileIndex::Merge(pkgCacheGenerator& Gen, OpProgress* Prog) const
 
 
    // and give it to the list parser
    // and give it to the list parser
    debDebFileParser Parser(DebControl, DebFile);
    debDebFileParser Parser(DebControl, DebFile);
-   if(Gen.SelectFile(DebFile, *this, "now", pkgCache::Flag::LocalSource) == false)
+   if(Gen.SelectFile(DebFile, *this, "", "now", pkgCache::Flag::LocalSource) == false)
       return _error->Error("Problem with SelectFile %s", DebFile.c_str());
       return _error->Error("Problem with SelectFile %s", DebFile.c_str());
 
 
    pkgCache::PkgFileIterator File = Gen.GetCurFile();
    pkgCache::PkgFileIterator File = Gen.GetCurFile();

+ 1 - 1
apt-pkg/edsp/edspindexfile.cc

@@ -49,7 +49,7 @@ bool edspIndex::Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const
 
 
    if (Prog != NULL)
    if (Prog != NULL)
       Prog->SubProgress(0,File);
       Prog->SubProgress(0,File);
-   if (Gen.SelectFile(File, *this, "edsp") == false)
+   if (Gen.SelectFile(File, *this, "", "edsp") == false)
       return _error->Error("Problem with SelectFile %s",File.c_str());
       return _error->Error("Problem with SelectFile %s",File.c_str());
 
 
    // Store the IMS information
    // Store the IMS information

+ 10 - 0
apt-pkg/pkgcachegen.cc

@@ -1113,6 +1113,7 @@ bool pkgCacheGenerator::SelectReleaseFile(const string &File,const string &Site,
    added versions. The caller is responsible for setting the IMS fields. */
    added versions. The caller is responsible for setting the IMS fields. */
 bool pkgCacheGenerator::SelectFile(std::string const &File,
 bool pkgCacheGenerator::SelectFile(std::string const &File,
 				   pkgIndexFile const &Index,
 				   pkgIndexFile const &Index,
+				   std::string const &Architecture,
 				   std::string const &Component,
 				   std::string const &Component,
 				   unsigned long const Flags)
 				   unsigned long const Flags)
 {
 {
@@ -1133,6 +1134,15 @@ bool pkgCacheGenerator::SelectFile(std::string const &File,
    if (unlikely(idxIndexType == 0))
    if (unlikely(idxIndexType == 0))
       return false;
       return false;
    CurrentFile->IndexType = idxIndexType;
    CurrentFile->IndexType = idxIndexType;
+   if (Architecture.empty())
+      CurrentFile->Architecture = 0;
+   else
+   {
+      map_stringitem_t const arch = StoreString(pkgCacheGenerator::MIXED, Architecture);
+      if (unlikely(arch == 0))
+	 return false;
+      CurrentFile->Architecture = arch;
+   }
    map_stringitem_t const component = StoreString(pkgCacheGenerator::MIXED, Component);
    map_stringitem_t const component = StoreString(pkgCacheGenerator::MIXED, Component);
    if (unlikely(component == 0))
    if (unlikely(component == 0))
       return false;
       return false;

+ 1 - 1
apt-pkg/pkgcachegen.h

@@ -102,7 +102,7 @@ class APT_HIDDEN pkgCacheGenerator					/*{{{*/
    inline map_stringitem_t StoreString(enum StringType const type, const std::string &S) {return StoreString(type, S.c_str(),S.length());};
    inline map_stringitem_t StoreString(enum StringType const type, const std::string &S) {return StoreString(type, S.c_str(),S.length());};
 
 
    void DropProgress() {Progress = 0;};
    void DropProgress() {Progress = 0;};
-   bool SelectFile(const std::string &File,pkgIndexFile const &Index, std::string const &Component, unsigned long Flags = 0);
+   bool SelectFile(const std::string &File,pkgIndexFile const &Index, std::string const &Architecture, std::string const &Component, unsigned long Flags = 0);
    bool SelectReleaseFile(const std::string &File, const std::string &Site, unsigned long Flags = 0);
    bool SelectReleaseFile(const std::string &File, const std::string &Site, unsigned long Flags = 0);
    bool MergeList(ListParser &List,pkgCache::VerIterator *Ver = 0);
    bool MergeList(ListParser &List,pkgCache::VerIterator *Ver = 0);
    inline pkgCache &GetCache() {return Cache;};
    inline pkgCache &GetCache() {return Cache;};