[TIC-CORE] Support analysis of unified repositories
[archive/20170607/tools/tic-core.git] / tic / parser / repo_parser.py
index 2487336..a7f0c5f 100644 (file)
 
 from lxml import etree
 from tic.utils.error import TICError
+from tic.utils.rpmmisc import archPolicies, default_arch
 import logging
 import re
 
+meta_prefix = 'building-blocks'
+meta_prefix_root = 'building-blocks-root-'
+meta_prefix_sub1 = 'building-blocks-sub1-'
+meta_pattern = re.compile(''.join(['^', meta_prefix, '-(?P<meta>root|sub1|sub2)-(?P<pkgname>.+)']), re.I)
+meta_sub1_pattern = re.compile("(?P<root>.+)-(?P<sub1>.+)")
+meta_sub2_pattern = re.compile("(?P<root>.+)-(?P<sub1>.+)-(?P<sub2>.+)")
+
 class RepodataParser(object):
     
-    def __init__(self, repodata_list):
+    def __init__(self, arch, repodata_list):
+        self.arch = arch
         self.repodata_list = repodata_list
         
-    def _xml_parse(self, pkg_group, root, tag_dic):
+    def _xml_parse(self, pkg_group, pkg_list, tag_dic):
         
         def _set_version(element, tag):
             if 'ver' in tag.attrib:
@@ -40,34 +49,26 @@ class RepodataParser(object):
                 element['epoch'] = tag.attrib['epoch']
             if 'flags' in tag.attrib:
                 element['flags'] = tag.attrib['flags']
-                
-        logger = logging.getLogger(__name__)
-        meta_prefix = 'building-block'
-        meta_prefix_root = 'building-block-root-'
-        meta_prefix_sub1 = 'building-block-sub1-'
-        meta_pattern = re.compile(''.join(['^', meta_prefix, '-(?P<meta>root|sub1|sub2)-(?P<pkgname>.+)']), re.I)
-        meta_sub1_pattern = re.compile("(?P<root>.+)-(?P<sub1>.+)")
-        meta_sub2_pattern = re.compile("(?P<root>.+)-(?P<sub1>.+)-(?P<sub2>.+)")
 
         pkg_dict = pkg_group.get('pkg_dict')
         provides_dict = pkg_group.get('provides')
         files_dict = pkg_group.get('files')
         meta_info = pkg_group.get('meta_info')
-        
         pkg_id = len(pkg_dict)
         
-        for pkg in root.findall(tag_dic['package']):
+        for pkg in pkg_list:
             pkg_name = pkg.findtext(tag_dic['name'])
             
             # check whether a package is duplicated. 
             if pkg_name in pkg_dict:
-                #TODO: Apply to policy of duplication
-                logger.warning('package(%s) is duplicated. exclude this package', pkg_name)
+                # TODO: Apply to policy of duplication
+                logger.warning('package(%s) is duplicated. exclude this package', pkg_name)
                 continue
-                
+            
             pkg_info = {}
             pkg_info['id'] = pkg_id
             pkg_info['name'] = pkg_name
+            pkg_info['arch'] = pkg.findtext(tag_dic['arch'])
             pkg_info['selfChecked'] = False # for web-ui tree
             
             # Parsing meta-pkg using meta naming rule
@@ -89,8 +90,7 @@ class RepodataParser(object):
                                               ''.join([meta_prefix_sub1, sub2_match.group('root'),'-', sub2_match.group('sub1')])])
                     pkg_info['meta'] = 'sub2'
             
