]> git.ipfire.org Git - thirdparty/mkosi.git/log
thirdparty/mkosi.git
3 years agomkosi: adjust comment for readability 781/head
Zbigniew Jędrzejewski-Szmek [Fri, 3 Sep 2021 08:20:33 +0000 (10:20 +0200)] 
mkosi: adjust comment for readability

3 years agomkosi: make ARG_DEBUG a set
Zbigniew Jędrzejewski-Szmek [Fri, 3 Sep 2021 08:20:18 +0000 (10:20 +0200)] 
mkosi: make ARG_DEBUG a set

With this change, ARG_DEBUG is always the same (mutable) object.
Before it was first a tuple, and then a list, so the object (and type)
changed. When we did 'from backend import ARG_DEBUG', we would get a
reference to the tuple, and then when ARG_DEBUG was adjusted in backend,
the import wasn't properly updated. ('backend.ARG_DEBUG' would refer
to one object, and '__init__.ARG_DEBUG' to a different one.)

With this change, --debug run works again for me.

3 years agomkosi/backend: fix priting of the executed commands
Zbigniew Jędrzejewski-Szmek [Fri, 3 Sep 2021 08:16:44 +0000 (10:16 +0200)] 
mkosi/backend: fix priting of the executed commands

Apparently this got borked in 80523f224e2f07b04bf14ec098da7108cdb1e070
and nobody noticed.

3 years agoMerge pull request #780 from keszybz/man-use-config-keys-as-primary
Zbigniew Jędrzejewski-Szmek [Fri, 3 Sep 2021 08:44:27 +0000 (10:44 +0200)] 
Merge pull request #780 from keszybz/man-use-config-keys-as-primary

Use config keys as primary in documentation, rename [Packages] to [Content]

3 years agoMerge pull request #768 from keszybz/mkosi-manifest
Zbigniew Jędrzejewski-Szmek [Thu, 2 Sep 2021 10:41:23 +0000 (12:41 +0200)] 
Merge pull request #768 from keszybz/mkosi-manifest

mkosi: record package list and changelogs in files

3 years agoman: regerate man page 780/head
Zbigniew Jędrzejewski-Szmek [Thu, 2 Sep 2021 10:40:59 +0000 (12:40 +0200)] 
man: regerate man page

3 years agoMove settings for password/autologin to [Content]
Zbigniew Jędrzejewski-Szmek [Fri, 27 Aug 2021 16:32:44 +0000 (18:32 +0200)] 
Move settings for password/autologin to [Content]

3 years agoRename [Packages] to [Content]
Zbigniew Jędrzejewski-Szmek [Tue, 17 Aug 2021 11:55:38 +0000 (13:55 +0200)] 
Rename [Packages] to [Content]

Initially, that section was mostly about packages. But now we have
a bazillion settings, out of which only a handful is about packages.

Backwards compatibility is preserved, the old name is automatically
translated in the config parser.

3 years agoman: describe SkeletonTree before ExtraTree
Zbigniew Jędrzejewski-Szmek [Tue, 17 Aug 2021 10:54:41 +0000 (12:54 +0200)] 
man: describe SkeletonTree before ExtraTree

In ee67e6ab3ea0353791eb3a37d166341dafeb44a5 I did the anologous change
in the Files section, but missed this spot.

3 years agoman: minor fixes and rewrappings of long paragraphs
Zbigniew Jędrzejewski-Szmek [Tue, 17 Aug 2021 10:39:44 +0000 (12:39 +0200)] 
man: minor fixes and rewrappings of long paragraphs

3 years agoman: refer to settings primarily by their config file name
Zbigniew Jędrzejewski-Szmek [Tue, 17 Aug 2021 10:31:32 +0000 (12:31 +0200)] 
man: refer to settings primarily by their config file name

This implements the first part of #769: the structure of the man page
is changed from:

Command Line Parameters
--foo
...
Command Line Parameters and their Settings File Counterparts
--foo Output Foo=
...

to:

Settings
[Output] section
Foo=
--foo
...

I think the new order is both easier to read _and_ easier to maintain.
E.g. the table with option name mappings was missing a few entries.

I dropped "(see above)" and "(see below)" in various places. The user
knows that they can search for a given option name, and we don't need
to tell them. And since the target of this "anchor" usually isn't right
below or right above, they will need to use search _anyway_.

An exception is when we wanted to refer to a description of a file
in the Files section. In those cases I changed "(see below)" to
"(see "Files" section below)" so the user actually knows what to look
for.

I inserted FIXMEs for various issues. Trying to fix everything at once
would lead to an unreviable commit…

The regeneration of man/ is not included in the commits, because it's
annoying to constantly fix this up when rebasing patches. I'll do it
one go at the end.

3 years agoMerge pull request #776 from keszybz/network-never
Daan De Meyer [Mon, 30 Aug 2021 08:49:43 +0000 (09:49 +0100)] 
Merge pull request #776 from keszybz/network-never

Fix handling of --with-network=never and actually apply the setting in dnf as documented

3 years agodnf: when runnning with --network=never, use package metadata cache 776/head
Zbigniew Jędrzejewski-Szmek [Wed, 4 Aug 2021 10:40:51 +0000 (12:40 +0200)] 
dnf: when runnning with --network=never, use package metadata cache

This implements the ability to rebuild packages from cache that was requested
in #700. I don't think it can be said to resolve the issue, since this is
only a partial solution, but useful nonetheless.

3 years agoFix the handling of --with-network
Zbigniew Jędrzejewski-Szmek [Fri, 27 Aug 2021 17:39:30 +0000 (19:39 +0200)] 
Fix the handling of --with-network

The man page describes "never", and the initial parser supported that,
but later on it was treated as a boolean.

