Skip to content

Commit

Permalink
Use ostree-rs-ext 0.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
cgwalters committed Nov 2, 2021
1 parent 26618db commit bc77e38
Show file tree
Hide file tree
Showing 11 changed files with 279 additions and 105 deletions.
192 changes: 179 additions & 13 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ nix = "0.23.0"
openat = "0.1.21"
openat-ext = "^0.2.2"
os-release = "0.1.0"
ostree-ext = "0.3.0"
ostree-ext = "0.4.0"
paste = "1.0"
phf = { version = "0.10", features = ["macros"] }
rand = "0.8.4"
Expand Down
2 changes: 1 addition & 1 deletion packaging/rpm-ostree.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ BuildRequires: gnome-common
BuildRequires: /usr/bin/g-ir-scanner
# Core requirements
# One way to check this: `objdump -p /path/to/rpm-ostree | grep LIBOSTREE` and pick the highest (though that might miss e.g. new struct members)
BuildRequires: pkgconfig(ostree-1) >= 2021.1
BuildRequires: pkgconfig(ostree-1) >= 2021.5
BuildRequires: pkgconfig(polkit-gobject-1)
BuildRequires: pkgconfig(json-glib-1.0)
BuildRequires: pkgconfig(rpm) >= 4.14.0
Expand Down
8 changes: 4 additions & 4 deletions rust/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,19 +137,19 @@ pub mod ffi {
/// cxx.rs currently requires types used as extern Rust types to be defined by the same crate
/// that contains the bridge using them, so we redefine an `ContainerImport` struct here.
pub(crate) struct ContainerImport {
pub changed: bool,
pub ostree_commit: String,
pub image_digest: String,
}

// sysroot_upgrade.rs
extern "Rust" {
fn import_container(
fn pull_container(
repo: Pin<&mut OstreeRepo>,
cancellable: Pin<&mut GCancellable>,
imgref: String,
imgref: &str,
) -> Result<Box<ContainerImport>>;

fn fetch_digest(imgref: String, cancellable: Pin<&mut GCancellable>) -> Result<String>;
fn get_commit_manifest_digest(commit_v: Pin<&mut GVariant>) -> Result<String>;
}

// core.rs
Expand Down
10 changes: 6 additions & 4 deletions rust/src/origin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,14 @@ pub(crate) fn origin_to_treefile_inner(kf: &KeyFile) -> Result<Box<Treefile>> {
Some(r)
} else if let Some(r) = keyfile_get_optional_string(kf, ORIGIN, "baserefspec")? {
Some(r)
} else if let Some(r) = keyfile_get_optional_string(kf, ORIGIN, "container-image-reference")? {
// TODO - consider this key deprecated and remove it
Some(r)
} else {
keyfile_get_optional_string(kf, ORIGIN, "container-image-reference")?
keyfile_get_optional_string(kf, ORIGIN, ostree_ext::container::deploy::ORIGIN_CONTAINER)?
};
let refspec_str = refspec_str.ok_or_else(|| {
anyhow::anyhow!("Failed to find refspec/baserefspec/container-image-reference in origin")
})?;
let refspec_str = refspec_str
.ok_or_else(|| anyhow::anyhow!("Failed to find refspec/baserefspec/container in origin"))?;
cfg.derive.base_refspec = Some(refspec_str);
cfg.packages = parse_stringlist(kf, PACKAGES, "requested")?;
cfg.derive.packages_local = parse_localpkglist(kf, PACKAGES, "requested-local")?;
Expand Down
Loading

0 comments on commit bc77e38

Please sign in to comment.