- pass repo_id to maven subtasks
- fix use of md5 and sha modules
This commit is contained in:
parent
82d44a4dbb
commit
9bd7fc3dae
4 changed files with 45 additions and 19 deletions
|
|
@ -2232,7 +2232,15 @@ class MavenTask(BaseTaskHandler):
|
|||
dest_tag = session.getTag(target_info['dest_tag'], strict=True)
|
||||
build_tag = session.getTag(target_info['build_tag'], strict=True)
|
||||
|
||||
build_opts = {}
|
||||
repo_id = opts.get('repo_id')
|
||||
if not repo_id:
|
||||
repo = session.getRepo(build_tag['id'])
|
||||
if repo:
|
||||
repo_id = repo['id']
|
||||
else:
|
||||
raise koji.BuildError, 'no repo for tag %s' % build_tag['name']
|
||||
|
||||
build_opts = {'repo_id': repo_id}
|
||||
if opts.get('properties'):
|
||||
build_opts['properties'] = opts['properties']
|
||||
if opts.get('patches'):
|
||||
|
|
@ -2266,7 +2274,7 @@ class MavenTask(BaseTaskHandler):
|
|||
rpm_results = None
|
||||
spec_url = self.opts.get('specfile')
|
||||
if spec_url:
|
||||
rpm_results = self.buildWrapperRPM(spec_url, build_tag, build_info)
|
||||
rpm_results = self.buildWrapperRPM(spec_url, build_tag, build_info, repo_id)
|
||||
|
||||
if not self.opts.get('scratch'):
|
||||
session.host.completeMavenBuild(self.id, self.build_id, maven_results, rpm_results)
|
||||
|
|
@ -2288,9 +2296,9 @@ class MavenTask(BaseTaskHandler):
|
|||
arch='noarch')
|
||||
self.wait(tag_task_id)
|
||||
|
||||
def buildWrapperRPM(self, spec_url, build_tag, build):
|
||||
def buildWrapperRPM(self, spec_url, build_tag, build, repo_id):
|
||||
task = session.getTaskInfo(self.build_task_id)
|
||||
arglist = [spec_url, build_tag, build, task]
|
||||
arglist = [spec_url, build_tag, build, task, {'repo_id': repo_id}]
|
||||
|
||||
rpm_task_id = session.host.subtask(method='wrapperRPM',
|
||||
arglist=arglist,
|
||||
|
|
@ -2326,11 +2334,14 @@ class BuildMavenTask(BaseTaskHandler):
|
|||
scm = SCM(url)
|
||||
scm.assert_allowed(options.allowed_scms)
|
||||
|
||||
host = session.host.getHost()
|
||||
if not host['arches']:
|
||||
raise koji.BuildError, 'No arch list for host: %s' % host['name']
|
||||
br_arch = host['arches'].split()[0]
|
||||
buildroot = BuildRoot(build_tag['id'], br_arch, self.id, install_group='maven-build', setup_dns=True)
|
||||
repo_id = opts.get('repo_id')
|
||||
if not repo_id:
|
||||
raise koji.BuildError, 'A repo_id must be provided'
|
||||
repo_info = session.repoInfo(repo_id, strict=True)
|
||||
event_id = repo_info['create_event']
|
||||
|
||||
br_arch = self.find_arch('noarch', session.host.getHost(), session.getBuildConfig(build_tag['id'], event=event_id))
|
||||
buildroot = BuildRoot(build_tag['id'], br_arch, self.id, install_group='maven-build', setup_dns=True, repo_id=repo_id)
|
||||
self.logger.debug("Initializing buildroot")
|
||||
buildroot.init()
|
||||
|
||||
|
|
@ -2507,7 +2518,10 @@ class WrapperRPMTask(BaseTaskHandler):
|
|||
raise koji.BuildError, 'srpm header "%s" does not match build info: srpm: %s, build: %s' % \
|
||||
(field, srpminfo[field], build[field])
|
||||
|
||||
def handler(self, spec_url, build_tag, build, task):
|
||||
def handler(self, spec_url, build_tag, build, task, opts=None):
|
||||
if not opts:
|
||||
opts = {}
|
||||
|
||||
values = {}
|
||||
|
||||
artifacts = {}
|
||||
|
|
@ -2635,11 +2649,15 @@ class WrapperRPMTask(BaseTaskHandler):
|
|||
if build:
|
||||
self.check_srpm(srpm, build)
|
||||
|
||||
host = session.host.getHost()
|
||||
if not host['arches']:
|
||||
raise koji.BuildError, 'no arch list for host: %s' % host['name']
|
||||
br_arch = host['arches'].split()[0]
|
||||
buildroot = BuildRoot(build_tag['id'], br_arch, self.id)
|
||||
repo_id = opts.get('repo_id')
|
||||
if not repo_id:
|
||||
raise koji.BuildError, "A repo id must be provided"
|
||||
|
||||
repo_info = session.repoInfo(repo_id, strict=True)
|
||||
event_id = repo_info['create_event']
|
||||
br_arch = self.find_arch('noarch', session.host.getHost(), session.getBuildConfig(build_tag['id'], event=event_id))
|
||||
|
||||
buildroot = BuildRoot(build_tag['id'], br_arch, self.id, repo_id=repo_id)
|
||||
self.logger.debug("Initializing buildroot")
|
||||
buildroot.init()
|
||||
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ import logging.handlers
|
|||
import fcntl
|
||||
import fnmatch
|
||||
from koji.util import md5_constructor
|
||||
from koji.util import sha1_constructor
|
||||
import os
|
||||
import pgdb
|
||||
import random
|
||||
|
|
@ -4068,7 +4069,7 @@ def import_archive(filepath, buildinfo, buildroot_id=None):
|
|||
build_id = buildinfo['id']
|
||||
size = os.path.getsize(filepath)
|
||||
archivefp = file(filepath)
|
||||
m = md5.new()
|
||||
m = md5_constructor()
|
||||
while True:
|
||||
contents = archivefp.read(8192)
|
||||
if not contents:
|
||||
|
|
@ -4184,10 +4185,10 @@ def _generate_maven_metadata(maveninfo, mavendir, contents=None):
|
|||
continue
|
||||
if not os.path.isfile('%s/%s' % (mavendir, mavenfile)):
|
||||
continue
|
||||
for ext, summodule in (('.md5', md5), ('.sha1', sha)):
|
||||
for ext, sum_constr in (('.md5', md5_constructor), ('.sha1', sha1_constructor)):
|
||||
sumfile = mavenfile + ext
|
||||
if sumfile not in mavenfiles:
|
||||
sum = summodule.new()
|
||||
sum = sum_constr()
|
||||
fobj = file('%s/%s' % (mavendir, mavenfile))
|
||||
while True:
|
||||
content = fobj.read(8192)
|
||||
|
|
|
|||
|
|
@ -23,6 +23,10 @@ try:
|
|||
from hashlib import md5 as md5_constructor
|
||||
except ImportError:
|
||||
from md5 import new as md5_constructor
|
||||
try:
|
||||
from hashlib import sha1 as sha1_constructor
|
||||
except ImportError:
|
||||
from sha1 import new as sha1_constructor
|
||||
|
||||
def _changelogDate(cldate):
|
||||
return time.strftime('%a %b %d %Y', time.strptime(koji.formatTime(cldate), '%Y-%m-%d %H:%M:%S'))
|
||||
|
|
|
|||
|
|
@ -137,8 +137,11 @@ $value
|
|||
<strong>Build:</strong> <a href="buildinfo?buildID=$params[2].id">$koji.buildLabel($params[2])</a><br/>
|
||||
#end if
|
||||
#if $params[3]
|
||||
<strong>Task:</strong> <a href="taskinfo?taskID=$wrapTask.id">$koji.taskLabel($wrapTask)</a>
|
||||
<strong>Task:</strong> <a href="taskinfo?taskID=$wrapTask.id">$koji.taskLabel($wrapTask)</a><br/>
|
||||
#end if
|
||||
#if $len($params) > 4
|
||||
$printOpts($params[4])
|
||||
#end if
|
||||
#elif $task.method == 'newRepo'
|
||||
<strong>Tag:</strong> <a href="taginfo?tagID=$tag.id">$tag.name</a><br/>
|
||||
#if $len($params) > 1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue