Skip to content

Commit 05725d8

Browse files
ckyrouaccgwalters
authored andcommitted
ci: Rename bootc-mount to bootc-internal-mount and publish to crates.io
Rename the mount crate from bootc-mount to bootc-internal-mount, matching the naming convention of other published internal crates (bootc-internal-utils, bootc-internal-blockdev). Set version to 0.1.0, add workspace lints, doc comments for public API, and update all dependent crates (blockdev, lib, system-reinstall-bootc) to reference the new package name with version. Add the crate to the crates-release publish list (in dependency order between utils and blockdev) and to the scheduled-release version bump. Assisted-by: Claude Code (Opus 4) Signed-off-by: ckyrouac <ckyrouac@redhat.com>
1 parent 95d928b commit 05725d8

10 files changed

Lines changed: 53 additions & 35 deletions

File tree

.github/workflows/crates-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- run: |
1717
# Publish crates if their current version is not already on crates.io.
1818
# Order matters: dependencies must be published first.
19-
CRATES="bootc-internal-utils bootc-internal-blockdev"
19+
CRATES="bootc-internal-utils bootc-internal-mount bootc-internal-blockdev"
2020
2121
for crate in $CRATES; do
2222
VERSION=$(cargo read-manifest -p "$crate" | jq -r '.version')

.github/workflows/scheduled-release.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ jobs:
9494
9595
# Set internal crate versions to match the bootc release version
9696
cargo set-version --manifest-path crates/utils/Cargo.toml --package bootc-internal-utils "$VERSION"
97+
cargo set-version --manifest-path crates/mount/Cargo.toml --package bootc-internal-mount "$VERSION"
9798
cargo set-version --manifest-path crates/blockdev/Cargo.toml --package bootc-internal-blockdev "$VERSION"
9899
99100
cargo update --workspace

Cargo.lock

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

crates/blockdev/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ version = "0.2.0"
99
[dependencies]
1010
# Internal crates
1111
bootc-utils = { package = "bootc-internal-utils", path = "../utils", version = "0.1.0" }
12-
bootc-mount = { path = "../mount" }
12+
bootc-mount = { package = "bootc-internal-mount", path = "../mount", version = "0.1.0" }
1313

1414
# Workspace dependencies
1515
anyhow = { workspace = true }

crates/lib/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ include = ["/src", "LICENSE-APACHE", "LICENSE-MIT"]
1616
# Internal crates
1717
bootc-blockdev = { package = "bootc-internal-blockdev", path = "../blockdev", version = "0.2.0" }
1818
bootc-kernel-cmdline = { path = "../kernel_cmdline", version = "0.0.0" }
19-
bootc-mount = { path = "../mount" }
19+
bootc-mount = { package = "bootc-internal-mount", path = "../mount", version = "0.1.0" }
2020
bootc-sysusers = { path = "../sysusers" }
2121
bootc-tmpfiles = { path = "../tmpfiles" }
2222
bootc-utils = { package = "bootc-internal-utils", path = "../utils", version = "0.1.0" }

crates/lib/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
//! # Related Crates
6060
//!
6161
//! - [`ostree-ext`](../ostree_ext/index.html) - OCI/ostree bridging
62-
//! - [`bootc-mount`](../bootc_mount/index.html) - Mount utilities
62+
//! - [`bootc-internal-mount`](../bootc_mount/index.html) - Mount utilities
6363
//! - [`bootc-kernel-cmdline`](../bootc_kernel_cmdline/index.html) - Cmdline parsing
6464
//! - [`etc-merge`](../etc_merge/index.html) - `/etc` three-way merge
6565

crates/mount/Cargo.toml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
[package]
2-
description = "Internal mount code"
3-
# Should never be published to crates.io
4-
publish = false
2+
description = "Internal implementation component of bootc; do not use"
53
edition = "2024"
64
license = "MIT OR Apache-2.0"
7-
name = "bootc-mount"
5+
name = "bootc-internal-mount"
86
repository = "https://github.com/bootc-dev/bootc"
9-
version = "0.0.0"
7+
version = "0.1.0"
108

119
[dependencies]
1210
# Internal crates
@@ -28,3 +26,6 @@ indoc = { workspace = true }
2826

2927
[lib]
3028
path = "src/mount.rs"
29+
30+
[lints]
31+
workspace = true

crates/mount/src/mount.rs

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ use rustix::{
2323
};
2424
use serde::Deserialize;
2525

26+
/// Temporary mount management with automatic cleanup.
2627
pub mod tempmount;
2728

