From 172ad053ffb39321deb918c432114f35ec2c66a3 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Thu, 16 Jul 2020 21:27:50 +0100 Subject: [PATCH 1/2] mkosi: Keep mkosi.default out of the repository. Defaulting to fedora makes it a pain to override mkosi.default point to one of the other mkosi settings files. Instead, have every developer manually add the symlink to his distro of choice and don't commit the symlink to the repository by putting it in the .gitignore. --- .gitignore | 1 + docs/HACKING.md | 36 ++++++++++++++++++++---------------- mkosi.default | 1 - 3 files changed, 21 insertions(+), 17 deletions(-) delete mode 120000 mkosi.default diff --git a/.gitignore b/.gitignore index f47de39f3d..0b2092d740 100644 --- a/.gitignore +++ b/.gitignore @@ -35,4 +35,5 @@ __pycache__/ /.mkosi-* /mkosi.builddir/ /mkosi.output/ +/mkosi.default /tags diff --git a/docs/HACKING.md b/docs/HACKING.md index a86a6f2172..990f78c9eb 100644 --- a/docs/HACKING.md +++ b/docs/HACKING.md @@ -36,9 +36,12 @@ building clean OS images from an upstream distribution in combination with a fresh build of the project in the local working directory. To make use of this, please acquire `mkosi` from https://github.com/systemd/mkosi first, unless your distribution has packaged it already and you can get it from there. After the -tool is installed it is sufficient to type `mkosi` in the systemd project -directory to generate a disk image `image.raw` you can boot either in -`systemd-nspawn` or in an UEFI-capable VM: +tool is installed, symlink the settings file for your distribution of choice from +.mkosi/ to mkosi.default in the project root directory (note that the package +manager for this distro needs to be installed on your host system). After doing +that, it is sufficient to type `mkosi` in the systemd project directory to +generate a disk image `image.raw` you can boot either in `systemd-nspawn` or in +an UEFI-capable VM: ``` # systemd-nspawn -bi image.raw @@ -72,22 +75,23 @@ Putting this all together, here's a series of commands for preparing a patch for systemd (this example is for Fedora): ```sh -$ sudo dnf builddep systemd # install build dependencies -$ sudo dnf install mkosi # install tool to quickly build images +$ sudo dnf builddep systemd # install build dependencies +$ sudo dnf install mkosi # install tool to quickly build images $ git clone https://github.com/systemd/systemd.git $ cd systemd -$ vim src/core/main.c # or wherever you'd like to make your changes -$ meson build # configure the build -$ ninja -C build # build it locally, see if everything compiles fine -$ ninja -C build test # run some simple regression tests -$ (umask 077; echo 123 > mkosi.rootpw) # set root password used by mkosi -$ sudo mkosi # build a test image -$ sudo systemd-nspawn -bi image.raw # boot up the test image -$ git add -p # interactively put together your patch -$ git commit # commit it +$ vim src/core/main.c # or wherever you'd like to make your changes +$ meson build # configure the build +$ ninja -C build # build it locally, see if everything compiles fine +$ ninja -C build test # run some simple regression tests +$ ln -s .mkosi/mkosi.fedora mkosi.default # Configure mkosi to build a fedora image +$ (umask 077; echo 123 > mkosi.rootpw) # set root password used by mkosi +$ sudo mkosi # build a test image +$ sudo systemd-nspawn -bi image.raw # boot up the test image +$ git add -p # interactively put together your patch +$ git commit # commit it $ git push REMOTE HEAD:refs/heads/BRANCH - # where REMOTE is your "fork" on GitHub - # and BRANCH is a branch name. + # where REMOTE is your "fork" on GitHub + # and BRANCH is a branch name. ``` And after that, head over to your repo on GitHub and click "Compare & pull request" diff --git a/mkosi.default b/mkosi.default deleted file mode 120000 index 2718c9e2a0..0000000000 --- a/mkosi.default +++ /dev/null @@ -1 +0,0 @@ -.mkosi/mkosi.fedora \ No newline at end of file From e5f001065979da32c8d225c9840ce51c0a88e10a Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Thu, 16 Jul 2020 21:41:11 +0100 Subject: [PATCH 2/2] mkosi: Update help comment in settings files --- .mkosi/mkosi.arch | 2 +- .mkosi/mkosi.debian | 2 +- .mkosi/mkosi.fedora | 2 +- .mkosi/mkosi.opensuse | 2 +- .mkosi/mkosi.ubuntu | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.mkosi/mkosi.arch b/.mkosi/mkosi.arch index 965e26e411..cb1952206d 100644 --- a/.mkosi/mkosi.arch +++ b/.mkosi/mkosi.arch @@ -3,7 +3,7 @@ # Copyright © 2016 Zeal Jagannatha # This is a settings file for OS image generation using mkosi (https://github.com/systemd/mkosi). -# Simply invoke "mkosi" in the project directory to build an OS image. +# Symlink this file to mkosi.default in the project root directory and invoke "mkosi" to build an OS image. [Distribution] Distribution=arch diff --git a/.mkosi/mkosi.debian b/.mkosi/mkosi.debian index ff0c8ffc07..db9bd3550e 100644 --- a/.mkosi/mkosi.debian +++ b/.mkosi/mkosi.debian @@ -1,7 +1,7 @@ # SPDX-License-Identifier: LGPL-2.1+ # This is a settings file for OS image generation using mkosi (https://github.com/systemd/mkosi). -# Simply invoke "mkosi" in the project directory to build an OS image. +# Symlink this file to mkosi.default in the project root directory and invoke "mkosi" to build an OS image. [Distribution] Distribution=debian diff --git a/.mkosi/mkosi.fedora b/.mkosi/mkosi.fedora index 5caf8a1866..09527711fe 100644 --- a/.mkosi/mkosi.fedora +++ b/.mkosi/mkosi.fedora @@ -1,7 +1,7 @@ # SPDX-License-Identifier: LGPL-2.1+ # This is a settings file for OS image generation using mkosi (https://github.com/systemd/mkosi). -# Simply invoke "mkosi" in the project directory to build an OS image. +# Symlink this file to mkosi.default in the project root directory and invoke "mkosi" to build an OS image. [Distribution] Distribution=fedora diff --git a/.mkosi/mkosi.opensuse b/.mkosi/mkosi.opensuse index 248a7f53c8..53837b6be8 100644 --- a/.mkosi/mkosi.opensuse +++ b/.mkosi/mkosi.opensuse @@ -1,7 +1,7 @@ # SPDX-License-Identifier: LGPL-2.1+ # This is a settings file for OS image generation using mkosi (https://github.com/systemd/mkosi). -# Simply invoke "mkosi" in the project directory to build an OS image. +# Symlink this file to mkosi.default in the project root directory and invoke "mkosi" to build an OS image. [Distribution] Distribution=opensuse diff --git a/.mkosi/mkosi.ubuntu b/.mkosi/mkosi.ubuntu index fc3192ccad..990e9c1cbc 100644 --- a/.mkosi/mkosi.ubuntu +++ b/.mkosi/mkosi.ubuntu @@ -1,7 +1,7 @@ # SPDX-License-Identifier: LGPL-2.1+ # This is a settings file for OS image generation using mkosi (https://github.com/systemd/mkosi). -# Simply invoke "mkosi" in the project directory to build an OS image. +# Symlink this file to mkosi.default in the project root directory and invoke "mkosi" to build an OS image. [Distribution] Distribution=ubuntu