Skip to content

Commit

Permalink
Use ostree-rs-ext (0.4.alpha) from git main for now
Browse files Browse the repository at this point in the history
For ostreedev/ostree-rs-ext#12

Let's ship this updated code to replace the existing bits so
people can try it out more easily.  Once we gain experience
with it, we can make a stable ostree-rs-ext release.
  • Loading branch information
cgwalters committed Oct 28, 2021
1 parent 26618db commit 7de4033
Show file tree
Hide file tree
Showing 11 changed files with 289 additions and 102 deletions.
201 changes: 189 additions & 12 deletions Cargo.lock

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

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ nix = "0.23.0"
openat = "0.1.21"
openat-ext = "^0.2.2"
os-release = "0.1.0"
ostree-ext = "0.3.0"
# To allow us to ship the new container code as experimental
ostree-ext = { git = "https://github.com/ostreedev/ostree-rs-ext", branch = "main" }
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
7 changes: 5 additions & 2 deletions rust/src/origin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +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")
anyhow::anyhow!("Failed to find refspec/baserefspec/container in origin")
})?;
cfg.derive.base_refspec = Some(refspec_str);
cfg.packages = parse_stringlist(kf, PACKAGES, "requested")?;
Expand Down
Loading

0 comments on commit 7de4033

Please sign in to comment.