Commit graph

310 commits

Author SHA1 Message Date
Christian Kellner
9d08f4faf2 meta: add Schema.check method to check the schema
The _validator member of `Schema` is used as an indicator whether
the provided schema is valid. The `check` method will, in case
that _validator is not set attempt to validate the schema data,
if present and set the _validator member if schema data is set and
validation has passed. On failure, i.e. missing schema information
or invalid schema data, the ValidationResult will contain the
respective error.
2020-05-06 15:42:23 +02:00
Christian Kellner
e3fa1e8e73 osbuild: add --inspect command line option
This option will print the manifest in JSON, including all the ids,
to stdout. It will not build the pipeline, but the input manifest
will be validated and if that fails the validation result will be
return in JSON.
2020-05-06 15:42:23 +02:00
Christian Kellner
4057bfe896 pipeline: description() can optionally include ids
Add a option to all description methods to include the respective
ids in the description. Defaults to False to preserve the original
output which is used in the tests.
2020-05-06 15:42:23 +02:00
Christian Kellner
35a20922f0 osbuild: validate pipeline options
Validate the options of stages and assembler of the pipeline
before running it. A validation failure will abort the run.
Errors are printed in human readable unless `--json` is passed;
For each error a human readable message together with a path
to the object with the error is given. The syntax of the path
is such it can be used via the `jq` command to select the item.
2020-05-06 15:42:23 +02:00
Christian Kellner
e77d95f4b7 osbuild: add meta module for metadata information
This new module contains utilities that help to introspect parts
that constitute the inner parts of osbuild, i.e. its stages
and assembler (which is also considered a type of stage in
this context). It contains the `StageInfo` class that can that
contains meta-information about the individual stage, such as
a short information (`info`), a longer description (`desc`) and
its JSON schema. A new Schema class represents schema data and
has a `validation` method that can be used to validate that json
data conforms to said schema.
A `Index` class can be used to obtain `StageInfo` and `Schema`
for entities identified via `klass` and `name`.
A top level `validate` method is introduced that can validate
manifest data.
Internally it uses the `jsonschema` package so add that as a
requirement and Install this dependency in the CI.
2020-05-06 15:42:23 +02:00
Christian Kellner
b1a8c465ce main_cli: Add missing newlines
PEP-8 demands it.
2020-05-06 15:42:23 +02:00
David Rheinsberg
41a4afd3ba Revert "buildroot: explicitly invoke runners via python3"
This reverts commit 33844711cd.

There are systems were our runners have no standard python3 location
available. They will fix the environment before invoking any further
utilities. Therefore, we cannot rely on `python3 foo.py` to work in our
ad-hoc containers.

This simply reverts the behavior back to using the shebang.
2020-05-05 16:57:50 +02:00
David Rheinsberg
3c56a3b7ac buildroot: insert osbuild-library into PYTHONPATH
Prepare the PYTHONPATH of the build-root container to include the path
to the osbuild library. This way, we no longer need any symlinks or
bind-mounts for the individual modules.
2020-05-04 12:32:25 +02:00
David Rheinsberg
33844711cd buildroot: explicitly invoke runners via python3
Use the python-interpreter explicitly to invoke the runners. This works
around inconsistencies between scripts imported from the host, and the
interpreter taken from a build-root.
2020-05-04 12:32:25 +02:00
David Rheinsberg
975ef7ff54 buildroot: drop unneeded DeviceAllow=
With `--keep-unit` we now run with the privileges and resources of the
caller. We no longer require external services to extend our privileges.
This also means we no longer have to configure our unit sandbox
manually, but simply rely on kernel sandboxing to do the right thing.
2020-04-29 20:31:32 +02:00
David Rheinsberg
d7adf2b3a5 osbuild: split main apart a bit
Split off the argument parser as well as the manifest parser into
helper functions. Drop the pylint hints from the main function now that
it is considerably smaller.
2020-04-28 15:39:54 +02:00
David Rheinsberg
421414ef0b osbuild: extract CLI to prepare for additional entrypoints
This extracts the CLI entrypoint into `main_cli.py` and prepares the
codebase for the introduction of additional entrypoints. This should
not contain any functional changes.

