return mapping
+def remove_overlaps(orig_list):
+ """docstring for make_unique"""
+ result = []
+ [result.append(obj) for obj in orig_list if obj not in result]
+ # Delete duplicate items for the abs and prerelease
+ # Delete prerelease items. Choice the abs item.
+ prjs = {}
+ for obj in result:
+ if obj.get('OBS_project') not in prjs:
+ prjs[obj.get('OBS_project')] = [ prj for prj in result \
+ if prj.get('OBS_project') == obj.get('OBS_project') ]
+ for obj in prjs:
+ prerelease_index = abs_index = -1
+ i = 0
+ for prj in prjs[obj]:
+ if 'prerelease' == prj.get('OBS_staging_project'):
+ prerelease_index = i
+ if 'abs' == prj.get('OBS_staging_project'):
+ abs_index = i
+ i += 1
+ if prerelease_index != -1 and abs_index != -1:
+ prjs[obj].pop(prerelease_index)
+
+ result = []
+ [ result.append(prj) for obj in prjs for prj in prjs[obj] ]
+
+ return result
+
+def get_xml_file_list(path):
+ """ get list of xml files """
+ file_list = []
+ for root, dirs, files in os.walk(path):
+ for file in files:
+ if file.endswith('.xml'):
+ file_list.append(os.path.join(path, file))
+ return file_list
+
def git_obs_map(gerrit_prj, gerrit_branch=None, gitcache=None, \
gerrit_hostname=None, gerrit_username=None, gerrit_sshport=None):
"""
by parsing git-obs-mapping.xml.
"""
- def remove_overlaps(orig_list):
- """docstring for make_unique"""
- result = []
- [result.append(obj) for obj in orig_list if obj not in result]
- return result
-
- def get_xml_file_list(path):
- file_list = []
- for root, dirs, files in os.walk(path):
- for file in files:
- if file.endswith('.xml'):
- file_list.append(os.path.join(path, file))
- return file_list
-
if gitcache:
git_cache = gitcache
else:
by parsing git-obs-mapping.xml.
"""
- def remove_overlaps(orig_list):
- """docstring for make_unique"""
- result = []
- [result.append(obj) for obj in orig_list if obj not in result]
- return result
-
- def get_xml_file_list(path):
- file_list = []
- for root, dirs, files in os.walk(path):
- for file in files:
- if file.endswith('.xml'):
- file_list.append(os.path.join(path, file))
- return file_list
-
if gitcache:
git_cache = gitcache
else: