[openjk] 09/15: Add patch to replace __DATE__ with PRODUCT_DATE, and define that from the changelog date

Simon McVittie smcv at debian.org
Wed Oct 7 07:36:18 UTC 2015


This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to branch master
in repository openjk.

commit 4be8381cb6a73062dcabb82425c922cb3cbbe70c
Author: Simon McVittie <smcv at debian.org>
Date:   Sun Aug 2 23:32:23 2015 +0100

    Add patch to replace __DATE__ with PRODUCT_DATE, and define that from the changelog date
---
 debian/changelog                                   |   2 +
 ...E__-to-be-avoided-for-reproducible-builds.patch | 160 +++++++++++++++++++++
 debian/patches/series                              |   1 +
 debian/rules                                       |   1 +
 4 files changed, 164 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 898049d..d25fa33 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -7,6 +7,8 @@ openjk (0~20150731+dfsg1-1) UNRELEASED; urgency=medium
   * debian/rules: use CMAKE_BUILD_TYPE=None now that that works
   * debian/copyright: license packaging GPL-2+ for ease of sharing
     with ioquake3
+  * Add patch to replace __DATE__ with PRODUCT_DATE, and define that
+    from the changelog date
 
  -- Simon McVittie <smcv at debian.org>  Mon, 27 Jul 2015 23:12:50 +0100
 
diff --git a/debian/patches/Allow-__DATE__-to-be-avoided-for-reproducible-builds.patch b/debian/patches/Allow-__DATE__-to-be-avoided-for-reproducible-builds.patch
new file mode 100644
index 0000000..ed6c981
--- /dev/null
+++ b/debian/patches/Allow-__DATE__-to-be-avoided-for-reproducible-builds.patch
@@ -0,0 +1,160 @@
+From: Simon McVittie <smcv at debian.org>
+Date: Sat, 1 Aug 2015 23:30:13 +0100
+Subject: Allow __DATE__ to be avoided, for reproducible builds
+
+Forwarded: no
+---
+ code/game/g_main.cpp      | 4 ++--
+ code/qcommon/common.cpp   | 4 ++--
+ code/qcommon/q_shared.h   | 4 ++++
+ codeJK2/game/g_main.cpp   | 4 ++--
+ codemp/game/g_main.c      | 2 +-
+ codemp/game/g_xcvar.h     | 2 +-
+ codemp/qcommon/common.cpp | 4 ++--
+ codemp/qcommon/q_shared.h | 4 ++++
+ 8 files changed, 18 insertions(+), 10 deletions(-)
+
+diff --git a/code/game/g_main.cpp b/code/game/g_main.cpp
+index aeeea5b..7ba6eac 100644
+--- a/code/game/g_main.cpp
++++ b/code/game/g_main.cpp
+@@ -602,7 +602,7 @@ void G_InitCvars( void ) {
+ 
+ 	// noset vars
+ 	gi.cvar( "gamename", GAMEVERSION , CVAR_SERVERINFO | CVAR_ROM );
+-	gi.cvar( "gamedate", __DATE__ , CVAR_ROM );
++	gi.cvar( "gamedate", PRODUCT_DATE , CVAR_ROM );
+ 	g_skippingcin = gi.cvar ("skippingCinematic", "0", CVAR_ROM);
+ 
+ 	// latched vars
+@@ -717,7 +717,7 @@ void InitGame(  const char *mapname, const char *spawntarget, int checkSum, cons
+ 
+ 	gi.Printf ("------- Game Initialization -------\n");
+ 	gi.Printf ("gamename: %s\n", GAMEVERSION);
+-	gi.Printf ("gamedate: %s\n", __DATE__);
++	gi.Printf ("gamedate: %s\n", PRODUCT_DATE);
+ 
+ 	srand( randomSeed );
+ 
+diff --git a/code/qcommon/common.cpp b/code/qcommon/common.cpp
+index 9817462..4f7b018 100644
+--- a/code/qcommon/common.cpp
++++ b/code/qcommon/common.cpp
+@@ -1050,7 +1050,7 @@ extern void Com_InitZoneMemory();
+ void Com_Init( char *commandLine ) {
+ 	char	*s;
+ 
+-	Com_Printf( "%s %s %s\n", Q3_VERSION, PLATFORM_STRING, __DATE__ );
++	Com_Printf( "%s %s %s\n", Q3_VERSION, PLATFORM_STRING, PRODUCT_DATE );
+ 
+ 	try {
+ 		Cvar_Init ();
+@@ -1126,7 +1126,7 @@ void Com_Init( char *commandLine ) {
+ 			Cmd_AddCommand ("freeze", Com_Freeze_f);
+ 		}
+ 		
+-		s = va("%s %s %s", Q3_VERSION, PLATFORM_STRING, __DATE__ );
++		s = va("%s %s %s", Q3_VERSION, PLATFORM_STRING, PRODUCT_DATE );
+ 		com_version = Cvar_Get ("version", s, CVAR_ROM | CVAR_SERVERINFO );
+ 
+ #ifdef JK2_MODE
+diff --git a/code/qcommon/q_shared.h b/code/qcommon/q_shared.h
+index 96e58eb..0a525ad 100644
+--- a/code/qcommon/q_shared.h
++++ b/code/qcommon/q_shared.h
+@@ -76,6 +76,10 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
+ #define HOMEPATH_NAME_MACOSX HOMEPATH_NAME_WIN
+ #endif
+ 
++#ifndef PRODUCT_DATE
++#   define PRODUCT_DATE __DATE__
++#endif
++
+ #define	BASEGAME "base"
+ #define OPENJKGAME "OpenJK"
+ 
+diff --git a/codeJK2/game/g_main.cpp b/codeJK2/game/g_main.cpp
+index 2fc693c..16734c6 100644
+--- a/codeJK2/game/g_main.cpp
++++ b/codeJK2/game/g_main.cpp
+@@ -546,7 +546,7 @@ void G_InitCvars( void ) {
+ 
+ 	// noset vars
+ 	gi.cvar( "gamename", GAMEVERSION , CVAR_SERVERINFO | CVAR_ROM );
+-	gi.cvar( "gamedate", __DATE__ , CVAR_ROM );
++	gi.cvar( "gamedate", PRODUCT_DATE , CVAR_ROM );
+ 	g_skippingcin = gi.cvar ("skippingCinematic", "0", CVAR_ROM);
+ 
+ 	// latched vars
+@@ -608,7 +608,7 @@ void InitGame(  const char *mapname, const char *spawntarget, int checkSum, cons
+ 
+ 	gi.Printf ("------- Game Initialization -------\n");
+ 	gi.Printf ("gamename: %s\n", GAMEVERSION);
+-	gi.Printf ("gamedate: %s\n", __DATE__);
++	gi.Printf ("gamedate: %s\n", PRODUCT_DATE);
+ 
+ 	srand( randomSeed );
+ 
+diff --git a/codemp/game/g_main.c b/codemp/game/g_main.c
+index e2a3e6b..25e5a66 100644
+--- a/codemp/game/g_main.c
++++ b/codemp/game/g_main.c
+@@ -193,7 +193,7 @@ void G_InitGame( int levelTime, int randomSeed, int restart ) {
+ 
+ 	trap->Print ("------- Game Initialization -------\n");
+ 	trap->Print ("gamename: %s\n", GAMEVERSION);
+-	trap->Print ("gamedate: %s\n", __DATE__);
++	trap->Print ("gamedate: %s\n", PRODUCT_DATE);
+ 
+ 	srand( randomSeed );
+ 
+diff --git a/codemp/game/g_xcvar.h b/codemp/game/g_xcvar.h
+index ea1761c..cc4a8a1 100644
+--- a/codemp/game/g_xcvar.h
++++ b/codemp/game/g_xcvar.h
+@@ -165,7 +165,7 @@ XCVAR_DEF( g_voteDelay,					"3000",			NULL,				CVAR_NONE,										qfalse )
+ XCVAR_DEF( g_warmup,					"20",			NULL,				CVAR_ARCHIVE,									qtrue )
+ XCVAR_DEF( g_weaponDisable,				"0",			NULL,				CVAR_SERVERINFO|CVAR_ARCHIVE|CVAR_LATCH,		qtrue )
+ XCVAR_DEF( g_weaponRespawn,				"5",			NULL,				CVAR_NONE,										qtrue )
+-XCVAR_DEF( gamedate,					__DATE__,		NULL,				CVAR_ROM,										qfalse )
++XCVAR_DEF( gamedate,					PRODUCT_DATE,		NULL,				CVAR_ROM,										qfalse )
+ XCVAR_DEF( gamename,					GAMEVERSION,	NULL,				CVAR_SERVERINFO|CVAR_ROM,						qfalse )
+ XCVAR_DEF( pmove_fixed,					"0",			NULL,				CVAR_SYSTEMINFO|CVAR_ARCHIVE,					qtrue )
+ XCVAR_DEF( pmove_float,					"0",			NULL,				CVAR_SYSTEMINFO|CVAR_ARCHIVE,					qtrue )
+diff --git a/codemp/qcommon/common.cpp b/codemp/qcommon/common.cpp
+index 899ddcc..f584eab 100644
+--- a/codemp/qcommon/common.cpp
++++ b/codemp/qcommon/common.cpp
+@@ -1125,7 +1125,7 @@ void Com_Init( char *commandLine ) {
+ 	char	*s;
+ 	int		qport;
+ 
+-	Com_Printf( "%s %s %s\n", JK_VERSION, PLATFORM_STRING, __DATE__ );
++	Com_Printf( "%s %s %s\n", JK_VERSION, PLATFORM_STRING, PRODUCT_DATE );
+ 
+ 	try
+ 	{
+@@ -1240,7 +1240,7 @@ void Com_Init( char *commandLine ) {
+ 
+ 		com_bootlogo = Cvar_Get( "com_bootlogo", "1", CVAR_ARCHIVE);
+ 
+-		s = va("%s %s %s", JK_VERSION_OLD, PLATFORM_STRING, __DATE__ );
++		s = va("%s %s %s", JK_VERSION_OLD, PLATFORM_STRING, PRODUCT_DATE );
+ 		com_version = Cvar_Get ("version", s, CVAR_ROM | CVAR_SERVERINFO );
+ 
+ 		SE_Init();
+diff --git a/codemp/qcommon/q_shared.h b/codemp/qcommon/q_shared.h
+index 2bf37ac..a2d0492 100644
+--- a/codemp/qcommon/q_shared.h
++++ b/codemp/qcommon/q_shared.h
+@@ -38,6 +38,10 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
+ #define	BASEGAME "base"
+ #define OPENJKGAME "OpenJK"
+ 
++#ifndef PRODUCT_DATE
++#   define PRODUCT_DATE __DATE__
++#endif
++
+ //NOTENOTE: Only change this to re-point ICARUS to a new script directory
+ #define Q3_SCRIPT_DIR	"scripts"
+ 
diff --git a/debian/patches/series b/debian/patches/series
index ebc409c..5a63394 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,4 @@
 MP-PM_VehicleViewAngles-fix-use-of-uninitialized-var.patch
 g_utils-disarm-debug-code-that-writes-to-c-nofreeent.patch
 Use-NET_Sleep-or-Sys_Sleep-in-SP-to-avoid-busy-waiti.patch
+Allow-__DATE__-to-be-avoided-for-reproducible-builds.patch
diff --git a/debian/rules b/debian/rules
index f02d840..74861d9 100755
--- a/debian/rules
+++ b/debian/rules
@@ -19,6 +19,7 @@ DEB_CXXFLAGS_MAINT_APPEND := \
 # OpenJK assumes that absence of -D_DEBUG implies -DNDEBUG
 DEB_CPPFLAGS_MAINT_APPEND := \
 	-DNDEBUG \
+	-DPRODUCT_DATE=\"$(date --utc --date="`dpkg-parsechangelog -SDate`" "+%b %_d %Y")\" \
 	$(NULL)
 DEB_LDFLAGS_MAINT_APPEND := \
 	-lm \

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/openjk.git



More information about the Pkg-games-commits mailing list