2023-09-16 15:00:24 +00:00
|
|
|
From 07b4dcdd06e59f02c3c56df94f0903c36360c183 Mon Sep 17 00:00:00 2001
|
2022-10-22 19:17:54 +00:00
|
|
|
From: Luke Granger-Brown <git@lukegb.com>
|
|
|
|
Date: Sat, 22 Oct 2022 19:35:00 +0100
|
2023-07-19 02:54:50 +00:00
|
|
|
Subject: [PATCH 2/5] proto_ver_generator: use changelog, not git
|
2022-10-22 19:17:54 +00:00
|
|
|
|
|
|
|
---
|
2023-05-05 23:42:06 +00:00
|
|
|
scripts/fbt_tools/fbt_assets.py | 28 ++++++++++------------------
|
|
|
|
1 file changed, 10 insertions(+), 18 deletions(-)
|
2022-10-22 19:17:54 +00:00
|
|
|
|
|
|
|
diff --git a/scripts/fbt_tools/fbt_assets.py b/scripts/fbt_tools/fbt_assets.py
|
2023-09-16 15:00:24 +00:00
|
|
|
index 4f4d3bffd..f798a15b0 100644
|
2022-10-22 19:17:54 +00:00
|
|
|
--- a/scripts/fbt_tools/fbt_assets.py
|
|
|
|
+++ b/scripts/fbt_tools/fbt_assets.py
|
2023-09-16 15:00:24 +00:00
|
|
|
@@ -76,26 +76,18 @@ def _invoke_git(args, source_dir):
|
2022-08-28 16:33:45 +00:00
|
|
|
|
|
|
|
|
|
|
|
def proto_ver_generator(target, source, env):
|
|
|
|
+ changelog_content = source[0].get_text_contents()
|
|
|
|
+ for ln in changelog_content.split('\n'):
|
|
|
|
+ ln = ln.strip()
|
|
|
|
+ if ln.startswith('## ['):
|
|
|
|
+ version = ln[len('## ['):-1]
|
|
|
|
+ break
|
|
|
|
+ else:
|
|
|
|
+ print("couldn't parse version from changelog " + str(source[0]))
|
|
|
|
+ Exit()
|
|
|
|
target_file = target[0]
|
|
|
|
- src_dir = source[0].dir.abspath
|
|
|
|
- try:
|
2023-05-05 23:42:06 +00:00
|
|
|
- _invoke_git(
|
2022-08-28 16:33:45 +00:00
|
|
|
- ["fetch", "--tags"],
|
|
|
|
- source_dir=src_dir,
|
|
|
|
- )
|
2023-05-05 23:42:06 +00:00
|
|
|
- except (subprocess.CalledProcessError, EnvironmentError):
|
2022-08-28 16:33:45 +00:00
|
|
|
- # Not great, not terrible
|
2022-12-04 06:40:03 +00:00
|
|
|
- print(fg.boldred("Git: fetch failed"))
|
2022-08-28 16:33:45 +00:00
|
|
|
-
|
|
|
|
- try:
|
|
|
|
- git_describe = _invoke_git(
|
|
|
|
- ["describe", "--tags", "--abbrev=0"],
|
|
|
|
- source_dir=src_dir,
|
|
|
|
- )
|
2023-05-05 23:42:06 +00:00
|
|
|
- except (subprocess.CalledProcessError, EnvironmentError):
|
2023-04-16 18:15:28 +00:00
|
|
|
- raise StopError("Git: describe failed")
|
2023-05-05 23:42:06 +00:00
|
|
|
|
2022-08-28 16:33:45 +00:00
|
|
|
- git_major, git_minor = git_describe.split(".")
|
|
|
|
+ git_major, git_minor = version.split(".")
|
|
|
|
version_file_data = (
|
|
|
|
"#pragma once",
|
|
|
|
f"#define PROTOBUF_MAJOR_VERSION {git_major}",
|
2022-10-22 19:17:54 +00:00
|
|
|
--
|
2023-09-16 15:00:24 +00:00
|
|
|
2.41.0
|
2022-10-22 19:17:54 +00:00
|
|
|
|