Skip to content

Commit 11473f7

Browse files
authored
Merge pull request #547 from cgwalters/hack-c9s-or-fedora
two minor patches
2 parents d65013c + 950110c commit 11473f7

File tree

3 files changed

+20
-9
lines changed

3 files changed

+20
-9
lines changed

hack/Containerfile

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
1-
# This container build is just a demo effectively; it shows how one might
2-
# build bootc in a container flow, using Fedora ELN as the target.
3-
FROM quay.io/centos-bootc/centos-bootc:stream9 as build
4-
RUN dnf config-manager --set-enabled crb && dnf -y install cargo ostree-devel openssl-devel && dnf clean all
1+
# Build bootc from the current git into a c9s-bootc container image.
2+
# Use e.g. --build-arg=base=quay.io/fedora/fedora-bootc:40 to target
3+
# Fedora instead.
4+
ARG base=quay.io/centos-bootc/centos-bootc:stream9
5+
FROM $base as build
6+
COPY hack/build.sh /build.sh
7+
RUN /build.sh && rm -v /build.sh
58
COPY . /build
69
WORKDIR /build
710
RUN mkdir -p /build/target/dev-rootfs # This can hold arbitrary extra content
811
# See https://www.reddit.com/r/rust/comments/126xeyx/exploring_the_problem_of_faster_cargo_docker/
912
# We aren't using the full recommendations there, just the simple bits.
1013
RUN --mount=type=cache,target=/build/target --mount=type=cache,target=/var/roothome make bin-archive && mkdir -p /out && cp target/bootc.tar.zst /out
1114

12-
FROM quay.io/centos-bootc/centos-bootc:stream9
15+
FROM $base
1316
COPY --from=build /out/bootc.tar.zst /tmp
1417
COPY --from=build /build/target/dev-rootfs/ /
1518
RUN tar -C / --zstd -xvf /tmp/bootc.tar.zst && rm -vf /tmp/*

hack/build.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
set -xeu
3+
. /usr/lib/os-release
4+
case $ID in
5+
centos|rhel) dnf config-manager --set-enabled crb;;
6+
fedora) dnf -y install dnf-utils ;;
7+
esac
8+
dnf -y builddep bootc

lib/src/docgen.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ pub fn generate_manpages(directory: &Utf8Path) -> Result<()> {
1515
fn generate_one(directory: &Utf8Path, cmd: Command) -> Result<()> {
1616
let version = env!("CARGO_PKG_VERSION");
1717
let name = cmd.get_name();
18-
let bin_name = cmd.get_bin_name()
19-
.unwrap_or_else(|| name);
18+
let bin_name = cmd.get_bin_name().unwrap_or_else(|| name);
2019
let path = directory.join(format!("{name}.8"));
2120
println!("Generating {path}...");
2221

@@ -37,12 +36,13 @@ fn generate_one(directory: &Utf8Path, cmd: Command) -> Result<()> {
3736

3837
for subcmd in cmd.get_subcommands().filter(|c| !c.is_hide_set()) {
3938
let subname = format!("{}-{}", name, subcmd.get_name());
40-
let bin_name = format!("{} {}", bin_name, subcmd.get_name());
39+
let bin_name = format!("{} {}", bin_name, subcmd.get_name());
4140
// SAFETY: Latest clap 4 requires names are &'static - this is
4241
// not long-running production code, so we just leak the names here.
4342
let subname = &*std::boxed::Box::leak(subname.into_boxed_str());
4443
let bin_name = &*std::boxed::Box::leak(bin_name.into_boxed_str());
45-
let subcmd = subcmd.clone()
44+
let subcmd = subcmd
45+
.clone()
4646
.name(subname)
4747
.alias(subname)
4848
.bin_name(bin_name)

0 commit comments

Comments
 (0)