From 3367addcc046f3ceb755c4e33ae3bf7ae04cd3b6 Mon Sep 17 00:00:00 2001 From: ZhuoX Li Date: Tue, 9 Dec 2014 16:28:17 +0800 Subject: [PATCH] Fix the bug about checking submit tag name. If tag is 'submit/tizen/mobile/20141119.110835', we get the 'tizen' branch by parsing the tag name. In fact, we should get 'tizen/mobile' branch. Fixes: #2245 Change-Id: I89ba0ccef0ff823234c1604df7a828ac355453e9 --- job_submit.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/job_submit.py b/job_submit.py index f9a413a..c937e36 100755 --- a/job_submit.py +++ b/job_submit.py @@ -156,6 +156,19 @@ def create_project(git_url, git_project, git_tag, git_revision, build, #change the aggregate package metadata of obs_project set_aggregate_package_meta(build, obs_project, obs_target_prj) +def get_branch_name(tag): + """Get branch name by parsing info + from submit tag name. + """ + branch = None + if tag.startswith('submit/'): + pos = tag.rfind('/', len('submit/')) + if pos != -1: + branch = tag[len('submit/'):pos] + if branch == 'trunk': + branch = 'master' + return branch + def main(build_type): """ Script entry point. @@ -183,9 +196,7 @@ def main(build_type): # Triggered by Gerrit - use GERRIT_REFNAME to get tag git_tag = gerrit_refname.split("refs/tags/")[1] - git_branch = git_tag.split('/')[1] - if git_branch == 'trunk': - git_branch = 'master' + git_branch = get_branch_name(git_tag) # add submitted log for iris pub_enabled = os.getenv("IRIS_PUB_ENABLED", "0") != "0" -- 2.7.4