[Reproducible-commits] [reprotest] 01/02: Make diffoscope able to find artifacts in paths including ../

Ceridwen ceridwen-guest at moszumanska.debian.org
Mon Jun 13 21:38:31 UTC 2016


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

ceridwen-guest pushed a commit to branch master
in repository reprotest.

commit a25f04b4b0c1a273e0a8dfc6c53c4c2438e7e50c
Author: Ceridwen <ceridwenv at gmail.com>
Date:   Mon Jun 13 17:36:29 2016 -0400

    Make diffoscope able to find artifacts in paths including ../
---
 reprotest/__init__.py | 17 ++++++++++++-----
 tests/tests.py        |  2 +-
 2 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/reprotest/__init__.py b/reprotest/__init__.py
index 9dce97a..a4d21f8 100644
--- a/reprotest/__init__.py
+++ b/reprotest/__init__.py
@@ -13,6 +13,7 @@ import subprocess
 import sys
 import tempfile
 import time
+import traceback
 
 # time zone, locales, disorderfs, host name, user/group, shell, CPU
 # number, architecture for uname (using linux64), umask, HOME, see
@@ -160,13 +161,19 @@ def check(build_command, artifact_name, source_root, variations=VARIATIONS):
                     for variation in variations:
                         # print(variation)
                         command1, command2, env1, env2, tree1, tree2 = stack.enter_context(VARIATIONS[variation](command1, command2, env1, env2, tree1, tree2))
+                    # I would prefer to use pathlib here but
+                    # .resolve(), to eliminate ../ references, doesn't
+                    # work on nonexistent paths.
                     build(' '.join(command1), str(tree1),
-                          temp + '/tree1/' + artifact_name,
-                          open(temp + '/artifact1', 'wb'), env=env1, shell=True)
+                          os.path.normpath(temp + '/tree1/' + artifact_name),
+                          open(os.path.normpath(temp + '/artifact1'), 'wb'),
+                          env=env1, shell=True)
                     build(' '.join(command2), str(tree2),
-                          temp + '/tree2/' + artifact_name,
-                          open(temp + '/artifact2', 'wb'), env=env2, shell=True)
-        except:
+                          os.path.normpath(temp + '/tree2/' + artifact_name),
+                          open(os.path.normpath(temp + '/artifact2'), 'wb'),
+                          env=env2, shell=True)
+        except Exception:
+            traceback.print_exc()
             sys.exit(2)
         sys.exit(subprocess.call(['diffoscope', temp + '/artifact1', temp + '/artifact2']))
 
diff --git a/tests/tests.py b/tests/tests.py
index 9780f84..339bec8 100644
--- a/tests/tests.py
+++ b/tests/tests.py
@@ -24,4 +24,4 @@ if __name__ == '__main__':
     test_return_code(['python', 'build.py', 'umask'], 1)
 
     assert(subprocess.call(['reprotest', 'python setup.py bdist', 'dist/reprotest-0.1.linux-x86_64.tar.gz']) == 1)
-    assert(subprocess.call(['reprotest', 'debuild --no-lintian -b -uc -us', '../reprotest_0.1_amd64.deb']) == 2)
+    assert(subprocess.call(['reprotest', 'debuild -b -uc -us', '../reprotest_0.1_all.deb']) == 1)

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



More information about the Reproducible-commits mailing list