Skip to contentSkip to conversation

gawk: use native gawk when building glibc and grub

PATCH New Alexander Kanavin 1 participant 1 message Nov 21, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gawk: use native gawk when building glibc and grub

From: Alexander Kanavin <[email protected]>

Different versions of gawk can produce different output, so depending on which version is installed on the build host, reproducibility issues can occur:
https://bugzilla.yoctoproject.org/show_bug.cgi?id=16072

So far only glibc and grub have been identified to have the issue; probably more fixes of similar nature will be required going forward.

Adjust the gawk recipe to apply target-only tweaks (particularly the removal of awk symlink to allow for alternatives) to only target and nativesdk variants, so that native installs both awk and gawk executables.

[YOCTO #16072]

---
 meta/recipes-bsp/grub/grub2.inc          |  2 +-
 meta/recipes-core/glibc/glibc.inc        |  2 +-
 meta/recipes-extended/gawk/gawk_5.3.2.bb | 11 ++++++++++-
 3 files changed, 12 insertions(+), 3 deletions(-)
meta/recipes-bsp/grub/grub2.inc +1 -1
index 14edda334ac..f67f0a167a5 100644
@@ -46,7 +46,7 @@ CVE_STATUS[CVE-2023-4001]  = "not-applicable-platform: Applies only to RHEL/Fedo
 CVE_STATUS[CVE-2024-1048]  = "not-applicable-platform: Applies only to RHEL/Fedora"
 CVE_STATUS[CVE-2024-2312]  = "not-applicable-platform: Applies only to Ubuntu"
 
-DEPENDS = "flex-native bison-native gettext-native"
+DEPENDS = "flex-native bison-native gettext-native gawk-replacement-native"
 
 GRUB_COMPATIBLE_HOST = '(x86_64.*|i.86.*|arm.*|aarch64.*|loongarch64.*|riscv.*)-(linux.*|freebsd.*)'
 COMPATIBLE_HOST = "${GRUB_COMPATIBLE_HOST}"
meta/recipes-core/glibc/glibc.inc +1 -1
index d8f20c87dd6..68fac4cca51 100644
@@ -1,7 +1,7 @@
 require glibc-common.inc
 require glibc-ld.inc
 
-DEPENDS = "virtual/cross-cc virtual/cross-binutils libgcc-initial linux-libc-headers"
+DEPENDS = "virtual/cross-cc virtual/cross-binutils libgcc-initial linux-libc-headers gawk-replacement-native"
 
 PROVIDES = "virtual/libc"
 PROVIDES += "virtual/libintl virtual/libiconv"
meta/recipes-extended/gawk/gawk_5.3.2.bb +10 -1
index 0448d90ba7b..01602f4f27a 100644
@@ -41,13 +41,21 @@ ALTERNATIVE:${PN} = "awk"
 ALTERNATIVE_TARGET[awk] = "${bindir}/gawk"
 ALTERNATIVE_PRIORITY = "100"
 
-do_install:append() {
+target_tweaks() {
 	# remove the link since we don't package it
 	rm ${D}${bindir}/awk
 	# Strip non-reproducible build flags (containing build paths)
 	sed -i -e 's|^CC.*|CC=""|g' -e 's|^CFLAGS.*|CFLAGS=""|g' ${D}${bindir}/gawkbug
 }
 
+do_install:append:class-target() {
+	target_tweaks
+}
+
+do_install:append:class-nativesdk() {
+	target_tweaks
+}
+
 inherit ptest
 
 do_install_ptest() {
@@ -94,4 +102,5 @@ RDEPENDS:${PN}-ptest += "make locale-base-en-us coreutils"
 RDEPENDS:${PN}-ptest:append:libc-glibc = " locale-base-en-us.iso-8859-1"
 RDEPENDS:${PN}-ptest:append:libc-musl = " musl-locales"
 
+PROVIDES:append:class-native = " gawk-replacement-native"
 BBCLASSEXTEND = "native nativesdk"
Signature · 1 line
2.39.5