Commit Graph

3471 Commits

Author SHA1 Message Date
Luca BRUNO
15a32c12d6 rust/passwd: finish moving group and passwd parsers
This drops the remaining C compatibility hops, moving group and
passwd parsing logic fully into Rust, under a `nameservice`
module.
2021-01-25 19:43:54 +01:00
Luca BRUNO
a0e6427bb6 testutils: port to new 'rand' library API 2021-01-25 18:51:53 +01:00
dependabot[bot]
f8ff6075c7 build(deps): bump rand from 0.7.3 to 0.8.2
Bumps [rand](https://github.com/rust-random/rand) from 0.7.3 to 0.8.2.
- [Release notes](https://github.com/rust-random/rand/releases)
- [Changelog](https://github.com/rust-random/rand/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-random/rand/compare/0.7.3...0.8.2)

Signed-off-by: dependabot[bot] <support@github.com>
2021-01-25 18:51:53 +01:00
dependabot[bot]
966ad4e1ca build(deps): bump cxx from 1.0.20 to 1.0.28
Bumps [cxx](https://github.com/dtolnay/cxx) from 1.0.20 to 1.0.28.
- [Release notes](https://github.com/dtolnay/cxx/releases)
- [Commits](https://github.com/dtolnay/cxx/compare/1.0.20...1.0.28)

Signed-off-by: dependabot[bot] <support@github.com>
2021-01-25 17:29:54 +01:00
Luca BRUNO
85640d44f6 ci: fix install-extra logic
This fixes `install-extra-builddeps.sh` helper, by letting cargo
detect whether the target binary is already present in the
environment with the expected version.
This is in order to avoid mismatches in generated code when the
library version is bumped, and stale binaries are present on
the system.
2021-01-25 17:05:53 +01:00
dependabot[bot]
2e7192466a build(deps): bump rust-ini from 0.16.0 to 0.16.1
Bumps [rust-ini](https://github.com/zonyitoo/rust-ini) from 0.16.0 to 0.16.1.
- [Release notes](https://github.com/zonyitoo/rust-ini/releases)
- [Commits](https://github.com/zonyitoo/rust-ini/compare/v0.16.0...v0.16.1)

Signed-off-by: dependabot[bot] <support@github.com>
2021-01-25 16:27:52 +01:00
dependabot[bot]
bd930b7e46 build(deps): bump tempfile from 3.1.0 to 3.2.0
Bumps [tempfile](https://github.com/Stebalien/tempfile) from 3.1.0 to 3.2.0.
- [Release notes](https://github.com/Stebalien/tempfile/releases)
- [Changelog](https://github.com/Stebalien/tempfile/blob/master/NEWS)
- [Commits](https://github.com/Stebalien/tempfile/commits)

Signed-off-by: dependabot[bot] <support@github.com>
2021-01-25 09:19:54 -05:00
dependabot[bot]
2fa928ccca build(deps): bump systemd from 0.8.1 to 0.8.2
Bumps [systemd](https://github.com/jmesmon/rust-systemd) from 0.8.1 to 0.8.2.
- [Release notes](https://github.com/jmesmon/rust-systemd/releases)
- [Commits](https://github.com/jmesmon/rust-systemd/compare/systemd-0.8.1...systemd-0.8.2)

Signed-off-by: dependabot[bot] <support@github.com>
2021-01-25 13:38:18 +01:00
dependabot[bot]
8a87121a4d build(deps): bump serde_yaml from 0.8.14 to 0.8.15
Bumps [serde_yaml](https://github.com/dtolnay/serde-yaml) from 0.8.14 to 0.8.15.
- [Release notes](https://github.com/dtolnay/serde-yaml/releases)
- [Commits](https://github.com/dtolnay/serde-yaml/compare/0.8.14...0.8.15)

Signed-off-by: dependabot[bot] <support@github.com>
2021-01-25 13:15:13 +01:00
dependabot[bot]
5a1f8f411e build(deps): bump libc from 0.2.81 to 0.2.82
Bumps [libc](https://github.com/rust-lang/libc) from 0.2.81 to 0.2.82.
- [Release notes](https://github.com/rust-lang/libc/releases)
- [Commits](https://github.com/rust-lang/libc/compare/0.2.81...0.2.82)

Signed-off-by: dependabot[bot] <support@github.com>
2021-01-25 12:02:15 +01:00
dependabot[bot]
7492f44db2 build(deps): bump anyhow from 1.0.35 to 1.0.38
Bumps [anyhow](https://github.com/dtolnay/anyhow) from 1.0.35 to 1.0.38.
- [Release notes](https://github.com/dtolnay/anyhow/releases)
- [Commits](https://github.com/dtolnay/anyhow/compare/1.0.35...1.0.38)

Signed-off-by: dependabot[bot] <support@github.com>
2021-01-25 11:22:16 +01:00
dependabot[bot]
b4b13bbc53 build(deps): bump serde from 1.0.120 to 1.0.122
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.120 to 1.0.122.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.120...v1.0.122)

Signed-off-by: dependabot[bot] <support@github.com>
2021-01-25 10:17:12 +01:00
Kelvin Fan
e7558c3dc9 app/status: Display update driver info
Read from `/run/rpm-ostree/update-driver.gv` and display the update
driver name (and systemd unit if verbose).
2021-01-24 06:28:08 +01:00
Kelvin Fan
a63476d90f Add register-driver option to UpdateDeployment D-Bus API
Record the calling agent's systemd unit and serialize it into a
g-variant file at `/run/rpmostree/update-driver.gv`, along with the
human-readable name of the update driver provided as a string
argument.

Also add the companion `--register-driver` option to the `deploy`
CLI argument.

Closes https://github.com/coreos/rpm-ostree/issues/1747.
2021-01-24 06:28:08 +01:00
Jonathan Lebon
271954a41c app: Add rpm-ostree compose extensions
This adds support for a new `rpm-ostree compose extensions` command`
which takes a treefile, a new extensions YAML file, and an OSTree repo
and ref. It performs a depsolve and downloads the extensions to a
provided output directory.

This is intended to replace cosa's `download-extensions`:
https://github.com/coreos/coreos-assembler/blob/master/src/download-extensions

The input YAML schema matches the one accepted by that script.

Some differences from the script:
- We have a guaranteed depsolve match and thus can avoid silly issues
  we've hit in RHCOS (like downloading the wrong `libprotobuf` for
  `usbguard` -- rhbz#1889694).
- We seamlessly re-use the same repos defined in the treefile, whereas
  the cosa script uses `reposdir=$dir` which doesn't have the same
  semantics (repo enablement is in that case purely based on the
  `enabled` flag in those repos, which may be different than what the
  rpm-ostree compose ran with).
- We perform more sanity-checks against the requested extensions, such
  as whether the extension is already in the base.
- We support no-change detection via a state SHA512 file for better
  integration in cosa and pipelines.
- We support a `match-base-evr` key, which forces the extension to have
  the same EVR as the one from a base package: this is helpful in the
  case of extensions which complement a base package, esp. those which
  may not have strong enough reldeps to enforce matching EVRs by
  depsolve alone (`kernel-headers` is an example of this).
- We don't try to organize the RPMs into separate directories by
  extension because IMO it's not at the right level. Instead, we should
  work towards higher-level metadata to represent extensions (see
  https://github.com/openshift/os/issues/409 which is related to this).

Closes: #2055
2021-01-23 17:12:09 +01:00
Jonathan Lebon
40af45814c Revert "core: Allow overriding downloaded RPMs target dir"
This reverts commit 6a3e3d807d.

This isn't as useful in the implementation of a `rpm-ostree compose
extensions` because it doesn't account for locally cached repos where no
downloading happens.

Instead, just let libdnf download the packages to the default location
if it's a remote package and we'll just copy it over to the output dir.
2021-01-23 17:12:09 +01:00
Jonathan Lebon
14d51a6a9e .editorconfig: Adjust for CXX files 2021-01-23 17:12:09 +01:00
Kelvin Fan
9198e50c47 docs/HACKING: Update kola ext test instructions 2021-01-22 21:05:22 +01:00
Colin Walters
71496c0958 rust: Add a bit more info on cxx, move up StringMapping
Docs are good, and move up `StringMapping` since multiple things
are likely to use it.
2021-01-22 03:00:21 -05:00
Colin Walters
a4487578a7 Remove some uses of goto out
All of these cases are actually fine, but in general we
can't use `goto out` since we started using C++ exceptions
which will skip that control flow.
2021-01-21 21:01:45 -05:00
Jonathan Lebon
ee34a2d57f docs/HACKING: drop reference to make vmcheck HOSTS=...
This is no longer supported.

Keep and rework the bit about `make vmsync`.

Also drop the bit about FAHC and CAHC.
2021-01-21 18:55:22 -05:00
Kelvin Fan
f8efa6808d HACKING: Update vmcheck instructions
Following c7a9c3b1dd,
it is no longer necessary to provision your own VM.
2021-01-21 17:16:47 -05:00
Colin Walters
01e6c56415 rust/fedora_integration: Support export RPMOSTREE_KOJI_JSON_API_HOST=...
The service where this is hosted was intended to be temporary; support
overriding it so if it goes down in the future people can at
least use a systemd unit file override to change it easily.
2021-01-21 12:46:32 -05:00
Jonathan Lebon
91b48be098 ci: Set RPM_BUILD_NCPUS when building RPMs
Otherwise, it defaults to `_SC_NPROCESSORS_ONLN` (via `%make_build` ->
`%_smp_mflags` -> `%_smp_build_ncpus` -> `%{getncpus}` ->
48c0f28834/rpmio/macro.c (L583)).
And that's going to be wrong in Kubernetes because we're constrained via
cgroups.

The `%_smp_build_ncpus` macro allows overriding this logic via
`RPM_BUILD_NCPUS`.

See: https://github.com/coreos/coreos-ci/issues/23
See: https://github.com/coreos/coreos-assembler/pull/632
See: https://github.com/coreos/coreos-assembler/pull/1287
2021-01-21 11:57:13 -05:00
dependabot[bot]
9138739c49 build(deps): bump serde from 1.0.118 to 1.0.120
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.118 to 1.0.120.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.118...v1.0.120)

Signed-off-by: dependabot[bot] <support@github.com>
2021-01-21 08:03:12 -05:00
dependabot[bot]
a974d95288 build(deps): bump serde_json from 1.0.60 to 1.0.61
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.60 to 1.0.61.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.60...v1.0.61)

Signed-off-by: dependabot[bot] <support@github.com>
2021-01-21 06:06:56 -05:00
Colin Walters
a9a4e022e6 rust: Port history to cxx-rs
Just keeping up momentum on the porting, we're getting closer
to being able to drop cbindgen entirely.
2021-01-20 17:22:29 -05:00
Kelvin Fan
7586503ee2 vmcheck/test-misc-2: Fix $cursor variable
Minor cleanup.

Follow up from https://github.com/coreos/rpm-ostree/pull/2461/.
2021-01-20 15:20:41 -05:00
Colin Walters
402912e030 Make make check work again
Our CI isn't running the C unit tests because it goes via RPM,
and while we could potentially add `%check` there...I don't
quite want to do that right now since it also runs the Rust
tests which means we rebuild all the Rust code again in debug
mode etc.

Change the C unit tests to compile in C++ mode, which is
enough for local testing.

Longer term I think the C unit tests will go away in favor
of Rust tests.
2021-01-20 13:10:14 -05:00
dependabot[bot]
70cfb765f6 build(deps): bump libdnf from 45981d5 to 1ebad38
Bumps [libdnf](https://github.com/rpm-software-management/libdnf) from `45981d5` to `1ebad38`.
- [Release notes](https://github.com/rpm-software-management/libdnf/releases)
- [Commits](45981d5f53...1ebad384f6)

Signed-off-by: dependabot[bot] <support@github.com>
2021-01-20 11:32:41 -05:00
Kelvin Fan
3f9fe06d24 daemon: Record agent's systemd service
In https://github.com/coreos/rpm-ostree/pull/2395/, agent's id is
recorded in the journal. Similarly, record the systemd service that
called the client, as well.

Related to https://github.com/coreos/rpm-ostree/issues/1747.
2021-01-20 10:13:02 -05:00
Luca BRUNO
8447fd7cfa github: update dependabot config
This updates dependabot config, dropping the "tooling" subdirectory
fixing the path to the top-level cargo manifest.
2021-01-20 09:32:14 -05:00
Luca BRUNO
21be64b3d6 libpriv/passwd: move RPM layering logic to Rust
This moves to Rust the RPM layering logic for users and groups
databases.
2021-01-19 19:32:27 -05:00
Jonathan Lebon
8c34dbe9d7 spec: Add BuildRequires: make
https://fedoraproject.org/wiki/Changes/Remove_make_from_BuildRoot

(Upstreamed from 6e99dd065d)

Really, libdnf's `cmake` BR does pull it into the buildroot anyway right
now. Though we do still need it as well.
2021-01-19 11:45:20 -05:00
Colin Walters
db76e56931 Update configure.ac
Co-authored-by: Jonathan Lebon <jonathan@jlebon.com>
2021-01-18 19:19:09 -05:00
Colin Walters
774923fce3 Release 2021.1 2021-01-18 19:19:09 -05:00
Colin Walters
1c573200dd scripts: Rework /var/lib/rpm-state creation, port to new style
Move the creation of the directory up into core.

Avoid the use of `goto out` since we can't really
do this anymore with C++ exceptions in play.
2021-01-18 12:54:35 -05:00
Colin Walters
f0122a761e scripts: Use bwrap --ro-bind-data rather than mutating target
This is part of avoiding `goto out`, but is also just better
because we're not mutating the target system.
2021-01-18 12:54:35 -05:00
Colin Walters
a8a1317748 rust: Port progress.rs to cxx-rs
Only slightly tricky thing here was double checking which
places pass "optional &str" (represented as empty strings)
and which don't.
2021-01-18 12:07:53 -05:00
Colin Walters
2f82733e65 apply-live: Extend /etc test case
- Further nested sub/sub directories
- symbolic links that point to various corner cases like `/`, are
  broken, to parents etc.
2021-01-18 05:51:05 -05:00
Jonathan Lebon
f9c0dc0828 app/compose: Drop rojig-related prototypes
Those functions don't actually exist (they're conditionally built under
the `ex` command now).
2021-01-15 19:03:42 -05:00
Jonathan Lebon
6a3e3d807d core: Allow overriding downloaded RPMs target dir
This will be useful for a follow-up patch which adds `rpm-ostree compose
extensions` where we'll want to download to a separate directory.
2021-01-15 19:03:42 -05:00
Jonathan Lebon
027f501f4a Makefile-rpm-ostree: Link to librt
For some reason, when building with `-g -Og`, I get a linker error for
a missing `lio_listio`. Adding `-lrt` fixes it. (We already link against
this transitively, so it's not actually a net new `DT_NEEDED`.)
2021-01-15 19:03:42 -05:00
Colin Walters
a3d6c85e06 rust: Fix a pub(crate) warning, add a few doc comments
Mainly went to fix the warning but decided to add some
comments while I was in here.
2021-01-15 18:25:27 -05:00
Colin Walters
becbf17fe3 rust: Update to openat-ext 0.1.10
We want the `remove_all()` fix and the new copy API.
2021-01-15 14:51:33 -05:00
Colin Walters
54ab9175ac rust: Add CxxResult
This is a workaround for the non-customizability of the cxx-rs
propagation of Rust result to C++ exception.  Right now we're
losing context.  Work around this by formatting on the Rust
side at exit points, explicitly converting an `anyhow::Error`
by printing it in "single line context".

Since we're likely to gain more things like this, unify
this with `cxx_bridge_gobject::` into a single `cxxrsutil::`.
2021-01-15 06:59:30 -05:00
Colin Walters
d0c6871d80 apply-live: Avoid clobbering changes in /etc
Gather the current diff of `/etc`, and filter out changes in
the tree which would overwrite it.

There is an OSTree API for diffs but it's a bit awkward, missing
some APIs in the Rust bindings and also `GFile` based unfortunately.
Doing this in Rust is nicer.  The dirdiff code obviously needs
a lot more testing, but I think it's right.
2021-01-15 05:41:53 -05:00
Colin Walters
1f76758513 testutils: Add script-shell, remove shell wrapper
Let's make it very convenient to reproduce the container
for our scripts even from inside a booted system.  Avoids
the need for a duplicate shell script implementation.
2021-01-14 17:55:40 -05:00
Colin Walters
d8076b1132 scripts: Pass script as a memfd
This avoids writing content to the target root, which is
good in general.

But more specifically this is prep for
`rpm-ostree testutils script-shell` which would operate
on the booted root (mounted read-only), in contrast
to the current default checkout that the compose path does.
2021-01-14 17:55:40 -05:00
Timothée Ravier
6650540c2f Remove now unused mkdocs.yml 2021-01-13 16:01:16 -05:00