-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rpm-ostree: Use upstream Rust bindings #491
base: main
Are you sure you want to change the base?
Conversation
Draft until the rpm-ostree PR merges. I also only compile tested this. |
d2eb1bb
to
c457ecb
Compare
OK rebased 🏄 and cleaned up to use the latest upstream client API. I think this turns out cleaner. Only compile tested though. |
Depends: coreos/rpm-ostree#2636 Use the upstream client bindings for the status data. An interesting note: In the upstream API, the commit metadata is exposed as a generic `HashMap<>` because that's how it's used by both ostree and rpm-ostree. It'd be a layering violation for us to hardcode `coreos-assembler.basearch` in the rpm-ostree git for example, not to mention `fedora-coreos.stream`. So those constants stay here in zincati. I dropped the `_json` terminology from various functions because that's weird - we parsed the data from JSON, but that's not really very relevant except as an implementation detail. It's just a `Deployment`, not a `DeploymentJSON`. Also I dropped for now the optimization of using `--booted`; it's not a huge amount of data. If we care we can re-add that later. Note it makes caching more complex because then we need to carefully check the booted state too.
c457ecb
to
9a9c5f9
Compare
OK so the |
.base_checksum | ||
.clone() | ||
.unwrap_or_else(|| d.checksum.clone()), | ||
version: d.version.clone().unwrap_or_default(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks sketchy, and may break other logic in the app.
I don't know in which cases we can end up with a version-less commit, but it may be good to log a warning and filter it out.
@@ -226,18 +147,4 @@ mod tests { | |||
assert_eq!(deployments.len(), 1); | |||
} | |||
} | |||
|
|||
#[test] | |||
fn mock_booted_basearch() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These two are some basic unit tests to ensure we don't regress on parsing FCOS-specific metadata, I'd rather not drop it.
@@ -16,6 +17,16 @@ use failure::{ensure, format_err, Fallible, ResultExt}; | |||
use serde::Serialize; | |||
use std::cmp::Ordering; | |||
|
|||
/// Metadata key the base (RPM) architecture; injected by coreos-assembler |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// Metadata key the base (RPM) architecture; injected by coreos-assembler | |
/// Metadata key for the base (RPM) architecture, injected by coreos-assembler. |
The crates.io tarball is the main artifact consumed by the Fedora specfile. We can back away from that by adjusting the release steps. But that would introduce maintenance skew compared to the other (coreos+rust) projects we maintain, and it would still be blocked by |
rpm-ostree: Use upstream Rust bindings
Depends: coreos/rpm-ostree#2636
Use the upstream client bindings for the status data. Note
that some functions switched to returning borrowed
&String
because there's no need to clone unnecessarily.
An interesting note: In the upstream API, the commit
metadata is exposed as a generic
HashMap<>
becausethat's how it's used by both ostree and rpm-ostree. It'd
be a layering violation for us to hardcode
coreos-assembler.basearch
in the rpm-ostree git for example, not to mention
fedora-coreos.stream
.So those constants stay here in zincati.
I dropped the
_json
terminology from various functionsbecause that's weird - we parsed the data from JSON, but
that's not really very relevant except as an implementation
detail. It's just a
Deployment
, not aDeploymentJSON
.Also I dropped for now the optimization of using
--booted
;it's not a huge amount of data. If we care we can re-add that
later. Note it makes caching more complex because then we
need to carefully check the booted state too.