[Git][reproducible-builds/reprotest][master] 5 commits: borken attempt at build path

Vagrant Cascadian (@vagrant) gitlab at salsa.debian.org
Thu Apr 11 21:07:45 UTC 2024



Vagrant Cascadian pushed to branch master at Reproducible Builds / reprotest


Commits:
9ea2e4bf by Vagrant Cascadian at 2024-02-21T16:01:47-08:00
borken attempt at build path

- - - - -
f94904bc by Vagrant Cascadian at 2024-02-21T16:01:52-08:00
support --vary=build_path.path ... partially...

Still needs work to copy the .deb from the appropriate location

- - - - -
94e66c47 by Vagrant Cascadian at 2024-02-22T12:46:59-08:00
Crude workaround to support --vary=build_path.path=/somepath/

- - - - -
9b0f5dcb by Vagrant Cascadian at 2024-02-22T14:45:03-08:00
clean up build artifacts and build directory, needed when using
--vary=build_path.path=/somepath/

- - - - -
92358622 by Vagrant Cascadian at 2024-04-11T14:05:53-07:00
README.rst: Update description for build_path.path.

- - - - -


3 changed files:

- README.rst
- reprotest/__init__.py
- reprotest/build.py


Changes:

=====================================
README.rst
=====================================
@@ -253,6 +253,13 @@ of names is given in the --help text for --variations.
 Most variations do not have parameters, and for them only the + and - operators
 are relevant. The variations that accept parameters are:
 
+build_path.path
+    The path to use for the experiment builds when build path
+    variations are enabled. This needs to be in a location writeable
+    to the user used for running the build. This is (somewhat
+    ironically) useful to normalize the build path when used in
+    conjunction with --control-build to compare against an existing
+    build not performed with reprotest.
 domain_host.use_sudo
     An integer, whether to use sudo(1) together with unshare(1) to change the
     system hostname and domainname. 0 means don't use sudo; any non-zero value


=====================================
reprotest/__init__.py
=====================================
@@ -220,7 +220,17 @@ class BuildContext(collections.namedtuple('_BuildContext',
             kind='build')
         logger.info("build successful, copying artifacts")
         dist_base = os.path.join(self.testbed_dist, VSRC_DIR)
-        testbed.check_exec2(shell_copy_pattern(dist_base, self.testbed_src, artifact_pattern))
+        try:
+            testbed.check_exec2(shell_copy_pattern(dist_base, self.testbed_src, artifact_pattern))
+        except:
+            # workaround when build_path.path is not the defaults
+            os.makedirs(build.tree, exist_ok=True)
+            testbed.check_exec2(shell_copy_pattern(dist_base, build.tree, artifact_pattern))
+            # clean up artifacts and build directory
+            testbed.check_exec2(['sh', '-ec', 'cd "%s" && rm -rvf %s' %
+                                 (build.tree, artifact_pattern)])
+            testbed.check_exec2(['sh', '-ec', 'rmdir -v %s' % build.tree])
+
         # FIXME: `touch` is needed because of the FIXME in build.faketime(). we can rm it after that is fixed
         testbed.check_exec2(['sh', '-ec',
             r"""cd "{0}" && touch -d at 0 . .. {1}""".format(dist_base, artifact_pattern)])


=====================================
reprotest/build.py
=====================================
@@ -252,7 +252,14 @@ def domain_host(ctx, build, vary):
 # of the current virtual servers. (It's theoretically possible to make it work)
 def build_path(ctx, build, vary):
     if vary:
-        return build
+        if ctx.spec.build_path.path:
+            custom_path = os.path.join(ctx.spec.build_path.path)
+            os.makedirs(os.path.dirname(custom_path), exist_ok=True)
+            if ctx.verbosity >= 1:
+                logger.info("BUILD_PATH variation: custom path = " + custom_path)
+            return build.move_tree(build.tree, custom_path, True)
+        else:
+            return build
     const_path = os.path.join(dirname(build.tree), 'const_build_path')
     if ctx.verbosity >= 1:
         logger.info("BUILD_PATH variation: const_path = " + const_path)
@@ -582,6 +589,11 @@ class LocalesVariation(collections.namedtuple('_LocaleVariation', 'locale')):
     def default(cls):
         return cls(mdiffconf.strlist_set(";"))
 
+class BuildPathVariation(collections.namedtuple('_BuildPathVariation', 'path')):
+    @classmethod
+    def default(cls):
+        return cls('')
+
 class VariationSpec(mdiffconf.ImmutableNamespace):
     @classmethod
     def default(cls, variations=VARIATIONS):
@@ -591,6 +603,7 @@ class VariationSpec(mdiffconf.ImmutableNamespace):
             "time": TimeVariation.default(),
             "domain_host": DomainHostVariation.default(),
             "locales": LocalesVariation.default(),
+            "build_path": BuildPathVariation.default(),
         }
         return cls(**{k: default_overrides.get(k, True) for k in variations})
 



View it on GitLab: https://salsa.debian.org/reproducible-builds/reprotest/-/compare/f2c04a3f7b3b8024dc1dc4a30571ee8d8ab4d5f5...923586225a5a680fb8601e59af95e23a44a81c7b

-- 
View it on GitLab: https://salsa.debian.org/reproducible-builds/reprotest/-/compare/f2c04a3f7b3b8024dc1dc4a30571ee8d8ab4d5f5...923586225a5a680fb8601e59af95e23a44a81c7b
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.reproducible-builds.org/pipermail/rb-commits/attachments/20240411/e7d59d0a/attachment.htm>


More information about the rb-commits mailing list