From: hyokeun Date: Mon, 4 Jul 2016 10:50:34 +0000 (+0900) Subject: Prerelease - Get obs project info instead of request every packages X-Git-Tag: submit/trunk/20190927.012743~576^2~12 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F54%2F78154%2F1;p=services%2Fjenkins-scripts.git Prerelease - Get obs project info instead of request every packages Change-Id: I8ee19c0860a0bf5654251f050df54da65b848965 --- diff --git a/common/buildservice.py b/common/buildservice.py index 20c3a14..0cf0cf9 100755 --- a/common/buildservice.py +++ b/common/buildservice.py @@ -888,3 +888,25 @@ class BuildService(OSC): path_args=path, data=ElementTree.tostring(root)) + def get_sourceinfo_list(self, prj): + """ + Get source info list of the project + { package1: [], + package2: ['Source Project'/'Source Package'], # if linked package + ...} + """ + query = {} + query['view'] = 'info' + query['parse'] = 0 + query['nofilename'] = 1 + + url = core.makeurl(self.apiurl, ['source', prj], query) + _file = core.http_GET(url) + root = ElementTree.parse(_file).getroot() + + s_dict = {} + for s in root.iter('sourceinfo'): + s_dict[s.get('package')] = \ + ''.join([node.get('project') + '/' + node.get('package') for node in s.findall('linked')]) + return s_dict + diff --git a/job_submit.py b/job_submit.py index 7c5d630..4912da7 100755 --- a/job_submit.py +++ b/job_submit.py @@ -107,11 +107,13 @@ def create_related_packages(build, obs_target_prj, obs_pre_prj, pre_package): obs_pre_prj is the prelease project pre_package is the original package """ - for package in build.get_package_list(obs_target_prj): - link_prj, link_pkg = build.get_package_linkinfo(obs_target_prj, package) - if link_prj == obs_target_prj and link_pkg == pre_package: - build.create_link_pac(obs_pre_prj, pre_package, \ - obs_pre_prj, package) + sourceinfo = build.get_sourceinfo_list(obs_target_prj) + for package in sourceinfo: + if sourceinfo[package]: + link_prj, link_pkg = sourceinfo[package].split('/') + if link_prj == obs_target_prj and link_pkg == pre_package: + build.create_link_pac(obs_pre_prj, pre_package, \ + obs_pre_prj, package) def create_project(git_url, git_project, git_tag, git_revision, build, obs_target_prj, obs_project, submitter, package):