2829
/// Well known identifier for pid 1
@@ -33,26 +34,37 @@ pub const PID1: Pid = const {
3334
}
3435
};
3536

37+
/// Deserialized information about a mounted filesystem from `findmnt`.
3638
#[derive(Deserialize, Debug)]
3739
#[serde(rename_all = "kebab-case")]
3840
#[allow(dead_code)]
3941
pub struct Filesystem {
4042
// Note if you add an entry to this list, you need to change the --output invocation below too
43+
/// The source device or path.
4144
pub source: String,
45+
/// The mount target path.
4246
pub target: String,
47+
/// Major:minor device numbers.
4348
#[serde(rename = "maj:min")]
4449
pub maj_min: String,
50+
/// The filesystem type (e.g. ext4, xfs).
4551
pub fstype: String,
52+
/// Mount options.
4653
pub options: String,
54+
/// The filesystem UUID, if available.
4755
pub uuid: Option<String>,
56+
/// Child filesystems, if any.
4857
pub children: Option<Vec<Filesystem>>,
4958
}
5059

60+
/// Deserialized output of `findmnt --json`.
5161
#[derive(Deserialize, Debug, Default)]
5262
pub struct Findmnt {
63+
/// The list of mounted filesystems.
5364
pub filesystems: Vec<Filesystem>,
5465
}
5566

67+
/// Run `findmnt` with JSON output and parse the result.
5668
pub fn run_findmnt(args: &[&str], cwd: Option<&Dir>, path: Option<&str>) -> Result<Findmnt> {
5769
let mut cmd = Command::new("findmnt");
5870
if let Some(cwd) = cwd {
@@ -99,8 +111,8 @@ pub fn inspect_filesystem_by_uuid(uuid: &str) -> Result<Filesystem> {
99111
findmnt_filesystem(&["--source"], None, &(format!("UUID={uuid}")))
100112
}
101113

102-
// Check if a specified device contains an already mounted filesystem
103-
// in the root mount namespace
114+
/// Check if a specified device contains an already mounted filesystem
115+
/// in the root mount namespace.
104116
pub fn is_mounted_in_pid1_mountns(path: &str) -> Result<bool> {
105117
let o = run_findmnt(&["-N"], None, Some("1"))?;
106118

@@ -109,7 +121,7 @@ pub fn is_mounted_in_pid1_mountns(path: &str) -> Result<bool> {
109121
Ok(mounted)
110122
}
111123

112-
// Recursively check a given filesystem to see if it contains an already mounted source
124+
/// Recursively check a given filesystem to see if it contains an already mounted source.
113125
pub fn is_source_mounted(path: &str, mounted_fs: &Filesystem) -> bool {
114126
if mounted_fs.source.contains(path) {
115127
return true;
@@ -281,8 +293,8 @@ pub fn bind_mount_from_pidns(
281293
Ok(())
282294
}
283295

284-
// If the target path is not already mirrored from the host (e.g. via -v /dev:/dev)
285-
// then recursively mount it.
296+
/// If the target path is not already mirrored from the host (e.g. via `-v /dev:/dev`)
297+
/// then recursively mount it.
286298
pub fn ensure_mirrored_host_mount(path: impl AsRef<Utf8Path>) -> Result<()> {
287299
let path = path.as_ref();
288300
// If we didn't have this in our filesystem already (e.g. for /var/lib/containers)

crates/mount/src/tempmount.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,12 @@ use cap_std_ext::cap_std::{ambient_authority, fs::Dir};
77
use fn_error_context::context;
88
use rustix::mount::{MountFlags, MoveMountFlags, UnmountFlags, move_mount, unmount};
99

10+
/// RAII wrapper for a temporary mount that is automatically unmounted on drop.
11+
#[derive(Debug)]
1012
pub struct TempMount {
13+
/// The backing temporary directory.
1114
pub dir: tempfile::TempDir,
15+
/// An open handle to the mounted directory.
1216
pub fd: Dir,
1317
}
1418

crates/system-reinstall-bootc/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ platforms = ["*-unknown-linux-gnu"]
1515

1616
[dependencies]
1717
# Internal crates
18-
bootc-mount = { path = "../mount" }
18+
bootc-mount = { package = "bootc-internal-mount", path = "../mount", version = "0.1.0" }
1919
bootc-utils = { package = "bootc-internal-utils", path = "../utils", version = "0.1.0" }
2020

2121
# Workspace dependencies

0 commit comments

Comments
 (0)