- a bit more generic compatarch stuff for multilib
authorpmatilai <pmatilai>
Tue, 31 Jan 2006 20:05:14 +0000 (20:05 +0000)
committerpmatilai <pmatilai>
Tue, 31 Jan 2006 20:05:14 +0000 (20:05 +0000)
apt-pkg/rpm/rpmlistparser.cc
apt-pkg/rpm/rpmlistparser.h

index 381006b..bc55587 100644 (file)
@@ -35,6 +35,9 @@
 
 #define WITH_VERSION_CACHING 1
 
+string MultilibArchs[] = {"x86_64", "ia64"};
+string CompatArchs[] = {"i386", "i486", "i586", "i686", "athlon"};
+
 // ListParser::rpmListParser - Constructor                             /*{{{*/
 // ---------------------------------------------------------------------
 /* */
@@ -56,6 +59,15 @@ rpmListParser::rpmListParser(RPMHandler *Handler)
       SeenPackages = NULL;
    }
    RpmData = RPMPackageData::Singleton();
+
+   BaseArch = _config->Find("APT::Architecture");
+   MultilibArch = false;
+   for (int i=0; i < sizeof(MultilibArchs) / sizeof(string); i++) {
+      if (BaseArch == MultilibArchs[i]) {
+        MultilibArch = true;
+        break;
+      }
+   }
 }
                                                                         /*}}}*/
 
@@ -120,7 +132,7 @@ string rpmListParser::Package()
    bool IsDup = false;
    string Name = str;
 
-   if (IsCompatArch(Architecture()) == true) {
+   if (MultilibArch && IsCompatArch(Architecture()) == true) {
         Name += ".32bit";       
         CurrentName = Name;
    }
@@ -168,17 +180,11 @@ string rpmListParser::Package()
 bool rpmListParser::IsCompatArch(string Architecture)
 {
    bool compat = false;
-   string BaseArch = _config->Find("APT::Architecture");
-   // ugh, gpg-pubkey doesn't have arch set
-   if (Architecture == "") {
-      return false;
-   }
-   // TODO: arch vs basearch isn't enough, should handle eg x86_64 vs ia32e
-   // and other fun..
-   if (Architecture != BaseArch && Architecture != "noarch") {
-      compat = true;
+   for (int i=0; i < sizeof(CompatArchs) / sizeof(string); i++) {
+      if (Architecture == CompatArchs[i])
+        return true;
    }
-   return compat;
+   return false;
 }
                                                                         /*}}}*/
 // ListParser::Arch - Return the architecture string                   /*{{{*/
index 4aa6cd8..6cfccf8 100644 (file)
@@ -32,6 +32,9 @@ class rpmListParser : public pkgCacheGenerator::ListParser
    RPMPackageData *RpmData;
    Header header;
 
+   string BaseArch;
+   bool MultilibArch;
+
    string CurrentName;
    const pkgCache::VerIterator *VI;