Do not replace version from the image name

This commit makes sure that replacing version to version plus the
build id on resulting files happens only on version suffixes. Before
that if image name was including the version string it, this part was
also replaced.

Fixes #787 (bsc#1102868)
This commit is contained in:
David Cassany 2018-07-27 12:27:18 +02:00
parent 2cffd331fc
commit 98c9c77a72
No known key found for this signature in database
GPG Key ID: D91C0AAD9018D486

View File

@ -100,6 +100,7 @@ class ResultBundleTask(CliTask):
result_directory + '/kiwi.result'
)
image_version = result.xml_state.get_image_version()
image_name = result.xml_state.get_image_name()
ordered_results = OrderedDict(sorted(result.get_results().items()))
# hard link bundle files, compress and build checksum
@ -109,11 +110,15 @@ class ResultBundleTask(CliTask):
if result_file.use_for_bundle:
bundle_file_basename = os.path.basename(result_file.filename)
# The bundle id is only taken into account for image results
# which contains the image version in its nane
bundle_file_basename = bundle_file_basename.replace(
image_version,
image_version + '-' + self.command_args['--id']
)
# which contains the image version appended in its file name
part_name = list(bundle_file_basename.partition(image_name))
bundle_file_basename = ''.join([
part_name[0], part_name[1],
part_name[2].replace(
image_version,
image_version + '-' + self.command_args['--id']
)
])
log.info('Creating %s', bundle_file_basename)
bundle_file = ''.join(
[bundle_directory, '/', bundle_file_basename]