]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
fix invalid cross-device link
authorBenedict Schlueter <benedictschlueter@gmail.com>
Fri, 23 Dec 2022 15:41:50 +0000 (16:41 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Sat, 24 Dec 2022 12:05:59 +0000 (13:05 +0100)
when the workspace directory is on another filesystem (i.e. /tmp) mkosi
fails.
replace os.rename with shutil.move when we may cross filesystem
boundaries. Furthermore, chown the resulting files if the flag is set
accordingly.

mkosi/__init__.py

index d6db0362f96e07fac1644fa8ca83e86330118bde..6a702f0491302c2c11c9fec98bbe7130ce6f738d 100644 (file)
@@ -3867,12 +3867,14 @@ def build_stuff(config: MkosiConfig) -> None:
 
         for p in state.config.output_paths():
             if state.staging.joinpath(p.name).exists():
-                os.rename(str(state.staging / p.name), str(p))
+                shutil.move(str(state.staging / p.name), str(p))
                 if p in (state.config.output, state.config.output_split_kernel):
                     compress_output(state.config, p)
+            if state.config.chown and p.exists(): 
+                chown_to_running_user(p)
 
         for p in state.staging.iterdir():
-            os.rename(str(p), str(state.config.output.parent / p.name))
+            shutil.move(str(p), str(state.config.output.parent / p.name))
             if p.name.startswith(state.config.output.name):
                 compress_output(state.config, p)