Commit Graph

478 Commits

Author SHA1 Message Date
Luca BRUNO
8e231b5aad composepost: uniform results and visibility for cxxbridge
This aligns the result types and visibility for all post-processing
functions that are bridged to C++.
2021-04-13 11:15:52 -04:00
Luca Bruno
358865675a
Merge pull request #2737 from cgwalters/treefile-client-prep
Treefile client prep
2021-04-12 16:04:07 +00:00
dependabot[bot]
89d4e2dcf1 build(deps): bump cxx from 1.0.41 to 1.0.43
Bumps [cxx](https://github.com/dtolnay/cxx) from 1.0.41 to 1.0.43.
- [Release notes](https://github.com/dtolnay/cxx/releases)
- [Commits](https://github.com/dtolnay/cxx/compare/1.0.41...1.0.43)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-12 10:58:08 -04:00
Colin Walters
fb7514240f treefile: derive(Default)
So that it's easy to construct without deserializing.  Prep
for converting from origins.
2021-04-10 11:14:24 -04:00
Colin Walters
fab62ac9fc treefile: Make all members pub(crate)
We've been doing this piecemeal so far, let's do it all at once
now.  Prep for converting origin files to treefiles in `origin.rs`.
2021-04-10 11:12:48 -04:00
Luca Bruno
de7574f764
Merge pull request #2732 from cgwalters/postprocess-rs-more
Oxidize more of postprocess.cxx
2021-04-09 12:47:35 +00:00
Colin Walters
66c764fb38 Oxidize more of postprocess.cxx
Figuring out that we can't `fchmod()` on an `O_PATH` descriptor
took me a while =(

As part of that I discovered the `nix` crate grew a `Dir`
abstraction too.  But I think we still probably want to be using
https://docs.rs/cap-std/0.13.7/cap_std/fs/index.html
2021-04-08 16:33:47 +00:00
Colin Walters
182cae05d6 rust/client: Make status be a method
In trying to use the API in ostree's tests, this feels like an obvious
change.
2021-04-07 18:56:59 +00:00
Jonathan Lebon
cb99db232f
Merge pull request #2725 from coreos/dependabot/cargo/cxx-build-1.0.42
build(deps): bump cxx-build from 1.0.41 to 1.0.42
2021-04-07 13:00:38 -04:00
Luca Bruno
bc1e596014
Merge pull request #2727 from cgwalters/composepost-cleanup
postprocess: Move more code into Rust
2021-04-07 14:38:51 +00:00
Luca Bruno
78f3e794f7
Merge pull request #2718 from coreos/dependabot/cargo/ostree-sys-0.7.2
build(deps): bump ostree-sys from 0.7.1 to 0.7.2
2021-04-07 13:22:19 +00:00
Colin Walters
46728cfd99 postprocess: Move more code into Rust
Previously we carefully ported functionality bit by bit here.
Now take the last step and move it all in to Rust.

A reason I didn't do this in one go before is around the
incredibly twisted handling of the `/etc` vs `/usr/etc`.

I think longer term we should aim to basically have all
of our code keep it as `/etc` up until the very end.  For
now we just do a rename dance around some of the add/remove
files code.
2021-04-07 11:32:40 +00:00
Jonathan Lebon
4624c3bdf8 app/db: Add db diff --advisories
This will be used by at least coreos-assembler to store in `meta.json`
so it's easy to tell new advisories that appeared in a given build.
2021-04-06 17:04:51 -04:00
dependabot[bot]
23e53bc492
build(deps): bump ostree-sys from 0.7.1 to 0.7.2
Bumps [ostree-sys](https://gitlab.com/fkrull/ostree-rs) from 0.7.1 to 0.7.2.
- [Release notes](https://gitlab.com/fkrull/ostree-rs/tags)
- [Commits](https://gitlab.com/fkrull/ostree-rs/compare/ostree-sys/0.7.1...ostree-sys/0.7.2)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-06 16:57:21 +00:00
Luca BRUNO
17d80dc566 passwd: aling all bridge functions to return CxxResult
This updates all bridged functions in order to return CxxResult in
a uniform way.
2021-04-05 13:44:44 -04:00
Jonathan Lebon
6077dcfae3 rust/treefile: Drop unnecessary semi-colons
Latest compiler really wants me to remove these.
2021-04-05 13:31:25 -04:00
dependabot[bot]
775dd832a5
build(deps): bump cxx-build from 1.0.41 to 1.0.42
Bumps [cxx-build](https://github.com/dtolnay/cxx) from 1.0.41 to 1.0.42.
- [Release notes](https://github.com/dtolnay/cxx/releases)
- [Commits](https://github.com/dtolnay/cxx/compare/1.0.41...1.0.42)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-05 06:57:50 +00:00
dependabot[bot]
89f6572f69
build(deps): bump serde from 1.0.124 to 1.0.125
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.124 to 1.0.125.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.124...v1.0.125)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-01 09:36:23 +00:00
Jonathan Lebon
0d12cb5548
Merge pull request #2702 from coreos/dependabot/cargo/cxx-1.0.40 2021-03-31 16:43:29 -04:00
Jonathan Lebon
e54d376055 build(deps): bump cxx and cxx-build from 1.0.33 to 1.0.41
The 1.0.41 includes a fix we need:

https://github.com/dtolnay/cxx/issues/799
2021-03-30 20:25:22 -04:00
Jonathan Lebon
bef1fc7926
Merge pull request #2703 from coreos/dependabot/cargo/anyhow-1.0.40
build(deps): bump anyhow from 1.0.38 to 1.0.40
2021-03-30 08:38:23 -04:00
Jonathan Lebon
914e79f414
Merge pull request #2706 from cgwalters/depmod-rs
Migrate `depmod` helper to core.rs
2021-03-29 16:32:40 -04:00
Colin Walters
4298fd4ddd rust: More usage of indoc
There's a lot more of this in the code, just decided to do a little
bit more in treefile.rs mostly.
2021-03-29 17:50:06 +00:00
Kelvin Fan
dedf2a2653
Merge pull request #2700 from cgwalters/indoc
rust: Use indoc crate
2021-03-29 13:18:43 -04:00
Colin Walters
eba911c00a Migrate depmod helper to core.rs
Since it's called from both client and compose side, it should be
in core.  Migrate to Rust too.
2021-03-29 16:43:19 +00:00
Colin Walters
fd69eeec5a bwrap: Add more docstrings
Trying to do this on general principle.
2021-03-29 14:45:35 +00:00
Colin Walters
a8f45b5848 bwrap: Clean up /sys ro binds
Less repetitive and a bit more documented this way.
2021-03-29 14:45:35 +00:00
Colin Walters
922e6847bc bwrap: Clean up capability additions
It's easier to read this way.
2021-03-29 14:45:35 +00:00
Colin Walters
8ba6348267 bwrap: Create a RoFilesMount struct
This cleans up the drop handling/ownership.
2021-03-29 14:45:35 +00:00
Colin Walters
fa81456cbf Rewrite bwrap code in Rust
I tried to do this incrementally but it snowballed.
2021-03-29 14:45:35 +00:00
Colin Walters
40dc281e5e bwrap: Initial Rust stub
This compiles and demonstrates moving a little bit of the bwrap
code to Rust.
2021-03-29 14:44:09 +00:00
dependabot[bot]
63a2a727cc
build(deps): bump anyhow from 1.0.38 to 1.0.40
Bumps [anyhow](https://github.com/dtolnay/anyhow) from 1.0.38 to 1.0.40.
- [Release notes](https://github.com/dtolnay/anyhow/releases)
- [Commits](https://github.com/dtolnay/anyhow/compare/1.0.38...1.0.40)

Signed-off-by: dependabot[bot] <support@github.com>
2021-03-29 06:46:16 +00:00
dependabot[bot]
cc8adac055
build(deps): bump cxx from 1.0.33 to 1.0.40
Bumps [cxx](https://github.com/dtolnay/cxx) from 1.0.33 to 1.0.40.
- [Release notes](https://github.com/dtolnay/cxx/releases)
- [Commits](https://github.com/dtolnay/cxx/compare/1.0.33...1.0.40)

Signed-off-by: dependabot[bot] <support@github.com>
2021-03-29 06:46:10 +00:00
Colin Walters
15842529dd rust: Use indoc crate
I came across this crate the other day randomly - yet *another*
dtolnay dependency.  We have a bunch of these inline multi-line
strings that are just much nicer to read this way.

I only converted this one use, if this merges I'll do more
over time.
2021-03-27 19:51:59 +00:00
Colin Walters
a7edfb6293 Add a helper API to detect running in systemd
Use it instead of detecting the journal; we *could* do that
by checking the `JOURNAL_STREAM` variable:
https://www.freedesktop.org/software/systemd/man/systemd.exec.html#%24JOURNAL_STREAM

But, really none of our code cares about this today;
anyone running `rpm-ostree compose tree` under e.g.
`systemd-run` can keep both pieces.
2021-03-26 14:29:53 +00:00
dependabot[bot]
c566e51c4a build(deps): bump cxx from 1.0.32 to 1.0.33
Bumps [cxx](https://github.com/dtolnay/cxx) from 1.0.32 to 1.0.33.
- [Release notes](https://github.com/dtolnay/cxx/releases)
- [Commits](https://github.com/dtolnay/cxx/compare/1.0.32...1.0.33)

Signed-off-by: dependabot[bot] <support@github.com>
2021-03-22 15:12:01 -04:00
dependabot[bot]
03ab3712ff build(deps): bump system-deps from 3.0.0 to 3.1.0
Bumps [system-deps](https://github.com/gdesmott/system-deps) from 3.0.0 to 3.1.0.
- [Release notes](https://github.com/gdesmott/system-deps/releases)
- [Commits](https://github.com/gdesmott/system-deps/compare/v3.0.0...v3.1.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-03-22 14:06:13 -04:00
dependabot[bot]
e15dba0fd8 build(deps): bump cxx-build from 1.0.32 to 1.0.33
Bumps [cxx-build](https://github.com/dtolnay/cxx) from 1.0.32 to 1.0.33.
- [Release notes](https://github.com/dtolnay/cxx/releases)
- [Commits](https://github.com/dtolnay/cxx/compare/1.0.32...1.0.33)

Signed-off-by: dependabot[bot] <support@github.com>
2021-03-22 12:58:12 -04:00
Jonathan Lebon
5d5f1d498d lockfile: Make packages optional
Now that `source-packages` is supported, we should allow a lockfile to
not specify a `packages` field at all. So make it optional.

We still require at least one of the two fields to be specified.
2021-03-22 12:57:49 -04:00
Jonathan Lebon
7979e250ee lockfile: Allow locking by source RPM EVR
Right now if we want to lock e.g. systemd, we need to specify every
subpackage of systemd that we use. This is a lot of duplication because
in the majority of cases, what we really mean is "lock at this build of
systemd".

Since RPMs bake in the source RPM they were built from, we can use this
to lock packages more succinctly. See the testcase and #2676 for
examples of how this looks.

Closes: https://github.com/coreos/rpm-ostree/issues/2676
2021-03-22 12:57:49 -04:00
Jonathan Lebon
4a9dc21d0e
Merge pull request #2679 from cgwalters/more-ostree-sys 2021-03-22 12:18:01 -04:00
Colin Walters
61e7d6a37f postprocess: Migrate mutate-os-release to Rust
Required binding a bit more of the bwrap bits.
2021-03-22 13:06:46 +00:00
Luca BRUNO
6905254344 passwd: optimize validation logic
This improves users/groups validation logic by avoiding spurious
allocations, and by optimizing lookups through an hashset.
2021-03-22 09:02:01 -04:00
Luca BRUNO
42d86d6895 libpriv/passwd: move pre-commit validation hooks to Rust
This moves the users/groups validation logic to Rust, taking care of
all the treefile check-passwd/check-groups knobs.
As all the passwd-handling logic has been ported to Rust, it also
drops the stale C source/headers/imports.
2021-03-22 09:02:01 -04:00
Colin Walters
8d30a82e0c rust/ostree-host: Add README.md and license files
In preparation for splitting to a new repo.
2021-03-19 18:13:35 +00:00
Colin Walters
41357a730a rust/ostree-host: Add SysrootExt trait
This currently just adds a reimplementation of a new API that's
already in C upstream, but the plan is to add more Rust-only APIs in
the future here.
2021-03-19 18:13:11 +00:00
Colin Walters
da9b64cd44 rust: Factor out an ostree-host crate
In preparation for publishing this to crates.io and moving
into e.g. github.com/ostreedev/ostree-host-rs

So that ostree upstream can move forward with more Rust on the
"top level".
2021-03-19 13:44:01 -04:00
Colin Walters
ae3c1bc9a7 compose: Move remove-files code to Rust
More oxidation.
2021-03-18 18:05:34 +00:00
Colin Walters
7f9129d67d compose: Move mutate-os-release string code to Rust
More classic C string manipulation which is much nicer in Rust
2021-03-18 18:05:34 +00:00
Colin Walters
5dafd7f75d treefile: Add an allow(dead_code)
I assume this will be used soon.
2021-03-17 21:21:09 +00:00