Commit graph

277 commits

Author SHA1 Message Date
Christian Kellner
bb620d727d tools/mpp: use python3 style super invocation
In Python3 there is no need for arguments in the `super` invocation
itself.
2021-06-30 20:26:07 +01:00
Christian Kellner
fdd757dd28 tools/mpp: sort the source urls
Sort the checksum: urls dictionary via the url, so that no matter
where the urls came from (import or any dep-solve section), the
checksum: url dict is the same for the same set of urls.
2021-06-30 20:26:07 +01:00
Christian Kellner
ec68369daf tools/mpp: support search dirs for manifests
Add support for additional paths that are searched when trying to
load a manifest. Currently only the path of the manifest that has
the include is searched. With this changed additional directories
will be included after that, in the order they were given ton the
command line.
2021-06-30 20:26:07 +01:00
Christian Kellner
2230dfe566 mpp: use simple urls if possible
If no `secrets` is required to download a package we can use the
simple checksum: url mapping, instead of the checksum: {url: }
one.
2021-06-30 20:26:07 +01:00
Christian Kellner
1b4f96c4e7 mpp: unify add package code path
Both v1 and v2 code paths used the same logic to add the resolved
dependencies to the `source_urls` dict, which is already stored
in the base class. Move the logic into the base class too.
2021-06-30 20:26:07 +01:00
Christian Kellner
4add7c69ff mpp: turn comment into doc string 2021-06-30 20:26:07 +01:00
Christian Kellner
3298a6461e mpp: small whitespace fixes
Be PEP-8 complaint.
2021-06-30 20:26:07 +01:00
Alexander Larsson
ab453bf81a mpp: combine depsolve and import into mpp.py
Rewrite image pre-processor to single tool so that it is easier to use.
Now also supports `ignore-weak-deps` when dep-solving and supports
relative paths for local files.
Also create a symlink to the osbuild package, so that the tools can be
run from the source checkout and have access to the osbuild package.
2021-06-30 20:26:07 +01:00
Christian Kellner
a350602a77 tools/mpp: sort urls for v2 manifests
The logic to sort urls was added globally in `mpp-import-pipeline`
but only the in the v1 code path was the `state.manifest_urls`
variable set and thus for v2 the actual sorting did not happen.
Fix this and set the `manifest_urls` to the `org.osbuild.curl`
items, which makes sense because we only know how to sort those.
2021-06-22 21:10:49 +02:00
Christian Kellner
aa00e62fed tools/mpp: sort source urls
In both mpp-depsolve and mpp-import-pipeline, sort the packages to
url dictionary before writing the JSON. This makes it easier to
look for packages but more importantly ensures that the resulting
set of packages has the same ordering in the sources section
independently of how it was assembled.
2021-06-21 18:04:13 +02:00
Christian Kellner
2dfb6a224b tools: add inline-source.py
Add a simple tool that will spit out a valid org.osbuild.inline
source entry that encodes the given file. Currently always uses
base64 as encoding and sha256 for the hashing.
2021-05-12 14:26:16 +02:00
Christian Kellner
01319b55a9 tools: use dnf filtering in lorax-template helper
The pylorax implementation of the template running code supports
globbing, as well as `--exclude` and `--optional` commands. These
are handled independently for each `installpkg` command, so that
requesting the installation of firmware packages in one command
together with an exclude of `*alsa` does indeed only exclude any
alsa firmware packages but not any other alsa packages. The
previous version of this script would just build an global list
for excludes which has a drastically different result because
a global exclude of "*alsa" would result in a global exclusion of
all matching packages and probably a dependency error.
Therefore, add support for dnf based filtering of packages on a
per `installpkg` command bases, very much like pylorax does.
2021-03-01 16:18:50 +01:00
Christian Kellner
961ce3077f tools: add lorax-template-pkg.py helper
Add a simple helper that is meant to gather the list of packages
to be installed via a lorax template that uses the "installpkg"
directives. A prominent example is the 'runtime-install.tmpl'
script from lorax-templates-generic, used to create boot isos.
2021-03-01 16:18:50 +01:00
Christian Kellner
bc941c2342 mpp/depsolve: support multiple repos
Although MPP supported having multiple repo entries for each
depsolve block, in reality that didn't actually work because
the same (global) baseurl was used for all packages.
Now the basurl can still be (otionally) specified globally,
but also overridden by the repo block and the package paths
will be relative to that.
2021-02-16 23:00:13 +00:00
Christian Kellner
81c8374d3e sources: rename org.osbuild.{files -> curl}
The `org.osbuild.files` source provides files, but might in the
future not be the only one that does. Therefore rename it to
match the internal tool that is being used to fetch the files.
This is done for most other osbuild modules that target tools.

The format v1 loader is adapted to make this change transparent
for users of the v1 format, so we are backwards compatible.

