aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2019-03-25 10:45:40 -0400
committerJack Lloyd <[email protected]>2019-03-25 10:45:40 -0400
commit1e2c51c6fd9d93c8d540c040ee38cd88c6a8c911 (patch)
tree3941bd6753db05795c6d12e384a9ffa87f36a159 /src
parent97fea6e86528f3c8fe77376aa5f74f6dd89e0656 (diff)
Support xz compression of releases
Also fix the bzip2 support
Diffstat (limited to 'src')
-rwxr-xr-xsrc/scripts/dist.py22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/scripts/dist.py b/src/scripts/dist.py
index 8a37a2581..57b4d6213 100755
--- a/src/scripts/dist.py
+++ b/src/scripts/dist.py
@@ -206,7 +206,20 @@ def rewrite_version_file(version_file, target_version, snapshot_branch, rev_id,
open(version_file, 'w').write(''.join(list(content_rewriter())))
def write_archive(output_basename, archive_type, rel_epoch, all_files, hash_file):
- output_archive = output_basename + '.' + archive_type
+
+ def archive_suffix(archive_type):
+ if archive_type == 'tgz':
+ return 'tgz'
+ elif archive_type == 'tbz':
+ return 'tar.bz2'
+ elif archive_type == 'txz':
+ return 'tar.xz'
+ elif archive_type == 'tar':
+ return 'tar'
+ else:
+ raise Exception("Unknown archive type '%s'" % (archive_type))
+
+ output_archive = output_basename + '.' + archive_suffix(archive_type)
logging.info('Writing archive "%s"' % (output_archive))
remove_file_if_exists(output_archive)
@@ -217,6 +230,8 @@ def write_archive(output_basename, archive_type, rel_epoch, all_files, hash_file
return 'w:gz'
elif archive_type == 'tbz':
return 'w:bz2'
+ elif archive_type == 'txz':
+ return 'w:xz'
elif archive_type == 'tar':
return 'w'
else:
@@ -231,7 +246,8 @@ def write_archive(output_basename, archive_type, rel_epoch, all_files, hash_file
fileobj=open(output_archive, 'wb'))
else:
archive = tarfile.open(output_basename + '.tar',
- write_mode(archive_type))
+ write_mode(archive_type),
+ fileobj=open(output_archive, 'wb'))
for f in all_files:
tarinfo = archive.gettarinfo(f)
@@ -292,7 +308,7 @@ def main(args=None):
archives = options.archive_types.split(',') if options.archive_types != '' else []
for archive_type in archives:
- if archive_type not in ['tar', 'tgz', 'tbz']:
+ if archive_type not in ['tar', 'tgz', 'tbz', 'txz']:
logging.error('Unknown archive type "%s"' % (archive_type))
if args[0] == 'snapshot':