]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Add DISTRIBUTION_ARCHITECTURE environment variable 2868/head
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Sun, 14 Jul 2024 14:51:53 +0000 (16:51 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Sun, 14 Jul 2024 14:51:53 +0000 (16:51 +0200)
mkosi/__init__.py
mkosi/resources/mkosi.md

index 23c9dad37fe876d2b0b4f4bb50f8936166860aaf..77791c9eda6918990250c5c5ce128607e40c3787 100644 (file)
@@ -436,6 +436,7 @@ def run_configure_scripts(config: Config) -> Config:
         RELEASE=config.release,
         ARCHITECTURE=str(config.architecture),
         QEMU_ARCHITECTURE=config.architecture.to_qemu(),
+        DISTRIBUTION_ARCHITECTURE=config.distribution.architecture(config.architecture),
         SRCDIR="/work/src",
         MKOSI_UID=str(INVOKING_USER.uid),
         MKOSI_GID=str(INVOKING_USER.gid),
@@ -473,6 +474,7 @@ def run_sync_scripts(context: Context) -> None:
         DISTRIBUTION=str(context.config.distribution),
         RELEASE=context.config.release,
         ARCHITECTURE=str(context.config.architecture),
+        DISTRIBUTION_ARCHITECTURE=context.config.distribution.architecture(context.config.architecture),
         SRCDIR="/work/src",
         MKOSI_UID=str(INVOKING_USER.uid),
         MKOSI_GID=str(INVOKING_USER.gid),
@@ -533,6 +535,7 @@ def run_prepare_scripts(context: Context, build: bool) -> None:
         DISTRIBUTION=str(context.config.distribution),
         RELEASE=context.config.release,
         ARCHITECTURE=str(context.config.architecture),
+        DISTRIBUTION_ARCHITECTURE=context.config.distribution.architecture(context.config.architecture),
         BUILDROOT="/buildroot",
         SRCDIR="/work/src",
         CHROOT_SRCDIR="/work/src",
@@ -617,6 +620,7 @@ def run_build_scripts(context: Context) -> None:
         DISTRIBUTION=str(context.config.distribution),
         RELEASE=context.config.release,
         ARCHITECTURE=str(context.config.architecture),
+        DISTRIBUTION_ARCHITECTURE=context.config.distribution.architecture(context.config.architecture),
         BUILDROOT="/buildroot",
         DESTDIR="/work/dest",
         CHROOT_DESTDIR="/work/dest",
@@ -705,6 +709,7 @@ def run_postinst_scripts(context: Context) -> None:
         DISTRIBUTION=str(context.config.distribution),
         RELEASE=context.config.release,
         ARCHITECTURE=str(context.config.architecture),
+        DISTRIBUTION_ARCHITECTURE=context.config.distribution.architecture(context.config.architecture),
         BUILDROOT="/buildroot",
         OUTPUTDIR="/work/out",
         CHROOT_OUTPUTDIR="/work/out",
@@ -782,6 +787,7 @@ def run_finalize_scripts(context: Context) -> None:
         DISTRIBUTION=str(context.config.distribution),
         RELEASE=context.config.release,
         ARCHITECTURE=str(context.config.architecture),
+        DISTRIBUTION_ARCHITECTURE=context.config.distribution.architecture(context.config.architecture),
         BUILDROOT="/buildroot",
         OUTPUTDIR="/work/out",
         CHROOT_OUTPUTDIR="/work/out",
@@ -857,6 +863,7 @@ def run_postoutput_scripts(context: Context) -> None:
         DISTRIBUTION=str(context.config.distribution),
         RELEASE=context.config.release,
         ARCHITECTURE=str(context.config.architecture),
+        DISTRIBUTION_ARCHITECTURE=context.config.distribution.architecture(context.config.architecture),
         SRCDIR="/work/src",
         OUTPUTDIR="/work/out",
         MKOSI_UID=str(INVOKING_USER.uid),
@@ -4483,6 +4490,7 @@ def run_clean_scripts(config: Config) -> None:
         DISTRIBUTION=str(config.distribution),
         RELEASE=config.release,
         ARCHITECTURE=str(config.architecture),
+        DISTRIBUTION_ARCHITECTURE=config.distribution.architecture(config.architecture),
         SRCDIR="/work/src",
         OUTPUTDIR="/work/out",
         MKOSI_UID=str(INVOKING_USER.uid),
index 8606f7ca171c638558dcf9770582c74be25281de..274ca206d89e8acf615e6b42904090e8722f908d 100644 (file)
@@ -2085,6 +2085,9 @@ Scripts executed by mkosi receive the following environment variables:
 
 * `$RELEASE` contains the release from the `Release=` setting.
 
+* `$DISTRIBUTION_ARCHITECTURE` contains the architecture from
+  `$ARCHITECTURE` in the format used by the configured distribution.
+
 * `$PROFILE` contains the profile from the `Profile=` setting.
 
 * `$CACHED=` is set to `1` if a cached image is available, `0` otherwise.
@@ -2176,33 +2179,34 @@ Scripts executed by mkosi receive the following environment variables:
 
 Consult this table for which script receives which environment variables:
 
-| Variable            | `configure` | `sync` | `prepare` | `build` | `postinst` | `finalize` | `postoutput` | `clean` |
-|---------------------|:-----------:|:------:|:---------:|:-------:|:----------:|:----------:|:------------:|:-------:|
-| `ARCHITECTURE`      | ✓           | ✓      | ✓         | ✓       | ✓          | ✓          | ✓            | ✓       |
-| `QEMU_ARCHITECTURE` | ✓           |        |           |         |            |            |              |         |
-| `DISTRIBUTION`      | ✓           | ✓      | ✓         | ✓       | ✓          | ✓          | ✓            | ✓       |
-| `RELEASE`           | ✓           | ✓      | ✓         | ✓       | ✓          | ✓          | ✓            | ✓       |
-| `PROFILE`           | ✓           | ✓      | ✓         | ✓       | ✓          | ✓          |              | ✓       |
-| `CACHED`            |             | ✓      |           |         |            |            |              |         |
-| `CHROOT_SCRIPT`     |             |        | ✓         | ✓       | ✓          | ✓          |              |         |
-| `SRCDIR`            | ✓           | ✓      | ✓         | ✓       | ✓          | ✓          | ✓            | ✓       |
-| `CHROOT_SRCDIR`     |             |        | ✓         | ✓       | ✓          | ✓          |              |         |
-| `BUILDDIR`          |             |        | ✓         | ✓       | ✓          | ✓          |              |         |
-| `CHROOT_BUILDDIR`   |             |        |           | ✓       |            |            |              |         |
-| `DESTDIR`           |             |        |           | ✓       |            |            |              |         |
-| `CHROOT_DESTDIR`    |             |        |           | ✓       |            |            |              |         |
-| `OUTPUTDIR`         |             |        |           | ✓       | ✓          | ✓          | ✓            | ✓       |
-| `CHROOT_OUTPUTDIR`  |             |        |           | ✓       | ✓          | ✓          |              |         |
-| `BUILDROOT`         |             |        | ✓         | ✓       | ✓          | ✓          |              |         |
-| `PACKAGEDIR`        |             |        | ✓         | ✓       | ✓          | ✓          |              |         |
-| `ARTIFACTDIR`       |             |        | ✓         | ✓       | ✓          | ✓          |              |         |
-| `WITH_DOCS`         |             |        | ✓         | ✓       |            |            |              |         |
-| `WITH_TESTS`        |             |        | ✓         | ✓       |            |            |              |         |
-| `WITH_NETWORK`      |             |        | ✓         | ✓       | ✓          | ✓          |              |         |
-| `SOURCE_DATE_EPOCH` |             |        | ✓         | ✓       | ✓          | ✓          |              | ✓       |
-| `MKOSI_UID`         | ✓           | ✓      | ✓         | ✓       | ✓          | ✓          | ✓            | ✓       |
-| `MKOSI_GID`         | ✓           | ✓      | ✓         | ✓       | ✓          | ✓          | ✓            | ✓       |
-| `MKOSI_CONFIG`      |             | ✓      | ✓         | ✓       | ✓          | ✓          | ✓            | ✓       |
+| Variable                    | `configure` | `sync` | `prepare` | `build` | `postinst` | `finalize` | `postoutput` | `clean` |
+|-----------------------------|:-----------:|:------:|:---------:|:-------:|:----------:|:----------:|:------------:|:-------:|
+| `ARCHITECTURE`              | ✓           | ✓      | ✓         | ✓       | ✓          | ✓          | ✓            | ✓       |
+| `QEMU_ARCHITECTURE`         | ✓           |        |           |         |            |            |              |         |
+| `DISTRIBUTION`              | ✓           | ✓      | ✓         | ✓       | ✓          | ✓          | ✓            | ✓       |
+| `DISTRIBUTION_ARCHITECTURE` | ✓           | ✓      | ✓         | ✓       | ✓          | ✓          | ✓            | ✓       |
+| `RELEASE`                   | ✓           | ✓      | ✓         | ✓       | ✓          | ✓          | ✓            | ✓       |
+| `PROFILE`                   | ✓           | ✓      | ✓         | ✓       | ✓          | ✓          |              | ✓       |
+| `CACHED`                    |             | ✓      |           |         |            |            |              |         |
+| `CHROOT_SCRIPT`             |             |        | ✓         | ✓       | ✓          | ✓          |              |         |
+| `SRCDIR`                    | ✓           | ✓      | ✓         | ✓       | ✓          | ✓          | ✓            | ✓       |
+| `CHROOT_SRCDIR`             |             |        | ✓         | ✓       | ✓          | ✓          |              |         |
+| `BUILDDIR`                  |             |        | ✓         | ✓       | ✓          | ✓          |              |         |
+| `CHROOT_BUILDDIR`           |             |        |           | ✓       |            |            |              |         |
+| `DESTDIR`                   |             |        |           | ✓       |            |            |              |         |
+| `CHROOT_DESTDIR`            |             |        |           | ✓       |            |            |              |         |
+| `OUTPUTDIR`                 |             |        |           | ✓       | ✓          | ✓          | ✓            | ✓       |
+| `CHROOT_OUTPUTDIR`          |             |        |           | ✓       | ✓          | ✓          |              |         |
+| `BUILDROOT`                 |             |        | ✓         | ✓       | ✓          | ✓          |              |         |
+| `PACKAGEDIR`                |             |        | ✓         | ✓       | ✓          | ✓          |              |         |
+| `ARTIFACTDIR`               |             |        | ✓         | ✓       | ✓          | ✓          |              |         |
+| `WITH_DOCS`                 |             |        | ✓         | ✓       |            |            |              |         |
+| `WITH_TESTS`                |             |        | ✓         | ✓       |            |            |              |         |
+| `WITH_NETWORK`              |             |        | ✓         | ✓       | ✓          | ✓          |              |         |
+| `SOURCE_DATE_EPOCH`         |             |        | ✓         | ✓       | ✓          | ✓          |              | ✓       |
+| `MKOSI_UID`                 | ✓           | ✓      | ✓         | ✓       | ✓          | ✓          | ✓            | ✓       |
+| `MKOSI_GID`                 | ✓           | ✓      | ✓         | ✓       | ✓          | ✓          | ✓            | ✓       |
+| `MKOSI_CONFIG`              |             | ✓      | ✓         | ✓       | ✓          | ✓          | ✓            | ✓       |
 
 Additionally, when a script is executed, a few scripts are made
 available via `$PATH` to simplify common usecases.