]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Restore subdirectory use for $BUILDDIR
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 30 Oct 2023 17:20:41 +0000 (18:20 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 2 Nov 2023 10:50:24 +0000 (11:50 +0100)
Sharing of a directory for the (package) cache seems fine. The package manager
shall use subdirectories and/or unique file names, so there should be no
accidental conflict, and using the same cache directory allows the cache to be
reused when possible. OTOH, sharing of the directory for the build directory is
unlikely to be useful (since at least the configuration will usually be
different, so the build would generally mean rebuilding anything anyway), but
also the build system might not do cache invalidation strongly enough, leading
to inadvertetent sharing of build artifacts. Let's avoid the issue completely
but not sharing the build directory between different distributions releases or
architectures.

This partially reverts b17810b4b571d0acbb307a6f7cd5c6456a45e4d3.

NEWS.md
mkosi/config.py

diff --git a/NEWS.md b/NEWS.md
index 5a122c60c8ad63a6a9856c17ad0adfcc9908df0b..074c67ebcead67400aa28d36668a8891190862fa 100644 (file)
--- a/NEWS.md
+++ b/NEWS.md
 - We now automatically configure the qemu firmware, kernel cmdline and
   initrd based on what type of kernel is passed by the user via
   `-kernel` or `QemuKernel=`
-- We don't create subdirectories beneath the configured cache or build
-  directories anymore. To get back the previous behavior, configure the
-  cache and build directories as follows:
+- We don't create subdirectories beneath the configured cache directory
+  anymore. To get back the previous behavior, configure the cache directory
+  with subdirectories:
 
   ```conf
   CacheDirectory=mkosi.cache/%d~%r~%a
-  BuildDirectory=mkosi.builddir/%d~%r~%a
   ```
 
 ## v18
index 2c6468cc7655f4391725a59258cf1bb4e29ac753..b9154f4ef0b4d1fb28c789abe98a279030dc9c1e 100644 (file)
@@ -2604,6 +2604,9 @@ def load_config(args: argparse.Namespace) -> MkosiConfig:
     if args.cmdline and not args.verb.supports_cmdline():
         die(f"Arguments after verb are not supported for {args.verb}.")
 
+    if args.build_dir:
+        args.build_dir = args.build_dir / f"{args.distribution}~{args.release}~{args.architecture}"
+
     if args.sign:
         args.checksum = True