- don't fail repo creation if a maven directory doesn't exist
- convert pom files to utf-8 before attempting to parse - a couple typos
This commit is contained in:
parent
b116f17147
commit
2ea09fb569
3 changed files with 21 additions and 10 deletions
|
|
@ -1887,6 +1887,9 @@ def repo_init(tag, with_src=False, with_debuginfo=False):
|
|||
def _populate_maven_repodir(buildinfo, maveninfo, repodir, artifact_dirs):
|
||||
maven_pi = koji.PathInfo(topdir=repodir)
|
||||
srcdir = koji.pathinfo.mavenbuild(buildinfo, maveninfo)
|
||||
if not os.path.isdir(srcdir):
|
||||
# srcdir doesn't exist, so there's nothing to do
|
||||
return
|
||||
destdir = maven_pi.mavenbuild(buildinfo, maveninfo)
|
||||
koji.ensuredir(destdir)
|
||||
# link all files in srcdir to destdir, including metadata files
|
||||
|
|
@ -3515,16 +3518,16 @@ def new_maven_build(build, maven_info):
|
|||
|
||||
for field in ('name', 'version', 'release', 'epoch'):
|
||||
if build[field] != maven_nvr[field]:
|
||||
raise koji.BuildError, '%s mismatch between build and Maven: %s, %s' % \
|
||||
(build[field], maven_nvr[field])
|
||||
raise koji.BuildError, '%s mismatch (build: %s, maven: %s)' % \
|
||||
(field, build[field], maven_nvr[field])
|
||||
|
||||
current_maven_info = get_maven_build(build)
|
||||
if current_maven_info:
|
||||
# already exists, verify that it matches
|
||||
for field in ('group_id', 'artifact_id', 'version'):
|
||||
if current_maven_info[field] != maven_info[field]:
|
||||
raise koji.BuildError, '%s mismatch between existing and new Maven info: %s, %s' % \
|
||||
(current_maven_info[field], maven_info[field])
|
||||
raise koji.BuildError, '%s mismatch (current: %s, new: %s)' % \
|
||||
(field, current_maven_info[field], maven_info[field])
|
||||
else:
|
||||
maven_info['build_id'] = build['id']
|
||||
insert = """INSERT INTO maven_builds (build_id, group_id, artifact_id, version)
|
||||
|
|
|
|||
|
|
@ -759,12 +759,18 @@ def parse_pom(path=None, contents=None):
|
|||
values = {}
|
||||
handler = POMHandler(values, fields)
|
||||
if path:
|
||||
xml.sax.parse(path, handler)
|
||||
elif contents:
|
||||
xml.sax.parseString(contents, handler)
|
||||
else:
|
||||
fd = file(path)
|
||||
contents = fd.read()
|
||||
fd.close()
|
||||
|
||||
if not contents:
|
||||
raise GenericError, 'either a path to a pom file or the contents of a pom file must be specified'
|
||||
|
||||
# A common problem is non-UTF8 characters in XML files, so we'll convert the string first
|
||||
|
||||
contents = fixEncoding(contents)
|
||||
xml.sax.parseString(contents, handler)
|
||||
|
||||
for field in fields:
|
||||
if field not in values.keys():
|
||||
raise GenericError, 'could not extract %s from POM: %s' % (field, (path or '<contents>'))
|
||||
|
|
@ -822,8 +828,10 @@ def maven_info_to_nvr(maveninfo):
|
|||
"""
|
||||
nvr = {'name': maveninfo['group_id'] + '-' + maveninfo['artifact_id'],
|
||||
'version': maveninfo['version'].replace('-', '_'),
|
||||
'release': 1,
|
||||
'release': '1',
|
||||
'epoch': None}
|
||||
# for backwards-compatibility
|
||||
nvr['package_name'] = nvr['name']
|
||||
return nvr
|
||||
|
||||
def mavenLabel(maveninfo):
|
||||
|
|
|
|||
|
|
@ -979,7 +979,7 @@ def archiveinfo(req, archiveID, fileOrder='name', fileStart=None):
|
|||
|
||||
archiveID = int(archiveID)
|
||||
archive = server.getArchive(archiveID)
|
||||
archive_type = server.getArchiveType(archive['type_id'])
|
||||
archive_type = server.getArchiveType(type_id=archive['type_id'])
|
||||
build = server.getBuild(archive['build_id'])
|
||||
maveninfo = server.getMavenArchive(archive['id'])
|
||||
builtInRoot = None
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue