debian-forge/osbuild
Christian Kellner 170ccd4722 pipeline: no auto-commit for build stages
Refactor the building of stages and the build tree so that no auto
commit is done at the end of the build pipeline anymore, i.e. the
respective build tree(s) are not commit to the store unless that
was explicitly enabled via a checkpoint.

NB: `objectstore.Object`s are used not via a context manager
anymore, because they are returned from the `build_stages` method
to make the code easier to use and read. Cleanup of Objects during
a KeyboardInterrupt exception (Ctrl-C) are handled by using the
ObjectStore with a context manager, which on exit of the context
will cleanup all objects. Due to a big in python[1] this is indeed
more robust than using `with object_store.new() as tree` because
that is translated[2] to something like:

     1: mgr = (EXPR)
     2: exit = type(mgr).__exit__
     3: value = type(mgr).__enter__(mgr)
 ->  4: # NOTE: KeyboardInterrupt here will "leak" value
     5: try:
     6:	[...]
     7: finally:
     8:	   if exc:
     9:        exit(mgr, None, None, None)

Which can leave the tree initialized but not cleaned up if the
KeyboardInterrupt happens exactly line 4.

[1] https://bugs.python.org/issue29988
[2] https://www.python.org/dev/peps/pep-0343/
2020-03-07 17:13:21 +01:00
..
__init__.py pipeline: return logs in --json mode 2019-12-14 13:49:24 +01:00
__main__.py osbuild: avoid n^2 loops in checkout handling 2020-03-03 09:48:44 +01:00
api.py api: add barriers 2020-02-06 19:01:12 +01:00
buildroot.py buildroot: allow customizing the backing store for /var 2020-01-27 15:51:47 +01:00
loop.py loop: explicitly close fds to loop devices 2020-01-19 22:19:25 +01:00
objectstore.py objectstore: add HostTree class to access host fs 2020-03-07 17:13:21 +01:00
pipeline.py pipeline: no auto-commit for build stages 2020-03-07 17:13:21 +01:00
remoteloop.py remoteloop: drop O_DIRECT 2020-02-06 19:01:12 +01:00
sources.py sources: add org.osbuild.files source 2020-02-06 19:01:12 +01:00
tmpfs.py osbuild: split package into separate files 2019-08-21 09:56:50 +04:00
treesum.py treesum: don't use dir_fd parameter in os.scandir() 2019-11-29 00:45:14 +01:00