Skip to content

Commit

Permalink
Fix condition when removing duplicate files from the overlay
Browse files Browse the repository at this point in the history
  • Loading branch information
DaanDeMeyer committed Jan 30, 2025
1 parent 962a2b9 commit cfffca0
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions mkosi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,11 +185,14 @@ def mount_base_trees(context: Context) -> Iterator[None]:
rel = p.relative_to(context.root)
q = context.workspace / "lower" / rel

if not q.is_symlink() and q.is_dir():
if p.is_symlink() or not p.is_dir():
if not q.is_symlink() and not q.exists():
continue

if not p.is_symlink() and p.is_dir():
if q.is_symlink() or not q.is_dir():
die(f"/{rel} is a directory in the base tree but not in the overlay")
shutil.copystat(q, p)
elif q.is_symlink() or q.exists():
else:
logging.info(f"Removing duplicate path /{rel} from overlay")
p.unlink()

Expand Down

0 comments on commit cfffca0

Please sign in to comment.