Skip to content

Commit

Permalink
Remove BuildDirectory= from PrepareScripts=
Browse files Browse the repository at this point in the history
The BuildDirectory= is meant for files which are non-essential and can
be recreated during the build process of the image, so source files that
need to be acquired should be saved somewhere within the $BUILDROOT to
be cached for runs when PrepareScripts= aren't run (assuming incremental
builds).
  • Loading branch information
NekkoDroid committed Nov 1, 2024
1 parent fe66c0e commit ff1bc3e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
8 changes: 0 additions & 8 deletions mkosi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -706,9 +706,6 @@ def run_prepare_scripts(context: Context, build: bool) -> None:
if context.config.profiles:
env["PROFILES"] = " ".join(context.config.profiles)

if context.config.build_dir is not None:
env |= dict(BUILDDIR="/work/build")

env |= context.config.environment

with (
Expand All @@ -730,11 +727,6 @@ def run_prepare_scripts(context: Context, build: bool) -> None:
"--ro-bind", json, "/work/config.json",
"--bind", context.artifacts, "/work/artifacts",
"--bind", context.package_dir, "/work/packages",
*(
["--ro-bind", str(context.config.build_dir), "/work/build"]
if context.config.build_dir
else []
),
*sources,
] # fmt: skip

Expand Down
2 changes: 1 addition & 1 deletion mkosi/resources/man/mkosi.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -2404,7 +2404,7 @@ Consult this table for which script receives which environment variables:
| `CHROOT_SCRIPT` | | | βœ“ | βœ“ | βœ“ | βœ“ | | |
| `SRCDIR` | βœ“ | βœ“ | βœ“ | βœ“ | βœ“ | βœ“ | βœ“ | βœ“ |
| `CHROOT_SRCDIR` | | | βœ“ | βœ“ | βœ“ | βœ“ | | |
| `BUILDDIR` | | | βœ“ | βœ“ | βœ“ | βœ“ | | |
| `BUILDDIR` | | | | βœ“ | βœ“ | βœ“ | | |
| `CHROOT_BUILDDIR` | | | | βœ“ | | | | |
| `DESTDIR` | | | | βœ“ | | | | |
| `CHROOT_DESTDIR` | | | | βœ“ | | | | |
Expand Down
4 changes: 4 additions & 0 deletions mkosi/resources/man/mkosi.news.7.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

## v25

- `BuildDirectory=` is no longer available in `PrepareScripts=`. If you
need to acquire some files for the build process place them somewhere
sensible within `$BUILDROOT` so that they can be cached when building
incrementally.
- Instead of using bubblewrap, sandboxing is now done with a new tool
`mkosi-sandbox`. This tool has a public API and can be used
independently of mkosi.
Expand Down

0 comments on commit ff1bc3e

Please sign in to comment.