Source: gnuradio Version: 3.7.13.4-2 Severity: wishlist Tags: patch User: reproducible-bui...@lists.alioth.debian.org Usertags: timestamps toolchain X-Debbugs-Cc: reproducible-b...@lists.alioth.debian.org
Hi, Whilst working on the Reproducible Builds effort [0], we noticed that gnuradio generates output that is not reproducible, affecting other packages. .grc files are compiled by the grcc utility which adds a Generated timestamp header. For example: │ │ │ ├── ./usr/bin/grgsm_livemon_headless │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ #! /usr/bin/python2 │ │ │ │ # -*- coding: utf-8 -*- │ │ │ │ ################################################## │ │ │ │ # GNU Radio Python Flow Graph │ │ │ │ # Title: Gr-gsm Livemon │ │ │ │ # Author: Piotr Krysik │ │ │ │ # Description: Interactive monitor of a single C0 channel with analysis performed by Wireshark (command to run wireshark: sudo wireshark -k -f udp -Y gsmtap -i lo) │ │ │ │ -# Generated: Sat Dec 21 20:48:21 2019 │ │ │ │ +# Generated: Mon Nov 19 16:56:32 2018 │ │ │ │ ################################################## Patch attached. [0] https://reproducible-builds.org/ Regards, -- ,''`. : :' : Chris Lamb `. `'` la...@debian.org / chris-lamb.co.uk `-
diff --git a/grc/core/generator/Generator.py b/grc/core/generator/Generator.py index f42392e..49731ca 100644 --- a/grc/core/generator/Generator.py +++ b/grc/core/generator/Generator.py @@ -17,8 +17,10 @@ import codecs +import datetime import os import tempfile +import time from Cheetah.Template import Template @@ -232,6 +234,8 @@ class TopBlockGenerator(object): for var_id in var_ids: callbacks[var_id] = [callback for callback in callbacks_all if uses_var_id()] + build_date = datetime.datetime.utcfromtimestamp(int(os.environ.get('SOURCE_DATE_EPOCH', time.time()))) + # Load the namespace namespace = { 'title': title, @@ -246,6 +250,7 @@ class TopBlockGenerator(object): 'msgs': msgs, 'generate_options': self._generate_options, 'callbacks': callbacks, + 'build_date': build_date, } # Build the template t = Template(open(FLOW_GRAPH_TEMPLATE, 'r').read(), namespace) diff --git a/grc/core/generator/flow_graph.tmpl b/grc/core/generator/flow_graph.tmpl index 5550dca..aa35e6c 100644 --- a/grc/core/generator/flow_graph.tmpl +++ b/grc/core/generator/flow_graph.tmpl @@ -30,7 +30,7 @@ $DIVIDER #if $flow_graph.get_option('description') # Description: $flow_graph.get_option('description') #end if -# Generated: $time.ctime() +# Generated: $build_date.strftime("%a %b %d %H:%M:%S %Y") $DIVIDER #if $flow_graph.get_option('thread_safe_setters') import threading