support multiply version of rpm packages in manifest
authorLiu jue <juex.liu@intel.com>
Tue, 24 Jun 2014 12:05:44 +0000 (20:05 +0800)
committerLin Yang <lin.a.yang@intel.com>
Mon, 7 Jul 2014 09:03:55 +0000 (17:03 +0800)
If two versions of one package both exist on repo, jenkins will
use the latter one overwrite the previous on when generating
manifest. A more direct method is jenkins insert the info of all
packages in repo into manifest.

Change-Id: I242342ddcfca604d44227ffff7940b015f89f156
Fixes: #2002

common/manifest.py
common/repomaker.py

index 813bf4a..13b2bb9 100644 (file)
@@ -46,9 +46,10 @@ def gen_repo_manifest(data, fetch_url, review_url):
 
 def get_package_vcs_tag(primary_md):
     """ Get package vcs tag from repo primary md
+        ret_data = [(pkg_name, vcs_tag), (), ()...]
     """
 
-    ret_data = {}
+    ret_data = []
     xml_file = gzip.open(primary_md)
 
     primary = xml2obj(xml_file)
@@ -56,9 +57,9 @@ def get_package_vcs_tag(primary_md):
     for package in primary.package:
         vcs_tag = package.version.vcs
         if vcs_tag:
-            ret_data[package.name] = vcs_tag
+            ret_data.append((package.name, vcs_tag))
         else:
-            ret_data[package.name] = ""
+            ret_data.append((package.name, ""))
 
     return ret_data
 
index 241712a..8ee4cf6 100644 (file)
@@ -327,13 +327,13 @@ class RepoMaker(object):
         # tuple set in (gitprj, git_path, revision)
         data = set([])
 
-        for pkg in package_vcs_tag.keys():
+        for pkg in package_vcs_tag:
             try:
-                git_prj, commit_id = package_vcs_tag[pkg].split('#')
+                git_prj, commit_id = pkg[1].split('#')
                 data.add((git_prj, git_prj, commit_id))
             except ValueError:
                 # No vcs tag found
-                data.add((pkg, '', ''))
+                data.add((pkg[0], '', ''))
 
         manifest_string = manifest.gen_repo_manifest(sorted(data),
                                             gerrit_fetch_url,