- move the multilib-stuff to where it belongs to
authorpmatilai <pmatilai>
Mon, 6 Feb 2006 17:21:43 +0000 (17:21 +0000)
committerpmatilai <pmatilai>
Mon, 6 Feb 2006 17:21:43 +0000 (17:21 +0000)
apt-pkg/rpm/rpmlistparser.cc
apt-pkg/rpm/rpmlistparser.h
apt-pkg/rpm/rpmpackagedata.cc
apt-pkg/rpm/rpmpackagedata.h
configure.in

index 95391ff..e56e92a 100644 (file)
@@ -58,26 +58,6 @@ rpmListParser::rpmListParser(RPMHandler *Handler)
       SeenPackages = NULL;
    }
    RpmData = RPMPackageData::Singleton();
-
-   // XXX ugh, move this stuff someplace else like rpmsystem
-   BaseArch = _config->Find("APT::Architecture");
-   MultilibArch = false;
-   for (int i=0; i < sizeof(MultilibArchs) / sizeof(string); i++) {
-      if (BaseArch == MultilibArchs[i]) {
-        MultilibArch = true;
-        break;
-      }
-   }
-   if (MultilibArch) {
-      CompatArch["x86_64"].push_back("i386");
-      CompatArch["x86_64"].push_back("i486");
-      CompatArch["x86_64"].push_back("i586");
-      CompatArch["x86_64"].push_back("i686");
-      CompatArch["x86_64"].push_back("athlon");
-      CompatArch["ia64"] = CompatArch["x86_64"];
-      CompatArch["ppc64"].push_back("ppc");
-      CompatArch["sparc64"].push_back("sparc");
-   }
 }
                                                                         /*}}}*/
 
@@ -142,7 +122,7 @@ string rpmListParser::Package()
    bool IsDup = false;
    string Name = str;
 
-   if (MultilibArch && IsCompatArch(Architecture()) == true) {
+   if (RpmData->IsMultilibSys() && RpmData->IsCompatArch(Architecture())) {
         Name += ".32bit";       
         CurrentName = Name;
    }
@@ -187,16 +167,6 @@ string rpmListParser::Package()
    return Name;
 }
 
-bool rpmListParser::IsCompatArch(string Architecture)
-{
-   bool compat = false;
-   for (vector<string>::iterator I = CompatArch[BaseArch].begin(); 
-        I != CompatArch[BaseArch].end(); I++) {
-      if (Architecture == *I)
-        return true;
-   }
-   return false;
-}
                                                                         /*}}}*/
 // ListParser::Arch - Return the architecture string                   /*{{{*/
 // ---------------------------------------------------------------------
index b7ad288..319dc53 100644 (file)
@@ -32,9 +32,6 @@ class rpmListParser : public pkgCacheGenerator::ListParser
    RPMPackageData *RpmData;
    Header header;
 
-   string BaseArch;
-   bool MultilibArch;
-
    string CurrentName;
    const pkgCache::VerIterator *VI;
    
@@ -46,8 +43,6 @@ class rpmListParser : public pkgCacheGenerator::ListParser
 #endif
    SeenPackagesType *SeenPackages;
 
-   hash_map<string, vector<string>, hash_string> CompatArch;
-   
    bool Duplicated;
    
    unsigned long UniqFindTagWrite(int Tag);
@@ -68,7 +63,6 @@ class rpmListParser : public pkgCacheGenerator::ListParser
    virtual string Package();
    virtual string Version();
    virtual string Architecture();
-   virtual bool IsCompatArch(string Architecture);
    virtual bool NewVersion(pkgCache::VerIterator Ver);
    virtual unsigned short VersionHash();
    virtual bool UsePackage(pkgCache::PkgIterator Pkg,
index 489bd96..0ce30fd 100644 (file)
@@ -20,6 +20,24 @@ RPMPackageData::RPMPackageData()
    , ArchScores(31), VerMap(517)
 #endif
 {
+   BaseArch = _config->Find("APT::Architecture");
+   if (BaseArch == "x86_64" || BaseArch == "ia64" ||
+       BaseArch == "ppc64" || BaseArch == "sparc64")
+      MultilibSys = true;
+   else
+      MultilibSys = false;
+
+   if (MultilibSys) {
+      CompatArch["x86_64"].push_back("i386");
+      CompatArch["x86_64"].push_back("i486");
+      CompatArch["x86_64"].push_back("i586");
+      CompatArch["x86_64"].push_back("i686");
+      CompatArch["x86_64"].push_back("athlon");
+      CompatArch["ia64"] = CompatArch["x86_64"];
+      CompatArch["ppc64"].push_back("ppc");
+      CompatArch["sparc64"].push_back("sparc");
+   }
+
    // Populate priorities
    string FileName = _config->FindFile("Dir::Etc::rpmpriorities");
    FileFd F(FileName, FileFd::ReadOnly);
@@ -276,6 +294,18 @@ int RPMPackageData::RpmArchScore(const char *Arch)
    return 0;
 }
 
+bool RPMPackageData::IsCompatArch(string Arch)
+{
+   bool compat = false;
+   for (vector<string>::iterator I = CompatArch[BaseArch].begin();
+        I != CompatArch[BaseArch].end(); I++) {
+      if (Arch == *I)
+         return true;
+   }
+   return false;
+}
+
+
 bool RPMPackageData::IsDupPackage(const string &Name)
 {
    if (DuplicatedPackages.find(Name) != DuplicatedPackages.end())
index 106ecf8..0977910 100644 (file)
@@ -27,6 +27,7 @@ class RPMPackageData
    hash_map<string,vector<string>*,hash_string> FakeProvides;
    hash_map<string,int,hash_string> IgnorePackages;
    hash_map<string,int,hash_string> DuplicatedPackages;
+   hash_map<string,vector<string>,hash_string> CompatArch;
    typedef map<string,pkgCache::VerIterator> VerMapValueType;
    typedef hash_map<unsigned long,VerMapValueType> VerMapType;
    typedef hash_map<const char*,int,
@@ -37,6 +38,7 @@ class RPMPackageData
    map<string,vector<string>*> FakeProvides;
    map<string,int> IgnorePackages;
    map<string,int> DuplicatedPackages;
+   map<string,vector<string> > CompatArch;
    typedef map<string,pkgCache::VerIterator> VerMapValueType;
    typedef map<unsigned long,VerMapValueType> VerMapType;
    typedef map<const char*,int,cstr_lt_pred> ArchScoresType;
@@ -64,6 +66,9 @@ class RPMPackageData
    ArchScoresType ArchScores;
    int RpmArchScore(const char *Arch);
 
+   string BaseArch;
+   bool MultilibSys;
+
    public:
 
    inline pkgCache::State::VerPriority VerPriority(const string &Package) 
@@ -107,6 +112,9 @@ class RPMPackageData
    }
    void InitMinArchScore();
 
+   bool IsCompatArch(string Arch);
+   bool IsMultilibSys() { return MultilibSys; };
+
    void SetDupPackage(const string &Name)
        {DuplicatedPackages[Name] = 1;};
    bool IsDupPackage(const string &Name);
index d6cd508..3ebd539 100644 (file)
@@ -1,7 +1,7 @@
 dnl Process this file with autoconf to produce a configure script.
 
 AC_PREREQ(2.54)
-AC_INIT([apt],[0.5.15cnc7])
+AC_INIT([apt],[0.5.15lorg1])
 dnl Check the archs, we want the target type.
 AC_CONFIG_AUX_DIR([buildlib])
 AC_CANONICAL_HOST