29d051e895
This adds support for e.g.: ``` $ rpm-ostree override replace https://bodhi.fedoraproject.org/updates/FEDORA-2020-2908628031 ``` This will find the Koji builds from the listed update, download all the RPMs (that aren't debuginfo) and pass them for overrides in the same way we support `override replace http://somewebserver/foo.rpm` now. We also support directly linking a Koji build: ``` $ rpm-ostree override replace https://koji.fedoraproject.org/koji/buildinfo?buildID=1625029 ``` Bodhi has a modern HTTP+JSON API, and the lack of a Koji equivalent drove me to create https://github.com/cgwalters/koji-sane-json-api and we currently depend on an instance set up in the OpenShift CI cluster. I hope it shouldn't take long to deploy this in Fedora Infra, but I don't want to block on it. Also notably this still downloads *all* the other RPMs even ones that aren't installed. Handling that truly correctly would require moving this logic to the daemon and core. All of this functionality is keyed off a `cfg(feature = "fedora-integration")` that is detected by a Rust `build.rs` which parses the build environment's `/etc/os-release` for now.
22 lines
586 B
Rust
22 lines
586 B
Rust
use anyhow::Result;
|
|
|
|
fn detect_fedora_feature() -> Result<()> {
|
|
if !std::path::Path::new("/usr/lib/os-release").exists() {
|
|
return Ok(());
|
|
}
|
|
let p = std::process::Command::new("sh")
|
|
.args(&["-c", ". /usr/lib/os-release && echo ${ID}"])
|
|
.stdout(std::process::Stdio::piped())
|
|
.output()?;
|
|
let out = std::str::from_utf8(&p.stdout).ok().map(|s| s.trim());
|
|
if out == Some("fedora") {
|
|
println!(r#"cargo:rustc-cfg=feature="fedora-integration""#)
|
|
}
|
|
Ok(())
|
|
}
|
|
|
|
fn main() -> Result<()> {
|
|
detect_fedora_feature()?;
|
|
Ok(())
|
|
}
|