move Maven scratch builds to the user's scratch directory
This commit is contained in:
parent
8cb82d0c5f
commit
b692f82862
2 changed files with 36 additions and 2 deletions
|
|
@ -1081,7 +1081,9 @@ class MavenTask(MultiPlatformTask):
|
|||
if spec_url:
|
||||
rpm_results = self.buildWrapperRPM(spec_url, self.build_task_id, build_tag, build_info, repo_id)
|
||||
|
||||
if not self.opts.get('scratch'):
|
||||
if self.opts.get('scratch'):
|
||||
self.session.host.moveMavenBuildToScratch(self.id, maven_results, rpm_results)
|
||||
else:
|
||||
self.session.host.completeMavenBuild(self.id, self.build_id, maven_results, rpm_results)
|
||||
except (SystemExit, ServerExit, KeyboardInterrupt):
|
||||
# we do not trap these
|
||||
|
|
|
|||
|
|
@ -8843,8 +8843,40 @@ class HostExports(object):
|
|||
os.rename(fn,dest)
|
||||
os.symlink(dest,fn)
|
||||
|
||||
def moveMavenBuildToScratch(self, task_id, results, rpm_results):
|
||||
"Move a completed Maven scratch build into place (not imported)"
|
||||
if not context.opts.get('EnableMaven'):
|
||||
raise koji.GenericError, 'Maven support not enabled'
|
||||
host = Host()
|
||||
host.verify()
|
||||
task = Task(task_id)
|
||||
task.assertHost(host.id)
|
||||
scratchdir = koji.pathinfo.scratch()
|
||||
username = get_user(task.getOwner())['name']
|
||||
destdir = os.path.join(scratchdir, username, 'task_%s' % task_id)
|
||||
for reldir, files in results['files'].items() + [('', results['logs'])]:
|
||||
for filename in files:
|
||||
if reldir:
|
||||
relpath = os.path.join(reldir, filename)
|
||||
else:
|
||||
relpath = filename
|
||||
src = os.path.join(koji.pathinfo.task(results['task_id']), relpath)
|
||||
dest = os.path.join(destdir, relpath)
|
||||
koji.ensuredir(os.path.dirname(dest))
|
||||
os.rename(src, dest)
|
||||
os.symlink(dest, src)
|
||||
if rpm_results:
|
||||
for relpath in [rpm_results['srpm']] + rpm_results['rpms'] + \
|
||||
rpm_results['logs']:
|
||||
src = os.path.join(koji.pathinfo.task(rpm_results['task_id']),
|
||||
relpath)
|
||||
dest = os.path.join(destdir, 'rpms', relpath)
|
||||
koji.ensuredir(os.path.dirname(dest))
|
||||
os.rename(src, dest)
|
||||
os.symlink(dest, src)
|
||||
|
||||
def moveWinBuildToScratch(self, task_id, results, rpm_results):
|
||||
"Move a completed scratch build into place (not imported)"
|
||||
"Move a completed Windows scratch build into place (not imported)"
|
||||
if not context.opts.get('EnableWin'):
|
||||
raise koji.GenericError, 'Windows support not enabled'
|
||||
host = Host()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue