guix, refactor: Move duplicated `outdir_for_host()` to `prelude.bash`
What changed, and why it matters
This commit is a simple cleanup: it removes two identical copies of a small helper function from two build scripts and places a single shared copy in a common file that both scripts already use. The function itself just builds an output directory path string. There is no security-relevant change here.
No security action needed. Treat as routine code maintenance.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch refactors outdir_for_host() out of contrib/guix/guix-build and contrib/guix/guix-codesign into contrib/guix/libexec/prelude.bash, which is already sourced by both scripts. The function body is unchanged: echo "${OUTDIR_BASE}/${1}${2:+-${2}}". This is purely a deduplication refactor with no functional or security impact.
Changed components
contrib/guix/guix-buildcontrib/guix/guix-codesigncontrib/guix/libexec/prelude.bashInspect captured patch +8 / −17
diff --git a/contrib/guix/guix-build b/contrib/guix/guix-build
index ac788840..9c78c2a2 100755
--- a/contrib/guix/guix-build
+++ b/contrib/guix/guix-build
@@ -294,14 +294,6 @@ for host in $HOSTS; do
make -C "${PWD}/depends" -j"$JOBS" download-"$(host_to_commonname "$host")" ${V:+V=1} ${SOURCES_PATH:+SOURCES_PATH="$SOURCES_PATH"}
done
-# Usage: outdir_for_host HOST SUFFIX
-#
-# HOST: The current platform triple we're building for
-#
-outdir_for_host() {
- echo "${OUTDIR_BASE}/${1}${2:+-${2}}"
-}
-
# Usage: profiledir_for_host HOST SUFFIX
#
# HOST: The current platform triple we're building for
diff --git a/contrib/guix/guix-codesign b/contrib/guix/guix-codesign
index 8c8682dd..230499c0 100755
--- a/contrib/guix/guix-codesign
+++ b/contrib/guix/guix-codesign
@@ -146,15 +146,6 @@ fi
# Codesigning tarballs SHOULD exist
################
-# Usage: outdir_for_host HOST SUFFIX
-#
-# HOST: The current platform triple we're building for
-#
-outdir_for_host() {
- echo "${OUTDIR_BASE}/${1}${2:+-${2}}"
-}
-
-
codesigning_tarball_for_host() {
case "$1" in
*mingw*)
diff --git a/contrib/guix/libexec/prelude.bash b/contrib/guix/libexec/prelude.bash
index 166675e8..fbebd2a1 100644
--- a/contrib/guix/libexec/prelude.bash
+++ b/contrib/guix/libexec/prelude.bash
@@ -80,6 +80,14 @@ time-machine() {
-- "$@"
}
+# Usage: outdir_for_host HOST [SUFFIX]
+#
+# HOST: The current platform triple we're building for
+# SUFFIX: Optional. If provided, appended to the directory name as "-SUFFIX"
+#
+outdir_for_host() {
+ echo "${OUTDIR_BASE}/${1}${2:+-${2}}"
+}
################
# Set common variables
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.