[reprotest] 01/04: main: generate build names in main instead of build, guard against dupes

Ximin Luo infinity0 at debian.org
Fri Sep 22 16:31:42 UTC 2017


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

infinity0 pushed a commit to branch master
in repository reprotest.

commit 5ad0200089596fc2f52f743ad522a5e9a3273908
Author: Ximin Luo <infinity0 at debian.org>
Date:   Fri Sep 22 17:32:49 2017 +0200

    main: generate build names in main instead of build, guard against dupes
---
 reprotest/__init__.py | 11 ++++++++---
 reprotest/build.py    |  6 ++----
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/reprotest/__init__.py b/reprotest/__init__.py
index ab0c9b1..a0245f8 100644
--- a/reprotest/__init__.py
+++ b/reprotest/__init__.py
@@ -216,9 +216,13 @@ def corun_builds(build_command, source_root, artifact_pattern, result_dir, no_cl
         with start_testbed(virtual_server_args, temp_dir, no_clean_on_error,
                            host_distro=host_distro) as testbed:
             name_variation = yield
-
+            names_seen = set()
             while name_variation:
                 name, var = name_variation
+                if name in names_seen:
+                    raise ValueError("already built '%s'" % name)
+                names_seen.add(name)
+
                 var = var._replace(spec=var.spec.apply_dynamic_defaults(source_root))
                 bctx = BuildContext(testbed.scratch, result_dir, source_root, name, var)
 
@@ -262,11 +266,12 @@ def check(build_command, source_root, artifact_pattern, store_dir=None, no_clean
             build_command, source_root, artifact_pattern, result_dir, no_clean_on_error,
             virtual_server_args, testbed_pre, testbed_init, host_distro)
 
-        local_dists = [proc.send(nv) for nv in build_variations]
+        bnames = ["control"] + ["experiment-%s" % i for i in range(1, len(build_variations))]
+        local_dists = [proc.send(nv) for nv in zip(bnames, build_variations)]
 
         retcodes = collections.OrderedDict(
             (bname, run_diff(local_dists[0], dist, diffoscope_args, store_dir))
-            for (bname, _), dist in zip(build_variations, local_dists[1:]))
+            for bname, dist in zip(bnames, local_dists[1:]))
 
         retcode = max(retcodes.values())
         if retcode == 0:
diff --git a/reprotest/build.py b/reprotest/build.py
index ccf0287..6571990 100644
--- a/reprotest/build.py
+++ b/reprotest/build.py
@@ -421,10 +421,8 @@ class VariationSpec(mdiffconf.ImmutableNamespace):
 
 class Variations(collections.namedtuple('_Variations', 'spec verbosity')):
     @classmethod
-    def of(cls, *specs, verbosity=0):
-        return [("control", cls(VariationSpec.empty(), verbosity))] + [
-            ("experiment-%s" % i, cls(spec, verbosity))
-            for i, spec in enumerate(specs, 1)]
+    def of(cls, *specs, zero=VariationSpec.empty(), verbosity=0):
+        return [cls(spec, verbosity) for spec in [zero] + list(specs)]
 
 
 if __name__ == "__main__":

-- 
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