The idea behind this is to add `main_api.py` (and maybe more in the
future), which will be similar to `main_cli.py` but contain the
`osbuild-api` entrypoint. This will make all entrypoints nicely symetric
and the only difference will be `setup.py` selecting the right
entrypoint for each executable, as well as `__main__.py` selecting the
entrypoint for the module itself (which we will keep to the CLI for
compatibility).
2020-04-28 15:39:54 +02:00
David Rheinsberg
4493d057a2 osbuild: move osrelease parser into ./util
Reduce the clutter in our pipeline implementation and move the
os-release parser into ./osbuild/util/.
2020-04-28 15:39:00 +02:00
Christian Kellner
11ffe72aff buildroot: micro cleanups for some strings
Remove an unnecessary format string modifier and unify the usage
of quotation marks.
2020-04-24 15:49:03 +02:00
David Rheinsberg
2bdb287731 sources: make cleanup explicit
This changes the sources module to explicitly cleanup event-loops.
Additionally, the implementation is protected against re-entrency which
we do not support (and do not need).

We did occasionally get the following exception when running
source-servers:

        /usr/lib/python3.8/asyncio/base_events.py:654: ResourceWarning: unclosed event loop <_UnixSelectorEventLoop running=False closed=False debug=False>
          _warn(f"unclosed event loop {self!r}", ResourceWarning, source=self)
        ResourceWarning: Enable tracemalloc to get the object allocation traceback

        Exception ignored in: <function BaseEventLoop.__del__ at 0x7f92589d14c0>
        Traceback (most recent call last):
          File "/usr/lib/python3.8/asyncio/base_events.py", line 656, in __del__
            self.close()
          File "/usr/lib/python3.8/asyncio/unix_events.py", line 58, in close
            super().close()
          File "/usr/lib/python3.8/asyncio/selector_events.py", line 92, in close
            self._close_self_pipe()
          File "/usr/lib/python3.8/asyncio/selector_events.py", line 99, in _close_self_pipe
            self._remove_reader(self._ssock.fileno())
          File "/usr/lib/python3.8/asyncio/selector_events.py", line 274, in _remove_reader
            key = self._selector.get_key(fd)
          File "/usr/lib/python3.8/selectors.py", line 190, in get_key
            return mapping[fileobj]
          File "/usr/lib/python3.8/selectors.py", line 71, in __getitem__
            fd = self._selector._fileobj_lookup(fileobj)
          File "/usr/lib/python3.8/selectors.py", line 225, in _fileobj_lookup
            return _fileobj_to_fd(fileobj)
          File "/usr/lib/python3.8/selectors.py", line 42, in _fileobj_to_fd
            raise ValueError("Invalid file descriptor: {}".format(fd))
        ValueError: Invalid file descriptor: -1

This is triggered when an event-loop is not closed explicitly via
`event_loop.close()`. It then tries to cleanup explicitly. The problem
here is that python has no knowledge of in which order it should
collect GC'ed objects. This might end up more or less random. Therefore,
file-descriptors might be closed in arbitrary order, leading to the
event-loop being unable to unregister its internal objects.

I am not entirely sure whether this is the case here. However, the error
definitely triggers on the internal event-loop socketpair, which there
is no other external access to. Furthermore, this socketpair is only set
to -1 in its own __del__ function. So unless we have a memory
corruption, I see nothing else that could trigger this.

With this fix in place, I can run `test_sources.py` in a loop without
triggering the bug.

It is quite likely that our other `*Server` classes need the same fix. I
did not verify, yet.
2020-04-24 11:48:16 +02:00
David Rheinsberg
f12c57c1fd buildroot: reduce nspawn requirements further
This adds one more flags to `systemd-nspawn`:

    --keep-unit
        This prevents nspawn from creating its own scope unit and
        instead uses the scope of the caller. Since we want nspawn to
        run with the privileges of the caller, this is fitting for our
        use case.
        Furthermore, this makes nspawn work without a running system
        bus, since it no longer needs to talk to systemd pid1.

        (introduced with systemd-v209)

