livemedia-creator: Use correct suffix on default image names (#1318958)
When an image name hasn't been passed, and the compression type is
something other than xz, the default image name should use the user
specified compression suffix.
Resolves: rhbz#1318958
(cherry picked from commit f753a064b8
)
This commit is contained in:
parent
69daa095bf
commit
0d28b9e09c
@ -964,6 +964,22 @@ def setup_logging(opts):
|
|||||||
log.setLevel(logging.DEBUG)
|
log.setLevel(logging.DEBUG)
|
||||||
pylorax_log.setLevel(logging.DEBUG)
|
pylorax_log.setLevel(logging.DEBUG)
|
||||||
|
|
||||||
|
|
||||||
|
def default_image_name(compression, basename):
|
||||||
|
""" Return a default image name with the correct suffix for the compression type.
|
||||||
|
|
||||||
|
:param str compression: Compression type
|
||||||
|
:param str basename: Base filename
|
||||||
|
:returns: basename with compression suffix
|
||||||
|
|
||||||
|
If the compression is unknown it defaults to xz
|
||||||
|
"""
|
||||||
|
SUFFIXES = {"xz": ".xz", "gzip": ".gz", "bzip2": ".bz2", "lzma": ".lzma"}
|
||||||
|
return basename + SUFFIXES.get(compression, ".xz")
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
|
||||||
sh = logging.StreamHandler()
|
sh = logging.StreamHandler()
|
||||||
sh.setLevel(logging.INFO)
|
sh.setLevel(logging.INFO)
|
||||||
fmt = logging.Formatter("%(asctime)s: %(message)s")
|
fmt = logging.Formatter("%(asctime)s: %(message)s")
|
||||||
@ -1213,7 +1229,7 @@ if __name__ == '__main__':
|
|||||||
opts.fs_label = "AMI"
|
opts.fs_label = "AMI"
|
||||||
elif opts.make_tar:
|
elif opts.make_tar:
|
||||||
if not opts.image_name:
|
if not opts.image_name:
|
||||||
opts.image_name = "root.tar.xz"
|
opts.image_name = default_image_name(opts.compression, "root.tar")
|
||||||
if opts.compression == "xz" and not opts.compress_args:
|
if opts.compression == "xz" and not opts.compress_args:
|
||||||
opts.compress_args = ["-9"]
|
opts.compress_args = ["-9"]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user