-
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.
WIP: Allow rebase to OSTree commits in container images
Still need to add tests and possibly handle write new ostree ref in `deploy_transaction_execute()`(?). NB: current method of guessing the refspec type may also not be ideal.
- Loading branch information
1 parent
726ec79
commit 3745416
Showing
13 changed files
with
201 additions
and
30 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
//! 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(); | ||
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.