Skip to content

Commit 22e0cee

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 5daa432 commit 22e0cee

File tree

12 files changed

+10
-115
lines changed

12 files changed

+10
-115
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/bootc_composefs/delete.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ fn delete_type1_entry(depl: &DeploymentEntry, boot_dir: &Dir, deleting_staged: b
4343
// We reuse kernel + initrd if they're the same for two deployments
4444
// We don't want to delete the (being deleted) deployment's kernel + initrd
4545
// if it's in use by any other deployment
46-
let should_del_kernel = match &depl.deployment.boot_digest {
47-
Some(digest) => find_vmlinuz_initrd_duplicates(&digest)?
46+
let should_del_kernel = match depl.deployment.boot_digest.as_ref() {
47+
Some(digest) => find_vmlinuz_initrd_duplicates(digest)?
4848
.is_some_and(|vec| vec.iter().any(|digest| *digest != depl.deployment.verity)),
4949
None => false,
5050
};

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: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,7 @@ 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::delete::delete_composefs_deployment;
38-
#[cfg(feature = "composefs-backend")]
3937
use crate::bootc_composefs::{
4038
finalize::{composefs_backend_finalize, get_etc_diff},
4139
rollback::composefs_rollback,
@@ -669,13 +667,12 @@ pub(crate) enum Opt {
669667
#[clap(subcommand)]
670668
#[clap(hide = true)]
671669
Internals(InternalsOpts),
672-
#[cfg(feature = "composefs-backend")]
673670
ComposefsFinalizeStaged,
674-
#[cfg(feature = "composefs-backend")]
675671
/// Diff current /etc configuration versus default
676672
ConfigDiff,
677-
#[cfg(feature = "composefs-backend")]
678-
DeleteDeployment { depl_id: String },
673+
DeleteDeployment {
674+
depl_id: String,
675+
},
679676
}
680677

681678
/// Ensure we've entered a mount namespace, so that we can remount
@@ -1267,38 +1264,26 @@ async fn run_from_opt(opt: Opt) -> Result<()> {
12671264
let root = &Dir::open_ambient_dir("/", cap_std::ambient_authority())?;
12681265
match opt {
12691266
Opt::Upgrade(opts) => {
1270-
#[cfg(feature = "composefs-backend")]
12711267
if composefs_booted()?.is_some() {
12721268
upgrade_composefs(opts).await
12731269
} else {
12741270
upgrade(opts).await
12751271
}
1276-
1277-
#[cfg(not(feature = "composefs-backend"))]
1278-
upgrade(opts).await
12791272
}
12801273
Opt::Switch(opts) => {
1281-
#[cfg(feature = "composefs-backend")]
12821274
if composefs_booted()?.is_some() {
12831275
switch_composefs(opts).await
12841276
} else {
12851277
switch(opts).await
12861278
}
1287-
1288-
#[cfg(not(feature = "composefs-backend"))]
1289-
switch(opts).await
12901279
}
12911280
Opt::Rollback(opts) => {
1292-
#[cfg(feature = "composefs-backend")]
12931281
if composefs_booted()?.is_some() {
12941282
composefs_rollback().await?
12951283
} else {
12961284
rollback(&opts).await?
12971285
}
12981286

1299-
#[cfg(not(feature = "composefs-backend"))]
1300-
rollback(&opts).await?;
1301-
13021287
if opts.apply {
13031288
crate::reboot::reboot()?;
13041289
}
@@ -1307,15 +1292,11 @@ async fn run_from_opt(opt: Opt) -> Result<()> {
13071292
}
13081293
Opt::Edit(opts) => edit(opts).await,
13091294
Opt::UsrOverlay => {
1310-
#[cfg(feature = "composefs-backend")]
13111295
if composefs_booted()?.is_some() {
13121296
composefs_usr_overlay()
13131297
} else {
13141298
usroverlay().await
13151299
}
1316-
1317-
#[cfg(not(feature = "composefs-backend"))]
1318-
usroverlay().await
13191300
}
13201301
Opt::Container(opts) => match opts {
13211302
ContainerOpts::Lint {
@@ -1608,13 +1589,10 @@ async fn run_from_opt(opt: Opt) -> Result<()> {
16081589
}
16091590
},
16101591

1611-
#[cfg(feature = "composefs-backend")]
16121592
Opt::ComposefsFinalizeStaged => composefs_backend_finalize().await,
16131593

1614-
#[cfg(feature = "composefs-backend")]
16151594
Opt::ConfigDiff => get_etc_diff().await,
16161595

1617-
#[cfg(feature = "composefs-backend")]
16181596
Opt::DeleteDeployment { depl_id } => delete_composefs_deployment(&depl_id).await,
16191597
}
16201598
}

crates/lib/src/install.rs

Lines changed: 3 additions & 27 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
@@ -88,7 +86,6 @@ const SELINUXFS: &str = "/sys/fs/selinux";
8886
pub(crate) const EFIVARFS: &str = "/sys/firmware/efi/efivars";
8987
pub(crate) const ARCH_USES_EFI: bool = cfg!(any(target_arch = "x86_64", target_arch = "aarch64"));
9088

91-
#[cfg(feature = "composefs-backend")]
9289
pub(crate) const EFI_LOADER_INFO: &str = "LoaderInfo-4a67b082-0a4c-41cf-b6c7-440b29bb8c4f";
9390

9491
const DEFAULT_REPO_CONFIG: &[(&str, &str)] = &[
@@ -278,7 +275,6 @@ pub(crate) struct InstallToDiskOpts {
278275

279276
#[clap(flatten)]
280277
#[serde(flatten)]
281-
#[cfg(feature = "composefs-backend")]
282278
pub(crate) composefs_opts: InstallComposefsOpts,
283279
}
284280

@@ -356,7 +352,6 @@ pub(crate) struct InstallToFilesystemOpts {
356352
#[clap(flatten)]
357353
pub(crate) config_opts: InstallConfigOpts,
358354

359-
#[cfg(feature = "composefs-backend")]
360355
#[clap(flatten)]
361356
pub(crate) composefs_opts: InstallComposefsOpts,
362357
}
@@ -391,7 +386,6 @@ pub(crate) struct InstallToExistingRootOpts {
391386
#[clap(default_value = ALONGSIDE_ROOT_MOUNT)]
392387
pub(crate) root_path: Utf8PathBuf,
393388

394-
#[cfg(feature = "composefs-backend")]
395389
#[clap(flatten)]
396390
pub(crate) composefs_opts: InstallComposefsOpts,
397391
}
@@ -434,7 +428,6 @@ pub(crate) struct State {
434428
pub(crate) composefs_required: bool,
435429

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

440433
/// Detected bootloader type for the target system
@@ -565,7 +558,7 @@ impl FromStr for MountSpec {
565558
}
566559
}
567560

568-
#[cfg(all(feature = "install-to-disk", feature = "composefs-backend"))]
561+
#[cfg(feature = "install-to-disk")]
569562
impl InstallToDiskOpts {
570563
pub(crate) fn validate(&self) -> Result<()> {
571564
if !self.composefs_opts.composefs_backend {
@@ -1221,19 +1214,15 @@ async fn verify_target_fetch(
12211214
}
12221215

12231216
fn root_has_uki(root: &Dir) -> Result<bool> {
1224-
#[cfg(feature = "composefs-backend")]
1225-
return crate::bootc_composefs::boot::container_root_has_uki(root);
1226-
1227-
#[cfg(not(feature = "composefs-backend"))]
1228-
Ok(false)
1217+
crate::bootc_composefs::boot::container_root_has_uki(root)
12291218
}
12301219

12311220
/// Preparation for an install; validates and prepares some (thereafter immutable) global state.
12321221
async fn prepare_install(
12331222
config_opts: InstallConfigOpts,
12341223
source_opts: InstallSourceOpts,
12351224
target_opts: InstallTargetOpts,
1236-
#[cfg(feature = "composefs-backend")] mut composefs_options: InstallComposefsOpts,
1225+
mut composefs_options: InstallComposefsOpts,
12371226
) -> Result<Arc<State>> {
12381227
tracing::trace!("Preparing install");
12391228
let rootfs = cap_std::fs::Dir::open_ambient_dir("/", cap_std::ambient_authority())
@@ -1308,7 +1297,6 @@ async fn prepare_install(
13081297

13091298
tracing::debug!("Composefs required: {composefs_required}");
13101299

1311-
#[cfg(feature = "composefs-backend")]
13121300
if composefs_required {
13131301
composefs_options.composefs_backend = true;
13141302
}
@@ -1381,7 +1369,6 @@ async fn prepare_install(
13811369

13821370
// Determine bootloader type for the target system
13831371
// Priority: user-specified > bootupd availability > systemd-boot fallback
1384-
#[cfg(feature = "composefs-backend")]
13851372
let detected_bootloader = {
13861373
if let Some(bootloader) = composefs_options.bootloader.clone() {
13871374
bootloader
@@ -1393,8 +1380,6 @@ async fn prepare_install(
13931380
}
13941381
}
13951382
};
1396-
#[cfg(not(feature = "composefs-backend"))]
1397-
let detected_bootloader = crate::spec::Bootloader::Grub;
13981383
println!("Bootloader: {detected_bootloader}");
13991384

14001385
// Create our global (read-only) state which gets wrapped in an Arc
@@ -1413,7 +1398,6 @@ async fn prepare_install(
14131398
host_is_container,
14141399
composefs_required,
14151400
detected_bootloader,
1416-
#[cfg(feature = "composefs-backend")]
14171401
composefs_options,
14181402
});
14191403

@@ -1585,7 +1569,6 @@ async fn install_to_filesystem_impl(
15851569
}
15861570
}
15871571

1588-
#[cfg(feature = "composefs-backend")]
15891572
if state.composefs_options.composefs_backend {
15901573
// Load a fd for the mounted target physical root
15911574

@@ -1596,9 +1579,6 @@ async fn install_to_filesystem_impl(
15961579
ostree_install(state, rootfs, cleanup).await?;
15971580
}
15981581

1599-
#[cfg(not(feature = "composefs-backend"))]
1600-
ostree_install(state, rootfs, cleanup).await?;
1601-
16021582
// Finalize mounted filesystems
16031583
if !rootfs.skip_finalize {
16041584
let bootfs = rootfs.boot.as_ref().map(|_| ("boot", "boot"));
@@ -1618,7 +1598,6 @@ fn installation_complete() {
16181598
#[context("Installing to disk")]
16191599
#[cfg(feature = "install-to-disk")]
16201600
pub(crate) async fn install_to_disk(mut opts: InstallToDiskOpts) -> Result<()> {
1621-
#[cfg(feature = "composefs-backend")]
16221601
opts.validate()?;
16231602

16241603
// Log the disk installation operation to systemd journal
@@ -1667,7 +1646,6 @@ pub(crate) async fn install_to_disk(mut opts: InstallToDiskOpts) -> Result<()> {
16671646
opts.config_opts,
16681647
opts.source_opts,
16691648
opts.target_opts,
1670-
#[cfg(feature = "composefs-backend")]
16711649
opts.composefs_opts,
16721650
)
16731651
.await?;
@@ -1905,7 +1883,6 @@ pub(crate) async fn install_to_filesystem(
19051883
opts.config_opts,
19061884
opts.source_opts,
19071885
opts.target_opts,
1908-
#[cfg(feature = "composefs-backend")]
19091886
opts.composefs_opts,
19101887
)
19111888
.await?;
@@ -2177,7 +2154,6 @@ pub(crate) async fn install_to_existing_root(opts: InstallToExistingRootOpts) ->
21772154
source_opts: opts.source_opts,
21782155
target_opts: opts.target_opts,
21792156
config_opts: opts.config_opts,
2180-
#[cfg(feature = "composefs-backend")]
21812157
composefs_opts: opts.composefs_opts,
21822158
};
21832159

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 & 7 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,
@@ -235,7 +233,6 @@ pub struct BootEntry {
235233
/// If this boot entry is ostree based, the corresponding state
236234
pub ostree: Option<BootEntryOstree>,
237235
/// If this boot entry is composefs based, the corresponding state
238-
#[cfg(feature = "composefs-backend")]
239236
pub composefs: Option<BootEntryComposefs>,
240237
}
241238

@@ -272,7 +269,6 @@ pub struct HostStatus {
272269
pub ty: Option<HostType>,
273270
}
274271

275-
#[cfg(feature = "composefs-backend")]
276272
pub(crate) struct DeploymentEntry<'a> {
277273
pub(crate) ty: Option<Slot>,
278274
pub(crate) deployment: &'a BootEntryComposefs,
@@ -315,7 +311,6 @@ impl Host {
315311
}
316312
}
317313

318-
#[cfg(feature = "composefs-backend")]
319314
pub(crate) fn require_composefs_booted(&self) -> anyhow::Result<&BootEntryComposefs> {
320315
let cfs = self
321316
.status
@@ -328,7 +323,6 @@ impl Host {
328323
}
329324

330325
/// Returns all composefs deployments in a list
331-
#[cfg(feature = "composefs-backend")]
332326
#[fn_error_context::context("Getting all composefs deployments")]
333327
pub(crate) fn all_composefs_deployments<'a>(&'a self) -> Result<Vec<DeploymentEntry<'a>>> {
334328
let mut all_deps = vec![];
@@ -636,7 +630,6 @@ mod tests {
636630
pinned: false,
637631
store: None,
638632
ostree: None,
639-
#[cfg(feature = "composefs-backend")]
640633
composefs: None,
641634
}
642635
}

0 commit comments

Comments
 (0)