With this in place, osbuild can be run from within docker containers (or
other containers without systemd as pid1). This still requires some
extra setup, but this can all be done in the container manager.
2020-04-22 18:27:10 +02:00
David Rheinsberg
e2aa7d8128 util: mark as module
Make sure ./osbuild/util/ is considered a python module. Add
__init__.py to declare it as such and include it in the module-list of
setup.py.
2020-04-21 17:00:04 +02:00
David Rheinsberg
2624be92dc osbuild: cleanup contextlib usage
Two cleanups for the context-managers we use:

  * Use `contextlib.AbstractContextManager` if possible. This class
    simply provides a default `__enter__` implementation which just
    returns `self`. So use it where applicable.
    Additionally, it provides an abstract `__exit__` method and thus
    allows static checks for an existance of `__exit__` in the dependent
    class. We might use that everywhere, but this is a separate
    decision, so not included here.

  * Explicitly return `None` from `__exit__`. The python docs state:

        If an exception is supplied, and the method wishes to suppress
        the exception (i.e., prevent it from being propagated), it
        should return a true value. Otherwise, the exception will be
        processed normally upon exit from this method.

    That is, unless we want exceptions to be suppressed, we should
    never return a `truthy` value. The python contextlib suggest using
    `None` as a default return value, so lets just do that.

    In particular, the explicit `return exc_type is None` that we use
    has no effect at all, since it only returns `True` if no exception
    was raised.

    This commit cleans this up and just follows what the `contextlib`
    module does and returns None everywhere (well, it returns nothing
    which apparently is the same as returning `None` in python). It is
    unlikely that we ever want to suppress any exceptions, anyway.
2020-04-21 16:02:20 +02:00
David Rheinsberg
1cdf2be0ac util/rmrf: use immutable helpers
Make use of the new immutable-flag ioctl helpers. While at it, move the
`chmod` to `fchmod` and re-use the open file-descriptor. Document the
behavior and move the `fchmod` into its own try-block for the same
reasons as the `ioctl` call: We rely on the following unlink() to catch
any errors. Errors in the fixperms() step are non-consequential.
2020-04-21 14:46:02 +02:00
David Rheinsberg
e5ff287f5a util/linux: add explicit FS_IMMUTABLE_FL helpers
The FS_IOC_{GET,SET}FLAGS ioctl numbers are not stable across different
architectures. Most of them use the asm-generic versions, but ALPHA and
SPARC in particular use completely different IOC number setups (see the
definition of _IOC, _IOR, _IOW, etc. in the kernel).

This commit moves the helpers for `FS_IMMUTABLE_FL` into
`osbuild/util/` and adds explicit tests. This will make sure that we
catch any ioctl mismatches as soon as possible when we run the osbuild
test-suite on other architectures. Until then, we will have to live with
this mismatch.
2020-04-21 14:46:02 +02:00
David Rheinsberg
2cc9160099 objectstore: extract remove_tree()
Move remove_tree() into its own module in `osbuild.util.rmrf`. This way
we can use it in other modules as well, without cross-referencing
internal helpers.
2020-04-21 14:46:02 +02:00
David Rheinsberg
4ad4da4658 osbuild: convert to jsoncomm
Convert the hard-coded DGRAM communication to util.jsoncomm. This
avoids hard-coding any IPC-details and simplifies the callers quite a
bit.
2020-04-21 13:47:38 +02:00
David Rheinsberg
6f8ba82fc6 util: add JSON Communication module
Add a new module that implements a simple JSON communication channel.
This is meant to replace all our hard-coded SOCK_DGRAM code that is
copied all over the place.

This is intentionally left simple. It only supports synchronous
operations, trivial JSON encoding and decoding, and uses a message-based
transport mode.
2020-04-21 13:47:38 +02:00
David Rheinsberg
58d368df0d osbuild: unify libdir handling
We want to run stages and other scripts inside of the nspawn containers
we use to build pipelines. Since our pipelines are meant to be
self-contained, this should imply that the build-root must have osbuild
installed. However, this has not been the case so far for several
reasons including:

  1. OSBuild is not packaged for all the build-roots we want to support
     and thus we have the chicken-and-egg problem.

  2. During testing and development, we want to support using a local
     `libdir`.

  3. We already provide an API to the container. Importing scripts from
     the outside just makes this API bigger, but does not change the
     fact that build-roots are not self-contained. Same is true for the
     running kernel, and probably much more..

With all this in mind, our strategy probably still is to eventually
package osbuild for the build-root. This would significantly reduce our
API exposure, points-of-failure, and host-reliance. However, this switch
might still be some weeks out.

