Skip to content

Commit 10f1c07

Browse files
committed
Update to ostree-ext 0.11, also bump rustix and cap-std-ext
This is similar to coreos/rpm-ostree#4400 Signed-off-by: Colin Walters <[email protected]>
1 parent 9ba1c13 commit 10f1c07

File tree

5 files changed

+15
-17
lines changed

5 files changed

+15
-17
lines changed

lib/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ rust-version = "1.64.0"
1111
[dependencies]
1212
anyhow = "1.0"
1313
camino = { version = "1.0.4", features = ["serde1"] }
14-
ostree-ext = "0.10.6"
14+
ostree-ext = "0.11"
1515
clap = { version= "4.2", features = ["derive"] }
1616
clap_mangen = { version = "0.2", optional = true }
17-
cap-std-ext = "1.0.1"
17+
cap-std-ext = "2"
1818
hex = "^0.4"
1919
fn-error-context = "0.2.0"
2020
gvariant = "0.4.0"
@@ -25,7 +25,7 @@ once_cell = "1.9"
2525
openssl = "^0.10"
2626
nix = ">= 0.24, < 0.26"
2727
regex = "1.7.1"
28-
rustix = { "version" = "0.36", features = ["thread"] }
28+
rustix = { "version" = "0.37", features = ["thread", "process"] }
2929
serde = { features = ["derive"], version = "1.0.125" }
3030
serde_json = "1.0.64"
3131
serde_with = ">= 1.9.4, < 2"

lib/src/cli.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
55
use anyhow::{Context, Result};
66
use camino::Utf8PathBuf;
7-
use cap_std_ext::rustix;
87
use clap::Parser;
98
use fn_error_context::context;
109
use ostree::{gio, glib};
@@ -145,7 +144,7 @@ pub(crate) async fn ensure_self_unshared_mount_namespace() -> Result<()> {
145144
return Ok(());
146145
}
147146
if std::env::var_os(recurse_env).is_some() {
148-
let am_pid1 = cap_std_ext::rustix::process::getpid().is_init();
147+
let am_pid1 = rustix::process::getpid().is_init();
149148
if am_pid1 {
150149
tracing::debug!("We are pid 1");
151150
return Ok(());
@@ -237,7 +236,7 @@ pub(crate) fn require_root() -> Result<()> {
237236
if !uid.is_root() {
238237
anyhow::bail!("This command requires root privileges");
239238
}
240-
if !rustix::thread::is_in_capability_bounding_set(rustix::thread::Capability::SystemAdmin)? {
239+
if !rustix::thread::capability_is_in_bounding_set(rustix::thread::Capability::SystemAdmin)? {
241240
anyhow::bail!("This command requires full root privileges (CAP_SYS_ADMIN)");
242241
}
243242
Ok(())
@@ -263,10 +262,10 @@ async fn prepare_for_write() -> Result<()> {
263262
async fn upgrade(opts: UpgradeOpts) -> Result<()> {
264263
prepare_for_write().await?;
265264
let sysroot = &get_locked_sysroot().await?;
266-
let repo = &sysroot.repo().unwrap();
265+
let repo = &sysroot.repo();
267266
let booted_deployment = &sysroot.require_booted_deployment()?;
268267
let status = crate::status::DeploymentStatus::from_deployment(booted_deployment, true)?;
269-
let osname = booted_deployment.osname().unwrap();
268+
let osname = booted_deployment.osname();
270269
let origin = booted_deployment
271270
.origin()
272271
.ok_or_else(|| anyhow::anyhow!("Deployment is missing an origin"))?;
@@ -279,7 +278,7 @@ async fn upgrade(opts: UpgradeOpts) -> Result<()> {
279278
"Booted deployment contains local rpm-ostree modifications; cannot upgrade via bootc"
280279
));
281280
}
282-
let commit = booted_deployment.csum().unwrap();
281+
let commit = booted_deployment.csum();
283282
let state = ostree_container::store::query_image_commit(repo, &commit)?;
284283
let digest = state.manifest_digest.as_str();
285284
let fetched = pull(repo, &imgref, opts.quiet).await?;
@@ -308,8 +307,8 @@ async fn switch(opts: SwitchOpts) -> Result<()> {
308307
let booted_deployment = &sysroot.require_booted_deployment()?;
309308
let (origin, booted_image) = crate::utils::get_image_origin(booted_deployment)?;
310309
let booted_refspec = origin.optional_string("origin", "refspec")?;
311-
let osname = booted_deployment.osname().unwrap();
312-
let repo = &sysroot.repo().unwrap();
310+
let osname = booted_deployment.osname();
311+
let repo = &sysroot.repo();
313312

314313
let transport = ostree_container::Transport::try_from(opts.transport.as_str())?;
315314
let imgref = ostree_container::ImageReference {

lib/src/install.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use camino::Utf8PathBuf;
2020
use cap_std::fs::Dir;
2121
use cap_std_ext::cap_std;
2222
use cap_std_ext::prelude::CapStdExtDirExt;
23-
use cap_std_ext::rustix::fs::MetadataExt;
23+
use rustix::fs::MetadataExt;
2424

2525
use fn_error_context::context;
2626
use ostree::gio;
@@ -518,7 +518,7 @@ async fn initialize_ostree_root_from_self(
518518
.next()
519519
.ok_or_else(|| anyhow::anyhow!("Failed to find deployment"))?;
520520
// SAFETY: There must be a path
521-
let path = sysroot.deployment_dirpath(&deployment).unwrap();
521+
let path = sysroot.deployment_dirpath(&deployment);
522522
let root = rootfs_dir
523523
.open_dir(path.as_str())
524524
.context("Opening deployment dir")?;
@@ -531,7 +531,7 @@ async fn initialize_ostree_root_from_self(
531531
writeln!(f, "{}", root_setup.boot.to_fstab())?;
532532
f.flush()?;
533533

534-
let uname = cap_std_ext::rustix::process::uname();
534+
let uname = rustix::process::uname();
535535

536536
let aleph = InstallAleph {
537537
image: src_imageref.imgref.name.clone(),

lib/src/privtests.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ use std::process::Command;
22

33
use anyhow::Result;
44
use camino::{Utf8Path, Utf8PathBuf};
5-
use cap_std_ext::rustix;
65
use fn_error_context::context;
76
use rustix::fd::AsFd;
87
use xshell::{cmd, Shell};

lib/src/status.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ impl DeploymentStatus {
6565
let staged = deployment.is_staged();
6666
let pinned = deployment.is_pinned();
6767
let image = get_image_origin(deployment)?.1;
68-
let checksum = deployment.csum().unwrap().to_string();
68+
let checksum = deployment.csum().to_string();
6969
let deploy_serial = (!staged).then(|| deployment.bootserial().try_into().unwrap());
7070
let supported = deployment
7171
.origin()
@@ -119,7 +119,7 @@ pub(crate) async fn status(opts: super::cli::StatusOpts) -> Result<()> {
119119
return Ok(());
120120
}
121121
let sysroot = super::cli::get_locked_sysroot().await?;
122-
let repo = &sysroot.repo().unwrap();
122+
let repo = &sysroot.repo();
123123
let booted_deployment = sysroot.booted_deployment();
124124

125125
let deployments = get_deployments(&sysroot, booted_deployment.as_ref(), opts.booted)?;

0 commit comments

Comments
 (0)