images stored by nvr instead of id
This commit is contained in:
parent
0ca380a5b1
commit
77417436ac
3 changed files with 25 additions and 21 deletions
|
|
@ -1774,9 +1774,9 @@ class BuildApplianceTask(BuildImageTask):
|
|||
release = opts.get('release')
|
||||
if not release:
|
||||
release = self.getRelease(name, version)
|
||||
build_id = None
|
||||
bld_info = None
|
||||
if not opts.get('scratch'):
|
||||
build_id = self.initImageBuild(name, version, release,
|
||||
bld_info = self.initImageBuild(name, version, release,
|
||||
target_info, opts)
|
||||
create_task_id = self.session.host.subtask(method='createAppliance',
|
||||
arglist=[name, version, release, arch, target_info, build_tag,
|
||||
|
|
@ -1788,22 +1788,23 @@ class BuildApplianceTask(BuildImageTask):
|
|||
|
||||
# import the image (move it too)
|
||||
if not opts.get('scratch'):
|
||||
self.session.host.importImage(create_task_id, build_id, results)
|
||||
self.session.host.importImage(create_task_id, bld_info['id'],
|
||||
results)
|
||||
except (SystemExit,ServerExit,KeyboardInterrupt):
|
||||
#we do not trap these
|
||||
raise
|
||||
except:
|
||||
if not opts.get('scratch'):
|
||||
#scratch builds do not get imported
|
||||
if build_id:
|
||||
self.session.host.failBuild(self.id, build_id)
|
||||
if bld_info:
|
||||
self.session.host.failBuild(self.id, bld_info['id'])
|
||||
# reraise the exception
|
||||
raise
|
||||
|
||||
# tag it
|
||||
if not opts.get('scratch') and not opts.get('skip_tag'):
|
||||
tag_task_id = self.session.host.subtask(method='tagBuild',
|
||||
arglist=[target_info['dest_tag'], build_id, False, None, True],
|
||||
arglist=[target_info['dest_tag'], bld_info['id'], False, None, True],
|
||||
label='tag', parent=self.id, arch='noarch')
|
||||
self.wait(tag_task_id)
|
||||
|
||||
|
|
@ -1814,7 +1815,7 @@ class BuildApplianceTask(BuildImageTask):
|
|||
report = 'scratch'
|
||||
else:
|
||||
respath = os.path.join(koji.pathinfo.imageFinalPath(),
|
||||
koji.pathinfo.applianceRelPath(build_id))
|
||||
koji.pathinfo.applianceRelPath(bld_info))
|
||||
report = ''
|
||||
files = [os.path.join(respath, f) for f in results['files']]
|
||||
report += 'appliance build results:\n%s' % '\n'.join(files)
|
||||
|
|
@ -1841,9 +1842,9 @@ class BuildLiveCDTask(BuildImageTask):
|
|||
release = opts.get('release')
|
||||
if not release:
|
||||
release = self.getRelease(name, version)
|
||||
build_id = None
|
||||
bld_info = None
|
||||
if not opts.get('scratch'):
|
||||
build_id = self.initImageBuild(name, version, release,
|
||||
bld_info = self.initImageBuild(name, version, release,
|
||||
target_info, opts)
|
||||
create_task_id = self.session.host.subtask(method='createLiveCD',
|
||||
arglist=[name, version, release, arch, target_info, build_tag,
|
||||
|
|
@ -1855,22 +1856,23 @@ class BuildLiveCDTask(BuildImageTask):
|
|||
|
||||
# import it (and move)
|
||||
if not opts.get('scratch'):
|
||||
self.session.host.importImage(create_task_id, build_id, results)
|
||||
self.session.host.importImage(create_task_id, bld_info['id'],
|
||||
results)
|
||||
except (SystemExit,ServerExit,KeyboardInterrupt):
|
||||
#we do not trap these
|
||||
raise
|
||||
except:
|
||||
if not opts.get('scratch'):
|
||||
#scratch builds do not get imported
|
||||
if build_id:
|
||||
self.session.host.failBuild(self.id, build_id)
|
||||
if bld_info:
|
||||
self.session.host.failBuild(self.id, bld_info['id'])
|
||||
# reraise the exception
|
||||
raise
|
||||
|
||||
# tag it if necessary
|
||||
if not opts.get('scratch') and not opts.get('skip_tag'):
|
||||
tag_task_id = self.session.host.subtask(method='tagBuild',
|
||||
arglist=[target_info['dest_tag'], build_id, False, None, True],
|
||||
arglist=[target_info['dest_tag'], bld_info['id'], False, None, True],
|
||||
label='tag', parent=self.id, arch='noarch')
|
||||
self.wait(tag_task_id)
|
||||
|
||||
|
|
@ -1883,7 +1885,7 @@ class BuildLiveCDTask(BuildImageTask):
|
|||
else:
|
||||
return 'Created image: %s' % \
|
||||
os.path.join(koji.pathinfo.imageFinalPath(),
|
||||
koji.pathinfo.livecdRelPath(build_id),
|
||||
koji.pathinfo.livecdRelPath(bld_info),
|
||||
results['files'][0])
|
||||
|
||||
# A generic task for building cd or disk images. Other handlers should inherit
|
||||
|
|
|
|||
|
|
@ -4767,10 +4767,10 @@ def import_archive(filepath, buildinfo, type, typeInfo, buildroot_id=None):
|
|||
insert.execute()
|
||||
if archivetype['name'] == 'iso':
|
||||
imgdir = os.path.join(koji.pathinfo.imageFinalPath(),
|
||||
koji.pathinfo.livecdRelPath(archive_id))
|
||||
koji.pathinfo.livecdRelPath(buildinfo))
|
||||
else:
|
||||
imgdir = os.path.join(koji.pathinfo.imageFinalPath(),
|
||||
koji.pathinfo.applianceRelPath(archive_id))
|
||||
koji.pathinfo.applianceRelPath(buildinfo))
|
||||
_import_archive_file(filepath, imgdir)
|
||||
# import log files?
|
||||
else:
|
||||
|
|
@ -9744,7 +9744,7 @@ class HostExports(object):
|
|||
build_id = new_build(data)
|
||||
data['id'] = build_id
|
||||
new_image_build(data)
|
||||
return build_id
|
||||
return data
|
||||
|
||||
def initWinBuild(self, task_id, build_info, win_info):
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -1497,13 +1497,15 @@ class PathInfo(object):
|
|||
"""Return the relative path for the task work directory"""
|
||||
return "tasks/%s/%s" % (task_id % 10000, task_id)
|
||||
|
||||
def livecdRelPath(self, image_id):
|
||||
def livecdRelPath(self, build_info):
|
||||
"""Return the relative path for the livecd image directory"""
|
||||
return os.path.join('livecd', str(image_id % 10000), str(image_id))
|
||||
return os.path.join('livecd', build_info['name'], build_info['version'],
|
||||
build_info['release'])
|
||||
|
||||
def applianceRelPath(self, image_id):
|
||||
def applianceRelPath(self, build_info):
|
||||
"""Return the relative path for the appliance image directory"""
|
||||
return os.path.join('appliance', str(image_id % 10000), str(image_id))
|
||||
return os.path.join('appliance', build_info['name'],
|
||||
build_info['version'], build_info['release'])
|
||||
|
||||
def imageFinalPath(self):
|
||||
"""Return the absolute path to where completed images can be found"""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue