Skip to contentSkip to conversation

override build timestamp

PATCH In review Olaf Hering 4 participants 10 messages Feb 16, 2007 – Feb 19, 2007 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 override build timestamp

Pass a timestamp to kbuild via an enviroment variable.

    TZ=UTC BUILD_TIMESTAMP=2007-01-01 make -kj O=../O vmlinux

This can be used when the kernel source is in a SCM and uname -v is supposed to give the commit date and not the package build time.

---
 scripts/mkcompile_h |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
scripts/mkcompile_h +6 -1
Index: linux-2.6/scripts/mkcompile_h
===================================================================
@@ -30,7 +30,12 @@ UTS_VERSION="#$VERSION"
 CONFIG_FLAGS=""
 if [ -n "$SMP" ] ; then CONFIG_FLAGS="SMP"; fi
 if [ -n "$PREEMPT" ] ; then CONFIG_FLAGS="$CONFIG_FLAGS PREEMPT"; fi
-UTS_VERSION="$UTS_VERSION $CONFIG_FLAGS `LC_ALL=C LANG=C date`"
+if [ -n "$BUILD_TIMESTAMP" ]; then
+  TIMESTAMP="`LC_ALL=C LANG=C date -d "$BUILD_TIMESTAMP"`"
+else
+  TIMESTAMP="`LC_ALL=C LANG=C date`"
+fi
+UTS_VERSION="$UTS_VERSION $CONFIG_FLAGS $TIMESTAMP"
 
 # Truncate to maximum length
 
#1 lore raw

exporting LANG=C (Re: [PATCH] override build timestamp)

Quoted 4 lines

From: Olaf Hering
Newsgroups: gmane.linux.kernel
Subject: [PATCH] override build timestamp
Date: Fri, 16 Feb 2007 22:52:13 +0100

Hallo, Olaf.

Quoted 6 lines

Pass a timestamp to kbuild via an enviroment variable.

    TZ=UTC BUILD_TIMESTAMP=2007-01-01 make -kj O=../O vmlinux

This can be used when the kernel source is in a SCM and uname -v is supposed to give the commit date and not the package build time.

While adding this functionality must be decided by kbuild developers, could you make separate patch with exporting 'LANG=C' on the very beginning and delete all other occurrences of it? It's a C header file generation and afaik, it must be ASCII.

Thanks.

Quoted 24 lines
---
 scripts/mkcompile_h |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Index: linux-2.6/scripts/mkcompile_h
===================================================================

scripts/mkcompile_h +6 -1
@@ -30,7 +30,12 @@ UTS_VERSION="#$VERSION"
 CONFIG_FLAGS=""
 if [ -n "$SMP" ] ; then CONFIG_FLAGS="SMP"; fi
 if [ -n "$PREEMPT" ] ; then CONFIG_FLAGS="$CONFIG_FLAGS PREEMPT"; fi
-UTS_VERSION="$UTS_VERSION $CONFIG_FLAGS `LC_ALL=C LANG=C date`"
+if [ -n "$BUILD_TIMESTAMP" ]; then
+  TIMESTAMP="`LC_ALL=C LANG=C date -d "$BUILD_TIMESTAMP"`"
+else
+  TIMESTAMP="`LC_ALL=C LANG=C date`"
+fi
+UTS_VERSION="$UTS_VERSION $CONFIG_FLAGS $TIMESTAMP"
 
 # Truncate to maximum length
 
#2 lore raw

Re: exporting LANG=C (Re: [PATCH] override build timestamp)

Quoted 4 lines · Oleg Verych

While adding this functionality must be decided by kbuild developers, could you make separate patch with exporting 'LANG=C' on the very beginning and delete all other occurrences of it? It's a C header file generation and afaik, it must be ASCII.

That makes sense.
But we better build the whole kernel with LC_ALL=C LANG=C.

#3 lore raw

Re: exporting LANG=C (Re: [PATCH] override build timestamp)

Quoted 1 line · Olaf Hering

But we better build the whole kernel with LC_ALL=C LANG=C.

If you have LC_ALL=C you don't need LANG=C.

Andreas.

Signature · 4 lines
Andreas Schwab, SuSE Labs, [email protected]
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."
#4 lore raw

Re: exporting LANG=C (Re: [PATCH] override build timestamp)

In reply to Oleg Verych

Hi,

Quoted 3 lines · Oleg Verych

could you make separate patch with exporting 'LANG=C' on the very beginning and delete all other occurrences of it? It's a C header file generation and afaik, it must be ASCII.

Bad idea, most user output should be localized (even if it's only utf-8) and some kconfig targets have explicit locale support.

bye, Roman

#5 lore raw

Re: exporting LANG=C (Re: [PATCH] override build timestamp)

Quoted 1 line · Roman Zippel

Hi,

Hallo, Roman.

Quoted 8 lines · Oleg Verych
Quoted 4 lines

could you make separate patch with exporting 'LANG=C' on the very beginning and delete all other occurrences of it? It's a C header file generation and afaik, it must be ASCII.

Bad idea, most user output should be localized (even if it's only utf-8) and some kconfig targets have explicit locale support.

Ok, then maybe this one

<http://marc.theaimsgroup.com/?l=linux-mm-commits&m=116720464804613&w=2>

can be fixed as well? I used same reasoning to comment on it (that particular patch was dropped).
____

#6 lore raw
In reply to Olaf Hering

Hi,

Quoted 6 lines · Olaf Hering

Pass a timestamp to kbuild via an enviroment variable.

    TZ=UTC BUILD_TIMESTAMP=2007-01-01 make -kj O=../O vmlinux

This can be used when the kernel source is in a SCM and uname -v is supposed to give the commit date and not the package build time.

Is this really necessary? I don't really see the point of this.

bye, Roman

#7 lore raw
Quoted 4 lines · Roman Zippel

Hi,

On Fri, 16 Feb 2007, Olaf Hering wrote:

Quoted 8 lines
Quoted 6 lines

Pass a timestamp to kbuild via an enviroment variable.

    TZ=UTC BUILD_TIMESTAMP=2007-01-01 make -kj O=../O vmlinux

This can be used when the kernel source is in a SCM and uname -v is supposed to give the commit date and not the package build time.

Is this really necessary? I don't really see the point of this.

The package/kernel buildtime does not mean much, but the commit date gives you a way to restore the source state for a given binary.

#8 lore raw

Hi,

Quoted 6 lines · Olaf Hering
Quoted 6 lines · Olaf Hering
Quoted 5 lines

Pass a timestamp to kbuild via an enviroment variable.

    TZ=UTC BUILD_TIMESTAMP=2007-01-01 make -kj O=../O vmlinux
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

This can be used when the kernel source is in a SCM and uname -v is supposed to give the commit date and not the package build time.

Is this really necessary? I don't really see the point of this.

The package/kernel buildtime does not mean much, but the commit date gives you a way to restore the source state for a given binary.

This information could also be added to the version string like CONFIG_LOCALVERSION_AUTO does. OTOH rather than abusing the build date (which may not mean much, but it nevertheless has a meaning), I'd rather add the possibility to add extra information.

bye, ROman

#9 lore raw
Quoted 4 lines · Roman Zippel

This information could also be added to the version string like CONFIG_LOCALVERSION_AUTO does. OTOH rather than abusing the build date (which may not mean much, but it nevertheless has a meaning), I'd rather add the possibility to add extra information.

What exactly do you have in mind, how to provide the extra info?