kojifile component type
This commit is contained in:
parent
05c266b7d1
commit
64f2467fd0
3 changed files with 42 additions and 1 deletions
|
|
@ -108,6 +108,14 @@ Each map in the buildroots list contains the following entries:
|
|||
- checksum: The checksum of the file.
|
||||
- checksum\_type: The checksum type used.
|
||||
|
||||
- For maps where **type = kojifile**, the following fields will be present:
|
||||
- filename: The name of the file.
|
||||
- filesize: The size of the file.
|
||||
- checksum: The checksum of the file.
|
||||
- checksum\_type: The checksum type used.
|
||||
- nvr: Build nvr from which this file origins.
|
||||
- archive\_id: ID of archive from specified build.
|
||||
|
||||
- The format may be extended with other types in the future.
|
||||
- extra: A map containing information specific to the Content Generator
|
||||
that produced the files to import. For OSBS, the extra map should
|
||||
|
|
|
|||
|
|
@ -5360,6 +5360,10 @@ class CG_Importer(object):
|
|||
match = self.match_file(comp)
|
||||
if match:
|
||||
files.append(match)
|
||||
elif comp['type'] == 'kojifile':
|
||||
match = self.match_kojifile(comp)
|
||||
if match:
|
||||
files.append(match)
|
||||
else:
|
||||
raise koji.GenericError("Unknown component type: %(type)s" % comp)
|
||||
return rpms, files
|
||||
|
|
@ -5411,6 +5415,27 @@ class CG_Importer(object):
|
|||
return None
|
||||
#raise koji.GenericError("No match: %(filename)s (size %(filesize)s, sum %(checksum)s" % comp)
|
||||
|
||||
def match_kojifile(self, comp):
|
||||
# kojifile is identified by nvr + archive_id + filename
|
||||
# additional checks by checksum
|
||||
assert(comp['type'] == 'kojifile')
|
||||
build = get_build(comp['nvr'])
|
||||
if build is None:
|
||||
logger.error("No match: NVR: %(nvr)" % comp)
|
||||
return None
|
||||
try:
|
||||
archive = list_archives(buildID = build['id'], archiveID = comp['archive_id'])[0]
|
||||
except IndexError:
|
||||
logger.error("No match: NVR: %(nvr), Archive: %(archive_id)s" % comp)
|
||||
return None
|
||||
if archive['checksum_type'] != koji.CHECKSUM_TYPES[comp['checksum_type']]:
|
||||
logger.error("Failed to match archive %(filename)s, unsupported checksum type: %(checksum_type)s" % archive)
|
||||
elif archive['checksum'] != comp['checksum']:
|
||||
logger.error("Failed to match archive %(filename)s (size %(filesize)s, sum %(checksum)s", comp)
|
||||
else:
|
||||
return archive
|
||||
return None
|
||||
|
||||
|
||||
def prep_outputs(self):
|
||||
metadata = self.metadata
|
||||
|
|
|
|||
|
|
@ -52,7 +52,15 @@
|
|||
"filename": "jboss-eap-6.3.3-full-build.zip",
|
||||
"filesize": 12345678,
|
||||
"checksum": "5ec2f29c4e1c2e2aa6552836e236a158",
|
||||
"checksum_type": "md5"}],
|
||||
"checksum_type": "md5"},
|
||||
{"type": "kojifile",
|
||||
"filename": "jboss-eap-6.4.10-1.win6.src.zip",
|
||||
"filesize": 21670719,
|
||||
"checksum": "215cf04db6bdbefb9644f001995bd550",
|
||||
"checksum_type": "md5",
|
||||
"archive_id": 1,
|
||||
"nvr": "jboss-eap-6.4.10-1.win6"}
|
||||
],
|
||||
"extra": {"osbs": {"build_id": 12345,
|
||||
"builder_image_id": 67890}}
|
||||
}],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue