Add LocalTarget, which isn't really that helpful actually.
authorCarl Hetherington <cth@carlh.net>
Sun, 24 Mar 2024 21:34:09 +0000 (22:34 +0100)
committerCarl Hetherington <cth@carlh.net>
Sun, 24 Mar 2024 21:34:10 +0000 (22:34 +0100)
You end up needing to delete things from /usr/local so they don't
get picked up by "local" builds.

cdist

diff --git a/cdist b/cdist
index 4faa3009e73560fd4467aa4da1a04380d93b01be..637c5a50997973c9cfa9c7665682c9f6148aa800 100755 (executable)
--- a/cdist
+++ b/cdist
@@ -910,6 +910,23 @@ class SourceTarget(Target):
             zstd = os.path.abspath('%s-%s.tar.zst' % (name, tree.version))
             copyfile(zstd, os.path.join(output_dir, os.path.basename(devel_to_git(tree.commit, zstd))))
 
+
+class LocalTarget(Target):
+    """Build on the local machine with its environment"""
+    def __init__(self, work):
+        super(LocalTarget, self).__init__('local', work)
+        # Hack around ffmpeg.git which sees that the target isn't windows/osx and then assumes
+        # distro will be there.
+        self.distro = None
+        self.set('PKG_CONFIG_PATH', '%s/lib/pkgconfig:%s/bin/pkgconfig' % (self.directory, self.directory))
+
+    def command(self, c):
+        log_normal('host -> %s' % c)
+        command('%s %s' % (self.variables_string(), c))
+
+    def cleanup(self):
+        rmtree(self.directory)
+
 # @param s Target string:
 #       windows-{32,64}
 #    or ubuntu-version-{32,64}
@@ -956,6 +973,8 @@ def target_factory(args):
         target = FlatpakTarget(args.project, args.checkout, args.work)
     elif s == 'appimage':
         target = AppImageTarget(args.work)
+    elif s == 'local':
+        target = LocalTarget(args.work)
 
     if target is None:
         raise Error("Bad target `%s'" % s)