Skip to content

Commit

Permalink
feat: Remove kernel version from kmod name (#257)
Browse files Browse the repository at this point in the history
  • Loading branch information
antheas authored Oct 20, 2024
1 parent a1d215e commit 3516e7b
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 1 deletion.
11 changes: 11 additions & 0 deletions Containerfile.common
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,17 @@ RUN --mount=type=cache,dst=/var/cache/dnf \
done && \
find /var/cache/rpms

# Remove kernel version from kmod package names
# FIXME: This will only work for 6.* kernels unfortunately
# FIXME: The sed is a gross hack, maybe PR upstream?
RUN set -e; \
sed -i -e 's/args = \["rpmbuild", "-bb"\]/args = \["rpmbuild", "-bb", "--buildroot", "#{build_path}\/BUILD"\]/g' /usr/local/share/gems/gems/fpm-*/lib/fpm/package/rpm.rb; \
for rpm in $(find /var/cache/rpms/kmods -type f -name \*.rpm); do \
basename=$(basename ${rpm}); \
name=${basename%%-6*}; \
fpm --verbose -s rpm -t rpm -p ${rpm} -f --name ${name} ${rpm}; \
done

FROM scratch

COPY --from=builder /var/cache/rpms /rpms
11 changes: 11 additions & 0 deletions Containerfile.extra
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,17 @@ RUN --mount=type=cache,dst=/var/cache/dnf \
done && \
find /var/cache/rpms

# Remove kernel version from kmod package names
# FIXME: This will only work for 6.* kernels unfortunately
# FIXME: The sed is a gross hack, maybe PR upstream?
RUN set -e; \
sed -i -e 's/args = \["rpmbuild", "-bb"\]/args = \["rpmbuild", "-bb", "--buildroot", "#{build_path}\/BUILD"\]/g' /usr/local/share/gems/gems/fpm-*/lib/fpm/package/rpm.rb; \
for rpm in $(find /var/cache/rpms/kmods -type f -name \*.rpm); do \
basename=$(basename ${rpm}); \
name=${basename%%-6*}; \
fpm --verbose -s rpm -t rpm -p ${rpm} -f --name ${name} ${rpm}; \
done

FROM scratch

COPY --from=builder /var/cache/rpms /rpms
Expand Down
11 changes: 11 additions & 0 deletions Containerfile.nvidia
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,17 @@ RUN --mount=type=cache,dst=/var/cache/dnf \
done && \
find /var/cache/rpms

# Remove kernel version from kmod package names
# FIXME: This will only work for 6.* kernels unfortunately
# FIXME: The sed is a gross hack, maybe PR upstream?
RUN set -e; \
sed -i -e 's/args = \["rpmbuild", "-bb"\]/args = \["rpmbuild", "-bb", "--buildroot", "#{build_path}\/BUILD"\]/g' /usr/local/share/gems/gems/fpm-*/lib/fpm/package/rpm.rb; \
for rpm in $(find /var/cache/rpms/kmods -type f -name \*.rpm); do \
basename=$(basename ${rpm}); \
name=${basename%%-6*}; \
fpm --verbose -s rpm -t rpm -p ${rpm} -f --name ${name} ${rpm}; \
done

FROM scratch

COPY --from=builder /var/cache/rpms /rpms
11 changes: 11 additions & 0 deletions Containerfile.nvidia-open
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,17 @@ RUN --mount=type=cache,dst=/var/cache/dnf \
done && \
find /var/cache/rpms

# Remove kernel version from kmod package names
# FIXME: This will only work for 6.* kernels unfortunately
# FIXME: The sed is a gross hack, maybe PR upstream?
RUN set -e; \
sed -i -e 's/args = \["rpmbuild", "-bb"\]/args = \["rpmbuild", "-bb", "--buildroot", "#{build_path}\/BUILD"\]/g' /usr/local/share/gems/gems/fpm-*/lib/fpm/package/rpm.rb; \
for rpm in $(find /var/cache/rpms/kmods -type f -name \*.rpm); do \
basename=$(basename ${rpm}); \
name=${basename%%-6*}; \
fpm --verbose -s rpm -t rpm -p ${rpm} -f --name ${name} ${rpm}; \
done

FROM scratch

COPY --from=builder /var/cache/rpms /rpms
11 changes: 11 additions & 0 deletions Containerfile.zfs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,17 @@ RUN --mount=type=cache,dst=/var/cache/dnf \
/tmp/build-kmod-zfs.sh && \
/tmp/dual-sign-zfs.sh

# Remove kernel version from kmod package names
# FIXME: This will only work for 6.* kernels unfortunately
# FIXME: The sed is a gross hack, maybe PR upstream?
RUN set -e; \
sed -i -e 's/args = \["rpmbuild", "-bb"\]/args = \["rpmbuild", "-bb", "--buildroot", "#{build_path}\/BUILD"\]/g' /usr/local/share/gems/gems/fpm-*/lib/fpm/package/rpm.rb; \
for rpm in $(find /var/cache/rpms/kmods -type f -name \*.rpm); do \
basename=$(basename ${rpm}); \
name=${basename%%-6*}; \
fpm --verbose -s rpm -t rpm -p ${rpm} -f --name ${name} ${rpm}; \
done

FROM scratch

COPY --from=builder /var/cache/rpms /rpms
5 changes: 4 additions & 1 deletion build-prep.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ fi
### PREPARE BUILD ENV
dnf install -y \
akmods \
mock
mock \
ruby-devel

gem install fpm

if [[ ! -s "/tmp/certs/private_key.priv" ]]; then
echo "WARNING: Using test signing key. Run './generate-akmods-key' for production builds."
Expand Down

0 comments on commit 3516e7b

Please sign in to comment.