From 16a4023abfebd1c7f03ecca71734b847d666fa76 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Wed, 21 Oct 2020 14:06:48 +0200 Subject: [PATCH] reorganize release script --- .gitignore | 1 + scripts/release.py | 517 ------------------ .../release/__pycache__/com.cpython-36.pyc | Bin 0 -> 3276 bytes .../release/__pycache__/dev.cpython-36.pyc | Bin 0 -> 2087 bytes .../release/__pycache__/proj.cpython-36.pyc | Bin 0 -> 1826 bytes .../__pycache__/release.cpython-36.pyc | Bin 0 -> 4276 bytes scripts/release/com.py | 109 ++++ scripts/release/dev.py | 74 +++ scripts/release/main.py | 64 +++ scripts/release/proj.py | 64 +++ scripts/release/release.py | 173 ++++++ 11 files changed, 485 insertions(+), 517 deletions(-) delete mode 100755 scripts/release.py create mode 100644 scripts/release/__pycache__/com.cpython-36.pyc create mode 100644 scripts/release/__pycache__/dev.cpython-36.pyc create mode 100644 scripts/release/__pycache__/proj.cpython-36.pyc create mode 100644 scripts/release/__pycache__/release.cpython-36.pyc create mode 100755 scripts/release/com.py create mode 100755 scripts/release/dev.py create mode 100755 scripts/release/main.py create mode 100755 scripts/release/proj.py create mode 100755 scripts/release/release.py diff --git a/.gitignore b/.gitignore index f0da6a113..07070a949 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +scripts/release/__pycache__ **/*.o **/*bin **/*.swp diff --git a/scripts/release.py b/scripts/release.py deleted file mode 100755 index 67e90f0ce..000000000 --- a/scripts/release.py +++ /dev/null @@ -1,517 +0,0 @@ -#!/usr/bin/env python - -# Release lvgl, lv_examples, lv_drivers. docs, blog and prepare the development of the next major, minoror bugfix release -# Usage: ./release,py bugfix | minor | major -# The option means what type of versin to prepare for development after release -# -# STEPS: -# - clone all 5 repos -# - get the version numnber from lvgl.h -# - set release branch (e.g. "release/v7") -# - prepare lvgl -# - run lv_conf_internal.py -# - run code formatter -# - clear LVGL_VERSION_INFO (set to "") -# - run Doxygen -# - update the version in lvgl's library.json, library.properties, lv_conf_template.h -# - update CHANGELOG.md -# - commit changes -# - prepare lv_examples -# - upadte the required LVGL version in lv_examples.h (LV_VERSION_CHECK) -# - update the version in lv_ex_conf_template.h -# - prepare lv_drivers -# - update the version in library.json, lv_drv_conf_template.h -# - prepare docs -# - update API XML -# - clear the versiopn info (should be plain vx.y.z) -# - tag all repos with the new version -# - merge to release branches -# - blog: add release post -# - push tags and commits -# - docs: run ./updade.py release/vX -# -# If --patch -# - merge master to dev branches -# - increment patch version by 1 and append "-dev". E.g. "vX.Y.(Z+1)-dev" -# - update version numbers in lvgl and docs -# - commit and push -# - docs: run ./updade.py latest dev -# -# Else (not --patch) -# - merge master to dev -# - merge the dev to master -# - increment version number like "vX.(Y+1).0-dev" -# - apply the new version in dev branches of lvgl, lv_examples, lv_drivers, docs -# - commit and push to dev branches -# - docs: run ./updade.py latest dev - -import re -import os, fnmatch -import os.path -from os import path -from datetime import date -import sys - -upstream_org_url = "https://github.com/lvgl/" -workdir = "./release_tmp" -proj_list = [ "lv_sim_eclipse_sdl", "lv_sim_emscripten"] - -ver_major = -1 -ver_minor = -1 -ver_patch = -1 - -dev_ver_major = -1 -dev_ver_minor = -1 -dev_ver_patch = -1 - -ver_str = "" -dev_ver_str = "" -release_br = "" -release_note = "" - -prepare_type = ['major', 'minor', 'bugfix'] - -dev_prepare = 'minor' - -def upstream(repo): - return upstream_org_url + repo + ".git" - -def cmd(c, exit_on_err = True): - print("\n" + c) - r = os.system(c) - if r: - print("### Error: " + str(r)) - if exit_on_err: exit(int(r)) - -def define_set(fn, name, value): - print("In " + fn + " set " + name + " to " + value) - - new_content = "" - s = r'^ *# *define +' + str(name).rstrip() + ' +' - - f = open(fn, "r") - for i in f.read().splitlines(): - r = re.search(s, i) - if r: - d = i.split("define") - i = d[0] + "define " + name + " " + value - new_content += i + '\n' - - f.close() - - f = open(fn, "w") - f.write(new_content) - f.close() - -def clone_repos(): - cmd("rm -fr " + workdir) - cmd("mkdir " + workdir) - os.chdir(workdir) - - cmd("git clone " + upstream("lvgl") + "; cd lvgl; git checkout master; git remote update origin --prune; ") - cmd("git clone " + upstream("lv_examples") + "; cd lv_examples; git checkout master; git remote update origin --prune; ") - cmd("git clone " + upstream("lv_drivers") + "; cd lv_drivers; git checkout master; git remote update origin --prune; ") - cmd("git clone --recurse-submodules " + upstream("docs") + "; cd docs; git checkout master; git remote update origin --prune; ") - cmd("git clone " + upstream("blog") + "; cd blog; git checkout master; git remote update origin --prune; ") - - for p in proj_list: - cmd("git clone " + upstream(p) + " --recurse-submodules ; cd " + p + "; git checkout master; git remote update origin --prune; ") - - -def get_lvgl_version(br): - print("Get LVGL's version") - - global ver_str, ver_major, ver_minor, ver_patch, release_br - - os.chdir("./lvgl") - - cmd("git checkout " + br) - - f = open("./lvgl.h", "r") - - lastNum = re.compile(r'(?:[^\d]*(\d+)[^\d]*)+') - for i in f.read().splitlines(): - r = re.search(r'^#define LVGL_VERSION_MAJOR ', i) - if r: - m = lastNum.search(i) - if m: ver_major = m.group(1) - - r = re.search(r'^#define LVGL_VERSION_MINOR ', i) - if r: - m = lastNum.search(i) - if m: ver_minor = m.group(1) - - r = re.search(r'^#define LVGL_VERSION_PATCH ', i) - if r: - m = lastNum.search(i) - if m: ver_patch = m.group(1) - - f.close() - - cmd("git checkout master") - - ver_str = "v" + str(ver_major) + "." + str(ver_minor) + "." + str(ver_patch) - print("New version:" + ver_str) - - release_br = "release/v" + ver_major - - os.chdir("../") - -def update_version(): - templ = fnmatch.filter(os.listdir('.'), '*templ*') - - if templ[0]: - print("Updating version in " + templ[0]) - cmd("sed -i -r 's/v[0-9]+\.[0-9]+\.[0-9]+/"+ ver_str +"/' " + templ[0]) - - if os.path.exists("library.json"): - print("Updating version in library.json") - cmd("sed -i -r 's/[0-9]+\.[0-9]+\.[0-9]+/"+ ver_str[1:] +"/' library.json") - - if path.exists("library.properties"): - print("Updating version in library.properties") - cmd("sed -i -r 's/version=[0-9]+\.[0-9]+\.[0-9]+/"+ "version=" + ver_str[1:] + "/' library.properties") - -def lvgl_prepare(): - print("Prepare lvgl") - - global ver_str, ver_major, ver_minor, ver_patch - - os.chdir("./lvgl") - define_set("./lvgl.h", "LVGL_VERSION_INFO", '\"\"') - - # Run some scripts - os.chdir("./scripts") - cmd("./code-format.sh") - cmd("./lv_conf_checker.py") - cmd("doxygen") - os.chdir("../") - - update_version() - - #update CHANGLELOG - new_content = "" - f = open("./CHANGELOG.md", "r") - - global release_note - release_note = "" - note_state = 0 - for i in f.read().splitlines(): - if note_state == 0: - r = re.search(r'^## ' + ver_str, i) - if r: - i = i.replace("planned on ", "") - note_state+=1 - - elif note_state == 1: - r = re.search(r'^## ', i) - if r: - note_state+=1 - else: - release_note += i + '\n' - - new_content += i + '\n' - - f.close() - - f = open("./CHANGELOG.md", "w") - f.write(new_content) - f.close() - - cmd('git commit -am "prepare to release ' + ver_str + '"') - - os.chdir("../") - - -def lv_examples_prepare(): - print("Prepare lv_examples") - global ver_str, ver_major, ver_minor, ver_patch - - os.chdir("./lv_examples") - - update_version() - - cmd("sed -i -r 's/LV_VERSION_CHECK\([0-9]+, *[0-9]+, *[0-9]+\)/"+ "LV_VERSION_CHECK(" + ver_major + ", " + ver_minor + ", " + ver_patch + ")/' lv_examples.h") - - cmd('git commit -am "prepare to release ' + ver_str + '"') - - os.chdir("../") - -def lv_drivers_prepare(): - print("Prepare lv_drivers") - global ver_str, ver_major, ver_minor, ver_patch - - os.chdir("./lv_drivers") - - update_version() - - cmd('git commit -am "prepare to release ' + ver_str + '"') - - os.chdir("../") - -def docs_prepare(): - print("Prepare docs") - global ver_str, ver_major, ver_minor, ver_patch - - os.chdir("./docs") - - cmd("git co latest --") - cmd("rm -rf xml"); - cmd("cp -r ../lvgl/docs/api_doc/xml ."); - cmd("git add xml"); - - cmd("sed -i -r \"s/'v[0-9]+\.[0-9]+\.[0-9]+.*'/\'" + ver_str + "'/\" conf.py") - - cmd('git commit -am "prepare to release ' + ver_str + '"') - - os.chdir("../") - -def blog_add_post(): - global ver_str, release_note - - os.chdir("./blog/_posts") - - post = "---\nlayout: post\ntitle: " + ver_str + " is released\nauthor: \"kisvegabor\"\ncover: /assets/release_cover.png\n---\n\n" - post += release_note - - today = date.today() - d = today.strftime("%Y-%m-%d") - - f = open(d + "-release_" + ver_str + ".md", "w") - f.write(post) - f.close() - - cmd("git add .") - cmd("git commit -am 'Add " + ver_str + " release post'") - - os.chdir("../../") - -def add_tags(): - global ver_str - tag_cmd = " git tag -a " + ver_str + " -m 'Release " + ver_str + "' " - cmd("cd lvgl; " + tag_cmd) - cmd("cd lv_examples; " + tag_cmd) - cmd("cd lv_drivers; " + tag_cmd) - cmd("cd docs; " + tag_cmd) - -def update_release_branches(): - global release_br - merge_cmd = " git checkout " + release_br + "; git pull origin " + release_br + "; git merge master -X ours; git push origin " + release_br + "; git checkout master" - cmd("cd lvgl; " + merge_cmd) - cmd("cd lv_examples; " + merge_cmd) - cmd("cd lv_drivers; " + merge_cmd) - - merge_cmd = " git checkout " + release_br + "; git pull origin " + release_br + "; git merge latest -X ours; git push origin " + release_br + "; git checkout latest" - cmd("cd docs; " + merge_cmd) - -def publish_master(): - - #Merge LVGL master to dev first to avoid "merge-to-dev.yml" running asynchronous - os.chdir("./lvgl") - cmd("git checkout dev") - cmd("git merge master -X ours") - cmd("git add .") - cmd("git commit -am 'Merge master'", False) - cmd("git push origin dev") - cmd("git checkout master") - os.chdir("../") - - pub_cmd = "git push origin master; git push origin " + ver_str - cmd("cd lvgl; " + pub_cmd) - cmd("cd lv_examples; " + pub_cmd) - cmd("cd lv_drivers; " + pub_cmd) - - pub_cmd = "git push origin master" - cmd("cd blog; " + pub_cmd) - -def merge_from_dev(): - merge_cmd = "git checkout master; git merge dev;" - cmd("cd lvgl; " + merge_cmd) - - merge_cmd = "git checkout latest -- ; git merge dev -X theirs --no-edit;" - cmd("cd docs; " + merge_cmd) - - -def lvgl_update_master_version(): - global ver_major, ver_minor, ver_patch, ver_str - - os.chdir("./lvgl") - - cmd("git checkout master") - define_set("./lvgl.h", "LVGL_VERSION_MAJOR", ver_major) - define_set("./lvgl.h", "LVGL_VERSION_MINOR", ver_minor) - define_set("./lvgl.h", "LVGL_VERSION_PATCH", ver_patch) - define_set("./lvgl.h", "LVGL_VERSION_INFO", "dev") - - templ = fnmatch.filter(os.listdir('.'), '*templ*') - if templ[0]: - print("Updating version in " + templ[0]) - cmd("sed -i -r 's/v[0-9]+\.[0-9]+\.[0-9]+.*/"+ ver_str +"/' " + templ[0]) - - - cmd("git commit -am 'Update version'") - - os.chdir("../") - -def docs_update_latest_version(): - global ver_str - - os.chdir("./docs") - cmd("git checkout latest --") - cmd("sed -i -r \"s/'v[0-9]+\.[0-9]+\.[0-9]+.*'/\'" + ver_str + "'/\" conf.py") - cmd("git commit -am 'Update version'") - cmd("git checkout master --") - - os.chdir("../") - - -def lvgl_update_dev_version(): - global ver_major, ver_minor, ver_patch, dev_ver_str - - os.chdir("./lvgl") - - cmd("git checkout dev") - define_set("./lvgl.h", "LVGL_VERSION_MAJOR", str(ver_major)) - define_set("./lvgl.h", "LVGL_VERSION_MINOR", str(ver_minor)) - define_set("./lvgl.h", "LVGL_VERSION_PATCH", str(ver_patch)) - define_set("./lvgl.h", "LVGL_VERSION_INFO", "\"dev\"") - - templ = fnmatch.filter(os.listdir('.'), '*templ*') - if templ[0]: - print("Updating version in " + templ[0]) - cmd("sed -i -r 's/v[0-9]+\.[0-9]+\.[0-9]+.*/"+ dev_ver_str +"/' " + templ[0]) - - - cmd("git commit -am 'Update dev version'") - cmd("git checkout master") - - os.chdir("../") - -def docs_update_dev_version(): - global dev_ver_str - - os.chdir("./docs") - cmd("git checkout dev --") - cmd("sed -i -r \"s/'v[0-9]+\.[0-9]+\.[0-9]+.*'/\'" + dev_ver_str + "'/\" conf.py") - cmd("git commit -am 'Update dev version'") - cmd("git checkout master --") - - os.chdir("../") - - -def publish_dev_and_master(): - pub_cmd = "git checkout dev; git push origin dev" - cmd("cd lvgl; " + pub_cmd) - pub_cmd = "git checkout master; git push origin master" - cmd("cd lvgl; " + pub_cmd) - -def projs_update(): - global proj_list, release_br, ver_str - for p in proj_list: - os.chdir("./" + p) - cmd('git checkout master') - print(p + ": upadte lvgl"); - cmd("cd lvgl; git co " + release_br + "; git pull origin " + release_br) - cmd("cp -f lvgl/lv_conf_template.h lv_conf.h") - cmd("sed -i -r 's/#if 0/#if 1/' lv_conf.h") # Enable lv_conf.h - d = {} - with open("confdef.txt") as f: - for line in f: - (key, val) = line.rstrip().split('\t') - d[key] = val - - for k,v in d.items(): - define_set("lv_conf.h", str(k), str(v)) - - if os.path.exists("lv_examples"): - print(p + ": upadte lv_examples"); - cmd("cd lv_examples; git co " + release_br + "; git pull origin " + release_br) - - if os.path.exists("lv_drivers"): - print(p + ": upadte lv_drivers"); - cmd("cd lv_drivers " + release_br + "; git pull origin " + release_br) - - msg = 'Update to ' + ver_str - cmd("git add .") - cmd('git commit -am "' + msg + '"') - cmd('git push origin master') - cmd("git tag -a " + ver_str + " -m '" + msg + "' " ) - cmd('git push origin ' + ver_str) - - os.chdir("../") - -def docs_update_all(): - cmd("cd docs; git checkout master; python 2.7 ./update.py master dev " + release_br) - -def cleanup(): - os.chdir("../") - cmd("rm -fr " + workdir) - -if __name__ == '__main__': - dev_prepare = 'minor' - if(len(sys.argv) != 2): - print("Missing argument. Usage ./release.py bugfix | minor | major") - print("Use minor by deafult") - else: - dev_prepare = sys.argv[1] - - if not (dev_prepare in prepare_type): - print("Invalid argument. Usage ./release.py bugfix | minor | major") - exit(1) - - clone_repos() - get_lvgl_version("dev") - dev_ver_major = ver_major - dev_ver_minor = ver_minor - dev_ver_patch = ver_patch - dev_ver_str = ver_str - - get_lvgl_version("master") - - lvgl_prepare() - lv_examples_prepare() - lv_drivers_prepare() - docs_prepare() - blog_add_post() - add_tags() - update_release_branches() - publish_master() - - projs_update() - dev_ver_major = "7" - dev_ver_minor = "7" - dev_ver_patch = "0" - dev_ver_str = "v7.7.0" - - if dev_prepare == 'bugfix': - ver_patch = str(int(ver_patch) + 1) - ver_str = "v" + ver_major + "." + ver_minor + "." + ver_patch + "-dev" - - print("Prepare bugfix version " + ver_str) - - lvgl_update_master_version() - docs_update_latest_version() - - else: - merge_from_dev() - - if dev_prepare == 'minor': - ver_major = dev_ver_major - ver_minor = str(int(dev_ver_minor) + 1) - ver_patch = "0" - else: - ver_major = str(int(dev_ver_major) + 1) - ver_minor = "0" - ver_patch = "0" - - dev_ver_str = "v" + str(ver_major) + "." + str(ver_minor) + "." + str(ver_patch) + "-dev" - - print("Prepare minor version " + dev_ver_str) - - lvgl_update_dev_version() - docs_update_dev_version() - publish_dev_and_master() - - docs_update_all(); - cleanup() - diff --git a/scripts/release/__pycache__/com.cpython-36.pyc b/scripts/release/__pycache__/com.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a8d36f0557b4589eb6f632133c786192fedf4f34 GIT binary patch literal 3276 zcmaJ@OLH5?5uVvM7XU?5lqe>Qy+zuhL7IS*xRSC;apE|B$fZCoS#hdhNhk=jBo|y@ z;h7~QZ7p&LeaO+rRQ^Gnb1o_W4j=ZKll}rv{(2UK046k0JCE+3?wNjkGrz3W{C{nI z)A@IWvH!BUpNaAB@Tm-qV1mc2UG}_fU~a_5z-*hmq#2sVW2+C z8IL1Mj7Cr)!#M1!u-QunjnVVM>$P}4oyvluU@fB_{ zxr}*_{6)Vdd^5lO2a|KZ31gk*@Q^UkW2`-6O-x~@Jcpn9#woljoOL#_;7umnQ)6O3 zyPw;A>y-8FQ}ze;==T#Rb^2~@9+{(;5!yvN*6{bOE1!)o#EL(mY>~06U zB0PwOVX&7O!JZ_~AQ?4Da!fLJ%0J_QBz`ch#WVBxSk0BPKfPr`O(7(VUvl3^Mm ztGFuoLBS)vw}K0uGi6hw4fy2-J2=}a=4ulS-A+%(_vSW7Nj0#G?G1KPDKRgG3Ix=}mByhlcUDd6lhj zxr_1aNEDXYkP3c)`U~(3yY|!*$3jxAi*ZwK{6SXpgJMVXMfL)zK7&R zx*>W0hQxOI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E&=P+$N&VlFfP7oEkj|oz%+f-YDCA z_~iaW_sQMIpM3P_(EaG}-lJ68+e>S`CA`vhukS~UcaI`5@seIVN_S|r>qpZgSNawg zz#Ir9dj4X_r>WlS^)n@H_4;=n+&;X2_u-@aJ-CW0(#r3zUw6{_EcB*R&YWoKydt$S z)y~vs=@sd0(PRRb?0OStZ}}--s(bfx-z{C4@zZ>M?z_2Ll>S?zojk^zUV3e9)BRsb zXU`Yxr*`4#wBOe`d)h1}64EVJVocp=36IMW1JGv=P~N0})&&d%r9 zG>l?Y&qM$=HL;&`O-x!H6bqV&{^OC^XQ~N<#WOgjGUf(gm0<38_*Ll1juQsfwt{$O#3K z$u?K#F>_auZ7W|_wrfS(E&>d#tj{&Lasv?oDPPkJF~~oU*y@o(D0!q8m6};q1r#hfhksyz}7hosU1g`MV!1L5bm(abgQA?v-f&TJTFhPe1!dtR9vNkyhlR5ql-O~3FP8B6>GTNUisQ3d>><8Oq&((CFp4f zIT$tZKKd_!uZ)HXM!p63suDs5AcUAxKq!xnm9bSs$J)G%wM<4y38ngBy0ro&CIVuN zv>}nSY^?+7ja2$S8@6NrU$)5U=WPbrfX{-_HiHt@MKv+!RaQmPNbFv?=E9g8 zW2;E%jB!n-d)nA8z(LYFB(yQENAmr2b&-&e=5OKp(d$1Aqha5jMR5|RSGwJ<9eOWt z7dddK%T5sG`GJ!@aDvz=!ZNeHlVlW$18492!mwxi5&ZtZ>3cC!h%)I%Tt|0rHXYiu zxt&@!e%rk<>E2*zt-Fl#u;zpb3f$>RX0)@O8Qn(0l(v>?NCo#_ivb33i2qJwg{994 znkmZ{1Br)O`*RF*UcZJV~L)Hk`xyl$_jEyC~BEa zfFh7ffS}>#(z@EApxDqc^VF|B 0 and templ[0]: + print("Updating version in " + templ[0]) + cmd("sed -i -r 's/v[0-9]+\.[0-9]+\.[0-9]+/"+ "v" + ver_num + "/' " + templ[0]) + + if os.path.exists("library.json"): + print("Updating version in library.json") + cmd("sed -i -r 's/[0-9]+\.[0-9]+\.[0-9]+/"+ ver_num +"/' library.json") + + if path.exists("library.properties"): + print("Updating version in library.properties") + cmd("sed -i -r 's/version=[0-9]+\.[0-9]+\.[0-9]+/"+ "version=" + ver_num + "/' library.properties") + + if path.exists("conf.py"): + cmd("sed -i -r \"s/'v[0-9]+\.[0-9]+\.[0-9]+.*'/\'" + ver_str + "'/\" conf.py") + + if path.exists("lvgl.h"): + define_set("./lvgl.h", "LVGL_VERSION_MAJOR", str(ver[0])) + define_set("./lvgl.h", "LVGL_VERSION_MINOR", str(ver[1])) + define_set("./lvgl.h", "LVGL_VERSION_PATCH", str(ver[2])) + define_set("./lvgl.h", "LVGL_VERSION_INFO", "\"" + ver[3] + "\"") + diff --git a/scripts/release/dev.py b/scripts/release/dev.py new file mode 100755 index 000000000..42cfd6a5e --- /dev/null +++ b/scripts/release/dev.py @@ -0,0 +1,74 @@ +#!/usr/bin/env python + +import re +import os, fnmatch +import os.path +from os import path +from datetime import date +import com + +def lvgl_upadte_ver(ver, br): + os.chdir("./lvgl") + + com.cmd("git checkout " + br) + com.update_version(ver) + com.cmd("git commit -am 'Update " + br + " version'") + com.push("origin " + br) + com.cmd("git checkout master") + + os.chdir("../") + +def docs_update_ver(ver, br): + os.chdir("./docs") + com.cmd("git checkout " + br + " --") + com.update_version(ver) + com.cmd("git commit -am 'Update " + br + " version'") + com.push("origin " + br) + com.cmd("git checkout master --") + + os.chdir("../") + + +def merge_dev_to_master(): + os.chdir("./lvgl") + com.cmd("git checkout master") + com.cmd("git merge dev") + com.push("origin master") + os.chdir("../") + + os.chdir("./docs") + com.cmd("git checkout dev -- ") #'dev' sometimes is not recognized so switch to it first + com.cmd("git checkout latest --") + com.cmd("git merge dev -X theirs --no-edit;") + com.push("origin latest") + os.chdir("../") + + +def make(mode): + ver = com.get_lvgl_version("dev") + ver[3] = "dev" + if(mode == "bugfix"): + ver[2] = ver[2] + 1 + lvgl_update_ver(ver, "master") + docs_update_ver(ver, "latest") + else: + merge_dev_to_master() + if(mode == "major"): + ver[0] = str(int(ver[0]) + 1) + ver[1] = '0' + ver[2] = '0' + if(mode == "minor"): + ver[1] = str(int(ver[1]) + 1) + ver[2] = '0' + + lvgl_upadte_ver(ver, "dev") + docs_update_ver(ver, "dev") + + + +if __name__ == '__main__': + if(len(sys.argv) != 2): + print("Missing argument. Usage ./dev.py major | minor | bugfix") + print("E.g. ./dev.py minor") + else: + make(sys.argv[1]) diff --git a/scripts/release/main.py b/scripts/release/main.py new file mode 100755 index 000000000..8d329d471 --- /dev/null +++ b/scripts/release/main.py @@ -0,0 +1,64 @@ +#!/usr/bin/env python + +import os.path +from os import path +from datetime import date +import sys +import com +import release +import dev +import proj + +upstream_org_url = "https://github.com/lvgl/" +workdir = "./release_tmp" +proj_list = [ "lv_sim_eclipse_sdl", "lv_sim_emscripten"] + +def upstream(repo): + return upstream_org_url + repo + ".git" + +def clone(repo): + com.cmd("git clone --recurse-submodules " + upstream(repo)) + os.chdir("./" + repo) + com.cmd("git checkout master") + com.cmd("git remote update origin --prune") + com.cmd("git pull origin --tags") + os.chdir("..") + +def clone_repos(): + com.cmd("rm -fr " + workdir) + com.cmd("mkdir " + workdir) + os.chdir(workdir) + clone("lvgl") + clone("lv_examples") + clone("lv_drivers") + clone("docs") + clone("blog") + + for p in proj_list: + clone(p) + +def cleanup(): + os.chdir("../") + com.cmd("rm -fr " + workdir) + +if __name__ == '__main__': + prepare_type = ['major', 'minor', 'bugfix'] + dev_prepare = 'minor' + +# if(len(sys.argv) != 2): +# print("Missing argument. Usage ./release.py bugfix | minor | major") +# print("Use minor by deafult") +# else: +# dev_prepare = sys.argv[1] + + if not (dev_prepare in prepare_type): + print("Invalid argument. Usage ./release.py bugfix | minor | major") + exit(1) + + clone_repos() + release.make() + for p in proj_list: + proj.make(p, True) + + dev.make(dev_prepare) + #cleanup() diff --git a/scripts/release/proj.py b/scripts/release/proj.py new file mode 100755 index 000000000..db02cd537 --- /dev/null +++ b/scripts/release/proj.py @@ -0,0 +1,64 @@ +#!/usr/bin/env python + +import sys +import os.path +from os import path +import re +import subprocess +import com + + +def make(repo_path, auto_push = False): + os.chdir("./" + repo_path) + com.cmd('git checkout master') + print("Upadte lvgl"); + os.chdir("./lvgl") + com.cmd("git checkout master") + com.cmd("git pull origin --tags") + + out = subprocess.Popen(['git', 'tag', '--sort=-creatordate'], + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT) + stdout,stderr = out.communicate() + + ver_str = stdout.decode("utf-8").split('\n')[0] + release_br = ver_str[1:] #trim "v" + release_br = release_br.split('.')[0] # get the first number + release_br = "release/v" + release_br + + com.cmd("git checkout " + release_br + "; git pull origin " + release_br) + + os.chdir("..") + + com.cmd("cp -f lvgl/lv_conf_template.h lv_conf.h") + com.cmd("sed -i -r 's/#if 0/#if 1/' lv_conf.h") # Enable lv_conf.h + with open("confdef.txt") as f: + for line in f: + (key, val) = line.rstrip().split('\t') + com.define_set("lv_conf.h", str(key), str(val)) + + + if os.path.exists("lv_examples"): + print("Upadte lv_examples"); + com.cmd("cd lv_examples; git co " + release_br + "; git pull origin " + release_br) + + if os.path.exists("lv_drivers"): + print("upadte lv_drivers"); + com.cmd("cd lv_drivers " + release_br + "; git pull origin " + release_br) + + msg = 'Update to ' + ver_str + com.cmd("git add .") + com.cmd('git commit -am "' + msg + '"') + com.cmd("git tag -a " + ver_str + " -m '" + msg + "' " ) + if auto_push: + com.push("origin --tags") + com.push("origin master") + + os.chdir("../") + +if __name__ == '__main__': + if(len(sys.argv) != 2): + print("Missing argument. Usage ./projs_update.py repo_path") + print("E.g. ./projs_update.py ./lv_sim_eclipse_sdl") + else: + make(sys.argv[1], sys.argv[2]) diff --git a/scripts/release/release.py b/scripts/release/release.py new file mode 100755 index 000000000..edcdf79e4 --- /dev/null +++ b/scripts/release/release.py @@ -0,0 +1,173 @@ +#!/usr/bin/env python + +import os.path +from os import path +from datetime import date +import sys +import com +import re + +def update_release_branch(release_br, master_br = "master"): + com.cmd("git checkout " + release_br) + com.cmd("git pull origin " + release_br) + com.cmd("git merge "+ master_br +" -X ours"); + com.push("origin " + release_br); + com.cmd("git checkout master"); + +def lvgl_release(ver): + print("Release lvgl") + + ver_str = com.ver_format(ver) + release_br = "release/v" + str(ver[0]) + + os.chdir("./lvgl") + com.define_set("./lvgl.h", "LVGL_VERSION_INFO", '\"\"') + + # Run some scripts + os.chdir("./scripts") + com.cmd("./code-format.sh") + com.cmd("./lv_conf_checker.py") + com.cmd("doxygen") + os.chdir("../") + + com.update_version(ver) + + #update CHANGLELOG + new_content = "" + f = open("./CHANGELOG.md", "r") + + release_note = "" + note_state = 0 + for i in f.read().splitlines(): + if note_state == 0: + r = re.search(r'^## ' + ver_str, i) + if r: + i = i.replace("planned on ", "") + note_state+=1 + + elif note_state == 1: + r = re.search(r'^## ', i) + if r: + note_state+=1 + else: + release_note += i + '\n' + + new_content += i + '\n' + + f.close() + + f = open("./CHANGELOG.md", "w") + f.write(new_content) + f.close() + + com.cmd('git commit -am "Release ' + ver_str + '"') + + com.cmd('git checkout dev') + com.cmd("git merge master -X ours") + com.cmd("git add .") + com.cmd("git commit -am 'Merge master'", False) + com.push('origin dev') + com.cmd('git checkout master') + com.cmd("git tag -a " + ver_str + " -m 'Release " + ver_str + "' ") + com.push('origin master') + com.push('origin --tags') + + update_release_branch(release_br) + + os.chdir("../") + + return release_note + + +def lv_examples_release(ver): + print("Release lv_examples") + + os.chdir("./lv_examples") + release_br = "release/v" + str(ver[0]) + ver_str = com.ver_format(ver) + + com.update_version(ver) + + com.cmd("sed -i -r 's/LV_VERSION_CHECK\([0-9]+, *[0-9]+, *[0-9]+\)/"+ "LV_VERSION_CHECK(" + str(ver[0]) + ", " + str(ver[1]) + ", " + str(ver[2]) + ")/' lv_examples.h") + + com.cmd('git commit -am "Release ' + ver_str + '"') + com.cmd("git tag -a " + ver_str + " -m 'Release " + ver_str + "' ") + com.push('origin master') + com.push('origin --tags') + + os.chdir("../") + +def lv_drivers_release(ver): + print("Release lv_drivers") + + os.chdir("./lv_drivers") + release_br = "release/v" + str(ver[0]) + ver_str = com.ver_format(ver) + + com.update_version(ver) + + com.cmd('git commit -am "Release ' + ver_str + '"') + com.cmd("git tag -a " + ver_str + " -m 'Release " + ver_str + "' ") + com.push('origin master') + com.push('origin --tags') + + update_release_branch(release_br) + + os.chdir("../") + +def docs_release(ver): + print("Release docs") + + os.chdir("./docs") + release_br = "release/v" + str(ver[0]) + ver_str = com.ver_format(ver) + + com.cmd("git co latest --") + com.cmd("rm -rf xml"); + com.cmd("cp -r ../lvgl/docs/api_doc/xml ."); + com.cmd("git add xml"); + + com.update_version(ver) + + com.cmd('git commit -am "Release ' + ver_str + '"') + com.cmd("git tag -a " + ver_str + " -m 'Release " + ver_str + "' ") + com.push('origin master') + com.push('origin --tags') + + update_release_branch(release_br, "latest") + + os.chdir("../") + +def blog_release(ver, release_note): + + os.chdir("./blog/_posts") + + ver_str = com.ver_format(ver) + + post = "---\nlayout: post\ntitle: " + ver_str + " is released\nauthor: \"kisvegabor\"\ncover: /assets/release_cover.png\n---\n\n" + post += release_note + + today = date.today() + d = today.strftime("%Y-%m-%d") + + f = open(d + "-release_" + ver_str + ".md", "w") + f.write(post) + f.close() + + com.cmd("git add .") + com.cmd("git commit -am 'Add " + ver_str + " release post'") + com.push('origin master') + + os.chdir("../../") + + +def make(): + ver = com.get_lvgl_version("master") + release_note = lvgl_release(ver) + lv_examples_release(ver) + lv_drivers_release(ver) + docs_release(ver) + blog_release(ver, release_note) + +if __name__ == '__main__': + make()