Don't build a tree that is being packaged; the package() method must do it (if required).
authorCarl Hetherington <cth@carlh.net>
Sat, 19 Feb 2022 16:31:54 +0000 (17:31 +0100)
committerCarl Hetherington <cth@carlh.net>
Sat, 19 Feb 2022 16:32:01 +0000 (17:32 +0100)
This is to make Linux builds more efficient; previously cdist
would build() everything (including the whole of DoM) and then
most linux package() methods would end up building it again
(making the build in build() redundant).

Now the cscript in DoM can call build() if necessary.

I'm a little bit worried that the environment is no longer preserved
during the final build(), but I'm unsure if this is necessary
anyway.

cdist

diff --git a/cdist b/cdist
index cdc6acf6280cc24c853eb895357245d437113c91..9b164e74c8a9fa55dc17fee114e73dcae549cb50 100755 (executable)
--- a/cdist
+++ b/cdist
@@ -447,7 +447,10 @@ class Target(object):
             copyfile(p, os.path.join(output_dir, os.path.basename(devel_to_git(tree.commit, p))))
 
     def package(self, project, checkout, output_dir, options, notarize):
-        tree = self.build(project, checkout, options)
+        # Build the dependencies; the cscript must call its own build() method if it needs to
+        tree = globals.trees.get(project, checkout, self)
+        if self.build_dependencies:
+            tree.build_dependencies(options)
         tree.add_defaults(options)
         p = self._cscript_package(tree, options)
         self._copy_packages(tree, p, output_dir)