With this in mind, though, we can expect the ideal setup to have a full
osbuild available in the build-root. Hence, any script we import so far
should be able to access the entire `libdir`. This commit unifies the
libdir handling by installing the symlinks into `libdir` and providing
a single bind-mount of the module-path into `libdir`.

We can always decide to scratch that in the future when we scratch the
libdir-import from the host-root. Until then, I believe this commit
nicely unifies the way we import the module both in a local checkout as
well as in the container.
2020-04-21 13:44:43 +02:00
David Rheinsberg
5d40010d3c loop: fix FD leak in mknod()
The mknod() method currently allows passing no dir_fd, in which case an
internal one is opened. This FD is then never closed, though.

Fix this by simply making the dir_fd mandatory. All callers pass it
(there is actually only a single caller), so no need for the fallback.
2020-04-21 13:02:29 +02:00
David Rheinsberg
551faf2d61 osbuild: add --output-directory=DIR
Add a new output-directory argument which specifies where to store
result objects. For now, this is purely optional and simply copies from
the old `output_id` into the specified directory. This allows a
backwards compatible transition towards removing any external access to
the osbuild cache.

Note that this has still lots of room for improvements:

  * We only support assembler-output for now, but we could also easily
    support entire trees as output, in case no assembler was selected.
    Alternatively, we could introduce a "copy" assembler, that just
    outputs the input tree.

  * This parameter is optional, but should really be mandatory. There
    is little reason to have the default behavior just dropping any
    generated content. This would be a breaking change, though.

  * We could move data out of a temporary object-store entry, rather
    than copy it. But again, for backwards-compatibility, we leave the
    latest store-object intact and do not move things out of it.

  * We could now transition towards never committing anything to the
    store, not even output IDs, unless explicitly checkpointed.
2020-04-15 15:40:17 +02:00
Christian Kellner
8d28b094eb buildroot: also bind mount /boot
Add /boot to be mounted from the build tree into the build root,
because the EFI binaries for grub are stored in there and for
ostree grub2 support those need to be copied too.
2020-04-15 15:39:45 +02:00
Christian Kellner
40c2545f74 util/selinux: add simple setfiles wrapper
Add a small wrapper around the setfiles(8) utility that can be used
to set the security context fields on one or multiple provided paths,
given a specification. The root of the file system tree can be given
via `root` and all elements of `paths` will be interpreted as
relative to that root.
2020-04-15 15:39:45 +02:00
Christian Kellner
50beb4ffb5 util: add selinux config file related helpers
Add a helper, `parse_config`, to parse a selinux configuration file,
see selinux(8), and return a dictionary containing the configuration
data in key, value pairs. This, in turn, can be fed into the other
helper method, `config_get_policy`, to get the effective policy or
`None` if SELinux is disabled or the policy type is not configured.
Add a new test suite that checks the basic functionality of the
helpers above.
2020-04-15 15:39:45 +02:00
Christian Kellner
47412e1bb7 util: new ostree module with TreeFile helper
When using rpm-ostree compose, a Treefile[1] controls various
aspects of its behaviour. Since rpm-ostree will, at least in
the beginning, be used to post-process and committing the tree
add a helper class to ease the creation of correct Treefiles.
The docstring of the Treefile contains the information in which
phases ('install', 'postprocess', 'commit') the option is used,
as of rpm-ostree commit 1cf0d557ae8059e689b1fed670022727e9842288

Add basic checks for the ostree.Treefile helper. Some of the
tests require rpm-ostree to be installed.

[1] https://rpm-ostree.readthedocs.io/en/stable/manual/treefile/
2020-04-15 15:39:45 +02:00
Christian Kellner
5acc68cdc3 pipeline: explicitly import importlib.util
Causes a problem with ostree-osbuild on CI (travis) otherwise:

