[Reproducible-commits] [reprotest] 01/02: Rename filesystem to fileordering for clarity and clean up some comments

Ceridwen ceridwen-guest at moszumanska.debian.org
Fri Jun 10 16:49:24 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 2973a9dc7225510d4146d3e69d1ec2cbe41731a2
Author: Ceridwen <ceridwenv at gmail.com>
Date:   Thu Jun 9 17:16:23 2016 -0400

    Rename filesystem to fileordering for clarity and clean up some comments
---
 reprotest/__init__.py | 22 ++++++++--------------
 tests/build.py        |  9 +--------
 tests/test.py         |  4 +---
 3 files changed, 10 insertions(+), 25 deletions(-)

diff --git a/reprotest/__init__.py b/reprotest/__init__.py
index 6b47df4..684c59c 100644
--- a/reprotest/__init__.py
+++ b/reprotest/__init__.py
@@ -33,13 +33,13 @@ def captures_environment(command1, command2, env1, env2, tree1, tree2):
     env2['CAPTURE_ENVIRONMENT'] = 'i_capture_the_environment'
     yield command1, command2, env1, env2, tree1, tree2
 
-# TODO: this probably requires superuser privileges.
+# TODO: this requires superuser privileges.
 @contextlib.contextmanager
 def domain_host(command1, command2, env1, env2, tree1, tree2):
     yield command1, command2, env1, env2, tree1, tree2
 
 @contextlib.contextmanager
-def filesystem(command1, command2, env1, env2, tree1, tree2):
+def fileordering(command1, command2, env1, env2, tree1, tree2):
     disorderfs = tree2.parent/'disorderfs'
     disorderfs.mkdir()
     subprocess.check_call(['disorderfs', '--shuffle-dirents=yes',
@@ -47,21 +47,16 @@ def filesystem(command1, command2, env1, env2, tree1, tree2):
     yield command1, command2, env1, env2, tree1, disorderfs
     subprocess.check_call(['fusermount', '-u', str(disorderfs)])
 
-# @contextlib.contextmanager
-# def filesystem(command1, command2, env1, env2, tree1, tree2):
-#     yield command1, command2, env1, env2, tree1, tree2
-
 @contextlib.contextmanager
 def home(command1, command2, env1, env2, tree1, tree2):
     env1['HOME'] = '/nonexistent/first-build'
     env2['HOME'] = '/nonexistent/second-build'
     yield command1, command2, env1, env2, tree1, tree2
 
-# TODO: Linux-specific?  uname is a POSIX standard.  The related Linux
-# command (setarch) only affects uname at the moment according to the
-# docs.  FreeBSD does this with environment variables.  Wikipedia has
-# a reference to a setname command:
-# https://en.wikipedia.org/wiki/Uname
+# TODO: uname is a POSIX standard.  The related Linux command
+# (setarch) only affects uname at the moment according to the docs.
+# FreeBSD changes uname with environment variables.  Wikipedia has a
+# reference to a setname command: https://en.wikipedia.org/wiki/Uname
 @contextlib.contextmanager
 def kernel(command1, command2, env1, env2, tree1, tree2):
     command2 = ['linux64', '--uname-2.6'] + command2
@@ -122,7 +117,7 @@ def umask(command1, command2, env1, env2, tree1, tree2):
     command1 = ['umask', '0002;'] + command1
     yield command1, command2, env1, env2, tree1, tree2
 
-# TODO: This definitely requires superuser privileges.
+# TODO: This requires superuser privileges.
 @contextlib.contextmanager
 def user_group(command1, command2, env1, env2, tree1, tree2):
     yield command1, command2, env1, env2, tree1, tree2
@@ -130,7 +125,7 @@ def user_group(command1, command2, env1, env2, tree1, tree2):
 VARIATIONS = collections.OrderedDict([
     ('captures_environment', captures_environment),
     # 'cpu': cpu,
-    ('domain_host', domain_host), ('filesystem', filesystem),
+    ('domain_host', domain_host), ('fileordering', fileordering),
     ('home', home), ('kernel', kernel), ('locales', locales),
     # 'namespace': namespace,
     ('path', path), ('shell', shell),
@@ -138,7 +133,6 @@ VARIATIONS = collections.OrderedDict([
 ])
 
 def build(command, source_root, built_artifact, artifact_store, **kws):
-    # print(command)
     subprocess.check_call(command, cwd=source_root, **kws)
     with open(built_artifact, 'rb') as artifact:
         artifact_store.write(artifact.read())
diff --git a/tests/build.py b/tests/build.py
index 083b24e..19c523b 100755
--- a/tests/build.py
+++ b/tests/build.py
@@ -26,7 +26,7 @@ if __name__ == '__main__':
     # Like the above test, this test can theoretically fail by
     # producing the same file order, but this is unlikely, if not
     # as unlikely as in the above test.
-    if 'filesystem' in args:
+    if 'fileordering' in args:
         # Ensure this temporary directory is created in the disorders
         # mount point by passing the dir argument.
         with tempfile.TemporaryDirectory(dir=str(pathlib.Path.cwd())) as temp:
@@ -39,8 +39,6 @@ if __name__ == '__main__':
     if 'kernel' in args:
         output.append(subprocess.check_output(['uname', '-r']))
     if 'locales' in args:
-        # print(locale.getlocale())
-        # print([l.encode('ascii') for l in locale.getlocale()])
         output.extend(l.encode('ascii') for l in locale.getlocale())
     if 'path' in args:
         output.extend(p.encode('ascii') for p in os.get_exec_path())
@@ -51,10 +49,5 @@ if __name__ == '__main__':
             test_permissions = pathlib.Path(temp)/'test_permissions'
             test_permissions.touch()
             output.append(stat.filemode(test_permissions.stat().st_mode).encode('ascii'))
-            # with tempfile.TemporaryFile() as file_object:
-            #     archive_object = tarfile.open(name='temp', mode='w', fileobj=file_object)
-            #     archive_object.add(str(test_permissions))
-            #     file_object.seek(0)
-            #     output.append(file_object.read())
     with open('artifact', 'wb') as artifact:
         artifact.write(b''.join(output))
diff --git a/tests/test.py b/tests/test.py
index 8639948..f321f35 100644
--- a/tests/test.py
+++ b/tests/test.py
@@ -1,8 +1,6 @@
 # Licensed under the GPL: https://www.gnu.org/licenses/gpl-3.0.en.html
 # For details: reprotest/debian/copyright
 
-import os
-
 import reprotest
 
 def test_return_code(command, code):
@@ -15,7 +13,7 @@ if __name__ == '__main__':
     test_return_code(['python', 'build.py'], 0)
     test_return_code(['python', 'fails.py'], 2)
     test_return_code(['python', 'build.py', 'irreproducible'], 1)
-    test_return_code(['python', 'build.py', 'filesystem'], 1)
+    test_return_code(['python', 'build.py', 'fileordering'], 1)
     test_return_code(['python', 'build.py', 'home'], 1)
     test_return_code(['python', 'build.py', 'kernel'], 1)
     test_return_code(['python', 'build.py', 'locales'], 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