[Pkg-pascal-devel] Bug#868790: castle-game-engine: please make the build reproducible

Chris Lamb lamby at debian.org
Tue Jul 18 17:00:15 UTC 2017


Source: castle-game-engine
Version: 6.2+dfsg1-1
Severity: wishlist
Tags: patch
User: reproducible-builds at lists.alioth.debian.org
Usertags: timestamps
X-Debbugs-Cc: reproducible-bugs at lists.alioth.debian.org

Hi,

Whilst working on the Reproducible Builds effort [0], we noticed
that castle-game-engine could not be built reproducibly.

This is because it uses the current year when generating a "Copyright"
string.

Patch attached.

 [0] https://reproducible-builds.org/


Regards,

-- 
      ,''`.
     : :'  :     Chris Lamb, Debian Project Leader
     `. `'`      lamby at debian.org / chris-lamb.co.uk
       `-
-------------- next part --------------
--- a/debian/patches/reproducible_build.patch	1970-01-01 01:00:00.000000000 +0100
--- b/debian/patches/reproducible_build.patch	2017-07-18 17:49:23.814417833 +0100
@@ -0,0 +1,47 @@
+Description: Make the build reproducible
+Author: Chris Lamb <lamby at debian.org>
+Last-Update: 2017-07-18
+
+--- castle-game-engine-6.2+dfsg1.orig/src/x3d/nodes_specification/x3d-nodes-to-pascal/generateprocessors.pas
++++ castle-game-engine-6.2+dfsg1/src/x3d/nodes_specification/x3d-nodes-to-pascal/generateprocessors.pas
+@@ -691,14 +691,22 @@ procedure THelperProcessor.NodeEnd(const
+   procedure GenerateOutput(const OutputInterface, OutputImplementation: string);
+   var
+     OutputFileName: string;
++    BuildDate: TDateTime;
++    SourceDateEpoch: string;
+   begin
+     OutputFileName := '../../auto_generated_node_helpers/x3dnodes_' +
+       LowerCase(Node.X3DType) + '.inc';
+ 
++    SourceDateEpoch := GetEnvironmentVariable('SOURCE_DATE_EPOCH');
++    if SourceDateEpoch = '' then
++        BuildDate := Now
++    else
++        BuildDate := UnixToDateTime(StrToInt(SourceDateEpoch));
++
+     StringToFile(OutputFileName,
+       '{ -*- buffer-read-only: t -*-' + NL +
+       '' + NL +
+-      '  Copyright 2015-' + IntToStr(YearOf(Now)) + ' Michalis Kamburelis.' + NL +
++      '  Copyright 2015-' + IntToStr(YearOf(BuildDate)) + ' Michalis Kamburelis.' + NL +
+       '' + NL +
+       '  This file is part of "Castle Game Engine".' + NL +
+       '' + NL +
+@@ -923,8 +931,15 @@ end;
+ procedure TTemplateProcessor.ComponentEnd(const ComponentName: string);
+ var
+   CopyrightYears: string;
++  BuildDate: TDateTime;
++  SourceDateEpoch: string;
+ begin
+-  CopyrightYears := IntToStr(YearOf(Now)) + '-' + IntToStr(YearOf(Now));
++  SourceDateEpoch := GetEnvironmentVariable('SOURCE_DATE_EPOCH');
++  if SourceDateEpoch = '' then
++      BuildDate := Now
++  else
++      BuildDate := UnixToDateTime(StrToInt(SourceDateEpoch));
++  CopyrightYears := IntToStr(YearOf(BuildDate)) + '-' + IntToStr(YearOf(BuildDate));
+   Writeln(
+     '{' + NL +
+     '  Copyright ' + CopyrightYears + ' Michalis Kamburelis.' + NL +
--- a/debian/patches/series	2017-07-18 17:15:07.631884102 +0100
--- b/debian/patches/series	2017-07-18 17:44:21.392106303 +0100
@@ -2,3 +2,4 @@
 use_system_font_files_instead_of_embedded.patch
 add_debug_info_for_powerpc.patch
 dont-add-website-header-and-footer-to-doc.patch
+reproducible_build.patch


More information about the Pkg-pascal-devel mailing list