]> git.ipfire.org Git - thirdparty/mkosi.git/commit
mkosi: add concept of "incremental" builds 85/head
authorLennart Poettering <lennart@poettering.net>
Wed, 21 Jun 2017 12:44:51 +0000 (14:44 +0200)
committerLennart Poettering <lennart@poettering.net>
Thu, 22 Jun 2017 13:06:20 +0000 (15:06 +0200)
commit99453d9c3e31f63f32332a31ac1795c66623a93a
tree03581c82e94e330a41fc9dc61093904b7a80c84a
parent6967c43162414a6c4f6995510922bc005f17c70a
mkosi: add concept of "incremental" builds

Incremental builds permit caching the build and final images right after
OS package installation — before the source or build tree is copied in.
This is useful to drastically reduce the runtime of mkosi image building.

If you have a source tree, you may now type in:

       # mkosi -if -t raw_gpt -o output.raw

This will build an image possibly making use of a pre-existing
"output.raw.cache-pre-dev" and "output.raw.cache-pre-inst" image files
to speed up the build. If the files exist, they are used under the
assumption they contain a pre-generated version of the disk images in
the state immediately before copying in the source tree or build tree.
(-i is short for --incremental). If the files don't exist, they are
generated, and thus available for speeding up subsequent runs. The
".cache-pre-dev" file contains the image for the development build of
the image, the ".cache-pre-inst" file contains the image for the final
build of the image.

If "mkosi -iff" is run (i.e. with two --force parameters) any
pre-existing cache image is removed before the operation is run. In this
mode the cache images are hence generated from scratch, and never used.

If --incremental is not specified behaviour is identical to the status
quo ante.

Note that there currently is no logic in place to only rebuild the image
automatically in full if the mkosi.defaults file is newer than the cache
files, this may be added in a later commit.

To remove the cache files without rebuilding, use "mkosi clean -f".

Note that this kind of "incremental" caching is orthogonal to the
already existing "package" caching on the package manager level. The
former caches the result of a the initial package manager run, while the
latter only caches individual packages before the package manager is
run. The latter is particular useful as it permits optimizing the build
time of the usual double image generation of mkosi (i.e. when a
development build is done followed by a final build).

Note that the caching works very differently for the output modes for
raw disk images and those for directory trees. In the former case we'll
cache the actual raw disk image after all partition setup and basic
directory tree setup. In the latter case we'll store the image directory
tree as directory. Note that the "raw_squashfs" is treated like a
directory mode in this regard, since squashfs compression is applied
much later than the point in time we create the cache version of the
image.
.gitignore
mkosi