Traceback (most recent call last):
  File "osbuild-ostree", line 345, in <module>
    sys.exit(main())
  File "osbuild-ostree", line 337, in main
    return build(args)
  File "osbuild-ostree", line 257, in build
    output_id, commit_id = build_commit(builddir, args)
  File "osbuild-ostree", line 162, in build_commit
    r = pipeline.run(store.store,
  File "/home/travis/build/gicmo/ostree-osbuild-demo/osbuild/osbuild/pipeline.py", line 358, in run
    r = self.assemble(object_store,
  File "/home/travis/build/gicmo/ostree-osbuild-demo/osbuild/osbuild/pipeline.py", line 314, in assemble
    r = self.assembler.run(input_dir,
  File "/home/travis/build/gicmo/ostree-osbuild-demo/osbuild/osbuild/pipeline.py", line 148, in run
    osbuild_module_path = os.path.dirname(importlib.util.find_
2020-04-08 13:42:46 +02:00
Christian Kellner
c33e745252 pipeline: check assembler res outside context mgr
Move the whole result handling of the assembler outside the context
manager; this includes the cleanup of the object in the error case
which would conflict with the ongoing write operation inside the
context manager and thus lead to a crash:

Traceback (most recent call last):
  File "/usr/bin/osbuild", line 11, in <module>;
    load_entry_point('osbuild==10', 'console_scripts', 'osbuild')()
  File "/usr/lib/python3.7/site-packages/osbuild/__main__.py", line 99, in main
    secrets=secrets
  File "/usr/lib/python3.7/site-packages/osbuild/pipeline.py", line 362, in run
    libdir)
  File "/usr/lib/python3.7/site-packages/osbuild/pipeline.py", line 324, in assemble
    output.cleanup()
  File "/usr/lib/python3.7/site-packages/osbuild/objectstore.py", line 160, in cleanup
    self._check_writer()
  File "/usr/lib/python3.7/site-packages/osbuild/objectstore.py", line 178, in _check_writer
    raise ValueError("Write operation is ongoing")
ValueError: Write operation is ongoing
2020-03-31 21:13:49 +02:00
Christian Kellner
64b8c0643a objectstore: use ioctl to clear immutable flag
Instead of using the chattr binary, which adds another dependency
use what amounts to ioctl(fd, ,FS_IOC_SETFLAGS, ~FS_IMMUTABLE_FL),
to clear the immutable flag. Constants are taken from linux/fs.h.
2020-03-30 23:58:33 +02:00
Christian Kellner
04aa5e0aeb objectstore: manually cleanup tree dir for Object
The tree, which is created by stages and assemblers, might contain
immutable files, which for Python 3 currently (version 3.8) leads
to errors when the tempfile.TemporaryDirectory is being cleaned up.
Therefore, manually cleanup the tree directory, if it exists, via
shutil.rmtree with a custom onerror handler that also removes the
immutable bit on permission errors.
2020-03-30 23:58:33 +02:00
Ondřej Budai
509d2ee895 osbuild: use "manifest" when describing the osbuild input
osbuild can now take only manifests as its input (the legacy input format
was dropped in e48c2f1). This commit changes all remaining occurrences of
"pipeline" to "manifest" when describing the osbuild input.
2020-03-30 13:03:16 +02:00
David Rheinsberg
926a6a56a2 osbuild: drop legacy input format
This drops support for passing in non-manifest style pipelines
directly. It used to be that we directly pass in the pipeline
description, but it got changed to a proper manifest format in:

    commit e48c2f178c
    Author: Tom Gundersen <teg@jklm.no>
    Date:   Thu Feb 13 17:44:54 2020 +0100

        osbuild: allow the sources to be passed in on stdin

With 2 releases in between, we are now far enough to drop the old
format. All code has been converted, our API guarantee is not in place,
yet, so lets just drop the legacy code and fully commit to the
manifest.

Fixes #265.
2020-03-27 14:23:38 +01:00
Christian Kellner
2d959e4d43 pipeline: ensure the build tree is always built
If there is a build pipeline specified, always build it, even if
there are no accompanying stages. If we short-circuit earlier and
ignore the build pipeline section, errors in the build pipeline
would not be caught at all.
2020-03-23 13:31:42 +01:00
Christian Kellner
56e0ac7c92 pipeline: eagerly cleanup trees in error case
The `build_stages` method short-circuits and returns early in case
any of the stages fail to build and returns None for the tree, and
build tree, therefore both of those can immediately cleaned up at
that point.
For this add a small helper `cleanup` that will call the cleanup
method for all supplied arguments, after filtering out None values.
2020-03-22 15:30:35 +01:00
Christian Kellner
08fc223276 pipeline: delay cleanup of build tree
Delay the cleanup of the build tree of the build pipeline, and
first check the result and only cleanup the tree when the build
did not fail, because in that case both returned trees will be
None and trying to cleanup them up will result in an exception.
Therefore, also don't clean up `tree` in the error case.
2020-03-22 15:30:35 +01:00
Christian Kellner
5d0f6aa981 pipeline: short-circuit if final object exists
If the final object, image, artifact, already exists in the store,
short-circuit and return directly from `Pipeline.run`. Otherwise
the situation might arise that the final result is in the store,
but the tree (and build trees) are not and thus the tree would be
built, just to be thrown away when the assembler phase detects
that the final output already exists.
2020-03-07 17:13:21 +01:00
Christian Kellner
b755e69bca pipeline: extract assembler code into method
Extract the code that assembles the tree into its own method as
it was previously done for the stages. This should make the new
method as well as `Pipeline.run` method easier to read.
2020-03-07 17:13:21 +01:00
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
Christian Kellner
457f21a336 objectstore: add HostTree class to access host fs
Simple new object that should expose the root file system with the
same API as `objectstore.Object` but as read-only. This means that
the `read` call works exactly as for `Object` but `write` raises
an exception.
Add tests to specifically check the read-only properties.
2020-03-07 17:13:21 +01:00
Christian Kellner
856698ee9c objectstore: keep track of created objects
Keep track of all created objects via weak references. Add support
to use ObjectStore as context manager and ensure that all objects
are cleaned up when the context is exited.
2020-03-07 17:13:21 +01:00
Christian Kellner
5fbf5bb431 objectstore: use 'tmp' subdir for temp directories
Instead of creating temporary directories at the root of the store
create them in a sub-directory called 'tmp'. This should make it
easy to cleanup left-over (temporary) dirs in case of crashes.
Additionally, it has the nice side effect that it is possible to
check that there are no objects that are still in-flight, i.e. not
cleaned-up.
2020-03-07 17:13:21 +01:00
Christian Kellner
01d989e718 objectstore: remove context manager for new method
Turn `ObjectStore.new` into a plain method, since `Object` itself
can be used as a context manager, which is now directly returned,
instead of internally wrapped in a `with` statement and then
yielded. Thus for callers of the method nothing changes and the
behavior of `with objectstore.new() as x` is exactly the same.
2020-03-07 17:13:21 +01:00
Christian Kellner
fecc62f5c8 pipeline: don't commit checkpoints on error
Only commit checkpoints to the object store if the run of the
stage or assembler was successful. Otherwise we commit a empty,
corrupted or old tree to the store. Any subsequent run might
then pick up that bogus tree as a starting point.
2020-03-03 13:38:45 +01:00
David Rheinsberg
adc3465879 osbuild: avoid n^2 loops in checkout handling
When marking stages for checkpointing, let us make use of the local set
datastructure we already allocate, rather than iterating over it
linearly.

Apart from the negligible performance improvement, it makes the code
quite a lot simpler.
2020-03-03 09:48:44 +01:00
David Rheinsberg
179f210e26 osbuild: fix coding style with missing newline
We generally surround function definitions with newlines. Make sure
this is also true for local function definitions.

Signed-off-by: David Rheinsberg <david.rheinsberg@gmail.com>
2020-03-03 09:48:44 +01:00
David Rheinsberg
0d8db1c169 osbuild: make parameter identifiers more descriptive
This modifies the help-strings for parameters in `osbuild --help`.
Rather than using the identifier to describe its purpose, make it
describe its type. That is, this changes:

  --sources=SOURCES         =>        --sources=FILE

The option-name should already describe the purpose, so lets use the
argument-name for the type. This also improves on the stuttering when
reading the output.

We already do that for options that take directories as arguments. For
some reasons, we did not do that for options that take file-paths.

It is arguable whether this should be `PATH` or `FILE`. The latter has
the advantage that it makes clear that it is not a directory. It should
be obvious that `FILE` allows all kinds of paths.

Lastly, this does not update the positional arguments (in our case just
`PIPELINE`), since I did not conclude on the best way to make it
self-documenting. `PIPELINE-FILE` sounds convoluted.
2020-03-02 21:33:52 +01:00