path.symlink_to(target)
-def copy_path(oldpath: PathString, newpath: Path) -> None:
+def copy_path(oldpath: PathString, newpath: Path, *, copystat: bool = True) -> None:
try:
newpath.mkdir(exist_ok=True)
except FileExistsError:
else:
print("Ignoring", entry.path)
continue
- shutil.copystat(oldpath, newpath, follow_symlinks=True)
+
+ if copystat:
+ shutil.copystat(oldpath, newpath, follow_symlinks=True)
@complete_step("Detaching namespace")
with complete_step("Copying in extra file trees…"):
for tree in args.extra_trees:
if tree.is_dir():
- copy_path(tree, root)
+ copy_path(tree, root, copystat=False)
else:
# unpack_archive() groks Paths, but mypy doesn't know this.
# Pretend that tree is a str.
with complete_step("Copying in skeleton file trees…"):
for tree in args.skeleton_trees:
if tree.is_dir():
- copy_path(tree, root)
+ copy_path(tree, root, copystat=False)
else:
# unpack_archive() groks Paths, but mypy doesn't know this.
# Pretend that tree is a str.
return
with complete_step("Copying in build tree…"):
- copy_path(install_dir(args, root), root)
+ copy_path(install_dir(args, root), root, copystat=False)
def make_read_only(args: MkosiArgs, root: Path, for_cache: bool, b: bool = True) -> None:
if fname.exists():
with complete_step(f"Copying in cached tree {fname}…"):
- copy_path(fname, root)
+ copy_path(fname, root, copystat=False)
return True