stages/org.osbuild.gzip: add compression level option
Allow compression level to be specified instead of defaulting to 1. This is needed for CoreOS Assembler.
This commit is contained in:
parent
30f740ec9f
commit
cfaabe618f
3 changed files with 12 additions and 2 deletions
|
|
@ -30,6 +30,13 @@ SCHEMA_2 = r"""
|
|||
"filename": {
|
||||
"description": "Filename to use for the compressed file",
|
||||
"type": "string"
|
||||
},
|
||||
"level": {
|
||||
"description": "Compression level",
|
||||
"type": "integer",
|
||||
"minimum": 1,
|
||||
"maximum": 9,
|
||||
"default": 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -48,13 +55,14 @@ def parse_input(inputs):
|
|||
|
||||
def main(inputs, output, options):
|
||||
filename = options["filename"].lstrip("/")
|
||||
level = options.get("level", 1)
|
||||
|
||||
source = parse_input(inputs)
|
||||
target = os.path.join(output, filename)
|
||||
|
||||
with open(target, "w", encoding="utf8") as f:
|
||||
cmd = [
|
||||
"gzip", "--no-name", "--stdout", "-1", source
|
||||
"gzip", "--no-name", "--stdout", f"-{level}", source
|
||||
]
|
||||
|
||||
subprocess.run(
|
||||
|
|
|
|||
|
|
@ -883,7 +883,8 @@
|
|||
}
|
||||
},
|
||||
"options": {
|
||||
"filename": "compressed.gz"
|
||||
"filename": "compressed.gz",
|
||||
"level": 9
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
|
|||
|
|
@ -25,3 +25,4 @@ pipelines:
|
|||
sha256:f950375066d74787f31cbd8f9f91c71819357cad243fb9d4a0d9ef4fa76709e0: {}
|
||||
options:
|
||||
filename: compressed.gz
|
||||
level: 9
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue