2018-08-15 16:59:25 +00:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
|
|
|
import os
|
2020-06-23 19:21:03 +00:00
|
|
|
import shutil
|
2018-08-15 16:59:25 +00:00
|
|
|
import sys
|
|
|
|
import tarfile
|
|
|
|
|
2020-06-23 19:21:03 +00:00
|
|
|
|
|
|
|
HERE = os.path.realpath(os.path.dirname(__file__))
|
|
|
|
|
|
|
|
|
2018-08-15 16:59:25 +00:00
|
|
|
if __name__ == "__main__":
|
|
|
|
files = sys.argv[1]
|
2020-06-23 19:21:03 +00:00
|
|
|
version = sys.argv[2]
|
|
|
|
release_name = 'gstreamer-doc-' + sys.argv[2]
|
|
|
|
builddir = sys.argv[3]
|
|
|
|
readme = os.path.join(builddir, "README.md")
|
2020-05-27 23:25:42 +00:00
|
|
|
outname = release_name + '.tar.xz'
|
2018-08-15 16:59:25 +00:00
|
|
|
|
2020-06-23 19:21:03 +00:00
|
|
|
version_v = version.split('.')
|
|
|
|
version_major_minor = version_v[0] + '.' + version_v[1]
|
|
|
|
symbols_index_dir = os.path.join(HERE, '..', 'symbols')
|
|
|
|
symbols_version = '-1'
|
|
|
|
symbols_version_file = os.path.join(symbols_index_dir, 'symbols_version.txt')
|
|
|
|
try:
|
|
|
|
with open(symbols_version_file) as sv:
|
|
|
|
symbols_version = sv.read()
|
|
|
|
except FileNotFoundError:
|
|
|
|
pass
|
|
|
|
|
|
|
|
if symbols_version != version_major_minor:
|
|
|
|
print("Updating symbols to new major version %s" % version_major_minor, file=sys.stderr)
|
|
|
|
|
|
|
|
symbol_index_file = os.path.join(symbols_index_dir, 'symbol_index.json')
|
|
|
|
shutil.copyfile(os.path.join(builddir, "hotdoc-private-GStreamer", "symbol_index.json"),
|
|
|
|
symbol_index_file)
|
|
|
|
with open(symbols_version_file, 'w') as sv:
|
|
|
|
sv.write(version_major_minor)
|
|
|
|
print("NOTE: YOU SHOULD COMMIT THE FOLLOWING FILES BEFORE PUBLISHING THE RELEASE:", file=sys.stderr)
|
|
|
|
print(" - " + symbol_index_file, file=sys.stderr)
|
|
|
|
print(" - " + symbols_version_file, file=sys.stderr)
|
|
|
|
|
|
|
|
sys.exit(1)
|
|
|
|
|
2020-05-27 23:25:42 +00:00
|
|
|
print("Generating %s" % os.path.realpath(os.path.join(os.path.curdir, outname)), file=sys.stderr)
|
2018-08-15 16:59:25 +00:00
|
|
|
tar = tarfile.open(outname, 'w:xz')
|
2020-05-27 23:25:42 +00:00
|
|
|
tar.add(files, release_name)
|
2018-08-15 16:59:25 +00:00
|
|
|
os.chdir(os.path.dirname(readme))
|
2020-05-27 23:25:42 +00:00
|
|
|
tar.add(os.path.basename(readme), os.path.join(release_name, os.path.basename(readme)))
|
2018-08-15 16:59:25 +00:00
|
|
|
tar.close()
|