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
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
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:
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))
# 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
#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)
# 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):
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,