3 years agomkosi: remove unnecessary argument specification 768/head
Zbigniew Jędrzejewski-Szmek [Thu, 12 Aug 2021 12:56:02 +0000 (14:56 +0200)] 
mkosi: remove unnecessary argument specification

'dest' is autoinitialized to the option name.

3 years agomkosi: add ManifestFormat= option to select what is written
Zbigniew Jędrzejewski-Szmek [Thu, 12 Aug 2021 12:54:27 +0000 (14:54 +0200)] 
mkosi: add ManifestFormat= option to select what is written

The default is 'json'. Specifying the empty list disables writing
of the manifest.

4 years agomkosi: use image output format type when cleaning up stale btrfs devices
Peter Morrow [Thu, 26 Aug 2021 11:39:12 +0000 (12:39 +0100)] 
mkosi: use image output format type when cleaning up stale btrfs devices

Rather than using the presence of the btrfs-progs/tools package as the
indicator to run "btrfs device scan -u" use the output format type.

Signed-off-by: Peter Morrow <pemorrow@linux.microsoft.com>
4 years agoDon't let dracut generate implicit devices in hostonly mode
Daan De Meyer [Fri, 20 Aug 2021 13:33:13 +0000 (14:33 +0100)] 
Don't let dracut generate implicit devices in hostonly mode

If hostonly_default_device is enabled, details from the host system devices
leak into the initrd which we want to avoid. For example, this caused the
seclabel mount option to leak into the mount options of my mkosi generated
BTRFS mount options rendering the image unbootable in QEMU.

4 years agoFix pyright typing errors 773/head
Daan De Meyer [Sun, 8 Aug 2021 12:58:25 +0000 (13:58 +0100)] 
Fix pyright typing errors

pyright is an alternative type checker for Python. It's main advantage
over mypy is that it's a lot faster than mypy which makes it a lot more
pleasant to use in VSCode for in-editor type checking.

This commit fixes the typing errors flagged by pyright.

4 years agomkosi: only print the summary when explicitly requested
Zbigniew Jędrzejewski-Szmek [Thu, 12 Aug 2021 11:58:41 +0000 (13:58 +0200)] 
mkosi: only print the summary when explicitly requested

Originally, the summary was printed whenever a build was done.
With 1f9a758fad3debbdddd2947a19978de3909aabf7, it is only printed
for cached builds. But that is surprising: when I turn on caching,
I suddently get extra output. Let's just print the summary when
requested.

4 years agomkosi: enhance ListAction to filter out duplicates
Zbigniew Jędrzejewski-Szmek [Thu, 12 Aug 2021 12:02:28 +0000 (14:02 +0200)] 
mkosi: enhance ListAction to filter out duplicates

All the arguments we use it for don't care about the order and
repeats, but it's nicer for the user if we remove duplicates.

Also, let's make it not fail on non-string types, so that it can
be used with enum.Enum.

4 years agobackend: move the OutputFormat conversion helpers to a mix-in class
Zbigniew Jędrzejewski-Szmek [Thu, 12 Aug 2021 10:18:42 +0000 (12:18 +0200)] 
backend: move the OutputFormat conversion helpers to a mix-in class

No functional change.

4 years agomkosi: print paths relative to the current working directory
Zbigniew Jędrzejewski-Szmek [Thu, 12 Aug 2021 09:08:03 +0000 (11:08 +0200)] 
mkosi: print paths relative to the current working directory

We would print a bunch of paths, and they tend to be quite long,
especially if 'mkosi.output' is used. The output on the console is
supposed to be pretty and easy to read. The user is most likely to
use the path to interact with the file in the same terminal, e.g.
'less mkosi.output/something.manifest', so let's just print the
paths that are underneath the current directory as relative to it.
This makes the output more readable while the paths can still be
used directly in subsequent commands most of the time.

Also, drop "Successfully" from messages: it is a long word, and
superfluous, since we either print an error message or this.

4 years agomkosi: record package list and changelogs in a text file
Zbigniew Jędrzejewski-Szmek [Tue, 10 Aug 2021 20:21:16 +0000 (22:21 +0200)] 
mkosi: record package list and changelogs in a text file

The output is something like this:

"""
Packages: 117
Size:     158417187

--------------------------------------------------------------------------------

SourcePackage: acl-2.3.1-2.fc35.src.rpm
Packages:      acl libacl
Size:          254969

Changelog:
* Wed Jul 21 2021 Fedora Release Engineering <releng@fedoraproject.org> - 2.3.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild

* Tue Mar 16 2021 Kamil Dudka <kdudka@redhat.com> - 2.3.1-1
- new upstream release
...
"""

The idea is that it's easy to diff such files. When the changes are
relatively small, for example between the same distro on different days,
we can easily see what changed, and why. For example, between F34 and F35
I get the following diff:

-Packages: 120
-Size:     164097624
+Packages: 117
+Size:     158417187
...
-SourcePackage: acl-2.3.1-1.fc34.src.rpm
+SourcePackage: acl-2.3.1-2.fc35.src.rpm
 Packages:      acl libacl
-Size:          255585
+Size:          254969

 Changelog:
+* Wed Jul 21 2021 Fedora Release Engineering <releng@fedoraproject.org> - 2.3.1-2
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
+
 * Tue Mar 16 2021 Kamil Dudka <kdudka@redhat.com> - 2.3.1-1
 - new upstream release
