diff --git a/Makefile b/Makefile index daffe5199..7c661446f 100644 --- a/Makefile +++ b/Makefile @@ -29,16 +29,19 @@ prefix ?= /usr # We may in the future also want to include Fedora+derivatives as # the code is really tiny. # (Note we should also make installation of the units conditional on the rhsm feature) -CARGO_FEATURES ?= $(shell . /usr/lib/os-release; if echo "$$ID_LIKE" |grep -qF rhel; then echo rhsm; fi) +CARGO_FEATURES_DEFAULT ?= $(shell . /usr/lib/os-release; if echo "$$ID_LIKE" |grep -qF rhel; then echo rhsm; fi) +# You can set this to override all cargo features, including the defaults +CARGO_FEATURES ?= $(CARGO_FEATURES_DEFAULT) -all: bin manpages - -bin: - cargo build --release --features "$(CARGO_FEATURES)" +# Build all binaries +.PHONY: bin +bin: manpages + cargo build --release --features "$(CARGO_FEATURES)" --bins +# Note this cargo build is run without features (such as rhsm) .PHONY: manpages manpages: - cargo run --package xtask -- manpages + cargo run --release --package xtask -- manpages STORAGE_RELATIVE_PATH ?= $(shell realpath -m -s --relative-to="$(prefix)/lib/bootc/storage" /sysroot/ostree/bootc/storage) install: diff --git a/contrib/packaging/bootc.spec b/contrib/packaging/bootc.spec index 83043d344..e9b5abac0 100644 --- a/contrib/packaging/bootc.spec +++ b/contrib/packaging/bootc.spec @@ -121,36 +121,20 @@ cd %{name}-%{version}-build %build export SYSTEM_REINSTALL_BOOTC_INSTALL_PODMAN_PATH=%{system_reinstall_bootc_install_podman_path} -%if 0%{?container_build} -# Container build: use cargo directly with cached dependencies -export CARGO_HOME=/var/roothome/.cargo -cargo build -j%{_smp_build_ncpus} --release %{?with_rhsm:--features rhsm} \ - --bin=bootc --bin=system-reinstall-bootc --bin=bootc-initramfs-setup \ - %{?with_tests:--bin tests-integration} +# Build this first to avoid feature skew make manpages -%else -# Build the main bootc binary -%if %new_cargo_macros - %cargo_build %{?with_rhsm:-f rhsm} -%else - %cargo_build %{?with_rhsm:--features rhsm} -%endif -# Build the system reinstallation CLI binary -%global cargo_args -p system-reinstall-bootc +# Build all binaries +%if 0%{?container_build} +# Container build: use cargo directly with cached dependencies to avoid RPM macro overhead +cargo build -j%{_smp_build_ncpus} --release %{?with_rhsm:--features rhsm} --bins +%else +# Non-container build: use RPM macros for proper dependency tracking %if %new_cargo_macros - # In cargo-rpm-macros, the cargo_build macro does flag processing, - # so we need to pass '--' to signify that cargo_args is not part - # of the macro args - %cargo_build -- %cargo_args + %cargo_build %{?with_rhsm:-f rhsm} -- --bins %else - # Older macros from rust-toolset do *not* do flag processing, so - # '--' would be passed through to cargo directly, which is not - # what we want. - %cargo_build %cargo_args + %cargo_build %{?with_rhsm:--features rhsm} -- --bins %endif - -make manpages %endif %if ! 0%{?container_build} diff --git a/tmt/tests/booted/readonly/021-test-rhsm-facts.nu b/tmt/tests/booted/readonly/021-test-rhsm-facts.nu new file mode 100644 index 000000000..4bdc80cc9 --- /dev/null +++ b/tmt/tests/booted/readonly/021-test-rhsm-facts.nu @@ -0,0 +1,13 @@ +use std assert +use tap.nu + +tap begin "rhsm facts" + +# Verify we have this feature +if ("/etc/rhsm" | path exists) { + bootc internals publish-rhsm-facts --help + let status = systemctl show -P ActiveState bootc-publish-rhsm-facts.service + assert equal $status "inactive" +} + +tap ok