Skip to content

Commit 71814e6

Browse files
authored
Merge pull request #963 from cgwalters/sync-bootc-code
Use published bootc-internal-{utils,blockdev} crates
2 parents 24d5deb + 12e91ec commit 71814e6

File tree

8 files changed

+22
-19
lines changed

8 files changed

+22
-19
lines changed

Cargo.lock

Lines changed: 9 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ path = "src/main.rs"
2222
[dependencies]
2323
anyhow = "1.0"
2424
bincode = "1.3.2"
25-
bootc-blockdev = { git = "https://github.com/containers/bootc", rev = "v1.3.0" }
26-
bootc-utils = { git = "https://github.com/containers/bootc", rev = "v1.3.0" }
25+
bootc-internal-blockdev = "0.0.0"
26+
bootc-internal-utils = "0.0.0"
2727
cap-std-ext = "4.0.6"
2828
camino = "1.1.9"
2929
chrono = { version = "0.4.41", features = ["serde"] }

src/bios.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ fn target_device(device: &str) -> Result<Cow<str>> {
2424
const PREPBOOT_MBR_TYPE: &str = "41";
2525

2626
// Here we use lsblk to see if the device has any partitions at all
27-
let dev = bootc_blockdev::list_dev(device.into())?;
27+
let dev = bootc_internal_blockdev::list_dev(device.into())?;
2828
if dev.children.is_none() {
2929
return Ok(device.into());
3030
};
3131
// If it does, directly call `sfdisk` and bypass lsblk because inside a container
3232
// we may not have all the cached udev state (that I think is in /run).
33-
let device = bootc_blockdev::partitions_of(device.into())?;
33+
let device = bootc_internal_blockdev::partitions_of(device.into())?;
3434
let prepdev = device
3535
.partitions
3636
.iter()

src/blockdev.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use camino::Utf8Path;
22
use std::path::Path;
33

44
use anyhow::{Context, Result};
5-
use bootc_blockdev::PartitionTable;
5+
use bootc_internal_blockdev::PartitionTable;
66
use fn_error_context::context;
77

88
#[context("get parent devices from mount point boot or sysroot")]
@@ -30,7 +30,7 @@ pub fn get_devices<P: AsRef<Path>>(target_root: P) -> Result<Vec<String>> {
3030
};
3131

3232
// Find the parent devices of the source path
33-
let parent_devices = bootc_blockdev::find_parent_devices(&source)
33+
let parent_devices = bootc_internal_blockdev::find_parent_devices(&source)
3434
.with_context(|| format!("While looking for backing devices of {}", source))?;
3535
log::debug!("Found parent devices: {parent_devices:?}");
3636
Ok(parent_devices)
@@ -40,7 +40,8 @@ pub fn get_devices<P: AsRef<Path>>(target_root: P) -> Result<Vec<String>> {
4040
/// using sfdisk to get partitiontable
4141
pub fn get_esp_partition(device: &str) -> Result<Option<String>> {
4242
const ESP_TYPE_GUID: &str = "C12A7328-F81F-11D2-BA4B-00A0C93EC93B";
43-
let device_info: PartitionTable = bootc_blockdev::partitions_of(Utf8Path::new(device))?;
43+
let device_info: PartitionTable =
44+
bootc_internal_blockdev::partitions_of(Utf8Path::new(device))?;
4445
let esp = device_info
4546
.partitions
4647
.into_iter()
@@ -70,7 +71,7 @@ pub fn find_colocated_esps(devices: &Vec<String>) -> Result<Option<Vec<String>>>
7071
/// Find bios_boot partition on the same device
7172
pub fn get_bios_boot_partition(device: &str) -> Result<Option<String>> {
7273
const BIOS_BOOT_TYPE_GUID: &str = "21686148-6449-6E6F-744E-656564454649";
73-
let device_info = bootc_blockdev::partitions_of(Utf8Path::new(device))?;
74+
let device_info = bootc_internal_blockdev::partitions_of(Utf8Path::new(device))?;
7475
let bios_boot = device_info
7576
.partitions
7677
.into_iter()

src/efi.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use std::path::{Path, PathBuf};
1010
use std::process::Command;
1111

1212
use anyhow::{bail, Context, Result};
13-
use bootc_utils::CommandRunExt;
13+
use bootc_internal_utils::CommandRunExt;
1414
use cap_std::fs::Dir;
1515
use cap_std_ext::cap_std;
1616
use fn_error_context::context;

src/filesystem.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::os::unix::process::CommandExt;
33
use std::process::Command;
44

55
use anyhow::Result;
6-
use bootc_utils::CommandRunExt;
6+
use bootc_internal_utils::CommandRunExt;
77
use fn_error_context::context;
88
use rustix::fd::BorrowedFd;
99
use serde::Deserialize;

src/filetree.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ pub(crate) struct ApplyUpdateOptions {
341341
target_arch = "riscv64"
342342
))]
343343
fn copy_dir(root: &openat::Dir, src: &str, dst: &str) -> Result<()> {
344-
use bootc_utils::CommandRunExt;
344+
use bootc_internal_utils::CommandRunExt;
345345
use std::os::unix::process::CommandExt;
346346
use std::process::Command;
347347

src/grubconfigs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::os::unix::io::AsRawFd;
33
use std::path::{Path, PathBuf};
44

55
use anyhow::{anyhow, Context, Result};
6-
use bootc_utils::CommandRunExt;
6+
use bootc_internal_utils::CommandRunExt;
77
use fn_error_context::context;
88
use openat_ext::OpenatDirExt;
99

0 commit comments

Comments
 (0)