...
-SourcePackage: compat-readline5-5.2-39.fc34.src.rpm
-Packages:      compat-readline5
-Size:          389854
-
-Changelog:
-* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 5.2-39
-- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
-
-* Thu Aug 13 2020 Tomas Korbar <tkorbar@redhat.com> - 5.2-38
-- Use make macros
-- https://fedoraproject.org/wiki/Changes/UseMakeBuildInstallMacro
-
-* Mon Jul 27 2020 Fedora Release Engineering <releng@fedoraproject.org> - 5.2-37
-- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
-
-* Tue Jan 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 5.2-36
-- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
-
-* Fri Jan 17 2020 Jeff Law <law@redhat.com> - 5.2-35
-- Fix configure test for MUST_REINSTALL_SIGLHANDLERS
-  compromised by LTO
-
-* Wed Jul 24 2019 Fedora Release Engineering <releng@fedoraproject.org> - 5.2-34
-- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
-
-* Thu Jan 31 2019 Fedora Release Engineering <releng@fedoraproject.org> - 5.2-33
-- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
...
-SourcePackage: cracklib-2.9.6-25.fc34.src.rpm
-Packages:      cracklib
-Size:          251906
+SourcePackage: cracklib-2.9.6-26.fc35.src.rpm
+Packages:      cracklib cracklib-dicts
+Size:          10066620

 Changelog:
+* Wed Jul 21 2021 Fedora Release Engineering <releng@fedoraproject.org> - 2.9.6-26
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
+
 * Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 2.9.6-25
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
"""

So when the package changed, we know *why* it changed, and can often
jump directly to the related bugs and such. For example, we now get
cracklib-dicts (yes, very useful), but the package itself didn't change.
Something else pulls it in [1]. Such a diff is useful when trying to
see debug regressions between related builds or minimizing the package
set.

Fixes #748.

[1] https://bugzilla.redhat.com/show_bug.cgi?id=1992607

4 years agomkosi: record package list in a json manifest
Zbigniew Jędrzejewski-Szmek [Tue, 10 Aug 2021 20:21:16 +0000 (22:21 +0200)] 
mkosi: record package list in a json manifest

The output is something like this

{
  "packages": [
    {
      "type": "rpm",
      "name": "acl",
      "version": "2.3.1-2.fc35.x86_64"
    },
    {
      "type": "rpm",
      "name": "alternatives",
      "version": "1.19-1.fc35.x86_64"
    },
    {
      "type": "rpm",
      "name": "audit-libs",
      "version": "3.0.3-2.fc35.x86_64"
    },
    ...
  ]
}

This is a partial step towards #700, but has other uses too.

4 years agobackend: classify distributions according to the package type
Zbigniew Jędrzejewski-Szmek [Wed, 11 Aug 2021 14:15:15 +0000 (16:15 +0200)] 
backend: classify distributions according to the package type

Also add a very simple test to check that I didn't mess something up
too badly with all the casts and __new__ twiddling.

4 years agoNEWS: fix typo
Zbigniew Jędrzejewski-Szmek [Thu, 12 Aug 2021 15:05:54 +0000 (17:05 +0200)] 
NEWS: fix typo

4 years agomkosi: call dracut/unified kernel image on the final image, not the cached image
Lennart Poettering [Wed, 16 Jun 2021 22:11:13 +0000 (00:11 +0200)] 
mkosi: call dracut/unified kernel image on the final image, not the cached image

We need to invoke dracut on the final image, not on the cached image.
Currently, it's done the other way round, in light of the fact that
dracut is the slowest part of the build. However that doesn't really
work, since the generated unified kernel image depends on the final
build.

The generated image after all will:

1. when verity is enabled receives the root hash which depends on the
   final fs image to be complete

2. when the image id/version logic is enabled the unified kernel image
   name will change with every build

3. we want to base the initrd on the resources installed in the OS
   during the build. Besides configuration this prominently includes a
   freshly build systemd. After all, one of the major usecases for mkosi
   was to be useful to build test images for systemd development. There
   we really want to ensure the systemd we just built is included in the
   initrd, and not an old version that happened to be around when the
   cache image was first created.

This reverts major parts of e4277c77618f47be6a5126a709f64ad48492807b

4 years agoMerge pull request #765 from keszybz/better-environment-setting
Daan De Meyer [Mon, 9 Aug 2021 11:08:18 +0000 (12:08 +0100)] 
Merge pull request #765 from keszybz/better-environment-setting

Better --environment setting

4 years agomkosi: extend --environment to cover all scripts 765/head
Zbigniew Jędrzejewski-Szmek [Sat, 7 Aug 2021 12:17:38 +0000 (14:17 +0200)] 
mkosi: extend --environment to cover all scripts

I would like to set environment variables for other scripts. But I
don't think adding separate options make sense: it should be fine to
just set the same environment variable for all scripts that are
invoked… After all, variables are best for "global" settings. Scripts
already get positional arguments that allow them to distinguish build
phases, so they don't need to use variables for this.

4 years agoMerge pull request #764 from keszybz/various-cleanups-and-refactorings
Zbigniew Jędrzejewski-Szmek [Sat, 7 Aug 2021 13:11:38 +0000 (15:11 +0200)] 
Merge pull request #764 from keszybz/various-cleanups-and-refactorings

Various cleanups and refactorings

4 years agomkosi: rename --build-environment to --environment/-E
Zbigniew Jędrzejewski-Szmek [Sat, 7 Aug 2021 11:05:39 +0000 (13:05 +0200)] 
mkosi: rename --build-environment to --environment/-E

This just renames the option, but doesn't change the semantics yet.
The old name is kept for compatibility, but not advertised.

4 years agomkosi: pull in envvar value from the environment if no value specified
Zbigniew Jędrzejewski-Szmek [Sat, 7 Aug 2021 07:14:27 +0000 (09:14 +0200)] 
mkosi: pull in envvar value from the environment if no value specified

This makes --build-env=FOO behave like --build-env=FOO=$FOO. This is a
common case, and it makes some invocations more convenient. In
particular, we avoid exposing the variable on the commandline.

4 years agoman: rebuild the man page
Zbigniew Jędrzejewski-Szmek [Sat, 7 Aug 2021 10:52:09 +0000 (12:52 +0200)] 
man: rebuild the man page

4 years agobackend: try to use shlex.join 764/head
Zbigniew Jędrzejewski-Szmek [Thu, 5 Aug 2021 15:48:37 +0000 (17:48 +0200)] 
backend: try to use shlex.join

It was added in 3.8, and unfortunately we still support python3.7.
Also remove the last backtick use in output.

4 years agomkosi: remove other uses of backticks in comments and output
Zbigniew Jędrzejewski-Szmek [Thu, 5 Aug 2021 15:38:53 +0000 (17:38 +0200)] 
mkosi: remove other uses of backticks in comments and output

4 years agomkosi: also pass the named tuple to mount_image()
Zbigniew Jędrzejewski-Szmek [Thu, 5 Aug 2021 10:13:56 +0000 (12:13 +0200)] 
mkosi: also pass the named tuple to mount_image()

This will hopefully make things easier if we add even more partition
types in the future…

4 years agomkosi: define NamedTuple to hold luks_setup_all() output
Zbigniew Jędrzejewski-Szmek [Wed, 4 Aug 2021 16:16:32 +0000 (18:16 +0200)] 
mkosi: define NamedTuple to hold luks_setup_all() output

I'm using a NamedTuple here, instead of a dataclass, because the
dataclass does not support indexing and iteration. It certainly would
be possible to define those, but with typing it becomes quite a lot of
code (and typing of __iter__() that supports both indexing and slicing
is tricky and verbose).

BuildOutput has no inherent ordering — it's a bunch of completely
different objects. But here we have a list of partitions, so it's
reasonable to use a tuple for this.

4 years agomkosi: rework link_output_*() to handle None internally
Zbigniew Jędrzejewski-Szmek [Wed, 4 Aug 2021 14:55:52 +0000 (16:55 +0200)] 
mkosi: rework link_output_*() to handle None internally

This makes build_stuff() more legible.

4 years agomkosi: use dataclass to hold build_image() output
Zbigniew Jędrzejewski-Szmek [Wed, 4 Aug 2021 14:34:55 +0000 (16:34 +0200)] 
mkosi: use dataclass to hold build_image() output

Passing around all the arguments was getting unwieldy…

4 years agomkosi: use complete_step() in one more place
Zbigniew Jędrzejewski-Szmek [Wed, 4 Aug 2021 13:01:21 +0000 (15:01 +0200)] 
mkosi: use complete_step() in one more place

4 years agomkosi: prettify format string
Zbigniew Jędrzejewski-Szmek [Wed, 4 Aug 2021 12:58:19 +0000 (14:58 +0200)] 
mkosi: prettify format string

It's better to avoid backticks because they are special for the shell
and make select-and-paste operations harder.

4 years agomkosi: create cache copy also for non-raw output formats
Zbigniew Jędrzejewski-Szmek [Wed, 4 Aug 2021 10:39:40 +0000 (12:39 +0200)] 
mkosi: create cache copy also for non-raw output formats

I don't quite grok the logic to skip the creation of the cache copy.
I'm using Format=directory, and I expected the cache copy to be there.
Since we can't overwrite one directory with another, unlink the output
when copying. (For raw output, which is a file, we don't need to unlink
because we can replace the file atomically.)
With this change, it is created and everything seems to work fine.

The assert is needed to placate mypy.

4 years agomkosi: do not suppress non-Exception exceptions when checking urls
Zbigniew Jędrzejewski-Szmek [Thu, 5 Aug 2021 10:46:07 +0000 (12:46 +0200)] 
mkosi: do not suppress non-Exception exceptions when checking urls

Same story… Let's rename the function while at it.

4 years agomkosi: do not suppress non-Exception exceptions in unlink_try_hard()
Zbigniew Jędrzejewski-Szmek [Wed, 4 Aug 2021 12:32:09 +0000 (14:32 +0200)] 
mkosi: do not suppress non-Exception exceptions in unlink_try_hard()

In 01eac0078a06334ed938b68a09db8799b490dfe0 annotations to suppress
warnings about this were added, sadly without any explanation, so we
can only guess what the author had in mind. But it doesn't seem
appropriate… If I press ^C while removing some files, it seems quite
wrong to continue execution. Also, if those operations fail on
permission errors, we also don't want to continue.

("except:" catches BaseException, which includes KeyboardInterrupt and
other things which should only be caught in very special
circumstances, like interactive shells.)

4 years agomkosi: use f-string in some more places
Zbigniew Jędrzejewski-Szmek [Wed, 4 Aug 2021 10:40:26 +0000 (12:40 +0200)] 
mkosi: use f-string in some more places

I think it's easier to read the code when the argument is "inline".

4 years agomkosi: include the ellipsis+dot in complete_step() in the format string
Zbigniew Jędrzejewski-Szmek [Wed, 4 Aug 2021 09:58:49 +0000 (11:58 +0200)] 
mkosi: include the ellipsis+dot in complete_step() in the format string

complete_step() already added an ellipsis and dot on its own (to the
opening message and to the cloing message, respectively), but in some
places we had "..." or "." in the format string anyway, so we eneded
up with six dots or four dots in output. But instead of fixing those
places, I think it's better to go in the opposite direction, and include
the terminator in the format string.

This is nicer because:
- It's just easier to see the complete format string including the
  terminator. The "saving" of a few characters by including it
  automatically isn't very important.
- If the line ends in a path, we should skip the terminator to make
  the path easier to select-and-paste. This is now trivial: just skip
  the terminator in the format string.
- If the step is "immediate" and we expect it to finish quickly and
  without any further output (like calling os.unlink() or such), we
  can skip the ellipsis.

While at it, let's change "..." to "…", it looks nicer and saves some
screen real estate.

4 years agobackend: indent printed steps by one space when recursing
Zbigniew Jędrzejewski-Szmek [Wed, 4 Aug 2021 10:36:30 +0000 (12:36 +0200)] 
backend: indent printed steps by one space when recursing

At least for me this makes the output a lot more easier to grok:
I know what is a substep of what:

‣ Detaching namespace...
‣ Setting up temporary workspace
‣ Temporary workspace in /home/zbyszek/src/mkosi-initrd/mkosi.output/.mkosi-bmqulbgi is now set up.
‣ Running second (final) stage to generate cached copy...
‣  Mounting image...
‣  Setting up basic OS tree...
‣  Mounting Package Cache...
‣  Installing Fedora...
‣   Mounting API VFS...
...
‣   Unmounting API VFS...
‣  Unmounting Package Cache...
‣  Removing random seed...
‣  Unmounting image...
‣  Installing cache copy ...
‣  Successfully installed cache copy /home/zbyszek/src/mkosi-initrd/mkosi.output/mkosi-5.13.4-200.fc34.x86_64.d.cache-pre-inst.
‣ Running second (final) stage...
...

4 years agobackend: move complete_step into the backend code
Zbigniew Jędrzejewski-Szmek [Wed, 4 Aug 2021 10:15:02 +0000 (12:15 +0200)] 
backend: move complete_step into the backend code

While at it, also make it a classmethod under MkosiPrinter…
It belongs there conceptually.

4 years agomkosi: say we are copying the cached tree only when it exists
Zbigniew Jędrzejewski-Szmek [Wed, 4 Aug 2021 09:59:31 +0000 (11:59 +0200)] 
mkosi: say we are copying the cached tree only when it exists

I was confused by the message that something is being copied in, when
there was nothing to copy.

4 years agomkosi: fix misleading comment
Zbigniew Jędrzejewski-Szmek [Wed, 4 Aug 2021 09:30:26 +0000 (11:30 +0200)] 
mkosi: fix misleading comment

4 years agomkosi: do not fail in incremental mode on second attempt to nuke locales
Zbigniew Jędrzejewski-Szmek [Wed, 4 Aug 2021 09:29:11 +0000 (11:29 +0200)] 
mkosi: do not fail in incremental mode on second attempt to nuke locales

We'd fail with FileNotFoundError on the second attempt :(

4 years agomkosi: do not fail in incremental mode on …/etc already existing
Zbigniew Jędrzejewski-Szmek [Wed, 4 Aug 2021 09:24:02 +0000 (11:24 +0200)] 
mkosi: do not fail in incremental mode on …/etc already existing

$ sudo mkosi --force -i --format=directory -o mkosi-5.13.4-200.fc34.x86_64.d/
...
‣ Unmounting API VFS...
‣ Unmounting Package Cache...
‣ Removing random seed...
‣ Unmounting image...
‣ Running second (final) stage...
‣ Mounting image...
‣ Setting up basic OS tree...
‣ (Unmounting image...)
Traceback (most recent call last):
...
FileExistsError: [Errno 17] File exists: '/home/zbyszek/src/mkosi-initrd/.mkosi-3legjys3/root/etc'

4 years agomkosi: de-emphasize completion of steps after an exception has occured
Zbigniew Jędrzejewski-Szmek [Wed, 4 Aug 2021 08:48:16 +0000 (10:48 +0200)] 
mkosi: de-emphasize completion of steps after an exception has occured

I had the following failure:
...
‣ Unmounting API VFS...
‣ Unmounting Package Cache...
‣ Removing random seed...
‣ Unmounting image...
‣ Running second (final) stage...
‣ Mounting image...
‣ Setting up basic OS tree...
‣ Unmounting image...
Traceback (most recent call last):
...
FileExistsError: [Errno 17] File exists: '/home/zbyszek/src/mkosi-initrd/.mkosi-5jv7jtu2/root/etc'

The error is generated in the block "Setting up basic OS tree...", but
the exception traceback is not printed immediately, so it seems like
it was generated in the "Unmounting image..." block. There could be
multiple lines of such cleanup, and it's hard to tell where the error
occurred without knowledge of mkosi internals. Let's de-bold and
parenthesize the steps that happen when we are in exception handling
blocks, so the reader can discern this more easily.

‣ Unmounting API VFS...
‣ Unmounting Package Cache...
‣ Removing random seed...
‣ Unmounting image...
‣ Running second (final) stage...
‣ Mounting image...
‣ Setting up basic OS tree...
‣ (Unmounting image...)
Traceback (most recent call last):
...
FileExistsError: [Errno 17] File exists: '/home/zbyszek/src/mkosi-initrd/.mkosi-3legjys3/root/etc'

4 years agomkosi: fix error message about existing output path
Zbigniew Jędrzejewski-Szmek [Wed, 4 Aug 2021 08:34:15 +0000 (10:34 +0200)] 
mkosi: fix error message about existing output path

With --format=directory, this is not a file…

4 years agoMerge pull request #763 from keszybz/man-feformatting
Zbigniew Jędrzejewski-Szmek [Thu, 5 Aug 2021 15:06:56 +0000 (17:06 +0200)] 
Merge pull request #763 from keszybz/man-feformatting

Man page formatting and grammar improvements + "Fedora Linux"

4 years agofedora: say "Fedora Linux" 763/head
Zbigniew Jędrzejewski-Szmek [Thu, 5 Aug 2021 09:16:52 +0000 (11:16 +0200)] 
fedora: say "Fedora Linux"

This is the new official name, see
https://fedoraproject.org/wiki/Changes/Fedora_Linux_in_os-release.

4 years agoman: improve grammar in description of --incremental
Zbigniew Jędrzejewski-Szmek [Wed, 4 Aug 2021 09:58:07 +0000 (11:58 +0200)] 
man: improve grammar in description of --incremental

4 years agoman: make files bold in list, adjust phrasing
Zbigniew Jędrzejewski-Szmek [Tue, 3 Aug 2021 18:38:29 +0000 (20:38 +0200)] 
man: make files bold in list, adjust phrasing

We said that all files are optional *before* starting the list of files,
then for each individual file, and then again *after* the list. Let's
simplify this by describing files without mentioning that is is optional.
Similarly, we don't need to emphasize the fact that scripts are executable
for each script… readers generally know that.

Let's also make the terms bold, so it's easier to find the interesting
paragraph in this wall of text.

Also break into paragraphs more; remove underlining from "OS" — it's a
normal abbreviation and the markup was confusing; use "/" at the end
of directories; use more markup for paths; move the description of
mkosi.skeleton above mkosi.extra.

Co-authored-by: Jörg Behrmann <behrmann@physik.fu-berlin.de>
4 years agoAdded in check for modules.dep prior to running dracut install
Ray Sit [Thu, 10 Jun 2021 03:21:19 +0000 (13:21 +1000)] 
Added in check for modules.dep prior to running dracut install

4 years agodocumented execution flow
nopeslide [Mon, 14 Jun 2021 10:46:13 +0000 (12:46 +0200)] 
documented execution flow

4 years agophoton: switch mirror to packages.vmware.com
Oluf Lorenzen [Tue, 3 Aug 2021 09:03:51 +0000 (11:03 +0200)] 
photon: switch mirror to packages.vmware.com

following <https://kb.vmware.com/s/article/82322> the repos have been switched to packages.vmware.com

4 years agobump version numbers for v10 v10
Zbigniew Jędrzejewski-Szmek [Fri, 30 Jul 2021 17:10:53 +0000 (19:10 +0200)] 
bump version numbers for v10

4 years agoMerge pull request #760 from keszybz/various-cleanups
Zbigniew Jędrzejewski-Szmek [Fri, 30 Jul 2021 17:05:49 +0000 (19:05 +0200)] 
Merge pull request #760 from keszybz/various-cleanups

Various cleanups without functional changes

4 years agofedora: use F34 by default
Zbigniew Jędrzejewski-Szmek [Fri, 30 Jul 2021 13:13:18 +0000 (15:13 +0200)] 
fedora: use F34 by default

F32 is no more…

4 years agoqemu: revert back to virtio from virtio-scsi-pci on Debian
Luca Boccassi [Fri, 18 Jun 2021 12:14:42 +0000 (13:14 +0100)] 
qemu: revert back to virtio from virtio-scsi-pci on Debian

Debian images on qemu fails to boot with virtio-scsi-pci. Reverting back to
virtio does not show issues with the EFI shell, everything boots correctly,
so do that when running Debian images.

4 years agomkosi: refactor creation of FIRMWARE_LOCATIONS lists 760/head
Zbigniew Jędrzejewski-Szmek [Fri, 30 Jul 2021 11:28:00 +0000 (13:28 +0200)] 
mkosi: refactor creation of FIRMWARE_LOCATIONS lists

It's nicer to make it more "declarative" by creating the lists
directly, instead of appending items one by one.

The newline is dropped from the error message: it's generally nicer to
make error messages one line. On a terminal, output will get wrapped
anyway.

Blame black, not me, for the ugly list formatting.

4 years agomkosi: refactor mangling of /etc/locale.gen into a separate function
Zbigniew Jędrzejewski-Szmek [Fri, 30 Jul 2021 10:58:47 +0000 (12:58 +0200)] 
mkosi: refactor mangling of /etc/locale.gen into a separate function

4 years agoNEWS: add remaining entries for v10
Zbigniew Jędrzejewski-Szmek [Fri, 30 Jul 2021 12:17:10 +0000 (14:17 +0200)] 
NEWS: add remaining entries for v10

4 years agoman: adjust wording and regenerate page
Zbigniew Jędrzejewski-Szmek [Fri, 30 Jul 2021 12:16:44 +0000 (14:16 +0200)] 
man: adjust wording and regenerate page

4 years agomkosi: if image version logic is enabled, make sure to generate root= entry in kernel...
Lennart Poettering [Fri, 2 Jul 2021 21:23:45 +0000 (23:23 +0200)] 
mkosi: if image version logic is enabled, make sure to generate root= entry in kernel command line

When the --image-version= logic is enabled this indicates that multiple
versions of an OS might be used in parallel within the same partition
table eventually. That makes it essential to boot the right root file
system from each unified kernel, so that kernel and root fs always match
up correctly.

If Verity is on this already worked, since we encode roothash= on the
kernel cmdline in that case, and that implies the root fs to use. Now,
ensure for verity-less cases that this works too.

We use PARTLABEL= match, using the image-id/image-version combination,
i.e. matching how we pick the label for the partition.

If the image version logic is not used, let's continue to not use the
a root= for simplicity reasons. In that case automatically finding the
root fs via fully automatic discovery should be simple and robust.

4 years agomkosi.md: Remove "in AUR" as the package has been moved to [community]
Morten Linderud [Mon, 5 Jul 2021 12:19:02 +0000 (14:19 +0200)] 
mkosi.md: Remove "in AUR" as the package has been moved to [community]

Signed-off-by: Morten Linderud <morten@linderud.pw>
4 years agoGithub Action: Update rpm version
Michal Koutný [Mon, 21 Jun 2021 14:16:14 +0000 (16:16 +0200)] 
Github Action: Update rpm version

The version 4.16.0 is affected by fallout from [1] in openSUSE:

> 2021-06-11 18:32:57 <1> fv-az272-819(29580) [zypp::exec++] ExternalProgram.cc(start_program):259 Executing 'rpmdb2solv' '-r' '/var/tmp/mkosi-jaz2krpn/root' '-X' '-p' '/var/tmp/mkosi-jaz2krpn/root/etc/products.d' '-o' '/var/tmp/mkosi-jaz2krpn/root/var/cache/zypp/solv/@System/solvwh4W4S'
> 2021-06-11 18:32:57 <1> fv-az272-819(29580) [zypp::exec++] ExternalProgram.cc(start_program):424 pid 29581 launched
> 2021-06-11 18:32:57 <2> fv-az272-819(29580) [zypp] TargetImpl.cc(buildCache):932   warning: invalid %_db_backend:
> 2021-06-11 18:32:57 <2> fv-az272-819(29580) [zypp] TargetImpl.cc(buildCache):932   warning: using dummy database, installs not possible
> 2021-06-11 18:32:57 <2> fv-az272-819(29580) [zypp] TargetImpl.cc(buildCache):932   rpmdb2solv: no error
> 2021-06-11 18:32:57 <1> fv-az272-819(29580) [zypp::exec++] ExternalProgram.cc(checkStatus):518 Pid 29581 exited with status 1

This is fixed [2] (backported also to 4.16.1, so bump to latest release
as of now 4.16.2).

[1] https://github.com/rpm-software-management/rpm/commit/471b7be4bd5cc7f245f9aa00c7784a7056e439b7
[2] https://github.com/rpm-software-management/rpm/commit/0644e4e79c841b03d606fc8bb035ec311f4bfb17

4 years agoGithub Action: Install pip module matching the git revision
Michal Koutný [Fri, 11 Jun 2021 16:54:13 +0000 (18:54 +0200)] 
Github Action: Install pip module matching the git revision

When the action is referenced with a particular git revision (e.g.
'uses: foo/mkosi@refspec') the given revision should be deployed.
Achieve that by installing pip directly from the action directory
(instead of a released/packaged version).

4 years agoGithub Action: Install zypper so that openSUSE container can be built
Michal Koutný [Mon, 15 Feb 2021 17:44:44 +0000 (18:44 +0100)] 
Github Action: Install zypper so that openSUSE container can be built

4 years agomkosi: be more careful when determining ifname for qemu machine
Lennart Poettering [Fri, 2 Jul 2021 21:27:23 +0000 (23:27 +0200)] 
mkosi: be more careful when determining ifname for qemu machine

Let's preferable use the image ID if we have it. and let's cut out any
'_' version suffix.

(This matters, since otherwise we might synthesize ifnames, that contain
version info, and thus dots, and that doesn't really work well for
ifnames)

4 years agoMerge pull request #740 from poettering/main
Daan De Meyer [Thu, 1 Jul 2021 11:16:32 +0000 (12:16 +0100)] 
Merge pull request #740 from poettering/main

mkosi: speed up "mkosi -i -f -B"

4 years agoMerge pull request #746 from bluca/debian_network
Daan De Meyer [Thu, 1 Jul 2021 11:13:42 +0000 (12:13 +0100)] 
Merge pull request #746 from bluca/debian_network

Debian: fallback to user/host network in qemu/nspawn with no networkd, manually enable resolved

4 years agoCorrect pacman hook name
Alex Wicks [Thu, 1 Jul 2021 01:58:07 +0000 (02:58 +0100)] 
Correct pacman hook name

Fixes systemd/mkosi#750
Pacman hooks must end with .hook as per Arch wiki
However mkosi's hook to update bootctl when the kernel updates ends in -hook instead of .hook
This means the hook doesn't get fired and kernel upgrades fail

4 years agodebian: enable resolved and symlink /etc/resolv.conf 746/head
Luca Boccassi [Fri, 18 Jun 2021 17:28:08 +0000 (18:28 +0100)] 
debian: enable resolved and symlink /etc/resolv.conf

By default resolved is disabled, and /etc/resolv.conf is an actual file with
'nameserver 127.0.0.1'.

4 years agonspawn: fallback to host network mode if networkd is not running
Luca Boccassi [Fri, 18 Jun 2021 18:14:38 +0000 (19:14 +0100)] 
nspawn: fallback to host network mode if networkd is not running

On Debian systemd-networkd is not the default network manager, so
there's nothing configuring the veth bridge.
If networkd is not running, simply fallback to using the host
network. This will not provide isolation, but at least the
connectivity is restored.

4 years agoqemu: fallback to usermode network if networkd is not running
Luca Boccassi [Fri, 18 Jun 2021 16:52:49 +0000 (17:52 +0100)] 
qemu: fallback to usermode network if networkd is not running

On Debian systemd-networkd is not the default network manager, Network-Manager is.
Fallback from TAP + veth to usermode networking. It is slower and NATted, but it
still works.

4 years agomkosi: add option to resolve symlinks when copying build sources.
Blair Bonnett [Fri, 25 Jun 2021 07:40:57 +0000 (09:40 +0200)] 
mkosi: add option to resolve symlinks when copying build sources.

This allows common build scripts or resources to be symlinked into the
build source directory, but then be copied into the build/final image as
actual files instead of symlinks.

4 years agomkosi: when using cached images, randomize fs and partition uuids explicitly 740/head
Lennart Poettering [Wed, 16 Jun 2021 15:16:14 +0000 (17:16 +0200)] 
mkosi: when using cached images, randomize fs and partition uuids explicitly

This addresses an annoying issue when building cached images containing
btrfs file systems: the kernel btrfs driver refuses mounting or handling
multiple different file systems with the same uuid. This means using an
image and building the next at the same time fails — as long as the
UUIDs of the newly build image aren't refreshed.

This patches makes sure when using a cached image we'll refresh disk,
partition and file system uuids. We generate them randomly, exactly like
we would have them when using non-cached builds.

This also ensures that the partition labels are rewritten when images
versions are bumped.

(Eventually we should probably start hashing the uuids from the
configuration state in some form, to provide a certain level of
reproducibility, but for now let's just randomize them.)

4 years agomkosi: speed up "mkosi -i -f -B"
Lennart Poettering [Tue, 15 Jun 2021 08:49:18 +0000 (10:49 +0200)] 
mkosi: speed up "mkosi -i -f -B"

When building images with image IDs and image versions it's a good idea
to reuse the pre-pared cached images from the earlier versions (I mean,
that's why cacheing/incremental operation exists). So far the cached
image names was derived 1:1 from the output file name, but if that
includs the image version it will be different for each build and hence
never suitable as cache.

Hence, if the image ID/version logic is used, let's change the naming
regime for the cache file, and let's derive it direcly from image name,
not taking the version into account.

4 years agoMerge pull request #744 from keszybz/add-remove-files
Daan De Meyer [Fri, 18 Jun 2021 16:25:24 +0000 (17:25 +0100)] 
Merge pull request #744 from keszybz/add-remove-files

Add --remove-files=/RemoveFiles=

4 years agomkosi: adjust comment 744/head
Zbigniew Jędrzejewski-Szmek [Fri, 18 Jun 2021 13:42:07 +0000 (15:42 +0200)] 
mkosi: adjust comment

> This comment is outdated, since we don't use the csv module anywhere.

4 years agoAdd --remove-files=/RemoveFiles=
Zbigniew Jędrzejewski-Szmek [Fri, 18 Jun 2021 11:56:15 +0000 (13:56 +0200)] 
Add --remove-files=/RemoveFiles=

This allows a post-install cleanup to be done. For example,
for initrd images:

  RemoveFiles=
        # we don't need this after the binary catalogs have been built
        /usr/lib/systemd/catalog
        /etc/udev/hwdb.d
        /usr/lib/udev/hwdb.d

As suggested in https://github.com/systemd/mkosi/pull/728#discussion_r646523736

4 years agoMerge pull request #743 from keszybz/minor-cleanups-suggested-by-rpmlint
Zbigniew Jędrzejewski-Szmek [Fri, 18 Jun 2021 07:39:52 +0000 (09:39 +0200)] 
Merge pull request #743 from keszybz/minor-cleanups-suggested-by-rpmlint

Minor cleanups suggested by rpmlint

4 years agomkosi: avoid mutable default arguments 743/head
Zbigniew Jędrzejewski-Szmek [Thu, 17 Jun 2021 11:41:58 +0000 (13:41 +0200)] 
mkosi: avoid mutable default arguments

4 years agomkosi: use 'in' in one more place
Zbigniew Jędrzejewski-Szmek [Thu, 17 Jun 2021 11:40:21 +0000 (13:40 +0200)] 
mkosi: use 'in' in one more place

4 years agomkosi: drop unused for_cache parameter
Zbigniew Jędrzejewski-Szmek [Thu, 17 Jun 2021 11:28:48 +0000 (13:28 +0200)] 
mkosi: drop unused for_cache parameter

4 years agomkosi: don't use [] as default argument
Zbigniew Jędrzejewski-Szmek [Thu, 17 Jun 2021 11:22:44 +0000 (13:22 +0200)] 
mkosi: don't use [] as default argument

rpmlint warns that this is dangerous. We don't modify the argument,
so actually this is safe here, but it's still nice to avoid this
potential pitfall.

4 years agomkosi: drop unused root argument
Zbigniew Jędrzejewski-Szmek [Thu, 17 Jun 2021 11:20:24 +0000 (13:20 +0200)] 
mkosi: drop unused root argument

4 years agomkosi: drop python2-style super() args
Zbigniew Jędrzejewski-Szmek [Thu, 17 Jun 2021 11:16:35 +0000 (13:16 +0200)] 
mkosi: drop python2-style super() args

4 years agomkosi: drop unused f from f-strings
Zbigniew Jędrzejewski-Szmek [Thu, 17 Jun 2021 11:16:21 +0000 (13:16 +0200)] 
mkosi: drop unused f from f-strings

Also, drop "+" from between string literals.

4 years agomkosi: don't use bsdtar on mandriva
Lennart Poettering [Wed, 16 Jun 2021 15:33:31 +0000 (17:33 +0200)] 
mkosi: don't use bsdtar on mandriva

Let's simplify things and use GNU tar everywhere, to expose somewhat
systematic behaviour on all distros.

This mirrors what systemd's importd daemon already does: force GNU tar
use even on distros where "tar" resolves to bsdtar.

4 years agoMerge pull request #728 from keszybz/cpio-and-zstd
Daan De Meyer [Wed, 16 Jun 2021 10:04:45 +0000 (11:04 +0100)] 
Merge pull request #728 from keszybz/cpio-and-zstd

cpio and zstd

4 years agoignore return code of fstrim
nopeslide [Fri, 21 May 2021 16:23:31 +0000 (18:23 +0200)] 
ignore return code of fstrim

devices (i.e. virtualized) may not support fstrim operations.

4 years agoFix short-form 'readonly' deprecation
Edwin Kofler [Tue, 8 Jun 2021 06:59:52 +0000 (06:59 +0000)] 
Fix short-form 'readonly' deprecation