| |
@@ -6717,6 +6717,9 @@
|
| |
def assert_policy(self):
|
| |
policy_data = {
|
| |
'package': self.buildinfo['name'],
|
| |
+ 'version': self.buildinfo['version'],
|
| |
+ 'release': self.buildinfo['release'],
|
| |
+ 'btypes': list(self.typeinfo),
|
| |
'source': self.buildinfo.get('source'),
|
| |
'metadata_only': self.metadata_only,
|
| |
'cg_list': [self.cg],
|
| |
@@ -7137,6 +7140,8 @@
|
| |
if fileinfo['type'] not in ['rpm', 'log']:
|
| |
self.prep_archive(fileinfo)
|
| |
if fileinfo['type'] == 'rpm':
|
| |
+ if fileinfo.get('subdir'):
|
| |
+ raise koji.GenericError("subdir field not allowed for rpm outputs")
|
| |
koji.check_NVRA(fileinfo['filename'], strict=True)
|
| |
outputs.append(fileinfo)
|
| |
self.prepped_outputs = outputs
|
| |
@@ -7170,6 +7175,8 @@
|
| |
"%(filename)s" % fileinfo)
|
| |
btype = key
|
| |
type_info = extra[key]
|
| |
+ if fileinfo.get('subdir'):
|
| |
+ raise koji.GenericError("subdir field not allowed for legacy btypes")
|
| |
for key in extra.get('typeinfo', {}):
|
| |
if btype == key:
|
| |
raise koji.GenericError("Duplicate typeinfo for: %r" % btype)
|
| |
@@ -7213,9 +7220,9 @@
|
| |
if fileinfo.get('metadata_only', False):
|
| |
# logs are not currently tracked, so this is a no op
|
| |
return
|
| |
- # TODO: determine subdir
|
| |
+ subdir = fileinfo.get('subdir')
|
| |
fn = fileinfo['hub.path']
|
| |
- import_build_log(fn, buildinfo, subdir=None)
|
| |
+ import_build_log(fn, buildinfo, subdir=subdir)
|
| |
|
| |
def import_archive(self, buildinfo, brinfo, fileinfo):
|
| |
fn = fileinfo['hub.path']
|
| |
@@ -7325,9 +7332,9 @@
|
| |
"""Move a logfile related to a build to the right place"""
|
| |
logdir = koji.pathinfo.build_logs(buildinfo)
|
| |
if subdir:
|
| |
- logdir = "%s/%s" % (logdir, subdir)
|
| |
+ logdir = joinpath(logdir, subdir)
|
| |
koji.ensuredir(logdir)
|
| |
- final_path = "%s/%s" % (logdir, os.path.basename(fn))
|
| |
+ final_path = joinpath(logdir, os.path.basename(fn))
|
| |
if os.path.exists(final_path):
|
| |
raise koji.GenericError("Error importing build log. %s already exists." % final_path)
|
| |
if os.path.islink(fn) or not os.path.isfile(fn):
|
| |
@@ -7828,6 +7835,9 @@
|
| |
# new style type, no supplementary table
|
| |
if not metadata_only:
|
| |
destdir = koji.pathinfo.typedir(buildinfo, btype['name'])
|
| |
+ subdir = fileinfo.get('subdir')
|
| |
+ if subdir:
|
| |
+ destdir = joinpath(destdir, subdir)
|
| |
_import_archive_file(filepath, destdir)
|
| |
|
| |
archiveinfo = get_archive(archive_id, strict=True)
|
| |
Two not-quite-related updates to cg_import
Previously, all cg logs went directly into the logs dir for the build with no way to indicate a different subdir. This prevented including multiple logs with the same filename (e.g. build.log per arch as native koji builds do). The field is also supported for non-legacy btypes. Legacy btypes have prescribed locations and do not allow subdir.
The additional policy data enables using the buildtype, version, and release tests in cg import policy
Fixes https://pagure.io/koji/issue/4119
Fixes https://pagure.io/koji/issue/1402