From: Zbigniew Jędrzejewski-Szmek Date: Mon, 30 Oct 2023 17:20:41 +0000 (+0100) Subject: Restore subdirectory use for $BUILDDIR X-Git-Tag: v19~31 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=44b19907d2c72234c6114ea3fe1be18b6346eee6;p=thirdparty%2Fmkosi.git Restore subdirectory use for $BUILDDIR 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. --- diff --git a/NEWS.md b/NEWS.md index 5a122c60c..074c67ebc 100644 --- a/NEWS.md +++ b/NEWS.md @@ -36,13 +36,12 @@ - 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 diff --git a/mkosi/config.py b/mkosi/config.py index 2c6468cc7..b9154f4ef 100644 --- a/mkosi/config.py +++ b/mkosi/config.py @@ -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