diff --git a/stages/org.osbuild.erofs b/stages/org.osbuild.erofs index e15ec5c7..0fa4e25b 100755 --- a/stages/org.osbuild.erofs +++ b/stages/org.osbuild.erofs @@ -10,6 +10,7 @@ def main(inputs, output_dir, options): source = inputs["tree"]["path"] filename = options["filename"].lstrip("/") compression = options.get("compression") + exclude_paths = options.get("exclude_paths") target = os.path.join(output_dir, filename) @@ -29,6 +30,10 @@ def main(inputs, output_dir, options): if cluster_size: cmd += ["-C", f"{cluster_size}"] + if exclude_paths: + for e in exclude_paths: + cmd += ["--exclude-regex", e] + subprocess.run(cmd, check=True) return 0 diff --git a/stages/org.osbuild.erofs.meta.json b/stages/org.osbuild.erofs.meta.json index 0f675189..3e32320a 100644 --- a/stages/org.osbuild.erofs.meta.json +++ b/stages/org.osbuild.erofs.meta.json @@ -16,6 +16,13 @@ "description": "Filename for the output", "type": "string" }, + "exclude_paths": { + "type": "array", + "description": "Regex of paths to exclude, can be files or directories", + "items": { + "type": "string" + } + }, "compression": { "type": "object", "additionalProperties": false, diff --git a/stages/test/test_erofs.py b/stages/test/test_erofs.py index d74bde2d..02ff7376 100644 --- a/stages/test/test_erofs.py +++ b/stages/test/test_erofs.py @@ -16,6 +16,7 @@ TEST_INPUT = [ ({"options": ["dedupe"]}, ["-E", "dedupe"]), ({"options": ["all-fragments", "force-inode-compact"]}, ["-E", "all-fragments,force-inode-compact"]), ({"cluster-size": 131072, "options": ["dedupe"]}, ["-E", "dedupe", "-C", "131072"]), + ({"exclude_paths": ["boot/", "root/"]}, ["--exclude-regex", "boot/", "--exclude-regex", "root/"]) ]