Commit graph

933 commits

Author SHA1 Message Date
Josue David Hernandez Gutierrez
60ec19f692 osbuild/solver/dnf.py: Add support for DNF variables for osbuild repos
Signed-off-by: Josue David Hernandez Gutierrez <josue.d.hernandez@oracle.com>
2025-08-13 15:42:00 +02:00
schutzbot
d9af977f78 Post release version bump
[skip ci]
2025-08-13 08:37:21 +00:00
schutzbot
7124e6dc64 Post release version bump
[skip ci]
2025-07-30 08:39:20 +00:00
schutzbot
49ee5fca02 Post release version bump
[skip ci]
2025-07-15 10:09:33 +00:00
schutzbot
5217c8931f Post release version bump
[skip ci]
2025-07-07 15:25:12 +00:00
schutzbot
4ec94759a1 Post release version bump
[skip ci]
2025-07-02 08:36:52 +00:00
Michael Vogt
67fabadbd4 osbuild: drop + when doing QEMU_LOG=unimp
This commit drops the `QEMU_LOG=+unimp` and replaces it with
`QEMU_LOG=unimp`. The `+` format does not work and we found
this in https://github.com/osbuild/bootc-image-builder/pull/963#issuecomment-3001154460
2025-06-27 11:37:38 +02:00
schutzbot
23c8bf3e8c Post release version bump
[skip ci]
2025-06-20 10:35:58 +00:00
schutzbot
230be8b504 Post release version bump
[skip ci]
2025-06-17 10:53:06 +00:00
Simon de Vlieger
3bbacb5703 solver/dnf5: switch base exception type
libdnf5 changed error types [1], [2], [3] and they no longer inherit from
`RuntimeError`; instead catch `Exception` which is the new common base
type.

This fixes issues in our CI.

[1]: https://github.com/rpm-software-management/dnf5/pull/2124
[2]: https://github.com/rpm-software-management/dnf5/pull/2118#issuecomment-2876601471
[3]: https://bugzilla.redhat.com/show_bug.cgi?id=2365689

Signed-off-by: Simon de Vlieger <supakeen@redhat.com>
2025-06-16 09:23:25 -07:00
Simon de Vlieger
daed32e462 compat: ast.Str -> ast.Constant
Python 3.14 removed the long deprecated `ast.Str` [1]. Rewrite to use
`ast.Constant` conditionally for any version that isn't 3.6.

Since 3.6 is our lowest supported version we don't check for below.

Signed-off-by: Simon de Vlieger <supakeen@redhat.com>
2025-06-16 12:26:15 +02:00
schutzbot
06d6772dca Post release version bump
[skip ci]
2025-06-04 08:35:40 +00:00
schutzbot
0cc6e5cf70 Post release version bump
[skip ci]
2025-05-21 08:35:09 +00:00
Michael Vogt
d068c6d91f dnfjson: detect/error if no repositories are defined
This commit adds an error message if no repositories are
defined in the dnfjson query. We had the issue in
https://github.com/osbuild/bootc-image-builder/issues/922
that in a RHEL bootc-container no repositories are defined.

Here the error is quite confusing, as it complains about
error marking packages which is technically correct but
hides the root of the problem.

With this detect we can construct a more useful error
message in the higher layers.
2025-05-12 20:51:57 +02:00
schutzbot
0e10c05172 Post release version bump
[skip ci]
2025-05-07 08:35:21 +00:00
Michael Vogt
549136b1b0 tools: drop requirement for module_platform_id from request
The PLATFORM_ID got retired from fedora-43 [0] and it
seems like it was always kinda optional. So lets make
it optional for real to avoid failing to build fedora-43
images.

[0] https://fedoraproject.org/wiki/Changes/Drop_PLATFORM_ID
2025-05-07 10:28:47 +02:00
Brian C. Lane
59fe07a6ab solver: Call update_cache
DNF apparently doesn't check the expiration time on the cache unless you
call this first. It may help improve issues with the cache being out of
sync.

Internally dnf checks the mtime of the main repomd.xml file when using
baseurl, and it checks the hash values when using metalink so this
should not result in any noticeable extra slowdowns when things are
fresh.
2025-05-05 13:56:54 +03:00
Brian C. Lane
d3dc07886c solver: Use load_repos instead of update_and_load_enabled_repos
The old function has been deprecated by dnf5, use load_repos directly
and only load the available repos (the ones osbuild has setup), not the
system repos.

Fixes #2080
2025-04-25 17:16:13 -07:00
schutzbot
025c8dd51d Post release version bump
[skip ci]
2025-04-23 08:33:27 +00:00
schutzbot
50a6f2733e Post release version bump
[skip ci]
2025-04-16 13:57:25 +00:00
schutzbot
912a1130cf Post release version bump
[skip ci]
2025-04-09 08:35:18 +00:00
Michael Vogt
f52aeb0676 osbuild: add experimental flag debug-qemu-user
This commit adds support for more debug for `qemu-user` options.
When settings:
```
$ sudo IMAGE_BUILDER_EXPERIMENAL=debug-qemu-user bootc-image-builder ...
```
extra debug will be printed. This hopefully helps to track down
the root cause of
https://github.com/podman-desktop/extension-bootc/issues/1475
2025-04-03 10:49:06 +02:00
Michael Vogt
ba0d9df68e util: add new util.experimentalflags.get_{bool,string} helpers
This commit adds two new helpers:
- util.experimentalflags.get_bool()
- util.experimentalflags.get_string()
similar to what we added in the images library in PR:
https://github.com/osbuild/images/pull/1248

The idea is that we provide experimentalflags for osbuild via
an environment like `OSBUILD_EXPERIMENTAL` and for those we
make no API promises. This will be initially used for better
debug of qemu-user.
2025-04-03 10:49:06 +02:00
schutzbot
7b843dc83e Post release version bump
[skip ci]
2025-04-01 13:54:43 +00:00
schutzbot
140abb03b0 Post release version bump
[skip ci]
2025-03-26 08:33:10 +00:00
schutzbot
8daf928b62 Post release version bump
[skip ci]
2025-03-12 08:33:19 +00:00
Tomáš Hozza
551d1f4ef2 sbom/spdx: always use license ref IDs as is
Always return License ref IDs as is, if used as package license,
regardless if license_expression package is available. This will prevent
wrapping them again as extracted license info and generating yet another
license ref ID.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2025-02-27 13:31:19 +01:00
Tomáš Hozza
a07431bb34 osbuild-depsolve-dnf: allow passing custom license index db file
Allow passing a custom license index db file for SBOM generation by
specifying it in the solver configuration.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2025-02-27 13:31:19 +01:00
Tomáš Hozza
a3428e282d sbom/spdx: use compliant license expressions
Introduce a new class `SpdxLicenseExpressionCreator`, responsible for
converting license texts extracted from packages, into an SPDX-compliant
license expressions. If the `license_expression` Python package is
available on the system, it is used to determine the license text
extracted from a package is a valid SPDX license expression. If it is,
it's returned as is back to the caller. If it is not, or of the package
is not available on the system, the license text is wrapped in a
`ExtractedLicensingInfo` instance.

The `SpdxLicenseExpressionCreator` object keeps track of all generated
`ExtractedLicensingInfo` instances and de-duplicates them based on the
license text. This means that if two packages use the same
SPDX-non-compliant license text, they will be wrapped by an
`ExtractedLicensingInfo` instance with the same `LicenseRef-` ID.

The reason for fallback when `license_expression` package is not
available is that it is not available on RHEL and CentOS Stream. This
implementation allows us to ship the functionality in RHEL and
optionally enabling it by installing `license_expression` from a 3rd
party repository. In any case, the generated SBOM document will always
contain valid SPDX license expressions.

Extend unit tests to cover the newly added functionality.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>

FIXUP: sbom/spdx: use compliant license expressions

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2025-02-27 13:31:19 +01:00
Tomáš Hozza
aaa6d8ec84 sbom/spdx2/model: support ExtractedLicensingInfo
Extend the SPDX v2 model to support referencing extracted licensing
information, which is either not in the SPDX license list or can't be
expressed by the SPDX-compliant license expression.

Cover the new functionality by unit tests.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2025-02-27 13:31:19 +01:00
schutzbot
39bfe3ce2d Post release version bump
[skip ci]
2025-02-26 08:32:13 +00:00
Michael Vogt
b22cbd3298 monitor: limit the amount of data sent in JSONSeqMontior.result()
This commit limits the output in the json pipeline to a "reasonable"
length. We ran into issues (e.g. [0]) from a combination of a stage
that produce tons of output (dracut, ~256 kb, see issue#1976) and
the consumer ("images" osbuild/monitor.go) that used a golang scanner
with a max default buffer of 64kb before erroring. So limit it
here.

The stage result from via json is mostly for information and any error
will most likely at the end. Plus consumers can collect the individual
log lines on their own if desired via the "log()" messages that are
stream in "real-time" with the added benefit that e.g. timestamps
can be added to the logs etc.

[0] https://issues.redhat.com/browse/RHEL-77988
2025-02-18 10:36:59 +01:00
schutzbot
6f69be6897 Post release version bump
[skip ci]
2025-02-12 08:30:17 +00:00
Simon de Vlieger
b2ec2cd5ee Revert "ostree: introduce optional subpath feature"
This reverts commit 3bb5bedd8e as it
introduces problems in the caching system used by `osbuild` [1]

[1]: https://github.com/osbuild/osbuild/issues/2009
2025-02-11 17:39:45 +01:00
Lukas Zapletal
3bb5bedd8e ostree: introduce optional subpath feature 2025-02-10 20:17:36 +01:00
schutzbot
33fd0bd183 Post release version bump
[skip ci]
2025-02-04 10:34:47 +00:00
Michael Vogt
035781ea1c osbuild: add a mutex to the _jsonseq() writer
This commit fixes a race/threading issue with the way the monitor
works. The osbuild monitor can be called from multiple threads,
e.g. in buildroot.py:run() monitor.log() is called but also
in host.py:_stdout_ready(). This can lead to out-of-order writes
when many messages need to be processed.

We did not notice this so far because we were lucky and also
log was just used for information. But now it is used to transmit
the jsonseq data which means out-of-order communication results
in broken json.

Closes: https://github.com/osbuild/image-builder-cli/issues/110
2025-01-30 20:08:53 +01:00
schutzbot
d925c26501 Post release version bump
[skip ci]
2025-01-29 08:30:14 +00:00
Simon de Vlieger
b6acd240f7 depsolve: remove nevra field
The NEVRA field accidentally made it into the public API. It shouldn't
be as it is not used downstream and in fact breaks downstream.

Signed-off-by: Simon de Vlieger <supakeen@redhat.com>
2025-01-23 20:07:12 +01:00
Simon de Vlieger
ffcafb390d depsolve: relax the module naming requirement
Remove the requirement for `:` in the name which would have been
selected by the fronted, instead asking dnf "is this a module?".

Signed-off-by: Simon de Vlieger <supakeen@redhat.com>
2025-01-22 18:03:21 +01:00
Simon de Vlieger
4337cd9595 solver/dnf4: structured data
Instead of returning the string contents of the module configuration
file let's return some more structured data so the resulting file can be
written with a stage.

Note that we don't do the same for the fallback file as we are only
provided this as a YAML blob and unparsing it to then immediately
reparse it again is counterproductive.

Signed-off-by: Simon de Vlieger <supakeen@redhat.com>
2025-01-22 18:03:21 +01:00
Simon de Vlieger
52b4ba7e63 depsolve: use modules-in-package-specs
This changes the depsolver to expect modules inside the normal
`package-specs` instead of having a separate `module-install-specs`.

Modules passed to a "normal" `dnf install` must start with an `@` and
contain a `:`. This is up to the user to pass correctly.

Signed-off-by: Simon de Vlieger <supakeen@redhat.com>
2025-01-22 18:03:21 +01:00
Simon de Vlieger
0c0580a570 solve/modularity: path + data
Return path and data separately so we have less logic in `images`.

Signed-off-by: Simon de Vlieger <supakeen@redhat.com>
2025-01-22 18:03:21 +01:00
Simon de Vlieger
983518042a modularity: handle profiles
We now keep track of enabled profiles and also handle the case where no
profile is selected.

Signed-off-by: Simon de Vlieger <supakeen@redhat.com>
2025-01-22 18:03:21 +01:00
Simon de Vlieger
6e9fb7dd6a modularity: depsolving
The commit implements modularity for the dnf4 dependency solver.

The dependency solver now takes two new keys per transaction:
`module-install-specs` and `module-enable-specs`, each of which is a
list of module specifications.

When modules are used and packages for them are installed a new
dictionary is returned in the response where each key is the name of an
enabled module and the value are the contents of the module
configuration and the module failsafe file that DNF needs in the
resulting system.

These values can be used by consumers of the dependency solver, such as
`images`, to create the appropriate inline sources and copy stages.

Signed-off-by: Simon de Vlieger <supakeen@redhat.com>
2025-01-22 18:03:21 +01:00
Achilleas Koutsou
1a529d78a9 osbuild/cli: prefer --cache over --store
Make primary name of the cache/store argument 'cache'.  Let's start
preferring it.
2025-01-21 11:35:16 +01:00
Achilleas Koutsou
db7867833a osbuild/cli: mention sources in cache/store help
The cache/store directory is also used to keep sources.  Mention that in
the description of the option.
2025-01-21 11:35:16 +01:00
Achilleas Koutsou
c31443f45b osbuild/cli: add --cache as an alias for --store
The name 'cache' is more recognisable and conveys the purpose of the
option just as well (if not better) than 'store'.
Also, the option that controls the size of this directory is called
'cache-max-size', so we're already referring to it as a cache.
2025-01-21 11:35:16 +01:00
schutzbot
dbfeae4110 Post release version bump
[skip ci]
2025-01-15 08:31:15 +00:00
Michael Vogt
154abafae8 osbuild: tweak build() to be mypy clean
This commit tweaks build() to be mypy clean without the need to
call assert. This drops the map() and instead we use the existing
dict-like access of the manifest to get the pipeline. In practise
this should not happen but lets be prepared.

Note that a small tweak for the error is needed to make it clear
what is happening.

Thanks to Simon for raising this.
2025-01-14 14:33:28 +01:00