Skip to content

Commit

Permalink
Merge pull request #547 from cgwalters/hack-c9s-or-fedora
Browse files Browse the repository at this point in the history
two minor patches
  • Loading branch information
jeckersb authored May 20, 2024
2 parents d65013c + 950110c commit 11473f7
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 9 deletions.
13 changes: 8 additions & 5 deletions hack/Containerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
# This container build is just a demo effectively; it shows how one might
# build bootc in a container flow, using Fedora ELN as the target.
FROM quay.io/centos-bootc/centos-bootc:stream9 as build
RUN dnf config-manager --set-enabled crb && dnf -y install cargo ostree-devel openssl-devel && dnf clean all
# Build bootc from the current git into a c9s-bootc container image.
# Use e.g. --build-arg=base=quay.io/fedora/fedora-bootc:40 to target
# Fedora instead.
ARG base=quay.io/centos-bootc/centos-bootc:stream9
FROM $base as build
COPY hack/build.sh /build.sh
RUN /build.sh && rm -v /build.sh
COPY . /build
WORKDIR /build
RUN mkdir -p /build/target/dev-rootfs # This can hold arbitrary extra content
# See https://www.reddit.com/r/rust/comments/126xeyx/exploring_the_problem_of_faster_cargo_docker/
# We aren't using the full recommendations there, just the simple bits.
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

FROM quay.io/centos-bootc/centos-bootc:stream9
FROM $base
COPY --from=build /out/bootc.tar.zst /tmp
COPY --from=build /build/target/dev-rootfs/ /
RUN tar -C / --zstd -xvf /tmp/bootc.tar.zst && rm -vf /tmp/*
8 changes: 8 additions & 0 deletions hack/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash
set -xeu
. /usr/lib/os-release
case $ID in
centos|rhel) dnf config-manager --set-enabled crb;;
fedora) dnf -y install dnf-utils ;;
esac
dnf -y builddep bootc
8 changes: 4 additions & 4 deletions lib/src/docgen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ pub fn generate_manpages(directory: &Utf8Path) -> Result<()> {
fn generate_one(directory: &Utf8Path, cmd: Command) -> Result<()> {
let version = env!("CARGO_PKG_VERSION");
let name = cmd.get_name();
let bin_name = cmd.get_bin_name()
.unwrap_or_else(|| name);
let bin_name = cmd.get_bin_name().unwrap_or_else(|| name);
let path = directory.join(format!("{name}.8"));
println!("Generating {path}...");

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

for subcmd in cmd.get_subcommands().filter(|c| !c.is_hide_set()) {
let subname = format!("{}-{}", name, subcmd.get_name());
let bin_name = format!("{} {}", bin_name, subcmd.get_name());
let bin_name = format!("{} {}", bin_name, subcmd.get_name());
// SAFETY: Latest clap 4 requires names are &'static - this is
// not long-running production code, so we just leak the names here.
let subname = &*std::boxed::Box::leak(subname.into_boxed_str());
let bin_name = &*std::boxed::Box::leak(bin_name.into_boxed_str());
let subcmd = subcmd.clone()
let subcmd = subcmd
.clone()
.name(subname)
.alias(subname)
.bin_name(bin_name)
Expand Down

0 comments on commit 11473f7

Please sign in to comment.