osbuild: honor OSBUILD_EXPORT_FORCE_NO_PRESERVE_OWNER env

To workaround the issue that inside macOS containers the ownership
cannot be preserved we introduce a new environment that can be
used to forcefully relax the use of `cp -a`.

I did it via an environment instead of a commandline option mostly
because `github.com/osbuild/images/osbuild:RunOBuild()` already has
`extraEnv` option.
This commit is contained in:
Michael Vogt 2023-12-19 18:01:38 +01:00
parent e35d841509
commit a6fba858ab

View file

@ -52,8 +52,10 @@ def export(name_or_id, output_directory, store, manifest):
obj = store.get(pipeline.id)
dest = os.path.join(output_directory, name_or_id)
skip_preserve_owner = \
os.getenv("OSBUILD_EXPORT_FORCE_NO_PRESERVE_OWNER") == "1"
os.makedirs(dest, exist_ok=True)
obj.export(dest)
obj.export(dest, skip_preserve_owner=skip_preserve_owner)
def parse_arguments(sys_argv):