[Reproducible-commits] [diffoscope] 03/04: Force ppudump to output time in UTC

Jérémy Bobbio lunar at moszumanska.debian.org
Sat Nov 14 13:45:30 UTC 2015


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

lunar pushed a commit to branch master
in repository diffoscope.

commit c5bfa7343bc00afab739c31168e8a93517d7bff8
Author: Jérémy Bobbio <lunar at debian.org>
Date:   Sat Nov 14 14:05:19 2015 +0100

    Force ppudump to output time in UTC
    
    ppudump will return times using the local timezone which is not ideal to
    investigate files.
    
    Sadly, it doesn't support the TZ environment variable… but it looks for
    timezone definitions in the directory specified by TZDIR.
    
    So let's set it to a non-existent directory so we get UTC output even when the
    system timezone is set otherwise. The expected diff in the test suite is
    updated to reflect that.
---
 diffoscope/comparators/ppu.py | 11 +++++++++++
 tests/data/ppu_expected_diff  |  4 ++--
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/diffoscope/comparators/ppu.py b/diffoscope/comparators/ppu.py
index 7c3d12e..6ea7b44 100644
--- a/diffoscope/comparators/ppu.py
+++ b/diffoscope/comparators/ppu.py
@@ -19,6 +19,7 @@
 # You should have received a copy of the GNU General Public License
 # along with diffoscope.  If not, see <http://www.gnu.org/licenses/>.
 
+import os
 import re
 from diffoscope import tool_required
 from diffoscope.comparators.binary import File, needs_content
@@ -31,6 +32,16 @@ class Ppudump(Command):
     def cmdline(self):
         return ['ppudump', self.path]
 
+    def env(self):
+        # ppudump will return times using the local timezone which is not ideal
+        # to investigate files. Sadly, it doesn't support the TZ environment
+        # variable… but it looks for timezone definitions in the directory
+        # specified by TZDIR. So let's set it to a non-existent directory
+        # so we get UTC output even when the system timezone is set otherwise.
+        env = dict(os.environ)
+        env['TZDIR'] = '/nonexistent'
+        return env
+
     def filter(self, line):
         if re.match(r'^Analyzing %s \(v[0-9]+\)$' % re.escape(self.path), line.decode('utf-8')):
             return b''
diff --git a/tests/data/ppu_expected_diff b/tests/data/ppu_expected_diff
index fef9ed8..0359aec 100644
--- a/tests/data/ppu_expected_diff
+++ b/tests/data/ppu_expected_diff
@@ -6,8 +6,8 @@
  ------------------
  Module Name: CastleTextureFont_DejaVuSans_10
  
--Source file 1 : castletexturefont_dejavusans_10.pas 2015/11/01 13:49:43
-+Source file 1 : castletexturefont_dejavusans_10.pas 2015/11/01 14:05:11
+-Source file 1 : castletexturefont_dejavusans_10.pas 2015/11/01 12:49:43
++Source file 1 : castletexturefont_dejavusans_10.pas 2015/11/01 13:05:11
  Uses unit: System (Crc: C28919E4, IntfcCrc: 33F67B81, IndCrc: AB715672)
  Uses unit: objpas (Crc: 322FFBC4, IntfcCrc: 68A68DD4, IndCrc: AB715672)
  Uses unit: CastleTextureFontData (Crc: 080D58E3, IntfcCrc: 0EE179C8, IndCrc: 70B73331)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/diffoscope.git



More information about the Reproducible-commits mailing list