15 versionH = open(
'version.h.in',
'r').read()
19 newInsightsVersion =
'18.0'
20 oldInsightsVersion = re.search(
r'INSIGHTS_VERSION\s+"(.*?)"', versionH, re.DOTALL | re.MULTILINE).group(1)
23 print(
'Preparing a new release:')
24 print(
' Current Clang stable : %s' %(oldClangStable))
25 print(
' New Clang stable : %s' %(newClangStable))
26 print(
' Current Insights version : %s' %(oldInsightsVersion))
27 print(
' New Insights version : %s' %(newInsightsVersion))
29 print(
' - Updating .github/workflows/ci.yml')
30 travis = open(
'.github/workflows/ci.yml',
'r').read()
32 regEx = re.compile(
'[clang|llvm]-([0-9]+)')
34 travis = re.sub(
r'(clang|llvm|clang\+\+|llvm-config|llvm-toolchain-bionic|clang-format|clang-tidy|llvm-toolchain-trusty)(-%s)' %(oldClangStable),
'\\1-%s' %(newClangStable) , travis)
35 travis = re.sub(
'(clang|Clang|llvm|LLVM) (%s)' %(oldClangStable),
'\\1 %s' %(newClangStable) , travis)
36 travis = re.sub(
r"(LLVM_VERSION=)('%s)" %(oldClangStable),
r"\1'%s" %(newClangStable) , travis)
37 travis = re.sub(
r"(LLVM_VERSION:)\s*(%s.0.0)" %(oldClangStable),
r"\1 %s.0.0" %(newClangStable) , travis)
38 travis = re.sub(
r'(llvm_version:\s*)("%s)(.0.0",)' %(oldClangStable),
'\\1"%s.0.0",' %(newClangStable), travis)
39 travis = re.sub(
r"clang(%s)0" %(oldClangStable),
r"clang%s0" %(newClangStable) , travis)
40 travis = re.sub(
r"(llvm-toolchain-xenial)-(%s)" %(oldClangStable),
r"\1-%s" %(newClangStable) , travis)
41 travis = re.sub(
r"(./llvm.sh) (%s)" %(oldClangStable),
r"\1 %s" %(newClangStable) , travis)
44 open(
'.github/workflows/ci.yml',
'w').write(travis)
47 print(
' - Updating CMakeLists.txt')
48 cmake = open(
'CMakeLists.txt',
'r').read()
49 cmake = re.sub(
r'(set\(INSIGHTS_MIN_LLVM_MAJOR_VERSION)( %s)\)' %(oldClangStable),
'\\1 %s)' %(newClangStable) , cmake)
50 open(
'CMakeLists.txt',
'w').write(cmake)
53 print(
' - Updating version.h %s -> %s' %(oldInsightsVersion, newInsightsVersion))
54 version = open(
'version.h.in',
'r').read()
55 version = re.sub(
'(INSIGHTS_VERSION )"(.*)"',
'\\1"%s"' %(newInsightsVersion) , version)
56 open(
'version.h.in',
'w').write(version)
59 print(
' - Generating CHANGELOG.md')
60 os.system(
'gren changelog --override --username=andreasfertig --repo=cppinsights %s...continous' %(oldInsightsVersion))
62 cmd = [
'gren',
'changelog',
'--override',
'--username=andreasfertig',
'--repo=cppinsights',
'%s...continous' %(oldInsightsVersion)]
63 p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
64 stdout, stderr = p.communicate()
67 print(
'ERR: gren failed')
71 changeLog = open(
'CHANGELOG.md',
'r').read()
72 changeLog = re.sub(
'(## Continuous build.*?---)\n',
'', changeLog, flags=re.DOTALL)
73 open(
'CHANGELOG.md',
'w').write(changeLog)
75 gitTag =
'v_%s' %(oldInsightsVersion)
76 print(
' - Tagging %s' %(gitTag))
79 cmd = [
'git',
'tag', gitTag,
'main']
80 p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
81 stdout, stderr = p.communicate()
84 print(
'ERR: git tag failed!')
88 cppInsightsDockerBaseFile =
'../cppinsights-docker-base/Dockerfile'
90 print(
' - Updating cppinsights-docker-base (%s)' %(cppInsightsDockerBaseFile))
92 dockerFile = open(cppInsightsDockerBaseFile,
'r').read()
93 dockerFile = re.sub(
r'(ENV\s+CLANG_VERSION=)([0-9]+)',
r'\g<1>%s' %(newClangStable), dockerFile)
94 open(cppInsightsDockerBaseFile,
'w').write(dockerFile)