diff --git a/scripts/release/com.py b/scripts/release/com.py index 3756c5b51..b159aab73 100755 --- a/scripts/release/com.py +++ b/scripts/release/com.py @@ -41,13 +41,11 @@ def ver_format(ver): if(ver[3] != ""): s = s + "-" + ver[3] return s -def get_lvgl_version(br): - print("Get LVGL's version") +def get_lvgl_version(): + print("Get lvgl's version ") ver = [0, 0, 0, ""] - com.cmd("git checkout " + br) - f = open("./lvgl.h", "r") lastNum = re.compile(r'(?:[^\d]*(\d+)[^\d]*)+') @@ -68,39 +66,43 @@ def get_lvgl_version(br): if m: ver[2] = m.group(1) f.close() + + print("Version found: " + ver_format(ver)) - com.cmd("git checkout master") return ver def push(c): cmd("git push " + c) def update_version(ver): - ver_str = ver_format(ver) - ver_num = ver[0] + "." + ver[1] + "." + ver[2] + ver_str = ver_format(ver) + ver_num = ver[0] + "." + ver[1] + "." + ver[2] - templ = fnmatch.filter(os.listdir('.'), '*_templ*.h') + templ = fnmatch.filter(os.listdir('.'), '*_templ*.h') - if len(templ) > 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 len(templ) > 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 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("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("conf.py"): + cmd("sed -i -r 's/v[0-9]+\.[0-9]+\.[0-9]+.*/" + ver_str + "/' conf.py") - if path.exists("Kconfig"): - cmd("sed -i -r 's/v[0-9]+\.[0-9]+\.[0-9]+.*/" + ver_str + "/' Kconfig") + if path.exists("Kconfig"): + cmd("sed -i -r 's/v[0-9]+\.[0-9]+\.[0-9]+.*/" + ver_str + "/' Kconfig") - 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] + "\"") + 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] + "\"") + + cmd("git commit -am 'Update versions to " + ver_str + "'") + diff --git a/scripts/release/patch.py b/scripts/release/patch.py index b021c1461..41da455de 100755 --- a/scripts/release/patch.py +++ b/scripts/release/patch.py @@ -11,7 +11,7 @@ import os, subprocess, com, re -# tag = True +push = False def clone(repo): com.cmd("git clone --recurse-submodules https://github.com/lvgl/" + repo) @@ -38,15 +38,21 @@ branches = branches.replace("\\n", "") branches = branches.split(" ") branches = list(filter(len, branches)) - commits = [] -with open('commits.txt') as f: +with open('../commits.txt') as f: for line in f: - commits.append(line) + commits.insert(0, line) print(commits) for br in branches: + com.cmd("git checkout " + br) + + print("Applying commits") + for c in commits: + h = c.split(" ") + com.cmd("git cherry-pick " + h[0]) + ver = com.get_lvgl_version(br) ver_new = ver.copy() ver_new[2] = str(int(ver_new[2]) + 1) @@ -62,8 +68,7 @@ ver = com.get_lvgl_version("master") ver = com.get_lvgl_version(br) ver_new[2] = str(int(ver_new[2]) + 1) t = com.ver_format(ver_new) + "-dev" -com.cmd("git tag -a " + t + "-m \"Start " + t + "\"") - +com.cmd("git tag -a " + t + " -m \"Start " + t + "\"") if push: com.cmd("git push origin master --tags")