Commit Graph

290 Commits

Author SHA1 Message Date
Colin Walters
9c9188ceae rust: Add deny(unused_must_use)
We're maintaining the operating system, let's hard require
that errors are checked.
2020-12-11 06:58:45 -05:00
Timothée Ravier
b7fa99e408 rust: Fix various clippy warnings 2020-12-10 15:07:11 -05:00
Colin Walters
f1488e52f0 Move the main Rust infra (i.e. Cargo.toml) to the toplevel
I think we should have done this as soon as it was clear that
Rust was sticking and not just an optional thing.

Reasons to make this change now:
 - More clear that Rust is going to be the majority of code in the future
 - `cargo build` and `cargo test` in a fresh git clone Just Work
 - Paves the way for using `cargo` to build C/C++ instead of Automake
2020-12-09 17:42:35 -05:00
dependabot[bot]
264b07eb82 build(deps): bump serde_derive from 1.0.117 to 1.0.118 in /rust
Bumps [serde_derive](https://github.com/serde-rs/serde) from 1.0.117 to 1.0.118.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.117...v1.0.118)

Signed-off-by: dependabot[bot] <support@github.com>
2020-12-09 05:37:49 -05:00
dependabot[bot]
87024019da build(deps): bump structopt from 0.3.20 to 0.3.21 in /rust
Bumps [structopt](https://github.com/TeXitoi/structopt) from 0.3.20 to 0.3.21.
- [Release notes](https://github.com/TeXitoi/structopt/releases)
- [Changelog](https://github.com/TeXitoi/structopt/blob/master/CHANGELOG.md)
- [Commits](https://github.com/TeXitoi/structopt/compare/v0.3.20...v0.3.21)

Signed-off-by: dependabot[bot] <support@github.com>
2020-12-08 18:47:31 -05:00
dependabot[bot]
c62c393c1e build(deps): bump serde from 1.0.117 to 1.0.118 in /rust
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.117 to 1.0.118.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.117...v1.0.118)

Signed-off-by: dependabot[bot] <support@github.com>
2020-12-08 17:57:00 -05:00
dependabot[bot]
215ed95e47 build(deps): bump serde_json from 1.0.59 to 1.0.60 in /rust
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.59 to 1.0.60.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.59...v1.0.60)

Signed-off-by: dependabot[bot] <support@github.com>
2020-12-08 03:53:49 -05:00
dependabot[bot]
03fcca6f38 build(deps): bump libc from 0.2.80 to 0.2.81 in /rust
Bumps [libc](https://github.com/rust-lang/libc) from 0.2.80 to 0.2.81.
- [Release notes](https://github.com/rust-lang/libc/releases)
- [Commits](https://github.com/rust-lang/libc/compare/0.2.80...0.2.81)

Signed-off-by: dependabot[bot] <support@github.com>
2020-12-07 18:03:12 -05:00
Jonathan Lebon
73fe78140d history: Use shorthand struct initialization
This lit up in my editor.
2020-12-07 12:58:33 -05:00
dependabot[bot]
e6bcb855d6 build(deps): bump anyhow from 1.0.34 to 1.0.35 in /rust
Bumps [anyhow](https://github.com/dtolnay/anyhow) from 1.0.34 to 1.0.35.
- [Release notes](https://github.com/dtolnay/anyhow/releases)
- [Commits](https://github.com/dtolnay/anyhow/compare/1.0.34...1.0.35)

Signed-off-by: dependabot[bot] <support@github.com>
2020-12-07 11:40:00 -05:00
Luca BRUNO
57f7e1fa8e core: add a guard for temporary-etc context and move to Rust
This adds a guard around the postprocessing logic dealing with
creating/destroying a temporary-etc context, and moves it to Rust.
2020-12-07 08:23:49 -05:00
Colin Walters
a0a5db7b73 compose: Use static enablement for ostree systemd services
I was looking at the output of `ostree admin config-diff`
on a base FCOS boot.  It'd be really nice to trim that down
as much as possible, so we can cleanly capture the difference
between user config and system config.

Let's use static enablement rather than presets.
2020-12-02 22:40:31 +01:00
Colin Walters
887d362906 Convert some code to compile in C++ mode
This is part of investigating using https://cxx.rs/
In order to make this really work, we need to convert some of our C
code to C++ so we can include cxx.rs-generated code.

This starts by converting just two files as a starting point.
I did the minimal porting; I didn't try to actually rewrite them
to resemble modern C++, just "C in C++ mode".
2020-12-01 22:07:49 +01:00
dependabot[bot]
be41946737 build(deps): bump nix from 0.19.0 to 0.19.1 in /rust
Bumps [nix](https://github.com/nix-rust/nix) from 0.19.0 to 0.19.1.
- [Release notes](https://github.com/nix-rust/nix/releases)
- [Changelog](https://github.com/nix-rust/nix/blob/master/CHANGELOG.md)
- [Commits](https://github.com/nix-rust/nix/compare/v0.19.0...v0.19.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-11-30 18:10:22 +01:00
Jonathan Lebon
589d0cbd2b rust: Move to new systemd journal API for opening
The `Journal::open` API has been deprecated in favour of the new
`OpenOptions` builder pattern.

We could dedupe this a bit more, though the mock journal in the history
code makes it trickier and there's little value in mocking the builder
pattern too.
2020-11-19 00:09:27 +01:00
Colin Walters
a76ddf0cef Rewrite livefs
Now always based on an overlayfs:
f2773c1b55
This fixes a whole swath of problems with the previous design,
including the danger in replacing `/usr/lib/ostree-boot` which
broke booting for some people.

Further, we don't need to push a rollback deployment; the livefs
changes are always transient.  So now we store livefs state
in `/run` instead of in the origin file.

Since we're doing a rewrite, it's now in Rust for much more safety.

We also always work in terms of incremental diffs between commits;
the previous huge hammer of swapping `/usr` was way too dangerous.
2020-11-16 19:07:16 +01:00
dependabot[bot]
213d8f0aa2 build(deps): bump openat-ext from 0.1.8 to 0.1.9 in /rust
Bumps [openat-ext](https://github.com/cgwalters/openat-ext) from 0.1.8 to 0.1.9.
- [Release notes](https://github.com/cgwalters/openat-ext/releases)
- [Commits](https://github.com/cgwalters/openat-ext/compare/v0.1.8...v0.1.9)

Signed-off-by: dependabot[bot] <support@github.com>
2020-11-16 11:02:20 +01:00
dependabot[bot]
f77cf1a968 build(deps): bump systemd from 0.7.1 to 0.8.1 in /rust
Bumps [systemd](https://github.com/jmesmon/rust-systemd) from 0.7.1 to 0.8.1.
- [Release notes](https://github.com/jmesmon/rust-systemd/releases)
- [Commits](https://github.com/jmesmon/rust-systemd/compare/systemd-0.7.1...systemd-0.8.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-11-16 10:39:06 +01:00
Colin Walters
7ed1c0b1e8 Remove coreos-rootfs command
This effectively reverts commit: c8113bde32
We never ended up using it; instead the `rdcore` bits from
`coreos-installer` have the rootfs reprovisioning logic.
2020-11-12 18:59:49 +01:00
dependabot[bot]
25c80101fc build(deps): bump anyhow from 1.0.33 to 1.0.34 in /rust
Bumps [anyhow](https://github.com/dtolnay/anyhow) from 1.0.33 to 1.0.34.
- [Release notes](https://github.com/dtolnay/anyhow/releases)
- [Commits](https://github.com/dtolnay/anyhow/compare/1.0.33...1.0.34)

Signed-off-by: dependabot[bot] <support@github.com>
2020-11-09 08:08:30 +00:00
Colin Walters
6ccf0e06bb treefile: Fix hashing of externals
See https://github.com/coreos/rpm-ostree/pull/2206#issuecomment-721372634

The commit 7f579a55d3fb7ec1cb9f74f8ec6bc36675df2ccc broke hashing
of overlay commits; this is a super evil bug because it causes us
to silently do the wrong thing.

The cause here is the GLib bindings don't (AFAICS) support getting
a `&mut` for a GLib boxed value.

Move all of the treefile checksum code into one place - this is
far saner.  The reason I didn't do this before is that it
will cause a spurious rebuild when one updates rpm-ostree, but...eh.
2020-11-04 22:05:54 +01:00
Colin Walters
10906f4a00 rust/lockfile: Use from_glib_full to avoid manual free
This is cleaner.
2020-11-04 03:48:42 -05:00
Colin Walters
96c2d8998d daemon: Rewrite some core initramfs-overlay logic in Rust
We had a memory safety/UB bug in the C code; let's use
that as a good motivation to rewrite in Rust.  It's a nice
self contained bit.
2020-11-02 21:27:35 +01:00
dependabot[bot]
542453a1f9 build(deps): bump serde_yaml from 0.8.13 to 0.8.14 in /rust
Bumps [serde_yaml](https://github.com/dtolnay/serde-yaml) from 0.8.13 to 0.8.14.
- [Release notes](https://github.com/dtolnay/serde-yaml/releases)
- [Commits](https://github.com/dtolnay/serde-yaml/compare/0.8.13...0.8.14)

Signed-off-by: dependabot[bot] <support@github.com>
2020-11-02 11:37:28 +01:00
dependabot[bot]
926c55c63d build(deps): bump systemd from 0.7.0 to 0.7.1 in /rust
Bumps [systemd](https://github.com/jmesmon/rust-systemd) from 0.7.0 to 0.7.1.
- [Release notes](https://github.com/jmesmon/rust-systemd/releases)
- [Commits](https://github.com/jmesmon/rust-systemd/compare/systemd-0.7.0...systemd-0.7.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-11-02 09:28:50 +01:00
Colin Walters
5775b00570 rust: Use Borrow<GString> in a few places
Particularly in places like the lockfile code where we were iterating
on a list of packages, validating UTF-8 and `memcpy()`ing strings
from C is...well, unnecessary.

I don't think there's any actual real performance concerns right
now but let's use this as a best practice because the patterns
we establish *will* be copy+pasted or at least used as inspiration
for other places where performance might matter.
2020-10-30 11:25:55 +01:00
Colin Walters
1e0a15c8d8 treefile: Directly write to String
I happened to scroll past this code while doing something
else and noticed what we were doing here was silly - no need
to re-validate UTF-8 etc when serde can hand us a `String` directly.
2020-10-30 10:59:27 +01:00
Colin Walters
520b29f1b5 composepost: Fix to use write_all()
Clippy reports this as an error; I think in practice Linux
doesn't return short writes for regular files, but it's still
a good idea to do the right thing here.
2020-10-30 10:21:23 +01:00
Colin Walters
885eb9ce01 Remove ffi_view_str/ffi_new_string functions
Let's just use the GLib translation bits rather than rolling our own;
this applies primarily to `ffi_new_string()`.

However, I think in most cases performance here doesn't
matter enough to have an even more special case that avoids duplicating
the string.  Let's remove the `ffi_view_str()` optimization too
in favor of consistently using GLib translation.

In the future perhaps we should argue for adding a `from_glib_str_unchecked()`
to the upstream GLib bindings.
2020-10-29 20:00:29 +01:00
Colin Walters
a2bbc12812 rust: Enable lto by default
This avoids us leaking all of the Rust symbols as public
into our shared library.

Came up in team chat since one person tried to copy just `/usr/bin/rpm-ostree`
from the dev container into a target and got a linker crash; but
really we want to avoid all the duplicated symbols entirely.

(And we should investigate cross-language LTO because that's the
 only way to get full savings)
2020-10-29 19:00:14 +01:00
Luca BRUNO
87775cb6a9 daemon/syscore: push livefs introspection to Rust
This starts bridging parts of the daemon syscore logic to Rust
plumbing, moving the livefs detection logic over there as a first
consumer. That was the simplest logic available for wiring, and
mostly meant as a sanity check.
2020-10-29 17:57:02 +01:00
Colin Walters
af37608d9b Update to openat-ext 0.1.8, use new file writing API
This cleans up several cases.

Remove the utils path.
2020-10-28 05:51:27 -04:00
Jonathan Lebon
535a6f4327 rust/libdnf-sys: Drop Cargo.lock
As Luca pointed out in #2258, this is a library and technically
shouldn't have a lockfile.
2020-10-26 16:51:04 +01:00
dependabot[bot]
aee2e0ec9d build(deps): bump systemd from 0.6.0 to 0.7.0 in /rust
Bumps [systemd](https://github.com/jmesmon/rust-systemd) from 0.6.0 to 0.7.0.
- [Release notes](https://github.com/jmesmon/rust-systemd/releases)
- [Commits](https://github.com/jmesmon/rust-systemd/compare/v0.6.0...systemd-0.7.0)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-26 16:15:58 +01:00
dependabot[bot]
cee8869af3 build(deps): bump rayon from 1.4.1 to 1.5.0 in /rust
Bumps [rayon](https://github.com/rayon-rs/rayon) from 1.4.1 to 1.5.0.
- [Release notes](https://github.com/rayon-rs/rayon/releases)
- [Changelog](https://github.com/rayon-rs/rayon/blob/master/RELEASES.md)
- [Commits](https://github.com/rayon-rs/rayon/compare/rayon-core-v1.4.1...rayon-core-v1.5.0)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-26 16:15:50 +01:00
dependabot[bot]
2b93098826 build(deps): bump libc from 0.2.79 to 0.2.80 in /rust
Bumps [libc](https://github.com/rust-lang/libc) from 0.2.79 to 0.2.80.
- [Release notes](https://github.com/rust-lang/libc/releases)
- [Commits](https://github.com/rust-lang/libc/compare/0.2.79...0.2.80)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-26 14:54:57 +01:00
Colin Walters
9a472f923b compose: Print a warning with boot-location: new
It's tempting to flip the default, but let's encourage
people to adapt to the `modules` version now.

Plus infrastructure to add deprecation warnings here
will come in handy in the future.
2020-10-23 12:43:26 -04:00
Jonathan Lebon
e99be88af8 rust: Update deps
```
$ cargo upgrade
$ cargo update
```
2020-10-19 18:34:16 -04:00
dependabot-preview[bot]
8f8b4411ac build(deps): bump libc from 0.2.77 to 0.2.79 in /rust
Bumps [libc](https://github.com/rust-lang/libc) from 0.2.77 to 0.2.79.
- [Release notes](https://github.com/rust-lang/libc/releases)
- [Commits](https://github.com/rust-lang/libc/compare/0.2.77...0.2.79)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-10-16 10:38:02 -04:00
dependabot-preview[bot]
5cc77f9ea1 build(deps): bump serde_json from 1.0.57 to 1.0.59 in /rust
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.57 to 1.0.59.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.57...v1.0.59)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-10-15 22:52:24 -04:00
dependabot-preview[bot]
3f768241af build(deps): bump structopt from 0.3.18 to 0.3.19 in /rust
Bumps [structopt](https://github.com/TeXitoi/structopt) from 0.3.18 to 0.3.19.
- [Release notes](https://github.com/TeXitoi/structopt/releases)
- [Changelog](https://github.com/TeXitoi/structopt/blob/master/CHANGELOG.md)
- [Commits](https://github.com/TeXitoi/structopt/compare/v0.3.18...v0.3.19)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-10-15 17:55:30 -04:00
Jonathan Lebon
96af966b38 rust/treefile: Use shorthand initialization for Treefile
This lit up in my editor which does linting in the background.
2020-10-14 03:44:19 +02:00
dependabot-preview[bot]
7139db2cc5 build(deps): bump anyhow from 1.0.32 to 1.0.33 in /rust
Bumps [anyhow](https://github.com/dtolnay/anyhow) from 1.0.32 to 1.0.33.
- [Release notes](https://github.com/dtolnay/anyhow/releases)
- [Commits](https://github.com/dtolnay/anyhow/compare/1.0.32...1.0.33)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-10-14 03:44:19 +02:00
dependabot-preview[bot]
f8a961319b build(deps): bump openat-ext from 0.1.5 to 0.1.6 in /rust
Bumps [openat-ext](https://github.com/cgwalters/openat-ext) from 0.1.5 to 0.1.6.
- [Release notes](https://github.com/cgwalters/openat-ext/releases)
- [Commits](https://github.com/cgwalters/openat-ext/compare/v0.1.5...v0.1.6)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-10-05 19:35:22 +02:00
dependabot-preview[bot]
56a2cf732b build(deps): bump libc from 0.2.77 to 0.2.79 in /rust/libdnf-sys
Bumps [libc](https://github.com/rust-lang/libc) from 0.2.77 to 0.2.79.
- [Release notes](https://github.com/rust-lang/libc/releases)
- [Commits](https://github.com/rust-lang/libc/compare/0.2.77...0.2.79)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-10-05 18:40:52 +02:00
dependabot-preview[bot]
0f8c09a64b build(deps): bump chrono from 0.4.18 to 0.4.19 in /rust
Bumps [chrono](https://github.com/chronotope/chrono) from 0.4.18 to 0.4.19.
- [Release notes](https://github.com/chronotope/chrono/releases)
- [Changelog](https://github.com/chronotope/chrono/blob/main/CHANGELOG.md)
- [Commits](https://github.com/chronotope/chrono/compare/v0.4.18...v0.4.19)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-10-05 18:40:45 +02:00
dependabot-preview[bot]
0c91ad0b48 build(deps): bump rayon from 1.4.0 to 1.4.1 in /rust
Bumps [rayon](https://github.com/rayon-rs/rayon) from 1.4.0 to 1.4.1.
- [Release notes](https://github.com/rayon-rs/rayon/releases)
- [Changelog](https://github.com/rayon-rs/rayon/blob/master/RELEASES.md)
- [Commits](https://github.com/rayon-rs/rayon/compare/rayon-core-v1.4.0...rayon-core-v1.4.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-10-05 18:17:23 +02:00
dependabot-preview[bot]
c365dd7d14 build(deps): bump structopt from 0.3.17 to 0.3.18 in /rust
Bumps [structopt](https://github.com/TeXitoi/structopt) from 0.3.17 to 0.3.18.
- [Release notes](https://github.com/TeXitoi/structopt/releases)
- [Changelog](https://github.com/TeXitoi/structopt/blob/master/CHANGELOG.md)
- [Commits](https://github.com/TeXitoi/structopt/compare/v0.3.17...v0.3.18)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-09-30 11:17:29 +00:00
dependabot-preview[bot]
f997618f2b build(deps): bump chrono from 0.4.15 to 0.4.18 in /rust
Bumps [chrono](https://github.com/chronotope/chrono) from 0.4.15 to 0.4.18.
- [Release notes](https://github.com/chronotope/chrono/releases)
- [Changelog](https://github.com/chronotope/chrono/blob/main/CHANGELOG.md)
- [Commits](https://github.com/chronotope/chrono/compare/v0.4.15...v0.4.18)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-09-28 14:40:14 +00:00
dependabot-preview[bot]
ac21add95d build(deps): bump openat-ext from 0.1.4 to 0.1.5 in /rust
Bumps [openat-ext](https://github.com/cgwalters/openat-ext) from 0.1.4 to 0.1.5.
- [Release notes](https://github.com/cgwalters/openat-ext/releases)
- [Commits](https://github.com/cgwalters/openat-ext/commits/v0.1.5)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-09-28 14:03:39 +00:00