Add ref_obs_target_prj field instead of obs_target_prj 58/132758/1
authorhyokeun <hyokeun.jeon@samsung.com>
Wed, 7 Jun 2017 10:47:12 +0000 (19:47 +0900)
committerhyokeun <hyokeun.jeon@samsung.com>
Wed, 7 Jun 2017 10:47:17 +0000 (19:47 +0900)
REPA tool uses obs_target_prj field.
Do not modify this fields. Instead use ref_obs_target_prj.

Change-Id: I44f95374ed75605adcf96af00aa506379dd5939f

job_pre_release_obs.py
job_submit.py

index c9db9ee..7187bfe 100755 (executable)
@@ -158,9 +158,12 @@ def make_repo(project, repo, backenddb, base_url, base_path,
     basebuildid = None
     base_project = None
     if os.getenv("REF_CREATE_PRJ_OBS_ENABLE","0") == "1":
-        if ':ref:' in build_info.get('obs_target_prj'):
-            basebuildid = build_info.get('obs_target_prj').split(':ref:')[1]
-        base_project = build_info.get('base', 'latest')
+        if build_info.get('ref_obs_target_prj') and \
+            ':ref:' in build_info.get('ref_obs_target_prj'):
+            basebuildid = build_info.get('ref_obs_target_prj').split(':ref:')[1]
+        base_project = build_info.get('base', None)
+        if not base_project or ':ref:' not in base_project:
+            base_project = None
     print 'BASE PROJECT : %s' % (base_project)
     print 'basebuildid=%s' % basebuildid
 
index 0235589..6722d8f 100755 (executable)
@@ -390,7 +390,7 @@ def get_base_project(build, _project):
     return None
 
 def create_project(git_url, git_project, git_tag, git_revision, build,
-                   obs_target_prj, obs_project, submitter, package, build_flag=True):
+                   obs_target_prj, ref_obs_target_prj, obs_project, submitter, package, build_flag=True):
     """Create prerelease OBS project and upload sources for the build."""
 
     # Create review project if it doesn't exist
@@ -398,12 +398,13 @@ def create_project(git_url, git_project, git_tag, git_revision, build,
     info = {'projects': [git_project],
             'packages': [package],
             'obs_target_prj': obs_target_prj,
+            'ref_obs_target_prj': ref_obs_target_prj,
             'git_tag': git_tag,
             'git_commit': git_revision,
             'obs_url': os.path.join(os.getenv('OBS_URL_EXTERNAL'), \
                                     'project/show?project=%s' % obs_project),
             'images': [],
-            'base': get_base_project(build, obs_target_prj)}
+            'base': get_base_project(build, ref_obs_target_prj)}
 
     if build.exists(obs_project):
         if submitter:
@@ -421,10 +422,10 @@ def create_project(git_url, git_project, git_tag, git_revision, build,
         if submitter:
             info['submitter'] = escape(submitter)
 
-        if not build.exists(obs_target_prj):
-            raise LocalError("Target project %s doesn't exist" % obs_target_prj)
+        if not build.exists(ref_obs_target_prj):
+            raise LocalError("Target project %s doesn't exist" % ref_obs_target_prj)
         try:
-            build.create_project(obs_project, obs_target_prj,
+            build.create_project(obs_project, ref_obs_target_prj,
                                  description=json.dumps(info))
         except ObsError, error:
             LocalError("Unable to create project %s: %s" % (obs_project, error))
@@ -446,7 +447,7 @@ def create_project(git_url, git_project, git_tag, git_revision, build,
 
     # copy the maintainer list from obs_target_prj meta to corresponding
     # prerelease project
-    copy_person_project_meta(build, obs_target_prj, obs_project)
+    copy_person_project_meta(build, ref_obs_target_prj, obs_project)
 
     if build_flag != True:
         return
@@ -454,7 +455,7 @@ def create_project(git_url, git_project, git_tag, git_revision, build,
     #build.link_project(obs_project, src=obs_target_prj, linktype="localdep")
 
     #create the 'link' package that relate the original package
-    create_related_packages(build, obs_target_prj, obs_project, package)
+    create_related_packages(build, ref_obs_target_prj, obs_project, package)
 
     #Wait 10 seconds to upload the package to the OBS
     sleep(10)
@@ -466,7 +467,7 @@ def create_project(git_url, git_project, git_tag, git_revision, build,
 
     # Enabled link project
     sleep(1)
-    build.link_project(obs_project, src=obs_target_prj, linktype="localdep")
+    build.link_project(obs_project, src=ref_obs_target_prj, linktype="localdep")
 
 
 def get_branch_name(tag):
@@ -733,7 +734,7 @@ def main(build_type):
                 while retry_count > 0:
                     try:
                         create_project(url, gerrit_project, git_tag, gerrit_newrev,
-                                build, ref_obs_target_prj, project, submitter, package, build_flag=enable_build)
+                                build, obs_target_prj, ref_obs_target_prj, project, submitter, package, build_flag=enable_build)
                         if pub_enabled:
                             rest.publish_event("pre_created", {
                                 "project": project,