1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-07 16:23:38 +03:00

Tools - makecorever.py fixed packaging & avoid needless overwrites (#9250)

update packaging script w/ new arguments

rewrite ci build pattern to only rewrite core_version.h once per job
restore behaviour from #6414 for other cases
This commit is contained in:
Max Prokhorov 2025-05-28 03:57:47 +03:00 committed by GitHub
parent 4214e16671
commit 2201770a20
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 17 additions and 18 deletions

View File

@ -117,7 +117,7 @@ $SED -E "s/name=([a-zA-Z0-9\ -]+).*/name=\1(${ver})/g"\
#echo "#define ARDUINO_ESP8266_GIT_DESC `git describe --tags 2>/dev/null`" >>${outdir}/cores/esp8266/core_version.h
#echo "#define ARDUINO_ESP8266_RELEASE_${ver_define}" >>${outdir}/cores/esp8266/core_version.h
#echo "#define ARDUINO_ESP8266_RELEASE \"${ver_define}\"" >>${outdir}/cores/esp8266/core_version.h
python3 ${srcdir}/tools/makecorever.py -b ${outdir} -i cores/esp8266 -p ${srcdir} -v ${plain_ver} -r
python3 ${srcdir}/tools/makecorever.py --git-root ${srcdir} --version ${plain_ver} --release ${outdir}/cores/esp8266/core_version.h
# Zip the package
pushd package/versions/${visiblever}

View File

@ -312,6 +312,7 @@ function install_core()
"compiler.c.extra_flags=-Wall -Wextra $debug_flags" \
"compiler.cpp.extra_flags=-Wall -Wextra $debug_flags" \
"mkbuildoptglobals.extra_flags=--ci --cache_core" \
"recipe.hooks.prebuild.1.pattern=\"{runtime.tools.python3.path}/python3\" -I \"{runtime.tools.makecorever}\" --git-root \"{runtime.platform.path}\" --version \"{version}\" \"{runtime.platform.path}/cores/esp8266/core_version.h\"" \
> ${core_path}/platform.local.txt
echo -e "\n----platform.local.txt----"
cat platform.local.txt

View File

@ -5,8 +5,9 @@ source "$root/tests/common.sh"
pushd "$root"/tools
python3 get.py -q
python3 makecorever.py --git-root "$root" "$root/cores/esp8266/core_version.h"
popd
pushd "$cache_dir"
gcc="$root/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-gcc"\

View File

@ -56,7 +56,6 @@ def check_git(*args: str, cwd: Optional[str]):
def generate(
out: TextIO,
*,
git_root: pathlib.Path,
hash_length: int = 8,
@ -118,7 +117,7 @@ def generate(
#define ARDUINO_ESP8266_DEV 1 // development version
"""
out.write(text)
return text
if __name__ == "__main__":
@ -158,20 +157,18 @@ if __name__ == "__main__":
args = parser.parse_args()
def select_output(s: str) -> TextIO:
if not s:
return sys.stdout
out = pathlib.Path(s)
out.parent.mkdir(parents=True, exist_ok=True)
return out.open("w", encoding="utf-8")
with select_output(args.output) as out:
generate(
out,
contents = generate(
git_root=args.git_root,
hash_length=args.hash_length,
release=args.release,
version=args.version,
)
if args.output:
out = pathlib.Path(args.output)
out.parent.mkdir(parents=True, exist_ok=True)
if not out.exists() or contents != out.read_text(encoding="utf-8"):
out.write_text(contents, encoding="utf-8")
else:
print(contents, file=sys.stdout)