summaryrefslogtreecommitdiff
path: root/buildtools/wafsamba/samba_dist.py
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2010-05-28 20:24:47 +1000
committerAndrew Bartlett <abartlet@samba.org>2010-05-28 21:59:08 +1000
commit7ea7b23413f48325d1805fd2666757241eddc2e7 (patch)
tree1f21cd36402c0552e16e3e1690a58d2367f4be42 /buildtools/wafsamba/samba_dist.py
parent708d6fc5b002fb781983dd6ca4bda6e59a3a6411 (diff)
downloadsamba-7ea7b23413f48325d1805fd2666757241eddc2e7.tar.gz
samba-7ea7b23413f48325d1805fd2666757241eddc2e7.tar.bz2
samba-7ea7b23413f48325d1805fd2666757241eddc2e7.zip
waf Provide release signing capability in 'waf dist'
This helps ensure the release is signed correctly - the .tar file, not the .tar.gz must be signed, and it's easy to forget this. Andrew Bartlett
Diffstat (limited to 'buildtools/wafsamba/samba_dist.py')
-rw-r--r--buildtools/wafsamba/samba_dist.py36
1 files changed, 32 insertions, 4 deletions
diff --git a/buildtools/wafsamba/samba_dist.py b/buildtools/wafsamba/samba_dist.py
index 30e82620af..05c5aaaeb6 100644
--- a/buildtools/wafsamba/samba_dist.py
+++ b/buildtools/wafsamba/samba_dist.py
@@ -1,7 +1,7 @@
# customised version of 'waf dist' for Samba tools
# uses git ls-files to get file lists
-import Utils, os, sys, tarfile, stat, Scripting, Logs
+import Utils, os, sys, tarfile, gzip, stat, Scripting, Logs, Options
from samba_utils import *
dist_dirs = None
@@ -86,9 +86,14 @@ def dist(appname='',version=''):
sys.exit(1)
dist_base = '%s-%s' % (appname, version)
- dist_name = '%s.tar.gz' % (dist_base)
- tar = tarfile.open(dist_name, 'w:gz')
+ if Options.options.SIGN_RELEASE:
+ dist_name = '%s.tar' % (dist_base)
+ tar = tarfile.open(dist_name, 'w')
+ else:
+ dist_name = '%s.tar.gz' % (dist_base)
+ tar = tarfile.open(dist_name, 'w:gz')
+
blacklist = dist_blacklist.split()
for dir in dist_dirs.split():
@@ -126,7 +131,30 @@ def dist(appname='',version=''):
tar.close()
- Logs.info('Created %s' % dist_name)
+ if Options.options.SIGN_RELEASE:
+ try:
+ os.unlink(dist_name + '.asc')
+ except OSError:
+ pass
+
+ cmd = "gpg --detach-sign --armor " + dist_name
+ os.system(cmd)
+ uncompressed_tar = open(dist_name, 'rb')
+ compressed_tar = gzip.open(dist_name + '.gz', 'wb')
+ while 1:
+ buffer = uncompressed_tar.read(1048576)
+ if buffer:
+ compressed_tar.write(buffer)
+ else:
+ break
+ uncompressed_tar.close()
+ compressed_tar.close()
+ os.unlink(dist_name)
+ Logs.info('Created %s.gz %s.asc' % (dist_name, dist_name))
+ dist_name = dist_name + '.gz'
+ else:
+ Logs.info('Created %s' % dist_name)
+
return dist_name