put scratch builds in scratch directory
This commit is contained in:
parent
87d028101d
commit
b38862333c
2 changed files with 46 additions and 8 deletions
|
|
@ -1788,8 +1788,10 @@ class BuildApplianceTask(BuildImageTask):
|
|||
|
||||
# import the image (move it too)
|
||||
if not opts.get('scratch'):
|
||||
self.session.host.importImage(create_task_id, bld_info['id'],
|
||||
self.session.host.importImage(self.id, bld_info['id'],
|
||||
results)
|
||||
else:
|
||||
self.session.host.moveImageBuildToScratch(self.id, results)
|
||||
except (SystemExit,ServerExit,KeyboardInterrupt):
|
||||
#we do not trap these
|
||||
raise
|
||||
|
|
@ -1855,8 +1857,10 @@ class BuildLiveCDTask(BuildImageTask):
|
|||
|
||||
# import it (and move)
|
||||
if not opts.get('scratch'):
|
||||
self.session.host.importImage(create_task_id, bld_info['id'],
|
||||
self.session.host.importImage(self.id, bld_info['id'],
|
||||
results)
|
||||
else:
|
||||
self.session.host.moveImageBuildToScratch(self.id, results)
|
||||
except (SystemExit,ServerExit,KeyboardInterrupt):
|
||||
#we do not trap these
|
||||
raise
|
||||
|
|
@ -2121,7 +2125,14 @@ class ApplianceTask(ImageTask):
|
|||
self.logger.debug('output: %s' % results)
|
||||
if len(results) == 0:
|
||||
raise koji.ApplianceError, "Could not find image build results!"
|
||||
imgdata = {'arch': arch, 'rootdev': self.getRootDevice()}
|
||||
imgdata = {
|
||||
'arch': arch,
|
||||
'rootdev': self.getRootDevice(),
|
||||
'task_id': self.id,
|
||||
'logs': ['build.log', 'mock_output.log', 'root.log', 'state.log',
|
||||
'appliance.log', os.path.basename(ksfile),
|
||||
os.path.basename(kskoji)]
|
||||
}
|
||||
imgdata['files'] = []
|
||||
for ofile in results:
|
||||
self.uploadFile(ofile)
|
||||
|
|
@ -2267,7 +2278,14 @@ class LiveCDTask(ImageTask):
|
|||
self.uploadFile(manifest)
|
||||
self.uploadFile(isosrc, remoteName=isoname)
|
||||
|
||||
imgdata = {'arch': arch, 'files': [isoname], 'rootdev': None}
|
||||
imgdata = {'arch': arch,
|
||||
'files': [isoname],
|
||||
'rootdev': None,
|
||||
'task_id': self.id,
|
||||
'logs': ['build.log', 'mock_output.log', 'root.log', 'state.log',
|
||||
'livecd.log', os.path.basename(ksfile),
|
||||
os.path.basename(kskoji)]
|
||||
}
|
||||
if not opts.get('scratch'):
|
||||
hdrlist = self.getImagePackages(os.path.join(broot.rootdir(),
|
||||
cachedir[1:]))
|
||||
|
|
|
|||
|
|
@ -6662,16 +6662,18 @@ def importImageInternal(task_id, build_id, imgdata):
|
|||
host = Host()
|
||||
host.verify()
|
||||
task = Task(task_id)
|
||||
task.assertHost(host.id)
|
||||
|
||||
koji.plugin.run_callbacks('preImport', type='image', image=imgdata)
|
||||
|
||||
# import the build output
|
||||
build_info = get_build(build_id, strict=True)
|
||||
workpath = koji.pathinfo.task(task_id)
|
||||
imgdata['relpath'] = koji.pathinfo.taskrelpath(task_id)
|
||||
workpath = koji.pathinfo.task(imgdata['task_id'])
|
||||
imgdata['relpath'] = koji.pathinfo.taskrelpath(imgdata['task_id'])
|
||||
archives = []
|
||||
for imgfile in imgdata['files']:
|
||||
relpath = os.path.join(koji.pathinfo.taskrelpath(task_id), imgfile)
|
||||
relpath = os.path.join(koji.pathinfo.taskrelpath(imgdata['task_id']),
|
||||
imgfile)
|
||||
fullpath = os.path.join(workpath, imgfile)
|
||||
archivetype = get_archive_type(filename=relpath)
|
||||
logger.debug('image type we are importing is: %s' % archivetype)
|
||||
|
|
@ -6734,7 +6736,7 @@ def importImageInternal(task_id, build_id, imgdata):
|
|||
update.execute()
|
||||
|
||||
# send email
|
||||
build_notification(task_id, build_id)
|
||||
build_notification(imgdata['task_id'], build_id)
|
||||
|
||||
koji.plugin.run_callbacks('postImport', type='image', image=imgdata,
|
||||
fullpath=fullpath)
|
||||
|
|
@ -9591,6 +9593,24 @@ class HostExports(object):
|
|||
os.rename(filename, dest)
|
||||
os.symlink(dest, filename)
|
||||
|
||||
def moveImageBuildToScratch(self, task_id, results):
|
||||
"""move a completed image scratch build into place"""
|
||||
host = Host()
|
||||
host.verify()
|
||||
task = Task(task_id)
|
||||
task.assertHost(host.id)
|
||||
workdir = koji.pathinfo.task(results['task_id'])
|
||||
scratchdir = koji.pathinfo.scratch()
|
||||
username = get_user(task.getOwner())['name']
|
||||
destdir = os.path.join(scratchdir, username,
|
||||
'task_%s' % results['task_id'])
|
||||
for img in results['files'] + results['logs']:
|
||||
src = os.path.join(workdir, img)
|
||||
dest = os.path.join(destdir, img)
|
||||
koji.ensuredir(destdir)
|
||||
os.rename(src, dest)
|
||||
os.symlink(dest, src)
|
||||
|
||||
def initBuild(self,data):
|
||||
"""Create a stub build entry.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue