Skip to content

Commit

Permalink
Merge pull request #467 from cgwalters/update-ostree-bindings
Browse files Browse the repository at this point in the history
Update to ostree 0.18
  • Loading branch information
jmarrero committed May 1, 2023
2 parents 8cd93fb + a880fd0 commit 4b97dc1
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ on:
env:
CARGO_TERM_COLOR: always
# Pinned toolchain for linting
ACTION_LINTS_TOOLCHAIN: 1.63.0
ACTION_LINTS_TOOLCHAIN: 1.64.0

jobs:
tests:
Expand Down
2 changes: 1 addition & 1 deletion cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ license = "MIT OR Apache-2.0"
repository = "https://github.com/ostreedev/ostree-rs-ext"
readme = "README.md"
publish = false
rust-version = "1.63.0"
rust-version = "1.64.0"

[dependencies]
anyhow = "1.0"
Expand Down
4 changes: 2 additions & 2 deletions lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ name = "ostree-ext"
readme = "README.md"
repository = "https://github.com/ostreedev/ostree-rs-ext"
version = "0.10.7"
rust-version = "1.63.0"
rust-version = "1.64.0"

[dependencies]
anyhow = "1.0"
Expand All @@ -33,7 +33,7 @@ libc = "0.2.92"
libsystemd = "0.5.0"
oci-spec = "0.5.4"
openssl = "0.10.33"
ostree = { features = ["v2022_5", "cap-std-apis"], version = "0.17.0" }
ostree = { features = ["v2022_5", "cap-std-apis"], version = "0.18.0" }
pin-project = "1.0"
regex = "1.5.4"
serde = { features = ["derive"], version = "1.0.125" }
Expand Down
2 changes: 1 addition & 1 deletion lib/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -871,7 +871,7 @@ where
} => {
let sysroot = &ostree::Sysroot::new(Some(&gio::File::for_path(&sysroot)));
sysroot.load(gio::Cancellable::NONE)?;
let repo = &sysroot.repo().unwrap();
let repo = &sysroot.repo();
let kargs = karg.as_deref();
let kargs = kargs.map(|v| {
let r: Vec<_> = v.iter().map(|s| s.as_str()).collect();
Expand Down
2 changes: 1 addition & 1 deletion lib/src/container/deploy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ pub async fn deploy(
) -> Result<Box<LayeredImageState>> {
let cancellable = ostree::gio::Cancellable::NONE;
let options = options.unwrap_or_default();
let repo = &sysroot.repo().unwrap();
let repo = &sysroot.repo();
let merge_deployment = sysroot.merge_deployment(Some(stateroot));
let mut imp =
super::store::ImageImporter::new(repo, imgref, options.proxy_cfg.unwrap_or_default())
Expand Down
4 changes: 2 additions & 2 deletions lib/src/container/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ pub fn merge_default_container_proxy_opts(
) -> Result<()> {
let user = cap_std_ext::rustix::process::getuid()
.is_root()
.then(|| isolation::DEFAULT_UNPRIVILEGED_USER);
.then_some(isolation::DEFAULT_UNPRIVILEGED_USER);
merge_default_container_proxy_opts_with_isolation(config, user)
}

Expand All @@ -341,7 +341,7 @@ pub fn merge_default_container_proxy_opts_with_isolation(
let isolation_user = config
.skopeo_cmd
.is_none()
.then(|| isolation_user.as_ref())
.then_some(isolation_user.as_ref())
.flatten();
if let Some(user) = isolation_user {
// Read the default authfile if it exists and pass it via file descriptor
Expand Down
13 changes: 6 additions & 7 deletions lib/src/diff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,21 +101,20 @@ fn diff_recurse(
from_child.ensure_resolved()?;

if is_dir {
let from_contents_checksum =
from_child.tree_get_contents_checksum().expect("checksum");
let to_contents_checksum = to_child.tree_get_contents_checksum().expect("checksum");
let from_contents_checksum = from_child.tree_get_contents_checksum();
let to_contents_checksum = to_child.tree_get_contents_checksum();
if from_contents_checksum != to_contents_checksum {
let subpath = format!("{}/", path);
diff_recurse(&subpath, diff, &from_child, &to_child)?;
}
let from_meta_checksum = from_child.tree_get_metadata_checksum().expect("checksum");
let to_meta_checksum = to_child.tree_get_metadata_checksum().expect("checksum");
let from_meta_checksum = from_child.tree_get_metadata_checksum();
let to_meta_checksum = to_child.tree_get_metadata_checksum();
if from_meta_checksum != to_meta_checksum {
diff.changed_dirs.insert(path);
}
} else {
let from_checksum = from_child.checksum().expect("checksum");
let to_checksum = to_child.checksum().expect("checksum");
let from_checksum = from_child.checksum();
let to_checksum = to_child.checksum();
if from_checksum != to_checksum {
diff.changed_files.insert(path);
}
Expand Down
4 changes: 2 additions & 2 deletions lib/src/fixture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ pub fn create_dirmeta(path: &Utf8Path, selinux: bool) -> glib::Variant {
None
};
let xattrs = label.map(|v| v.new_xattrs());
ostree::create_directory_metadata(&finfo, xattrs.as_ref()).unwrap()
ostree::create_directory_metadata(&finfo, xattrs.as_ref())
}

/// Wraps [`create_dirmeta`] and commits it.
Expand Down Expand Up @@ -320,7 +320,7 @@ fn build_mapping_recurse(
});
}

let checksum = child.checksum().unwrap().to_string();
let checksum = child.checksum().to_string();
match ret.map.entry(checksum) {
Entry::Vacant(v) => {
v.insert(owner);
Expand Down
2 changes: 1 addition & 1 deletion lib/src/tar/import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,7 @@ impl Importer {
finfo.set_attribute_uint32("unix::gid", 0);
finfo.set_attribute_uint32("unix::mode", libc::S_IFDIR | 0o755);
// SAFETY: TODO: This is not a nullable return, fix it in ostree
ostree::create_directory_metadata(&finfo, None).unwrap()
ostree::create_directory_metadata(&finfo, None)
}

pub(crate) fn finish_import_object_set(self) -> Result<String> {
Expand Down

0 comments on commit 4b97dc1

Please sign in to comment.