Reverted c619010d3b5efa9dc0ebec7839b73cbcd59edcb2
authorEd Bartosh <eduard.bartosh@intel.com>
Sun, 16 Jun 2013 13:39:40 +0000 (16:39 +0300)
committerEd Bartosh <eduard.bartosh@intel.com>
Sun, 16 Jun 2013 13:42:52 +0000 (16:42 +0300)
Reverted wrong implementation of getting default architecture. It was
caused inconsitent determination of arch. Different arch was determined
for different orders of repos in .ks file. As a result of wrong
determination of architecture there are image creation failures for the
configurations, where arch was determined incorrectly.

Signed-off-by: Ed Bartosh <eduard.bartosh@intel.com>
mic/utils/misc.py

index e7dbf2f..6302434 100644 (file)
@@ -713,35 +713,8 @@ def get_rpmver_in_repo(repometadata):
     return None
 
 def get_arch(repometadata):
-    def uniqarch(archlist=[]):
-        uniq_arch = []
-        for i in range(len(archlist)):
-            if archlist[i] not in rpmmisc.archPolicies.keys():
-                continue
-            need_append = True
-            j = 0
-            while j < len(uniq_arch):
-                if archlist[i] in rpmmisc.archPolicies[uniq_arch[j]].split(':'):
-                    need_append = False
-                    break
-                if uniq_arch[j] in rpmmisc.archPolicies[archlist[i]].split(':'):
-                    if need_append:
-                        uniq_arch[j] = archlist[i]
-                        need_append = False
-                    else:
-                        uniq_arch.remove(uniq_arch[j])
-                        continue
-                j += 1
-            if need_append:
-                uniq_arch.append(archlist[i])
-
-        return uniq_arch
-
-
-    ret_uniq_arch = []
-    ret_arch_list = []
+    archlist = []
     for repo in repometadata:
-        archlist = []
         if repo["primary"].endswith(".xml"):
             root = xmlparse(repo["primary"])
             ns = root.getroot().tag
@@ -759,13 +732,28 @@ def get_arch(repometadata):
 
             con.close()
 
-        uniq_arch = uniqarch(archlist)
-        if not ret_uniq_arch and len(uniq_arch) == 1:
-            ret_uniq_arch = uniq_arch
-        ret_arch_list += uniq_arch
-
-    ret_arch_list = uniqarch(ret_arch_list)
-    return ret_uniq_arch, ret_arch_list
+    uniq_arch = []
+    for i in range(len(archlist)):
+        if archlist[i] not in rpmmisc.archPolicies.keys():
+            continue
+        need_append = True
+        j = 0
+        while j < len(uniq_arch):
+            if archlist[i] in rpmmisc.archPolicies[uniq_arch[j]].split(':'):
+                need_append = False
+                break
+            if uniq_arch[j] in rpmmisc.archPolicies[archlist[i]].split(':'):
+                if need_append:
+                    uniq_arch[j] = archlist[i]
+                    need_append = False
+                else:
+                    uniq_arch.remove(uniq_arch[j])
+                    continue
+            j += 1
+        if need_append:
+             uniq_arch.append(archlist[i])
+
+    return uniq_arch, archlist
 
 def get_package(pkg, repometadata, arch = None):
     ver = ""