Skip to contentSkip to conversation

pkg-generic: suppress SOURCE_DATE_EPOCH warning in step_time

PATCH In review Nathan Bloch 3 participants 4 messages Mar 19 – Apr 8

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pkg-generic: suppress SOURCE_DATE_EPOCH warning in step_time

From: Nathan Bloch <[email protected]>

The step_time hook calls date +%s.%N to measure build step elapsed time. When SOURCE_DATE_EPOCH is set (for reproducible builds), GNU coreutils date emits "Warning: using $SOURCE_DATE_EPOCH instead of true time" for every call — twice per step, across all packages, resulting in hundreds of noisy log lines.

Unset SOURCE_DATE_EPOCH inline for these timing-only calls, since they measure real elapsed time and do not affect build reproducibility.

---
 package/pkg-generic.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/pkg-generic.mk +1 -1
index a2749320..e4bf6def 100644
@@ -50,7 +50,7 @@ endef
 # Time steps
 define step_time
 	printf "%s:%-5.5s:%-20.20s: %s\n"           \
-	       "$$(date +%s.%N)" "$(1)" "$(2)" "$(3)"  \
+	       "$$(SOURCE_DATE_EPOCH= date +%s.%N)" "$(1)" "$(2)" "$(3)"  \
 	       >>"$(BUILD_DIR)/build-time.log"
 endef
 GLOBAL_INSTRUMENTATION_HOOKS += step_time
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

Hi Nathan,

Quoted 7 lines · Nathan Bloch

From: Nathan Bloch <[email protected]>

The step_time hook calls date +%s.%N to measure build step elapsed time. When SOURCE_DATE_EPOCH is set (for reproducible builds), GNU coreutils date emits "Warning: using $SOURCE_DATE_EPOCH instead of true time" for every call — twice per step, across all packages, resulting in hundreds of noisy log lines.

I was going to apply but just to be sure I tested myself, and my (Fedora 43)
GNU coreutils date turns out not to behave like that. So I went to the coreutils source and searched for SOURCE_DATE_EPOCH and for "instead of true time", and got no hits (except for the expected ones for SOURCE_DATE_EPOCH). It actually just uses true time. I also checked uutils and glibc just to be sure, found nothing there either.

So it looks like you're using some patched version of GNU date. I'm not sure
if it worth patching Buildroot to cater with that, unless you're on some pretty mainstream distro.

Regards,
Arnout

Quoted 13 lines

Unset SOURCE_DATE_EPOCH inline for these timing-only calls, since they measure real elapsed time and do not affect build reproducibility.

---
  package/pkg-generic.mk | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
package/pkg-generic.mk +0 -0
index a2749320..e4bf6def 100644

package/pkg-generic.mk endef · line 56

Quoted 8 lines
package/pkg-generic.mk +1 -1
@@ -50,7 +50,7 @@ endef
  # Time steps
  define step_time
  	printf "%s:%-5.5s:%-20.20s: %s\n"           \
-	       "$$(date +%s.%N)" "$(1)" "$(2)" "$(3)"  \
+	       "$$(SOURCE_DATE_EPOCH= date +%s.%N)" "$(1)" "$(2)" "$(3)"  \
  	       >>"$(BUILD_DIR)/build-time.log"
  endef
  GLOBAL_INSTRUMENTATION_HOOKS += step_time

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#2 lore raw
Quoted 11 lines · Arnout Vandecappelle via buildroot

 Hi Nathan,

Quoted 7 lines · Nathan Bloch

From: Nathan Bloch <[email protected]>

The step_time hook calls date +%s.%N to measure build step elapsed time. When SOURCE_DATE_EPOCH is set (for reproducible builds), GNU coreutils date emits "Warning: using $SOURCE_DATE_EPOCH instead of true time" for every call — twice per step, across all packages, resulting in hundreds of noisy log lines.

Quoted 5 lines

 I was going to apply but just to be sure I tested myself, and my
(Fedora 43) GNU coreutils date turns out not to behave like that. So I went to the coreutils source and searched for SOURCE_DATE_EPOCH and for "instead of true time", and got no hits (except for the expected ones for SOURCE_DATE_EPOCH). It actually just uses true time. I also checked uutils and glibc just to be sure, found nothing there either.

 So it looks like you're using some patched version of GNU date. I'm
not sure if it worth patching Buildroot to cater with that, unless you're on some pretty mainstream distro.

You need to enable BR2_REPRODUCIBLE to have package/fakedate/fakedate installed as host/bin/date to obey SOURCE_DATE_EPOCH.
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#3 lore raw
Quoted 12 lines · Nicolas Cavallari
Quoted 11 lines · Arnout Vandecappelle via buildroot

  Hi Nathan,

Quoted 7 lines · Nathan Bloch

From: Nathan Bloch <[email protected]>

The step_time hook calls date +%s.%N to measure build step elapsed time. When SOURCE_DATE_EPOCH is set (for reproducible builds), GNU coreutils date emits "Warning: using $SOURCE_DATE_EPOCH instead of true time" for every call — twice per step, across all packages, resulting in hundreds of noisy log lines.

Quoted 5 lines
Quoted 3 lines

  I was going to apply but just to be sure I tested myself, and my (Fedora 43) GNU coreutils date turns out not to behave like that. So I went to the coreutils source and searched for SOURCE_DATE_EPOCH and for "instead of true time", and got no hits (except for the expected ones for SOURCE_DATE_EPOCH). It actually just uses true time. I also checked uutils and glibc just to be sure, found nothing there either.

  So it looks like you're using some patched version of GNU date. I'm not sure if it worth patching Buildroot to cater with that, unless you're on some pretty mainstream distro.

You need to enable BR2_REPRODUCIBLE to have package/fakedate/fakedate installed as host/bin/date to obey SOURCE_DATE_EPOCH.

D'oh, I missed that.

However, how come host/bin/date gets used in the timing step? $(HOST_DIR)/bin
doesn't get exported to PATH, so it should only get used in the actual build and configure steps (which use PATH=$(BR_PATH)).

I tried it locally (with BR2_REPRODUCIBLE=y obviously) and I don't see this issue.

Regards,
Arnout

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot