mirror of
https://github.com/LBRYFoundation/lbry-sdk.git
synced 2025-10-02 16:20:33 +00:00
improve set_build.py, add BUILD_COMMIT
This commit is contained in:
parent
8d7ea5aae0
commit
b2a6c1295c
2 changed files with 19 additions and 23 deletions
|
@ -1,2 +1,3 @@
|
||||||
# don't touch this. CI server changes this during build/deployment
|
# don't touch this. CI server changes this during build/deployment
|
||||||
BUILD = "dev"
|
BUILD = "dev"
|
||||||
|
BUILD_COMMIT = "source installation"
|
||||||
|
|
|
@ -1,33 +1,28 @@
|
||||||
|
"""Set the build version to be 'qa', 'rc', 'release'"""
|
||||||
|
|
||||||
"""Set the build version to be 'dev', 'qa', 'rc', 'release'"""
|
|
||||||
|
|
||||||
import os.path
|
|
||||||
import re
|
|
||||||
import subprocess
|
|
||||||
import sys
|
import sys
|
||||||
|
import os
|
||||||
|
import re
|
||||||
|
|
||||||
|
|
||||||
|
def get_build_type(travis_tag=None):
|
||||||
|
if not travis_tag:
|
||||||
|
return "qa"
|
||||||
|
print("getting build type for tag: \"%s\"" % travis_tag)
|
||||||
|
if re.match('v\d+\.\d+\.\d+rc\d+$', travis_tag):
|
||||||
|
return 'rc'
|
||||||
|
elif re.match('v\d+\.\d+\.\d+$', travis_tag):
|
||||||
|
return 'release'
|
||||||
|
return 'qa'
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
build = get_build()
|
|
||||||
root_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
|
root_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
|
||||||
|
travis_commit = os.environ['TRAVIS_COMMIT'][:6]
|
||||||
|
build_type = get_build_type(os.environ.get('TRAVIS_TAG', None))
|
||||||
|
print("setting build type=%s, build commit=%s", build_type, travis_commit)
|
||||||
with open(os.path.join(root_dir, 'lbrynet', 'build_type.py'), 'w') as f:
|
with open(os.path.join(root_dir, 'lbrynet', 'build_type.py'), 'w') as f:
|
||||||
f.write("BUILD = '{}'\n".format(build))
|
f.write("BUILD = \"{}\"\nBUILD_COMMIT = \"{}\"\n".format(build_type, travis_commit))
|
||||||
|
|
||||||
|
|
||||||
def get_build():
|
|
||||||
try:
|
|
||||||
tag = subprocess.check_output(['git', 'describe', '--exact-match', '--all']).strip()
|
|
||||||
if re.match('tags\/v\d+\.\d+\.\d+rc\d+$', tag.decode()):
|
|
||||||
print('Build: rc')
|
|
||||||
return 'rc'
|
|
||||||
elif re.match('tags\/v\d+\.\d+\.\d+$', tag.decode()):
|
|
||||||
print('Build: release')
|
|
||||||
return 'release'
|
|
||||||
print('Build: qa')
|
|
||||||
return 'qa'
|
|
||||||
except subprocess.CalledProcessError:
|
|
||||||
print("Couldn't determine build type, defaulting to qa.")
|
|
||||||
return 'qa'
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
Loading…
Add table
Reference in a new issue