diff --git a/WWWORKER-overwrites-runtime.NumCPU.patch b/WWWORKER-overwrites-runtime.NumCPU.patch new file mode 100644 index 0000000..e430a1d --- /dev/null +++ b/WWWORKER-overwrites-runtime.NumCPU.patch @@ -0,0 +1,75 @@ +From 53f6f72917211903d2f068b48ed552a6e0e98734 Mon Sep 17 00:00:00 2001 +From: Christian Goll +Date: Wed, 26 Feb 2025 17:07:31 +0100 +Subject: [PATCH] WWWORKER overwrites runtime.NumCPU + +runtime.NumCPU varies for different build hosts, so the +environment variable WWWORKER can be set to keep this number +constant as this number ends up in +docs/man/man1/wwctl-overlay-build.1 +and so in the packages + +Signed-off-by: Christian Goll +--- + CHANGELOG.md | 1 + + Makefile | 2 +- + internal/app/wwctl/overlay/build/root.go | 10 +++++++++- + 3 files changed, 11 insertions(+), 2 deletions(-) + +diff --git a/CHANGELOG.md b/CHANGELOG.md +index 93b7700a..3ea71b31 100644 +--- a/CHANGELOG.md ++++ b/CHANGELOG.md +@@ -60,6 +60,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). + - Fix timeout problem for wwclient. #1741 + - Fixed default "true" state of NetDev.OnBoot. #1754 + - Port NFS mounts during `wwctl upgrade nodes` before applying defaults. #1758 ++- Set WWWORKER from commandline for reproducible builds + + ### Removed + +diff --git a/Makefile b/Makefile +index 245bdc64..88bc7921 100644 +--- a/Makefile ++++ b/Makefile +@@ -73,7 +73,7 @@ wwapird: $(config) $(apiconfig) $(call godeps,internal/app/api/wwapird/wwapird.g + .PHONY: man_pages + man_pages: wwctl $(wildcard docs/man/man5/*.5) + mkdir -p docs/man/man1 +- ./wwctl --emptyconf genconfig man docs/man/man1 ++ WWWORKER=8 ./wwctl --emptyconf genconfig man docs/man/man1 + gzip --force docs/man/man1/*.1 + for manpage in docs/man/man5/*.5; do gzip <$${manpage} >$${manpage}.gz; done + +diff --git a/internal/app/wwctl/overlay/build/root.go b/internal/app/wwctl/overlay/build/root.go +index ba1fe163..f41e0132 100644 +--- a/internal/app/wwctl/overlay/build/root.go ++++ b/internal/app/wwctl/overlay/build/root.go +@@ -1,7 +1,9 @@ + package build + + import ( ++ "os" + "runtime" ++ "strconv" + + "github.com/spf13/cobra" + "github.com/warewulf/warewulf/internal/app/wwctl/completions" +@@ -29,7 +31,13 @@ func init() { + } + baseCmd.PersistentFlags().StringVarP(&OverlayDir, "output", "o", "", `Do not create an overlay image for distribution but write to + the given directory. An overlay must also be ge given to use this option.`) +- baseCmd.PersistentFlags().IntVar(&Workers, "workers", runtime.NumCPU(), "The number of parallel workers building overlays") ++ workers := runtime.NumCPU() ++ numCPU := os.Getenv("WWWORKER") ++ wwWorker, err := strconv.Atoi(numCPU) ++ if err == nil { ++ workers = wwWorker ++ } ++ baseCmd.PersistentFlags().IntVar(&Workers, "workers", workers, "The number of parallel workers building overlays") + } + + // GetRootCommand returns the root cobra.Command for the application. +-- +2.43.0 + diff --git a/warewulf4.changes b/warewulf4.changes index 5172df6..fb1c2ef 100644 --- a/warewulf4.changes +++ b/warewulf4.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Wed Feb 26 16:26:11 UTC 2025 - Christian Goll + +- added WWWORKER-overwrites-runtime.NumCPU.patch for reproducible + builds + ------------------------------------------------------------------- Tue Feb 25 14:13:23 UTC 2025 - Christian Goll diff --git a/warewulf4.spec b/warewulf4.spec index 937428d..c3de9c2 100644 --- a/warewulf4.spec +++ b/warewulf4.spec @@ -42,6 +42,7 @@ Source10: config-ww4.sh Source11: adjust_overlays.sh Source20: README.dnsmasq Source21: README.RKE2.md +Patch0: WWWORKER-overwrites-runtime.NumCPU.patch BuildRequires: distribution-release BuildRequires: dracut