stages/erofs: Add exclude_paths support
Add the ability to exclude files and directories from the erofs image. This uses the mkfs.erofs --exclude-regex feature, so simple matches or regexes can be used.
This commit is contained in:
parent
86c89a2421
commit
a828ef95d6
3 changed files with 13 additions and 0 deletions
|
|
@ -10,6 +10,7 @@ def main(inputs, output_dir, options):
|
||||||
source = inputs["tree"]["path"]
|
source = inputs["tree"]["path"]
|
||||||
filename = options["filename"].lstrip("/")
|
filename = options["filename"].lstrip("/")
|
||||||
compression = options.get("compression")
|
compression = options.get("compression")
|
||||||
|
exclude_paths = options.get("exclude_paths")
|
||||||
|
|
||||||
target = os.path.join(output_dir, filename)
|
target = os.path.join(output_dir, filename)
|
||||||
|
|
||||||
|
|
@ -29,6 +30,10 @@ def main(inputs, output_dir, options):
|
||||||
if cluster_size:
|
if cluster_size:
|
||||||
cmd += ["-C", f"{cluster_size}"]
|
cmd += ["-C", f"{cluster_size}"]
|
||||||
|
|
||||||
|
if exclude_paths:
|
||||||
|
for e in exclude_paths:
|
||||||
|
cmd += ["--exclude-regex", e]
|
||||||
|
|
||||||
subprocess.run(cmd, check=True)
|
subprocess.run(cmd, check=True)
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,13 @@
|
||||||
"description": "Filename for the output",
|
"description": "Filename for the output",
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
"exclude_paths": {
|
||||||
|
"type": "array",
|
||||||
|
"description": "Regex of paths to exclude, can be files or directories",
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
"compression": {
|
"compression": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"additionalProperties": false,
|
"additionalProperties": false,
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ TEST_INPUT = [
|
||||||
({"options": ["dedupe"]}, ["-E", "dedupe"]),
|
({"options": ["dedupe"]}, ["-E", "dedupe"]),
|
||||||
({"options": ["all-fragments", "force-inode-compact"]}, ["-E", "all-fragments,force-inode-compact"]),
|
({"options": ["all-fragments", "force-inode-compact"]}, ["-E", "all-fragments,force-inode-compact"]),
|
||||||
({"cluster-size": 131072, "options": ["dedupe"]}, ["-E", "dedupe", "-C", "131072"]),
|
({"cluster-size": 131072, "options": ["dedupe"]}, ["-E", "dedupe", "-C", "131072"]),
|
||||||
|
({"exclude_paths": ["boot/", "root/"]}, ["--exclude-regex", "boot/", "--exclude-regex", "root/"])
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue