-
Notifications
You must be signed in to change notification settings - Fork 198
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow rebase to OSTree commits in container images
This adds support for providing a container image as the argument for `rpm-ostree rebase` by teaching rpm-ostree to use ostree-rs-ext's new import OSTree commits from container images feature. `deploy` and `upgrade` while based on a container image is not yet implemented. Currently, a tag for the target container image must be provided; i.e. omitting the tag will not be a shortcut for `latest`.
- Loading branch information
1 parent
6fea2de
commit 5800d1d
Showing
13 changed files
with
254 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
//! Rust portion of `rpmostree-sysroot-upgrader.cxx`. | ||
// SPDX-License-Identifier: Apache-2.0 OR MIT | ||
|
||
use crate::cxxrsutil::*; | ||
use anyhow::{Context, Result}; | ||
use std::convert::TryInto; | ||
use std::pin::Pin; | ||
|
||
/// Import ostree commit in container image using ostree-rs-ext's API. | ||
pub fn import_container( | ||
mut sysroot: Pin<&mut crate::FFIOstreeSysroot>, | ||
imgref: String, | ||
) -> Result<String> { | ||
let sysroot = &sysroot.gobj_wrap(); | ||
// TODO: take a GCancellable and monitor it, and drop the import task (which is how async cancellation works in Rust). | ||
let repo = &sysroot.get_repo(gio::NONE_CANCELLABLE)?; | ||
let imgref = imgref.as_str().try_into()?; | ||
let commit = build_runtime()? | ||
.block_on(async { ostree_ext::container::import(&repo, &imgref, None).await })?; | ||
Ok(commit.ostree_commit) | ||
} | ||
|
||
fn build_runtime() -> Result<tokio::runtime::Runtime> { | ||
tokio::runtime::Builder::new_multi_thread() | ||
.enable_all() | ||
.build() | ||
.context("Failed to build tokio runtime") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.