mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-28 07:03:00 +08:00
describe the intended features of the new relase scripts (initial ideas)
This commit is contained in:
parent
8bba029aa6
commit
ee09d7de6a
@ -1,110 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
import os.path
|
||||
from os import path
|
||||
import os, fnmatch
|
||||
import re
|
||||
import subprocess
|
||||
import com
|
||||
|
||||
def cmd(c, ask_on_err = True):
|
||||
print("\n" + c)
|
||||
r = os.system(c)
|
||||
if r:
|
||||
print("### Error: " + str(r))
|
||||
if ask_on_err:
|
||||
input("Press Enter to continue execution...")
|
||||
|
||||
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 ver_format(ver):
|
||||
s = "v" + str(ver[0]) + "." + str(ver[1]) + "." + str(ver[2])
|
||||
if(ver[3] != ""): s = s + "-" + ver[3]
|
||||
return s
|
||||
|
||||
def get_lvgl_version(br):
|
||||
print("Get LVGL's version")
|
||||
|
||||
ver = [0, 0, 0, ""]
|
||||
|
||||
os.chdir("./lvgl")
|
||||
|
||||
com.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[0] = m.group(1)
|
||||
|
||||
r = re.search(r'^#define LVGL_VERSION_MINOR ', i)
|
||||
if r:
|
||||
m = lastNum.search(i)
|
||||
if m: ver[1] = m.group(1)
|
||||
|
||||
r = re.search(r'^#define LVGL_VERSION_PATCH ', i)
|
||||
if r:
|
||||
m = lastNum.search(i)
|
||||
if m: ver[2] = m.group(1)
|
||||
|
||||
f.close()
|
||||
|
||||
com.cmd("git checkout master")
|
||||
|
||||
os.chdir("../")
|
||||
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]
|
||||
|
||||
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 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("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] + "\"")
|
@ -1,72 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import re
|
||||
import os, fnmatch
|
||||
import os.path
|
||||
from os import path
|
||||
from datetime import date
|
||||
import com
|
||||
|
||||
def lvgl_update_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):
|
||||
if(mode == "bugfix"):
|
||||
ver = com.get_lvgl_version("master")
|
||||
ver[3] = "dev"
|
||||
ver[2] = str(int(ver[2]) + 1)
|
||||
lvgl_update_ver(ver, "master")
|
||||
docs_update_ver(ver, "latest")
|
||||
else:
|
||||
ver = com.get_lvgl_version("dev")
|
||||
ver[3] = "dev"
|
||||
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_update_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])
|
@ -1,65 +0,0 @@
|
||||
#!/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 default")
|
||||
# else:
|
||||
# dev_prepare = sys.argv[1]
|
||||
|
||||
if not (dev_prepare in prepare_type):
|
||||
print("Invalid argument. Usage ./release.py bugfix | minor | major")
|
||||
exit(1)
|
||||
|
||||
#os.chdir(workdir)
|
||||
clone_repos()
|
||||
release.make()
|
||||
for p in proj_list:
|
||||
proj.make(p, True)
|
||||
|
||||
dev.make(dev_prepare)
|
||||
#cleanup()
|
9
scripts/release/patch.py
Normal file
9
scripts/release/patch.py
Normal file
@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# Applies a commit or commits on baranch or branches
|
||||
# USAGE:
|
||||
# patch.py -c <commit-list> -b <branch-list> [-p] [-t]
|
||||
# - <commit-list>: list of commit SHAs to apply.
|
||||
# - <branch-list>: branches where the commit should be applied. * can be used as wildchar
|
||||
# - p: push the changes to <brach-list>
|
||||
# - t: increment version number and create a tag
|
@ -1,62 +0,0 @@
|
||||
#!/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("Update 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("Update lv_examples");
|
||||
com.cmd("cd lv_examples; git co " + release_br + "; git pull origin " + release_br)
|
||||
|
||||
if os.path.exists("lv_drivers"):
|
||||
print("update 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])
|
188
scripts/release/release.py
Executable file → Normal file
188
scripts/release/release.py
Executable file → Normal file
@ -1,173 +1,17 @@
|
||||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
|
||||
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')
|
||||
|
||||
update_release_branch(release_br)
|
||||
|
||||
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()
|
||||
# Create a new release from master. Execute the followings:
|
||||
# - On lvgl, lv_demos, and lv_drivers:
|
||||
# - Detect the current version of master. E.g. 8.1-dev
|
||||
# - Create a new branch from the master for the release. E.g. release/v8.1
|
||||
# - Remove the "-dev" postfix from the version numbers
|
||||
# - Create a tag for the new version. E.g. v8.1
|
||||
# - Push the new branch and tag
|
||||
# - Get the relevant changes from docs/CHANGELOG.md and create a blog post from it
|
||||
# - Increment the version number in master. E.g.g 8.1-dev to 8.2-dev
|
||||
# - Add a new section to the CHANGELOG with the new version
|
||||
# - Update the simulator and lv_port projects
|
||||
#
|
||||
# USAGE:
|
||||
# release.py <type>
|
||||
# - <type>: -minor or -major
|
||||
|
Loading…
x
Reference in New Issue
Block a user