Change the MPP depsolve preprocessor so that for format v2 based
manifest `org.osbuild.curl` source is used. Also rename the
corresponding source test. Adapt the format v2 mod test to use
the curl source.
2021-02-12 19:27:08 +01:00
Christian Kellner
a4127cce66 mpp/depsolve: support for format version 2
Support for dep-solving in format version 2. Instead of adding
the checksums to a key in the options, it will be added to the
references inside an input. The urls for the items are added
in the sources dict via the new format, i.e. in the `items`
dict instead of the `urls` dict.
2021-02-12 15:55:43 +01:00
Christian Kellner
7d72b2250c mpp/depsolve: prepare for multi format support
Rename the parsing and process functions to have a format version
specific suffix. This should make it easy to add support for the
format version 2. Logic should be unchanged.
2021-02-12 15:55:43 +01:00
Christian Kellner
49e1800503 mpp/import: support for format version 2
Add support for foramt version 2. This is slightly easier than
version 1, since there is no recursion. In addition to the
path of the manifest to import the pipeline from, the pipeline
identifier needs to be specified.
Source merging is also different since in format version two,
there is a generic "items" key, which means we can merge
other sources than "org.osbuild.files".
2021-02-12 15:55:43 +01:00
Christian Kellner
a38a3fa502 mpp/import: prepare for multi format support
Rename the parsing and process functions to have a format version
specific suffix. This should make it easy to add support for the
format version 2.
2021-02-12 15:55:43 +01:00
Christian Kellner
33283853e9 tree-diff: properly detect missing selinux labels
Detect the case that one file has a SELinux label but the other
file does not have any label at all. This was currently not
possible to detect because both calls to get the labels were
wrapped in one try-except block and any failure in one of the
two calls, like a missing label, would lead to an early return
of the function, with a success value.
2021-01-26 12:09:23 +01:00
Lars Karlitski
651c5b5461 tools/mpp-depsolve: make use of dnf's per-user cache
Use dnf's per-user cache when `--dnf-cache` is not given. This speeds up
repeated invocations of `mpp-depsolve` considerably, without having to
specify a cache location.
2020-10-19 17:37:46 +01:00
Lars Karlitski
792b2ac5fc tools/mpp-depsolve: ensure canonical urls
Technically, a few extra "/"s don't matter, but in practice, it
sometimes does. In particular, rpmrepo returns `500 Internal Server
Error` when a path contains additional "/"s.
2020-10-19 17:37:46 +01:00
Lars Karlitski
423e38cf5d tools/mpp-depsolve: also support baseurl and mirrorlist repositories 2020-10-19 17:37:46 +01:00
Christian Kellner
953583d636 tools/mpp-depsolve: support excluding packages
Support excluding packages when dep-solving; needed for e.g. the
ostree commits to not create a rescue kernel by excluding the
'dracut-config-rescue' package.
2020-06-15 13:44:01 +02:00
David Rheinsberg
06119f7d88 tools: move tree-diff into ./tools
Move the `tree-diff` tool into ./tools, which is our new place for tools
used by the test-suite or during development.

The only hard-coded user is the TestBase, so fix its path to the tool
so the test-suite will continue to find it.
2020-06-05 09:27:40 +02:00
David Rheinsberg
ae8910e02c tools: add pipeline-import mpp
This adds a new MPP which supports importing pipelines from another
file. It simply looks for "mpp-import-pipeline" tags at the same
position where we would expect a "pipeline" tag. It then uses the "path"
attribute in it to find a manifest. From this manifest, the "sources"
are merged back into the original sources, and the "pipeline" is taken
verbatim to replace the "mpp-import-pipeline".

The idea is to allow importing build-pipelines from other files into our
test manifests, without duplicating the build-pipeline everywhere.
2020-06-05 09:27:40 +02:00
David Rheinsberg
7dcc946fe2 test: add F32 manifests and a manifest-preprocessor
This adds F32 manifests in ./test/data/. To avoid magically deducing the
package list out of the void, this adds a ManifestPreProcessor (MPP)
called `./tools/mpp-depsolve.py`. What this does is it takes a manifest
on stdin, modifies it, and produces a manifest on stdout.

The `mpp-depsolve.py` preprocessor takes a manifest and modifies all the
`org.osbuild.rpm` stages. It parses a new option to that stage called
`mpp-depsolve`, which contains a package-list, a repo-list, and dnf
metadata. It then drops this `mpp-depsolve` option (since it would be an
invalid manifest otherwise), depsolves the packages, inserts a proper
"packages" option as well as appends the correct paths to the sources
entry.

With this in place, this adds `mpp-f32-base.json` and
`mpp-f32-build.json` in ./test/data/manifests/. These will then be used
as base F32 manifests for our test-suite.

Lastly, this adds `./test/data/README.md` as a place to document the
files we place in `./test/data/`, since most of the files do not allow
for comments.
2020-05-20 18:54:38 +02:00