Build .zst as well as .tar.bz2 for source targets (DoM #1705).
authorCarl Hetherington <cth@carlh.net>
Fri, 30 Dec 2022 00:56:17 +0000 (01:56 +0100)
committerCarl Hetherington <cth@carlh.net>
Fri, 30 Dec 2022 00:57:37 +0000 (01:57 +0100)
cdist

diff --git a/cdist b/cdist
index da87f8473986e64d866b2ae7fc8dbe9ce3a635f1..f36bdfd819b18f97f210384a7f9d0f0985a93776 100755 (executable)
--- a/cdist
+++ b/cdist
@@ -891,7 +891,7 @@ class OSXUniversalTarget(OSXTarget):
             self._copy_packages(tree, p, output_dir)
 
 class SourceTarget(Target):
-    """Build a source .tar.bz2"""
+    """Build a source .tar.bz2 and .zst"""
     def __init__(self):
         super(SourceTarget, self).__init__('source')
 
@@ -907,8 +907,12 @@ class SourceTarget(Target):
         with TreeDirectory(tree):
             name = read_wscript_variable(os.getcwd(), 'APPNAME')
             command('./waf dist')
-            p = os.path.abspath('%s-%s.tar.bz2' % (name, tree.version))
-            copyfile(p, os.path.join(output_dir, os.path.basename(devel_to_git(tree.commit, p))))
+            bz2 = os.path.abspath('%s-%s.tar.bz2' % (name, tree.version))
+            copyfile(bz2, os.path.join(output_dir, os.path.basename(devel_to_git(tree.commit, bz2))))
+            command('tar xjf %s' % bz2)
+            command('tar --zstd -cf %s-%s.zst %s-%s' % (name, tree.version, name, tree.version))
+            zstd = os.path.abspath('%s-%s.zst' % (name, tree.version))
+            copyfile(zstd, os.path.join(output_dir, os.path.basename(devel_to_git(tree.commit, zstd))))
 
 # @param s Target string:
 #       windows-{32,64}