build logs in data/logs/image directory
This commit is contained in:
parent
343b470157
commit
87d028101d
1 changed files with 23 additions and 1 deletions
|
|
@ -6667,17 +6667,39 @@ def importImageInternal(task_id, build_id, imgdata):
|
||||||
|
|
||||||
# import the build output
|
# import the build output
|
||||||
build_info = get_build(build_id, strict=True)
|
build_info = get_build(build_id, strict=True)
|
||||||
|
workpath = koji.pathinfo.task(task_id)
|
||||||
imgdata['relpath'] = koji.pathinfo.taskrelpath(task_id)
|
imgdata['relpath'] = koji.pathinfo.taskrelpath(task_id)
|
||||||
archives = []
|
archives = []
|
||||||
for imgfile in imgdata['files']:
|
for imgfile in imgdata['files']:
|
||||||
relpath = os.path.join(koji.pathinfo.taskrelpath(task_id), imgfile)
|
relpath = os.path.join(koji.pathinfo.taskrelpath(task_id), imgfile)
|
||||||
fullpath = os.path.join(koji.pathinfo.task(task_id), imgfile)
|
fullpath = os.path.join(workpath, imgfile)
|
||||||
archivetype = get_archive_type(filename=relpath)
|
archivetype = get_archive_type(filename=relpath)
|
||||||
logger.debug('image type we are importing is: %s' % archivetype)
|
logger.debug('image type we are importing is: %s' % archivetype)
|
||||||
if not archivetype:
|
if not archivetype:
|
||||||
raise koji.BuildError, 'Unsupported image type'
|
raise koji.BuildError, 'Unsupported image type'
|
||||||
archives.append(import_archive(fullpath, build_info, 'image', imgdata))
|
archives.append(import_archive(fullpath, build_info, 'image', imgdata))
|
||||||
|
|
||||||
|
# upload logs
|
||||||
|
logs = [f for f in os.listdir(workpath) if f.endswith('.log')]
|
||||||
|
for logfile in logs:
|
||||||
|
logsrc = os.path.join(workpath, logfile)
|
||||||
|
if imgdata.get('rootdev'):
|
||||||
|
logdir = os.path.join(koji.pathinfo.imageFinalPath(),
|
||||||
|
koji.pathinfo.applianceRelPath(build_info),
|
||||||
|
'data/logs/image')
|
||||||
|
else:
|
||||||
|
logdir = os.path.join(koji.pathinfo.imageFinalPath(),
|
||||||
|
koji.pathinfo.livecdRelPath(build_info),
|
||||||
|
'data/logs/image')
|
||||||
|
koji.ensuredir(logdir)
|
||||||
|
final_path = os.path.join(logdir, os.path.basename(logfile))
|
||||||
|
if os.path.exists(final_path):
|
||||||
|
raise koji.GenericError("Error importing build log. %s already exists." % final_path)
|
||||||
|
if os.path.islink(logsrc) or not os.path.isfile(logsrc):
|
||||||
|
raise koji.GenericError("Error importing build log. %s is not a regular file." % logsrc)
|
||||||
|
os.rename(logsrc, final_path)
|
||||||
|
os.symlink(final_path, logsrc)
|
||||||
|
|
||||||
# track the contents of the image
|
# track the contents of the image
|
||||||
rpm_ids = []
|
rpm_ids = []
|
||||||
for an_rpm in imgdata['rpmlist']:
|
for an_rpm in imgdata['rpmlist']:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue