summaryrefslogtreecommitdiff
path: root/lib/lvgl/scripts/release
diff options
context:
space:
mode:
authorjacqueline <me@jacqueline.id.au>2023-06-01 15:41:47 +1000
committerjacqueline <me@jacqueline.id.au>2023-06-01 15:41:47 +1000
commitdd27c3530432ea0b09f01e604bf577f31d8ef841 (patch)
treebbf86cf81a78f0ff0b07f31f1c390db473f26fd3 /lib/lvgl/scripts/release
parent6fd588e970470b15936187980829916d0dbe77bb (diff)
downloadtangara-fw-dd27c3530432ea0b09f01e604bf577f31d8ef841.tar.gz
convert lvgl from submodule to a plain old directory
Diffstat (limited to 'lib/lvgl/scripts/release')
m---------lib/lvgl0
-rwxr-xr-xlib/lvgl/scripts/release/com.py108
-rw-r--r--lib/lvgl/scripts/release/commits.txt0
-rwxr-xr-xlib/lvgl/scripts/release/patch.py74
-rw-r--r--lib/lvgl/scripts/release/release.py17
5 files changed, 199 insertions, 0 deletions
diff --git a/lib/lvgl b/lib/lvgl
deleted file mode 160000
-Subproject 0732400e7b564dd0e7dc4a924619d8e19c5b23a
diff --git a/lib/lvgl/scripts/release/com.py b/lib/lvgl/scripts/release/com.py
new file mode 100755
index 00000000..0cf8c6d7
--- /dev/null
+++ b/lib/lvgl/scripts/release/com.py
@@ -0,0 +1,108 @@
+#!/usr/bin/env python3
+
+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():
+ print("Get lvgl's version ")
+
+ ver = [0, 0, 0, ""]
+
+ 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()
+
+ print("Version found: " + ver_format(ver))
+
+ 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] + "\"")
+
+ cmd("git commit -am 'Update versions to " + ver_str + "'")
+
diff --git a/lib/lvgl/scripts/release/commits.txt b/lib/lvgl/scripts/release/commits.txt
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/lib/lvgl/scripts/release/commits.txt
diff --git a/lib/lvgl/scripts/release/patch.py b/lib/lvgl/scripts/release/patch.py
new file mode 100755
index 00000000..9ccdc735
--- /dev/null
+++ b/lib/lvgl/scripts/release/patch.py
@@ -0,0 +1,74 @@
+#!/usr/bin/env python3
+
+# Applies a commit or commits on branch 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 <branch-list>
+# - t: increment version number and create a tag
+
+
+import os, subprocess, com, re
+
+push = False
+
+def clone(repo):
+ com.cmd("git clone --recurse-submodules https://github.com/lvgl/" + repo)
+ os.chdir("./" + repo)
+ com.cmd("git checkout master")
+ com.cmd("git remote update origin --prune")
+ com.cmd("git pull origin --tags")
+ os.chdir("..")
+
+# Get the list of related minor version branches
+
+#clone("lvgl")
+os.chdir("lvgl")
+
+cmd = "git branch --remotes | grep origin/release/v8"
+branches, error = subprocess.Popen(cmd, shell=True, executable="/bin/bash", stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
+
+branches = str(branches)
+branches = branches.replace("b'", "")
+branches = branches.replace("'", "")
+branches = branches.replace("origin/", "")
+branches = branches.replace(" ", " ")
+branches = branches.replace("\\n", "")
+branches = branches.split(" ")
+branches = list(filter(len, branches))
+
+commits = []
+with open('../commits.txt') as f:
+ for line in f:
+ 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)
+ print("Updating branch '" + br + "' from '" + com.ver_format(ver) + "' to '" + com.ver_format(ver_new) + "'")
+ com.update_version(ver_new)
+ com.cmd("git tag -a " + com.ver_format(ver_new) + "-m \"Release " + com.ver_format(ver_new) + "\"")
+
+ if push:
+ com.cmd("git push origin " + br + "--tags")
+
+com.cmd("git checkout master")
+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 + "\"")
+
+if push:
+ com.cmd("git push origin master --tags")
diff --git a/lib/lvgl/scripts/release/release.py b/lib/lvgl/scripts/release/release.py
new file mode 100644
index 00000000..7da8230b
--- /dev/null
+++ b/lib/lvgl/scripts/release/release.py
@@ -0,0 +1,17 @@
+#!/usr/bin/env python3
+
+# 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