Skip to content

Commit d42d5b7

Browse files
committed
lib: Remove composefs-backend feature gate
While composefs is still experimental, after looking at this I think the feature gating we're doing has a pretty high "pain:gain" ratio - in other words, the risk we're mitigating by having it off is very low. Since composefs is a focus of development, let's just remove the feature gate. We have good CI coverage for the non-composefs case. Assisted-by: Claude Code (Sonnet 4.5) Signed-off-by: Colin Walters <[email protected]>
1 parent 37fa085 commit d42d5b7

File tree

11 files changed

+5
-104
lines changed

11 files changed

+5
-104
lines changed

crates/lib/Cargo.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,11 @@ similar-asserts = { workspace = true }
7474
static_assertions = { workspace = true }
7575

7676
[features]
77-
default = ["install-to-disk", "composefs-backend"]
77+
default = ["install-to-disk"]
7878
# This feature enables `bootc install to-disk`, which is considered just a "demo"
7979
# or reference installer; we expect most nontrivial use cases to be using
8080
# `bootc install to-filesystem`.
8181
install-to-disk = []
82-
# Enable support for the composefs native backend
83-
composefs-backend = []
8482
# This featuares enables `bootc internals publish-rhsm-facts` to integrate with
8583
# Red Hat Subscription Manager
8684
rhsm = []

crates/lib/src/bootloader.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ use fn_error_context::context;
88
use bootc_blockdev::{Partition, PartitionTable};
99
use bootc_mount as mount;
1010

11-
#[cfg(any(feature = "composefs-backend", feature = "install-to-disk"))]
1211
use crate::bootc_composefs::boot::mount_esp;
1312
use crate::{discoverable_partition_specification, utils};
1413

@@ -72,7 +71,6 @@ pub(crate) fn install_via_bootupd(
7271
}
7372

7473
#[context("Installing bootloader")]
75-
#[cfg(any(feature = "composefs-backend", feature = "install-to-disk"))]
7674
pub(crate) fn install_systemd_boot(
7775
device: &PartitionTable,
7876
_rootfs: &Utf8Path,

crates/lib/src/cli.rs

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ use schemars::schema_for;
3333
use serde::{Deserialize, Serialize};
3434
use tempfile::tempdir_in;
3535

36-
#[cfg(feature = "composefs-backend")]
3736
use crate::bootc_composefs::{
3837
finalize::{composefs_backend_finalize, get_etc_diff},
3938
rollback::composefs_rollback,
@@ -667,9 +666,7 @@ pub(crate) enum Opt {
667666
#[clap(subcommand)]
668667
#[clap(hide = true)]
669668
Internals(InternalsOpts),
670-
#[cfg(feature = "composefs-backend")]
671669
ComposefsFinalizeStaged,
672-
#[cfg(feature = "composefs-backend")]
673670
/// Diff current /etc configuration versus default
674671
ConfigDiff,
675672
}
@@ -1263,38 +1260,26 @@ async fn run_from_opt(opt: Opt) -> Result<()> {
12631260
let root = &Dir::open_ambient_dir("/", cap_std::ambient_authority())?;
12641261
match opt {
12651262
Opt::Upgrade(opts) => {
1266-
#[cfg(feature = "composefs-backend")]
12671263
if composefs_booted()?.is_some() {
12681264
upgrade_composefs(opts).await
12691265
} else {
12701266
upgrade(opts).await
12711267
}
1272-
1273-
#[cfg(not(feature = "composefs-backend"))]
1274-
upgrade(opts).await
12751268
}
12761269
Opt::Switch(opts) => {
1277-
#[cfg(feature = "composefs-backend")]
12781270
if composefs_booted()?.is_some() {
12791271
switch_composefs(opts).await
12801272
} else {
12811273
switch(opts).await
12821274
}
1283-
1284-
#[cfg(not(feature = "composefs-backend"))]
1285-
switch(opts).await
12861275
}
12871276
Opt::Rollback(opts) => {
1288-
#[cfg(feature = "composefs-backend")]
12891277
if composefs_booted()?.is_some() {
12901278
composefs_rollback().await?
12911279
} else {
12921280
rollback(&opts).await?
12931281
}
12941282

1295-
#[cfg(not(feature = "composefs-backend"))]
1296-
rollback(&opts).await?;
1297-
12981283
if opts.apply {
12991284
crate::reboot::reboot()?;
13001285
}
@@ -1303,15 +1288,11 @@ async fn run_from_opt(opt: Opt) -> Result<()> {
13031288
}
13041289
Opt::Edit(opts) => edit(opts).await,
13051290
Opt::UsrOverlay => {
1306-
#[cfg(feature = "composefs-backend")]
13071291
if composefs_booted()?.is_some() {
13081292
composefs_usr_overlay()
13091293
} else {
13101294
usroverlay().await
13111295
}
1312-
1313-
#[cfg(not(feature = "composefs-backend"))]
1314-
usroverlay().await
13151296
}
13161297
Opt::Container(opts) => match opts {
13171298
ContainerOpts::Lint {
@@ -1604,10 +1585,8 @@ async fn run_from_opt(opt: Opt) -> Result<()> {
16041585
}
16051586
},
16061587

1607-
#[cfg(feature = "composefs-backend")]
16081588
Opt::ComposefsFinalizeStaged => composefs_backend_finalize().await,
16091589

1610-
#[cfg(feature = "composefs-backend")]
16111590
Opt::ConfigDiff => get_etc_diff().await,
16121591
}
16131592
}

crates/lib/src/install.rs

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ use serde::{Deserialize, Serialize};
5353

5454
#[cfg(feature = "install-to-disk")]
5555
use self::baseline::InstallBlockDeviceOpts;
56-
#[cfg(feature = "composefs-backend")]
5756
use crate::bootc_composefs::{boot::setup_composefs_boot, repo::initialize_composefs_repository};
5857
use crate::boundimage::{BoundImage, ResolvedBoundImage};
5958
use crate::containerenv::ContainerExecutionInfo;
@@ -66,7 +65,6 @@ use crate::task::Task;
6665
use crate::utils::sigpolicy_from_opt;
6766
use bootc_kernel_cmdline::{bytes, utf8, INITRD_ARG_PREFIX, ROOTFLAGS};
6867
use bootc_mount::Filesystem;
69-
#[cfg(feature = "composefs-backend")]
7068
use composefs::fsverity::FsVerityHashValue;
7169

7270
/// The toplevel boot directory
@@ -275,7 +273,6 @@ pub(crate) struct InstallToDiskOpts {
275273

276274
#[clap(flatten)]
277275
#[serde(flatten)]
278-
#[cfg(feature = "composefs-backend")]
279276
pub(crate) composefs_opts: InstallComposefsOpts,
280277
}
281278

@@ -353,7 +350,6 @@ pub(crate) struct InstallToFilesystemOpts {
353350
#[clap(flatten)]
354351
pub(crate) config_opts: InstallConfigOpts,
355352

356-
#[cfg(feature = "composefs-backend")]
357353
#[clap(flatten)]
358354
pub(crate) composefs_opts: InstallComposefsOpts,
359355
}
@@ -388,7 +384,6 @@ pub(crate) struct InstallToExistingRootOpts {
388384
#[clap(default_value = ALONGSIDE_ROOT_MOUNT)]
389385
pub(crate) root_path: Utf8PathBuf,
390386

391-
#[cfg(feature = "composefs-backend")]
392387
#[clap(flatten)]
393388
pub(crate) composefs_opts: InstallComposefsOpts,
394389
}
@@ -431,7 +426,6 @@ pub(crate) struct State {
431426
pub(crate) composefs_required: bool,
432427

433428
// If Some, then --composefs_native is passed
434-
#[cfg(feature = "composefs-backend")]
435429
pub(crate) composefs_options: InstallComposefsOpts,
436430

437431
/// Detected bootloader type for the target system
@@ -562,7 +556,7 @@ impl FromStr for MountSpec {
562556
}
563557
}
564558

565-
#[cfg(all(feature = "install-to-disk", feature = "composefs-backend"))]
559+
#[cfg(feature = "install-to-disk")]
566560
impl InstallToDiskOpts {
567561
pub(crate) fn validate(&self) -> Result<()> {
568562
if !self.composefs_opts.composefs_backend {
@@ -1218,19 +1212,15 @@ async fn verify_target_fetch(
12181212
}
12191213

12201214
fn root_has_uki(root: &Dir) -> Result<bool> {
1221-
#[cfg(feature = "composefs-backend")]
1222-
return crate::bootc_composefs::boot::container_root_has_uki(root);
1223-
1224-
#[cfg(not(feature = "composefs-backend"))]
1225-
Ok(false)
1215+
crate::bootc_composefs::boot::container_root_has_uki(root)
12261216
}
12271217

12281218
/// Preparation for an install; validates and prepares some (thereafter immutable) global state.
12291219
async fn prepare_install(
12301220
config_opts: InstallConfigOpts,
12311221
source_opts: InstallSourceOpts,
12321222
target_opts: InstallTargetOpts,
1233-
#[cfg(feature = "composefs-backend")] mut composefs_options: InstallComposefsOpts,
1223+
mut composefs_options: InstallComposefsOpts,
12341224
) -> Result<Arc<State>> {
12351225
tracing::trace!("Preparing install");
12361226
let rootfs = cap_std::fs::Dir::open_ambient_dir("/", cap_std::ambient_authority())
@@ -1305,7 +1295,6 @@ async fn prepare_install(
13051295

13061296
tracing::debug!("Composefs required: {composefs_required}");
13071297

1308-
#[cfg(feature = "composefs-backend")]
13091298
if composefs_required {
13101299
composefs_options.composefs_backend = true;
13111300
}
@@ -1378,7 +1367,6 @@ async fn prepare_install(
13781367

13791368
// Determine bootloader type for the target system
13801369
// Priority: user-specified > bootupd availability > systemd-boot fallback
1381-
#[cfg(feature = "composefs-backend")]
13821370
let detected_bootloader = {
13831371
if let Some(bootloader) = composefs_options.bootloader.clone() {
13841372
bootloader
@@ -1390,8 +1378,6 @@ async fn prepare_install(
13901378
}
13911379
}
13921380
};
1393-
#[cfg(not(feature = "composefs-backend"))]
1394-
let detected_bootloader = crate::spec::Bootloader::Grub;
13951381
println!("Bootloader: {detected_bootloader}");
13961382

13971383
// Create our global (read-only) state which gets wrapped in an Arc
@@ -1410,7 +1396,6 @@ async fn prepare_install(
14101396
host_is_container,
14111397
composefs_required,
14121398
detected_bootloader,
1413-
#[cfg(feature = "composefs-backend")]
14141399
composefs_options,
14151400
});
14161401

@@ -1582,7 +1567,6 @@ async fn install_to_filesystem_impl(
15821567
}
15831568
}
15841569

1585-
#[cfg(feature = "composefs-backend")]
15861570
if state.composefs_options.composefs_backend {
15871571
// Load a fd for the mounted target physical root
15881572

@@ -1593,9 +1577,6 @@ async fn install_to_filesystem_impl(
15931577
ostree_install(state, rootfs, cleanup).await?;
15941578
}
15951579

1596-
#[cfg(not(feature = "composefs-backend"))]
1597-
ostree_install(state, rootfs, cleanup).await?;
1598-
15991580
// Finalize mounted filesystems
16001581
if !rootfs.skip_finalize {
16011582
let bootfs = rootfs.boot.as_ref().map(|_| ("boot", "boot"));
@@ -1615,7 +1596,6 @@ fn installation_complete() {
16151596
#[context("Installing to disk")]
16161597
#[cfg(feature = "install-to-disk")]
16171598
pub(crate) async fn install_to_disk(mut opts: InstallToDiskOpts) -> Result<()> {
1618-
#[cfg(feature = "composefs-backend")]
16191599
opts.validate()?;
16201600

16211601
// Log the disk installation operation to systemd journal
@@ -1664,7 +1644,6 @@ pub(crate) async fn install_to_disk(mut opts: InstallToDiskOpts) -> Result<()> {
16641644
opts.config_opts,
16651645
opts.source_opts,
16661646
opts.target_opts,
1667-
#[cfg(feature = "composefs-backend")]
16681647
opts.composefs_opts,
16691648
)
16701649
.await?;
@@ -1902,7 +1881,6 @@ pub(crate) async fn install_to_filesystem(
19021881
opts.config_opts,
19031882
opts.source_opts,
19041883
opts.target_opts,
1905-
#[cfg(feature = "composefs-backend")]
19061884
opts.composefs_opts,
19071885
)
19081886
.await?;
@@ -2174,7 +2152,6 @@ pub(crate) async fn install_to_existing_root(opts: InstallToExistingRootOpts) ->
21742152
source_opts: opts.source_opts,
21752153
target_opts: opts.target_opts,
21762154
config_opts: opts.config_opts,
2177-
#[cfg(feature = "composefs-backend")]
21782155
composefs_opts: opts.composefs_opts,
21792156
};
21802157

crates/lib/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
//! to provide a fully "container native" tool for using
55
//! bootable container images.
66
7-
#[cfg(feature = "composefs-backend")]
87
mod bootc_composefs;
98
pub(crate) mod bootc_kargs;
109
mod bootloader;

crates/lib/src/lints.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ use linkme::distributed_slice;
2727
use ostree_ext::ostree_prepareroot;
2828
use serde::Serialize;
2929

30-
#[cfg(feature = "composefs-backend")]
3130
use crate::bootc_composefs::boot::EFI_LINUX;
3231

3332
/// Reference to embedded default baseimage content that should exist.
@@ -770,7 +769,6 @@ fn check_boot(root: &Dir, config: &LintExecutionConfig) -> LintResult {
770769
})
771770
.collect();
772771
let mut entries = entries?;
773-
#[cfg(feature = "composefs-backend")]
774772
{
775773
// Work around https://github.com/containers/composefs-rs/issues/131
776774
let efidir = Utf8Path::new(EFI_LINUX)

crates/lib/src/spec.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ use ostree_ext::{container::OstreeImageReference, oci_spec};
1111
use schemars::JsonSchema;
1212
use serde::{Deserialize, Serialize};
1313

14-
#[cfg(feature = "composefs-backend")]
1514
use crate::bootc_composefs::boot::BootType;
1615
use crate::{k8sapitypes, status::Slot};
1716

@@ -201,7 +200,6 @@ impl FromStr for Bootloader {
201200
/// A bootable entry
202201
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, JsonSchema)]
203202
#[serde(rename_all = "camelCase")]
204-
#[cfg(feature = "composefs-backend")]
205203
pub struct BootEntryComposefs {
206204
/// The erofs verity
207205
pub verity: String,
@@ -232,7 +230,6 @@ pub struct BootEntry {
232230
/// If this boot entry is ostree based, the corresponding state
233231
pub ostree: Option<BootEntryOstree>,
234232
/// If this boot entry is composefs based, the corresponding state
235-
#[cfg(feature = "composefs-backend")]
236233
pub composefs: Option<BootEntryComposefs>,
237234
}
238235

@@ -305,7 +302,6 @@ impl Host {
305302
}
306303
}
307304

308-
#[cfg(feature = "composefs-backend")]
309305
pub(crate) fn require_composefs_booted(&self) -> anyhow::Result<&BootEntryComposefs> {
310306
let cfs = self
311307
.status
@@ -588,7 +584,6 @@ mod tests {
588584
pinned: false,
589585
store: None,
590586
ostree: None,
591-
#[cfg(feature = "composefs-backend")]
592587
composefs: None,
593588
}
594589
}

0 commit comments

Comments
 (0)