-            pkg_info['arch'] = pkg.findtext(tag_dic['arch'])
-            #pkg_info['version'] = pkg.find(tag_dic['version']).attrib['ver']
+            
             ver_tag = pkg.find(tag_dic['version'])
             pkg_info['version'] = {'epoch':ver_tag.attrib['epoch'],
                                    'ver':ver_tag.attrib['ver'],
@@ -213,6 +213,20 @@ class RepodataParser(object):
         tags['recommends'] = '{%s}recommends' % root.nsmap['rpm']
         tags['file'] = '{%s}file' % root.nsmap[None]
         return tags
+    
+    def _filtering_data_based_arch(self, xml_list, tag_dic):
+        ret_list = []
+        for xml_root in xml_list:
+            pkg_data = {}
+            for pkg_elm in xml_root.findall(tag_dic['package']):
+                pkg_arch = pkg_elm.findtext(tag_dic['arch'])
+                if pkg_arch not in archPolicies[self.arch] and pkg_arch not in default_arch:
+                    continue;
+                if not pkg_data.get(pkg_arch):
+                    pkg_data[pkg_arch] = []
+                pkg_data[pkg_arch].append(pkg_elm)
+            ret_list.append(pkg_data)
+        return ret_list
 
     def parse(self):
         if not self.repodata_list:
@@ -228,22 +242,30 @@ class RepodataParser(object):
         
         tag_dic = self._get_tagname(xml_list[0])
         
-        #TODO: temporary code (should be deleted)
-        #meta_string='<?xml version="1.0" encoding="UTF-8"?><metadata xmlns="http://linux.duke.edu/metadata/common" xmlns:rpm="http://linux.duke.edu/metadata/rpm" packages="1467"><package type="rpm"><name>building-block-root-metapkg</name><arch>aarch64</arch><version epoch="0" ver="2.0.4" rel="4.2" vcs="platform/upstream/SDL#5f9405ba696ad79a0e05150430fe69e874f8280d" /><checksum type="sha256" pkgid="YES">6f74666eb89e1addc4ce75e25f3e639bbfdd8798fc848a6b7027501070567dcf</checksum><summary>Simple DirectMedia Layer</summary><description>This is the Simple DirectMedia Layer, a generic API that provides low level access to audio, keyboard, mouse, and display framebuffer across multiple platforms.</description><packager /><url>http://www.libsdl.org/</url><time file="1476718677" build="1476718668" /><size package="264245" installed="956696" archive="957124" /><location href="aarch64/SDL2-2.0.4-4.2.aarch64.rpm" /><format><rpm:license>Zlib and SGI-B-2.0</rpm:license><rpm:vendor>tizen</rpm:vendor><rpm:group>System Environment/Libraries</rpm:group><rpm:buildhost>w36</rpm:buildhost><rpm:sourcerpm>SDL2-2.0.4-4.2.src.rpm</rpm:sourcerpm><rpm:header-range start="280" end="5958" /><rpm:requires><rpm:entry name="building-block-sub1-metapkg-extsub1" /><rpm:entry name="building-block-sub1-metapkg-extsub2" /></rpm:requires></format></package><package type="rpm"><name>building-block-sub1-metapkg-extsub1</name><arch>aarch64</arch><version epoch="0" ver="2.0.4" rel="4.2" vcs="platform/upstream/SDL#5f9405ba696ad79a0e05150430fe69e874f8280d" /><checksum type="sha256" pkgid="YES">6f74666eb89e1addc4ce75e25f3e639bbfdd8798fc848a6b7027501070567dcf</checksum><summary>sub1-extension</summary><description>This is the Simple DirectMedia Layer, a generic API that provides low level access to audio, keyboard, mouse, and display framebuffer across multiple platforms.</description><packager /><url>http://www.libsdl.org/</url><time file="1476718677" build="1476718668" /><size package="264245" installed="956696" archive="957124" /><location href="aarch64/SDL2-2.0.4-4.2.aarch64.rpm" /><format><rpm:license>Zlib and SGI-B-2.0</rpm:license><rpm:vendor>tizen</rpm:vendor><rpm:group>System Environment/Libraries</rpm:group><rpm:buildhost>w36</rpm:buildhost><rpm:sourcerpm>SDL2-2.0.4-4.2.src.rpm</rpm:sourcerpm><rpm:header-range start="280" end="5958" /><rpm:requires><rpm:entry name="building-block-sub2-metapkg-extsub1-exts1sub1" /></rpm:requires></format></package><package type="rpm"><name>building-block-sub2-metapkg-extsub1-exts1sub1</name><arch>aarch64</arch><version epoch="0" ver="2.0.4" rel="4.2" vcs="platform/upstream/SDL#5f9405ba696ad79a0e05150430fe69e874f8280d" /><checksum type="sha256" pkgid="YES">6f74666eb89e1addc4ce75e25f3e639bbfdd8798fc848a6b7027501070567dcf</checksum><summary>sub2-extension</summary><description>This is the Simple DirectMedia Layer, a generic API that provides low level access to audio, keyboard, mouse, and display framebuffer across multiple platforms.</description><packager /><url>http://www.libsdl.org/</url><time file="1476718677" build="1476718668" /><size package="264245" installed="956696" archive="957124" /><location href="aarch64/SDL2-2.0.4-4.2.aarch64.rpm" /><format><rpm:license>Zlib and SGI-B-2.0</rpm:license><rpm:vendor>tizen</rpm:vendor><rpm:group>System Environment/Libraries</rpm:group><rpm:buildhost>w36</rpm:buildhost><rpm:sourcerpm>SDL2-2.0.4-4.2.src.rpm</rpm:sourcerpm><rpm:header-range start="280" end="5958" /></format></package><package type="rpm"><name>building-block-sub2-metapkg-extsub1-exts1sub2</name><arch>aarch64</arch><version epoch="0" ver="2.0.4" rel="4.2" vcs="platform/upstream/SDL#5f9405ba696ad79a0e05150430fe69e874f8280d" /><checksum type="sha256" pkgid="YES">6f74666eb89e1addc4ce75e25f3e639bbfdd8798fc848a6b7027501070567dcf</checksum><summary>sub2-extension</summary><description>This is the Simple DirectMedia Layer, a generic API that provides low level access to audio, keyboard, mouse, and display framebuffer across multiple platforms.</description><packager /><url>http://www.libsdl.org/</url><time file="1476718677" build="1476718668" /><size package="264245" installed="956696" archive="957124" /><location href="aarch64/SDL2-2.0.4-4.2.aarch64.rpm" /><format><rpm:license>Zlib and SGI-B-2.0</rpm:license><rpm:vendor>tizen</rpm:vendor><rpm:group>System Environment/Libraries</rpm:group><rpm:buildhost>w36</rpm:buildhost><rpm:sourcerpm>SDL2-2.0.4-4.2.src.rpm</rpm:sourcerpm><rpm:header-range start="280" end="5958" /></format></package><package type="rpm"><name>building-block-sub1-metapkg-extsub2</name><arch>aarch64</arch><version epoch="0" ver="2.0.4" rel="4.2" vcs="platform/upstream/SDL#5f9405ba696ad79a0e05150430fe69e874f8280d" /><checksum type="sha256" pkgid="YES">6f74666eb89e1addc4ce75e25f3e639bbfdd8798fc848a6b7027501070567dcf</checksum><summary>sub1-extension</summary><description>This is the Simple DirectMedia Layer, a generic API that provides low level access to audio, keyboard, mouse, and display framebuffer across multiple platforms.</description><packager /><url>http://www.libsdl.org/</url><time file="1476718677" build="1476718668" /><size package="264245" installed="956696" archive="957124" /><location href="aarch64/SDL2-2.0.4-4.2.aarch64.rpm" /><format><rpm:license>Zlib and SGI-B-2.0</rpm:license><rpm:vendor>tizen</rpm:vendor><rpm:group>System Environment/Libraries</rpm:group><rpm:buildhost>w36</rpm:buildhost><rpm:sourcerpm>SDL2-2.0.4-4.2.src.rpm</rpm:sourcerpm><rpm:header-range start="280" end="5958" /><rpm:requires><rpm:entry name="building-block-sub2-metapkg-extsub2-exts2sub1" /><rpm:entry name="SDL2" /></rpm:requires></format></package><package type="rpm"><name>building-block-sub2-metapkg-extsub2-exts2sub1</name><arch>aarch64</arch><version epoch="0" ver="2.0.4" rel="4.2" vcs="platform/upstream/SDL#5f9405ba696ad79a0e05150430fe69e874f8280d" /><checksum type="sha256" pkgid="YES">6f74666eb89e1addc4ce75e25f3e639bbfdd8798fc848a6b7027501070567dcf</checksum><summary>sub2-extension</summary><description>This is the Simple DirectMedia Layer, a generic API that provides low level access to audio, keyboard, mouse, and display framebuffer across multiple platforms.</description><packager /><url>http://www.libsdl.org/</url><time file="1476718677" build="1476718668" /><size package="264245" installed="956696" archive="957124" /><location href="aarch64/SDL2-2.0.4-4.2.aarch64.rpm" /><format><rpm:license>Zlib and SGI-B-2.0</rpm:license><rpm:vendor>tizen</rpm:vendor><rpm:group>System Environment/Libraries</rpm:group><rpm:buildhost>w36</rpm:buildhost><rpm:sourcerpm>SDL2-2.0.4-4.2.src.rpm</rpm:sourcerpm><rpm:header-range start="280" end="5958" /></format></package><package type="rpm"><name>building-block-sub2-metapkg-extsub2-exts2sub2</name><arch>aarch64</arch><version epoch="0" ver="2.0.4" rel="4.2" vcs="platform/upstream/SDL#5f9405ba696ad79a0e05150430fe69e874f8280d" /><checksum type="sha256" pkgid="YES">6f74666eb89e1addc4ce75e25f3e639bbfdd8798fc848a6b7027501070567dcf</checksum><summary>sub2-extension</summary><description>This is the Simple DirectMedia Layer, a generic API that provides low level access to audio, keyboard, mouse, and display framebuffer across multiple platforms.</description><packager /><url>http://www.libsdl.org/</url><time file="1476718677" build="1476718668" /><size package="264245" installed="956696" archive="957124" /><location href="aarch64/SDL2-2.0.4-4.2.aarch64.rpm" /><format><rpm:license>Zlib and SGI-B-2.0</rpm:license><rpm:vendor>tizen</rpm:vendor><rpm:group>System Environment/Libraries</rpm:group><rpm:buildhost>w36</rpm:buildhost><rpm:sourcerpm>SDL2-2.0.4-4.2.src.rpm</rpm:sourcerpm><rpm:header-range start="280" end="5958" /><rpm:requires><rpm:entry name="SDL2" /></rpm:requires></format></package></metadata>'
-        meta_string='<?xml version="1.0" encoding="UTF-8"?><metadata xmlns="http://linux.duke.edu/metadata/common" xmlns:rpm="http://linux.duke.edu/metadata/rpm" packages="1467"><package type="rpm"><name>building-block-root-metapkg</name><arch>aarch64</arch><version epoch="0" ver="2.0.4" rel="4.2" vcs="platform/upstream/SDL#5f9405ba696ad79a0e05150430fe69e874f8280d" /><checksum type="sha256" pkgid="YES">6f74666eb89e1addc4ce75e25f3e639bbfdd8798fc848a6b7027501070567dcf</checksum><summary>Simple DirectMedia Layer</summary><description>This is the Simple DirectMedia Layer, a generic API that provides low level access to audio, keyboard, mouse, and display framebuffer across multiple platforms.</description><packager /><url>http://www.libsdl.org/</url><time file="1476718677" build="1476718668" /><size package="264245" installed="956696" archive="957124" /><location href="aarch64/SDL2-2.0.4-4.2.aarch64.rpm" /><format><rpm:license>Zlib and SGI-B-2.0</rpm:license><rpm:vendor>tizen</rpm:vendor><rpm:group>System Environment/Libraries</rpm:group><rpm:buildhost>w36</rpm:buildhost><rpm:sourcerpm>SDL2-2.0.4-4.2.src.rpm</rpm:sourcerpm><rpm:header-range start="280" end="5958" /><rpm:requires><rpm:entry name="building-block-sub1-metapkg-extsub1" /><rpm:entry name="building-block-sub1-metapkg-extsub2" /></rpm:requires></format></package><package type="rpm"><name>building-block-sub1-metapkg-extsub1</name><arch>aarch64</arch><version epoch="0" ver="2.0.4" rel="4.2" vcs="platform/upstream/SDL#5f9405ba696ad79a0e05150430fe69e874f8280d" /><checksum type="sha256" pkgid="YES">6f74666eb89e1addc4ce75e25f3e639bbfdd8798fc848a6b7027501070567dcf</checksum><summary>sub1-extension</summary><description>This is the Simple DirectMedia Layer, a generic API that provides low level access to audio, keyboard, mouse, and display framebuffer across multiple platforms.</description><packager /><url>http://www.libsdl.org/</url><time file="1476718677" build="1476718668" /><size package="264245" installed="956696" archive="957124" /><location href="aarch64/SDL2-2.0.4-4.2.aarch64.rpm" /><format><rpm:license>Zlib and SGI-B-2.0</rpm:license><rpm:vendor>tizen</rpm:vendor><rpm:group>System Environment/Libraries</rpm:group><rpm:buildhost>w36</rpm:buildhost><rpm:sourcerpm>SDL2-2.0.4-4.2.src.rpm</rpm:sourcerpm><rpm:header-range start="280" end="5958" /><rpm:requires><rpm:entry name="building-block-sub2-metapkg-extsub1-exts1sub1" /></rpm:requires></format></package><package type="rpm"><name>building-block-sub2-metapkg-extsub1-exts1sub1</name><arch>aarch64</arch><version epoch="0" ver="2.0.4" rel="4.2" vcs="platform/upstream/SDL#5f9405ba696ad79a0e05150430fe69e874f8280d" /><checksum type="sha256" pkgid="YES">6f74666eb89e1addc4ce75e25f3e639bbfdd8798fc848a6b7027501070567dcf</checksum><summary>sub2-extension</summary><description>This is the Simple DirectMedia Layer, a generic API that provides low level access to audio, keyboard, mouse, and display framebuffer across multiple platforms.</description><packager /><url>http://www.libsdl.org/</url><time file="1476718677" build="1476718668" /><size package="264245" installed="956696" archive="957124" /><location href="aarch64/SDL2-2.0.4-4.2.aarch64.rpm" /><format><rpm:license>Zlib and SGI-B-2.0</rpm:license><rpm:vendor>tizen</rpm:vendor><rpm:group>System Environment/Libraries</rpm:group><rpm:buildhost>w36</rpm:buildhost><rpm:sourcerpm>SDL2-2.0.4-4.2.src.rpm</rpm:sourcerpm><rpm:header-range start="280" end="5958" /><rpm:conflicts><rpm:entry name="building-block-sub2-metapkg-extsub1-exts1sub2" /></rpm:conflicts></format></package><package type="rpm"><name>building-block-sub2-metapkg-extsub1-exts1sub2</name><arch>aarch64</arch><version epoch="0" ver="2.0.4" rel="4.2" vcs="platform/upstream/SDL#5f9405ba696ad79a0e05150430fe69e874f8280d" /><checksum type="sha256" pkgid="YES">6f74666eb89e1addc4ce75e25f3e639bbfdd8798fc848a6b7027501070567dcf</checksum><summary>sub2-extension</summary><description>This is the Simple DirectMedia Layer, a generic API that provides low level access to audio, keyboard, mouse, and display framebuffer across multiple platforms.</description><packager /><url>http://www.libsdl.org/</url><time file="1476718677" build="1476718668" /><size package="264245" installed="956696" archive="957124" /><location href="aarch64/SDL2-2.0.4-4.2.aarch64.rpm" /><format><rpm:license>Zlib and SGI-B-2.0</rpm:license><rpm:vendor>tizen</rpm:vendor><rpm:group>System Environment/Libraries</rpm:group><rpm:buildhost>w36</rpm:buildhost><rpm:sourcerpm>SDL2-2.0.4-4.2.src.rpm</rpm:sourcerpm><rpm:header-range start="280" end="5958" /><rpm:conflicts><rpm:entry name="building-block-sub2-metapkg-extsub1-exts1sub1" /></rpm:conflicts></format></package><package type="rpm"><name>building-block-sub1-metapkg-extsub2</name><arch>aarch64</arch><version epoch="0" ver="2.0.4" rel="4.2" vcs="platform/upstream/SDL#5f9405ba696ad79a0e05150430fe69e874f8280d" /><checksum type="sha256" pkgid="YES">6f74666eb89e1addc4ce75e25f3e639bbfdd8798fc848a6b7027501070567dcf</checksum><summary>sub1-extension</summary><description>This is the Simple DirectMedia Layer, a generic API that provides low level access to audio, keyboard, mouse, and display framebuffer across multiple platforms.</description><packager /><url>http://www.libsdl.org/</url><time file="1476718677" build="1476718668" /><size package="264245" installed="956696" archive="957124" /><location href="aarch64/SDL2-2.0.4-4.2.aarch64.rpm" /><format><rpm:license>Zlib and SGI-B-2.0</rpm:license><rpm:vendor>tizen</rpm:vendor><rpm:group>System Environment/Libraries</rpm:group><rpm:buildhost>w36</rpm:buildhost><rpm:sourcerpm>SDL2-2.0.4-4.2.src.rpm</rpm:sourcerpm><rpm:header-range start="280" end="5958" /><rpm:requires><rpm:entry name="building-block-sub2-metapkg-extsub2-exts2sub1" /><rpm:entry name="SDL2" /></rpm:requires></format></package><package type="rpm"><name>building-block-sub2-metapkg-extsub2-exts2sub1</name><arch>aarch64</arch><version epoch="0" ver="2.0.4" rel="4.2" vcs="platform/upstream/SDL#5f9405ba696ad79a0e05150430fe69e874f8280d" /><checksum type="sha256" pkgid="YES">6f74666eb89e1addc4ce75e25f3e639bbfdd8798fc848a6b7027501070567dcf</checksum><summary>sub2-extension</summary><description>This is the Simple DirectMedia Layer, a generic API that provides low level access to audio, keyboard, mouse, and display framebuffer across multiple platforms.</description><packager /><url>http://www.libsdl.org/</url><time file="1476718677" build="1476718668" /><size package="264245" installed="956696" archive="957124" /><location href="aarch64/SDL2-2.0.4-4.2.aarch64.rpm" /><format><rpm:license>Zlib and SGI-B-2.0</rpm:license><rpm:vendor>tizen</rpm:vendor><rpm:group>System Environment/Libraries</rpm:group><rpm:buildhost>w36</rpm:buildhost><rpm:sourcerpm>SDL2-2.0.4-4.2.src.rpm</rpm:sourcerpm><rpm:header-range start="280" end="5958" /></format></package><package type="rpm"><name>building-block-sub2-metapkg-extsub2-exts2sub2</name><arch>aarch64</arch><version epoch="0" ver="2.0.4" rel="4.2" vcs="platform/upstream/SDL#5f9405ba696ad79a0e05150430fe69e874f8280d" /><checksum type="sha256" pkgid="YES">6f74666eb89e1addc4ce75e25f3e639bbfdd8798fc848a6b7027501070567dcf</checksum><summary>sub2-extension</summary><description>This is the Simple DirectMedia Layer, a generic API that provides low level access to audio, keyboard, mouse, and display framebuffer across multiple platforms.</description><packager /><url>http://www.libsdl.org/</url><time file="1476718677" build="1476718668" /><size package="264245" installed="956696" archive="957124" /><location href="aarch64/SDL2-2.0.4-4.2.aarch64.rpm" /><format><rpm:license>Zlib and SGI-B-2.0</rpm:license><rpm:vendor>tizen</rpm:vendor><rpm:group>System Environment/Libraries</rpm:group><rpm:buildhost>w36</rpm:buildhost><rpm:sourcerpm>SDL2-2.0.4-4.2.src.rpm</rpm:sourcerpm><rpm:header-range start="280" end="5958" /><rpm:requires><rpm:entry name="SDL2" /></rpm:requires></format></package></metadata>'
-        xml_list.append(etree.fromstring(meta_string))
+        # TODO: temporary code (should be deleted)
+        # meta_string='<?xml version="1.0" encoding="UTF-8"?><metadata xmlns="http://linux.duke.edu/metadata/common" xmlns:rpm="http://linux.duke.edu/metadata/rpm" packages="1467"><package type="rpm"><name>building-blocks-root-chooseonlyone_Kernel</name><arch>armv7l</arch><version epoch="0" ver="2.0.4" rel="4.2" vcs="platform/upstream/SDL#5f9405ba696ad79a0e05150430fe69e874f8280d" /><checksum type="sha256" pkgid="YES">6f74666eb89e1addc4ce75e25f3e639bbfdd8798fc848a6b7027501070567dcf</checksum><summary>Linux Kernel</summary><description>Include Linux Kernel in the Platform Image</description><packager /><url>http://tizen.org</url><time file="1487645040" build="1487645034" /><size package="2088" installed="0" archive="124" /><location href="armv7l/building-blocks-root-Kernel-0.0.1-1.1.armv7l.rpm" /><format><rpm:license>Apache-2</rpm:license><rpm:vendor>tizen</rpm:vendor><rpm:group>Meta</rpm:group><rpm:buildhost>w08</rpm:buildhost><rpm:sourcerpm>building-blocks-0.0.1-1.1.src.rpm</rpm:sourcerpm><rpm:header-range start="280" end="1964" /><rpm:requires><rpm:entry name="linux-kernel" flags="GE" epoch="0" ver="3.10" /></rpm:requires></format></package></metadata>'
+        # xml_list.append(etree.fromstring(meta_string))
         
-        #pkg_group = dict(pkg_list=[], pkg2id={}, provides2id={}, file2id={}, meta_info=dict(root=[], sub1=[], sub2=[]))
-        pkg_group = dict(pkg_dict={}, 
-                         provides={}, 
-                         files={}, 
+        filter_data = self._filtering_data_based_arch(xml_list, tag_dic)
+        
+        pkg_group = dict(pkg_dict={},
+                         provides={},
+                         files={},
                          groups={},
                          conflicts={},
                          meta_info=dict(root=[], sub1=[], sub2=[]))
         
         # parses the repodata (primary.xml)
-        for xml_root in xml_list:
-            self._xml_parse(pkg_group, xml_root, tag_dic)
+        # for xml_root in xml_list:
+        #    self._xml_parse(pkg_group, xml_root, tag_dic)
+        for xml_data in filter_data:
+            for arch in archPolicies[self.arch]:
+                if arch in xml_data:
+                    self._xml_parse(pkg_group, xml_data[arch], tag_dic)
+            # noarch, src
+            for arch in default_arch:
+                if arch in xml_data:
+                    self._xml_parse(pkg_group, xml_data[arch], tag_dic)
             
         # set the requires id
         #self._prepare_requires_id(pkg_group)