push build_tag, session, scratch into callbacks
This commit is contained in:
parent
db96dd63c3
commit
65799703e2
4 changed files with 71 additions and 34 deletions
|
|
@ -899,7 +899,7 @@ class BuildTask(BaseTaskHandler):
|
|||
def getSRPMFromSCM(self, url, build_tag, repo_id):
|
||||
#TODO - allow different ways to get the srpm
|
||||
task_id = self.session.host.subtask(method='buildSRPMFromSCM',
|
||||
arglist=[url, build_tag, {'repo_id': repo_id}],
|
||||
arglist=[url, build_tag, {'repo_id': repo_id, 'scratch': self.opts.get('scratch')}],
|
||||
label='srpm',
|
||||
parent=self.id)
|
||||
# wait for subtask to finish
|
||||
|
|
@ -1264,7 +1264,7 @@ class MavenTask(MultiPlatformTask):
|
|||
raise koji.BuildError('no repo for tag %s' % build_tag['name'])
|
||||
|
||||
build_opts = dslice(opts, ['goals', 'profiles', 'properties', 'envs', 'patches',
|
||||
'packages', 'jvm_options', 'maven_options', 'deps'],
|
||||
'packages', 'jvm_options', 'maven_options', 'deps', 'scratch'],
|
||||
strict=False)
|
||||
build_opts['repo_id'] = repo_id
|
||||
|
||||
|
|
@ -1415,11 +1415,12 @@ class BuildMavenTask(BaseBuildTask):
|
|||
uploadpath = self.getUploadDir()
|
||||
|
||||
|
||||
self.run_plugin('preSCMCheckout', scminfo=scm.get_info())
|
||||
self.run_plugin('preSCMCheckout', scminfo=scm.get_info(), build_tag=build_tag)
|
||||
# Check out sources from the SCM
|
||||
sourcedir = scm.checkout(scmdir, self.session, uploadpath, logfile)
|
||||
self.run_plugin("postSCMCheckout",
|
||||
scminfo=scm.get_info(),
|
||||
scratch=opts.get('scratch'),
|
||||
srcdir=sourcedir)
|
||||
|
||||
# zip up pristine sources for auditing purposes
|
||||
|
|
@ -1430,12 +1431,13 @@ class BuildMavenTask(BaseBuildTask):
|
|||
patchlog = self.workdir + '/patches.log'
|
||||
patch_scm = SCM(self.opts.get('patches'))
|
||||
patch_scm.assert_allowed(self.options.allowed_scms)
|
||||
self.run_plugin('preSCMCheckout', scminfo=patch_scm.get_info())
|
||||
self.run_plugin('preSCMCheckout', scminfo=patch_scm.get_info(), build_tag=build_tag)
|
||||
# never try to check out a common/ dir when checking out patches
|
||||
patch_scm.use_common = False
|
||||
patchcheckoutdir = patch_scm.checkout(patchdir, self.session, uploadpath, patchlog)
|
||||
self.run_plugin("postSCMCheckout",
|
||||
scminfo=patch_scm.get_info(),
|
||||
scratch=opts.get('scratch'),
|
||||
srcdir=patchcheckoutdir)
|
||||
self._zip_dir(patchcheckoutdir, os.path.join(outputdir, 'patches.zip'))
|
||||
|
||||
|
|
@ -1717,10 +1719,11 @@ class WrapperRPMTask(BaseBuildTask):
|
|||
logfile = os.path.join(self.workdir, 'checkout.log')
|
||||
scmdir = buildroot.rootdir() + '/tmp/scmroot'
|
||||
koji.ensuredir(scmdir)
|
||||
self.run_plugin('preSCMCheckout', scminfo=scm.get_info())
|
||||
self.run_plugin('preSCMCheckout', scminfo=scm.get_info(), build_tag=build_tag)
|
||||
specdir = scm.checkout(scmdir, self.session, self.getUploadDir(), logfile)
|
||||
self.run_plugin("postSCMCheckout",
|
||||
scminfo=scm.get_info(),
|
||||
scratch=opts.get('scratch'),
|
||||
srcdir=specdir)
|
||||
|
||||
spec_template = None
|
||||
|
|
@ -2631,7 +2634,7 @@ class ImageTask(BaseTaskHandler):
|
|||
self.logger.debug("Image buildroot ready: " + broot.rootdir())
|
||||
return broot
|
||||
|
||||
def fetchKickstart(self, broot, ksfile):
|
||||
def fetchKickstart(self, broot, ksfile, build_tag):
|
||||
"""
|
||||
Retrieve the kickstart file we were given (locally or remotely) and
|
||||
upload it.
|
||||
|
|
@ -2645,6 +2648,7 @@ class ImageTask(BaseTaskHandler):
|
|||
@args:
|
||||
broot: a buildroot object
|
||||
ksfile: path to a kickstart file
|
||||
build_tag: build tag name
|
||||
@returns: absolute path to the retrieved kickstart file
|
||||
"""
|
||||
scmdir = os.path.join(broot.rootdir(), 'tmp')
|
||||
|
|
@ -2654,10 +2658,11 @@ class ImageTask(BaseTaskHandler):
|
|||
scm = SCM(self.opts['ksurl'])
|
||||
scm.assert_allowed(self.options.allowed_scms)
|
||||
logfile = os.path.join(self.workdir, 'checkout.log')
|
||||
self.run_plugin('preSCMCheckout', scminfo=scm.get_info())
|
||||
self.run_plugin('preSCMCheckout', scminfo=scm.get_info(), build_tag=build_tag)
|
||||
scmsrcdir = scm.checkout(scmdir, self.session, self.getUploadDir(), logfile)
|
||||
self.run_plugin("postSCMCheckout",
|
||||
scminfo=scm.get_info(),
|
||||
scratch=self.opts.get('scratch'),
|
||||
srcdir=scmsrcdir)
|
||||
kspath = os.path.join(scmsrcdir, ksfile)
|
||||
else:
|
||||
|
|
@ -2832,7 +2837,7 @@ class ApplianceTask(ImageTask):
|
|||
self.opts = opts
|
||||
broot = self.makeImgBuildRoot(build_tag, repo_info, arch,
|
||||
'appliance-build')
|
||||
kspath = self.fetchKickstart(broot, ksfile)
|
||||
kspath = self.fetchKickstart(broot, ksfile, target_info['build_tag_name'])
|
||||
self.readKickstart(kspath, opts)
|
||||
kskoji = self.prepareKickstart(repo_info, target_info, arch, broot, opts)
|
||||
# Figure out appliance-creator arguments, let it fail if something
|
||||
|
|
@ -2981,7 +2986,7 @@ class LiveCDTask(ImageTask):
|
|||
|
||||
broot = self.makeImgBuildRoot(build_tag, repo_info, arch,
|
||||
'livecd-build')
|
||||
kspath = self.fetchKickstart(broot, ksfile)
|
||||
kspath = self.fetchKickstart(broot, ksfile, target_info['build_tag_name'])
|
||||
self.readKickstart(kspath, opts)
|
||||
kskoji = self.prepareKickstart(repo_info, target_info, arch, broot, opts)
|
||||
|
||||
|
|
@ -3131,7 +3136,7 @@ class LiveMediaTask(ImageTask):
|
|||
|
||||
broot = self.makeImgBuildRoot(build_tag, repo_info, arch,
|
||||
'livemedia-build')
|
||||
kspath = self.fetchKickstart(broot, ksfile)
|
||||
kspath = self.fetchKickstart(broot, ksfile, target_info['build_tag_name'])
|
||||
self.readKickstart(kspath, opts)
|
||||
kskoji = self.prepareKickstart(repo_info, target_info, arch, broot, opts)
|
||||
|
||||
|
|
@ -3249,7 +3254,7 @@ class LiveMediaTask(ImageTask):
|
|||
class OzImageTask(BaseTaskHandler):
|
||||
Methods = []
|
||||
|
||||
def fetchKickstart(self):
|
||||
def fetchKickstart(self, build_tag):
|
||||
"""
|
||||
Retrieve the kickstart file we were given (locally or remotely) and
|
||||
upload it to the hub.
|
||||
|
|
@ -3260,7 +3265,8 @@ class OzImageTask(BaseTaskHandler):
|
|||
relative path in a remote scm. The user should have passed in an scm
|
||||
url with --ksurl.
|
||||
|
||||
@args: None, use self.opts for options
|
||||
@args: build_tag: build tag name
|
||||
use self.opts for options
|
||||
@returns:
|
||||
absolute path to the retrieved kickstart file
|
||||
"""
|
||||
|
|
@ -3270,11 +3276,12 @@ class OzImageTask(BaseTaskHandler):
|
|||
scm = SCM(self.opts['ksurl'])
|
||||
scm.assert_allowed(self.options.allowed_scms)
|
||||
logfile = os.path.join(self.workdir, 'checkout-%s.log' % self.arch)
|
||||
self.run_plugin('preSCMCheckout', scminfo=scm.get_info())
|
||||
self.run_plugin('preSCMCheckout', scminfo=scm.get_info(), build_tag=build_tag)
|
||||
scmsrcdir = scm.checkout(self.workdir, self.session,
|
||||
self.getUploadDir(), logfile)
|
||||
self.run_plugin("postSCMCheckout",
|
||||
scminfo=scm.get_info(),
|
||||
scratch=self.opts.get('scratch'),
|
||||
srcdir=scmsrcdir)
|
||||
kspath = os.path.join(scmsrcdir, os.path.basename(ksfile))
|
||||
else:
|
||||
|
|
@ -3929,7 +3936,7 @@ class BaseImageTask(OzImageTask):
|
|||
self.formats = self._format_deps(opts.get('format'))
|
||||
|
||||
# First, prepare the kickstart to use the repos we tell it
|
||||
kspath = self.fetchKickstart()
|
||||
kspath = self.fetchKickstart(build_tag=target_info['build_tag_name'])
|
||||
ks = self.prepareKickstart(kspath, inst_tree)
|
||||
kskoji = self.writeKickstart(ks,
|
||||
os.path.join(self.workdir, 'koji-%s-%i-base.ks' %
|
||||
|
|
@ -4060,7 +4067,7 @@ class BuildIndirectionImageTask(OzImageTask):
|
|||
|
||||
# END inefficient base image task method copies
|
||||
|
||||
def fetchHubOrSCM(self, filepath, fileurl):
|
||||
def fetchHubOrSCM(self, filepath, fileurl, build_tag):
|
||||
"""
|
||||
Retrieve a file either from the hub or a remote scm
|
||||
|
||||
|
|
@ -4080,12 +4087,13 @@ class BuildIndirectionImageTask(OzImageTask):
|
|||
if fileurl:
|
||||
scm = SCM(fileurl)
|
||||
scm.assert_allowed(self.options.allowed_scms)
|
||||
self.run_plugin('preSCMCheckout', scminfo=scm.get_info())
|
||||
self.run_plugin('preSCMCheckout', scminfo=scm.get_info(), build_tag=build_tag)
|
||||
logfile = os.path.join(self.workdir, 'checkout.log')
|
||||
scmsrcdir = scm.checkout(self.workdir, self.session,
|
||||
self.getUploadDir(), logfile)
|
||||
self.run_plugin("postSCMCheckout",
|
||||
scminfo=scm.get_info(),
|
||||
scratch=self.opts.get('scratch'),
|
||||
srcdir=scmsrcdir)
|
||||
final_path = os.path.join(scmsrcdir, os.path.basename(filepath))
|
||||
else:
|
||||
|
|
@ -4236,7 +4244,8 @@ class BuildIndirectionImageTask(OzImageTask):
|
|||
raise koji.ApplianceError('The Release may not have a hyphen')
|
||||
|
||||
indirection_template = self.fetchHubOrSCM(opts.get('indirection_template'),
|
||||
opts.get('indirection_template_url'))
|
||||
opts.get('indirection_template_url'),
|
||||
target_info['build_tag_name'])
|
||||
|
||||
self.logger.debug('Got indirection template %s' % (indirection_template))
|
||||
|
||||
|
|
@ -4427,11 +4436,12 @@ class BuildSRPMFromSCMTask(BaseBuildTask):
|
|||
logfile = self.workdir + '/checkout.log'
|
||||
uploadpath = self.getUploadDir()
|
||||
|
||||
self.run_plugin('preSCMCheckout', scminfo=scm.get_info())
|
||||
self.run_plugin('preSCMCheckout', scminfo=scm.get_info(), build_tag=build_tag)
|
||||
# Check out spec file, etc. from SCM
|
||||
sourcedir = scm.checkout(scmdir, self.session, uploadpath, logfile)
|
||||
self.run_plugin("postSCMCheckout",
|
||||
scminfo=scm.get_info(),
|
||||
scratch=self.opts.get('scratch'),
|
||||
srcdir=sourcedir)
|
||||
# chown the sourcedir and everything under it to the mockuser
|
||||
# so we can build the srpm as non-root
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue