From d877cff2f369ed31cde3f952147e64628b6b0808 Mon Sep 17 00:00:00 2001 From: david gauchard Date: Sat, 12 Jun 2021 23:49:58 +0200 Subject: [PATCH 01/10] update release process to the new CI --- package/README.md | 38 ++++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/package/README.md b/package/README.md index 5c77d9f80c..55f2147eb5 100644 --- a/package/README.md +++ b/package/README.md @@ -76,7 +76,7 @@ Here is a rough overview of the effective release process. See the section below * Prepare release notes in Markdown format. * For changes that are breaking, duplicate those changes and put the duplicate lines into a separate group called Breaking Changes. That group should go at the top of the Changelog. The original lines for the breaking changes should be marked by appending "(Breaking change)" to the line. Example: - + ``` Breaking Changes ================ @@ -141,7 +141,7 @@ The following points assume work in a direct clone of the repository, and not in 8. Wait for Travis CI build for the tag to pass, see https://travis-ci.org/esp8266/Arduino/builds, -9. Check that the new (draft) release has been created (no editing at this point!), see https://github.com/esp8266/Arduino/releases. +9. Check that the new (draft) release has been created (no editing at this point!), see https://github.com/esp8266/Arduino/releases. 10. Check that the boards manager package .zip file has been successfully uploaded as a release artifact. @@ -167,41 +167,39 @@ The following points assume work in a direct clone of the repository, and not in --------------COPY BELOW THIS LINE-------------- [Reference](https://github.com/esp8266/Arduino/tree/master/package#creating-a-release-for-maintainers) for details. -- [ ] 1. Open a new issue to track activities. +- [ ] 1. Make sure that no issues or PRs are assigned to the milestone to be released. -- [ ] 2. Make sure that no issues or PRs are assigned to the milestone to be released. +- [ ] 2. Open a new issue to track activities. - [ ] 3. Assemble release notes. -- [ ] 4. Make a PR with the following, [wait for Travis CI](https://travis-ci.org/github/esp8266/Arduino/builds/), and merge. +- [ ] 4. Make a PR with the following, [wait for CI](https://github.com/esp8266/Arduino/pull/8034/checks), and merge. * [platform.txt](https://github.com/esp8266/Arduino/blob/master/platform.txt) * [package.json](https://github.com/esp8266/Arduino/blob/master/package.json) - * [cores/esp8266/TZ.h](https://github.com/esp8266/Arduino/blob/master/cores/esp8266/TZ.h) - -- [ ] 5. Wait until the release notes have been checked by other maintainers - -- [ ] 6. Navigate to [Travis CI options](https://travis-ci.org/esp8266/Arduino/settings), enable ´Build pushed branches´ (before tagging in next step) + * [TZ.h](https://github.com/esp8266/Arduino/blob/master/cores/esp8266/TZ.h) (<= `cd tools; ./TZupdate.sh`) -- [ ] 7. Tag the latest commit on the master branch, then push it to esp8266/Arduino +- [ ] 5. Wait until the release notes have been checked by other maintainers (can be changed afterwards anyway) -- [ ] 8. Wait for Travis CI build for the tag to pass, see https://travis-ci.org/esp8266/Arduino/builds, +- [ ] 6. Tag the latest commit on the master branch, then push it to esp8266/Arduino + add: `git tag -a -m "Release 3.0.0" 3.0.0; git push origin 3.0.0` + remove: `git tag -d X.Y.Z; git push --delete origin X.Y.Z` -- [ ] 9. Check that the new (draft) release has been created (no editing at this point!), see https://github.com/esp8266/Arduino/releases. +- [ ] 7. Wait for CI build for the tag to pass (in `Actions` menu) -- [ ] 10. Check that the boards manager package .zip file has been successfully uploaded as a release artifact. +- [ ] 8. Check that the new (draft) release has been created (no editing at this point!), see https://github.com/esp8266/Arduino/releases. -- [ ] 11. Check that the package index downloaded from https://arduino.esp8266.com/stable/package_esp8266com_index.json contains an entry for the new version (it may not be the first one). +- [ ] 9. Check that the boards manager package .zip file has been successfully uploaded as a release artifact. -- [ ] 12. Return to the [Travis CI options](https://travis-ci.org/esp8266/Arduino/settings) and disable `Build pushed branches`. +- [ ] 10. Check that the package index downloaded from https://arduino.esp8266.com/stable/package_esp8266com_index.json contains an entry for the new version (it may not be the first one). -- [ ] 13. Navigate to [release list in Github](https://github.com/esp8266/Arduino/releases), press "Edit" button to edit release description, paste release notes, and publish it. +- [ ] 11. Navigate to [release list in Github](https://github.com/esp8266/Arduino/releases), press "Edit" button to edit release description, paste release notes, and publish it. -- [ ] 14. In the issue tracker, remove "staged-for-release" label for all issues which have it, and close them. Close the milestone associated with the released version (the milestone should be empty per point 2 above) +- [ ] 12. In the issue tracker, remove "staged-for-release" label for all issues which have it, and close them. Close the milestone associated with the released version (the milestone should be empty per point 1 above) -- [ ] 15. Check that https://arduino-esp8266.readthedocs.io/en/latest/ has a new doc build for the new tag, and that "stable" points to that build. If a new build did not trigger, log into readthedoc's home here https://readthedocs.org/ (account must have been added to project as maintainer) and trigger it manually. +- [ ] 13. Check that https://arduino-esp8266.readthedocs.io/en/latest/ has a new doc build for the new tag, and that "stable" points to that build. If a new build did not trigger, log into readthedoc's home here https://readthedocs.org/ (account must have been added to project as maintainer) and trigger it manually. -- [ ] 16. Create a commit to the master branch, updating: +- [ ] 14. Create a commit to the master branch, updating: * The version in platform.txt and package.json files. This should correspond to the version of the *next* milestone, plus `-dev` suffix. E.g. `3.1.0-dev`. * In main README.md go to "Latest release" section, change version number in the readthedocs link to the version which was just released, and verify that all links work. From 3a4dbe0ec0fe6adc8868c0597ba2f4d574bf6952 Mon Sep 17 00:00:00 2001 From: david gauchard Date: Sun, 13 Jun 2021 23:28:50 +0200 Subject: [PATCH 02/10] generate ARDUINO_ESP8266_{MAJOR,MINOR,REVISION} in core_version.h --- tools/makecorever.py | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/tools/makecorever.py b/tools/makecorever.py index 144466235a..5ff3546aa1 100755 --- a/tools/makecorever.py +++ b/tools/makecorever.py @@ -20,23 +20,38 @@ import argparse import os import subprocess +import re -def generate(path, platform_path, git_ver="ffffffff", git_desc="unspecified"): +def generate(path, platform_path, git_ver="ffffffff", platform_version="unspecified"): def git(*args): cmd = ["git", "-C", platform_path] cmd.extend(args) proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, universal_newlines=True, stderr=subprocess.DEVNULL) return proc.stdout.readlines()[0].strip() + git_desc = platform_version; try: git_ver = git("rev-parse", "--short=8", "HEAD") git_desc = git("describe", "--tags") except Exception: pass - text = "#define ARDUINO_ESP8266_GIT_VER 0x{}\n".format(git_ver) - text += "#define ARDUINO_ESP8266_GIT_DESC {}\n".format(git_desc) + text = "#define ARDUINO_ESP8266_GIT_VER 0x{}\n".format(git_ver) + text += "#define ARDUINO_ESP8266_GIT_DESC {}\n".format(git_desc) + text += "#define ARDUINO_ESP8266_GIT_DESC2 {}\n\n".format(re.sub("[-\.]", "_", git_desc)) + + version = re.split("\.", platform_version) + # major: if present, skip "unix-" in "unix-3" + text += "#define ARDUINO_ESP8266_MAJOR {}\n".format(re.split("-", version[0])[-1]) + text += "#define ARDUINO_ESP8266_MINOR {}\n".format(version[1]) + # revision can be ".x" or ".x-dev" + revision = re.split("-", version[2]) + text += "#define ARDUINO_ESP8266_REVISION {}\n\n".format(revision[0]) + if len(revision) > 1: + text += "#define ARDUINO_ESP8266_DEV 1 // developpment version\n" + else: + text += "#define ARDUINO_ESP8266_RELEASE 1 // release version\n" try: with open(path, "r") as inp: @@ -79,5 +94,5 @@ def git(*args): generate( os.path.join(include_dir, "core_version.h"), args.platform_path, - git_desc=args.version, + platform_version=args.version, ) From 878c02c328f6521347d91438a47d1f68f0a14731 Mon Sep 17 00:00:00 2001 From: david gauchard Date: Sun, 13 Jun 2021 23:32:32 +0200 Subject: [PATCH 03/10] use default values for new version defines --- cores/esp8266/core_version.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/cores/esp8266/core_version.h b/cores/esp8266/core_version.h index 04c95c80c5..3c9d4d54b8 100644 --- a/cores/esp8266/core_version.h +++ b/cores/esp8266/core_version.h @@ -6,6 +6,18 @@ #define ARDUINO_ESP8266_GIT_DESC unspecified #endif +#ifndef ARDUINO_ESP8266_MAJOR +#define ARDUINO_ESP8266_MAJOR 0 +#endif + +#ifndef ARDUINO_ESP8266_MINOR +#define ARDUINO_ESP8266_MINOR 0 +#endif + +#ifndef ARDUINO_ESP8266_REVISION +#define ARDUINO_ESP8266_REVISION 0 +#endif + // ARDUINO_ESP8266_RELEASE is defined for released versions as a string containing the version name, i.e. "2_3_0_RC1" // ARDUINO_ESP8266_RELEASE is used in the core internally. Please use ESP.getCoreVersion() function instead. From 95bc21b60473a11d0870284574acb754e2918c76 Mon Sep 17 00:00:00 2001 From: david gauchard Date: Sun, 13 Jun 2021 23:43:20 +0200 Subject: [PATCH 04/10] (WIP) package builder: factorize version generation using makecorever --- package/build_boards_manager_package.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/package/build_boards_manager_package.sh b/package/build_boards_manager_package.sh index 2d57bd3fdd..1a88822971 100755 --- a/package/build_boards_manager_package.sh +++ b/package/build_boards_manager_package.sh @@ -110,11 +110,12 @@ $SED -E "s/name=([a-zA-Z0-9\ -]+).*/name=\1(${ver})/g"\ # Put core version and short hash of git version into core_version.h ver_define=`echo "${plain_ver}" | tr "[:lower:]." "[:upper:]_"` -echo "ver_define: ${ver_define} (plain_ver: ${plain_ver})" -echo "#define ARDUINO_ESP8266_GIT_VER 0x`git rev-parse --short=8 HEAD 2>/dev/null`" >${outdir}/cores/esp8266/core_version.h -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 +#echo "ver_define: ${ver_define} (plain_ver: ${plain_ver})" +#echo "#define ARDUINO_ESP8266_GIT_VER 0x`git rev-parse --short=8 HEAD 2>/dev/null`" >${outdir}/cores/esp8266/core_version.h +#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 -b ${outdir} -i cores/esp8266 -p ${srcdir} -v ${ver_define} # Zip the package pushd package/versions/${visiblever} From 212470f50d07180ca66bac872401749fe68907ee Mon Sep 17 00:00:00 2001 From: david gauchard Date: Tue, 15 Jun 2021 21:56:24 +0200 Subject: [PATCH 05/10] ...continuation --- tools/makecorever.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tools/makecorever.py b/tools/makecorever.py index 5ff3546aa1..fd4f5e382d 100755 --- a/tools/makecorever.py +++ b/tools/makecorever.py @@ -39,19 +39,21 @@ def git(*args): text = "#define ARDUINO_ESP8266_GIT_VER 0x{}\n".format(git_ver) text += "#define ARDUINO_ESP8266_GIT_DESC {}\n".format(git_desc) - text += "#define ARDUINO_ESP8266_GIT_DESC2 {}\n\n".format(re.sub("[-\.]", "_", git_desc)) + text += "\n" version = re.split("\.", platform_version) # major: if present, skip "unix-" in "unix-3" text += "#define ARDUINO_ESP8266_MAJOR {}\n".format(re.split("-", version[0])[-1]) text += "#define ARDUINO_ESP8266_MINOR {}\n".format(version[1]) - # revision can be ".x" or ".x-dev" + # revision can be ".n" or ".n-dev" revision = re.split("-", version[2]) - text += "#define ARDUINO_ESP8266_REVISION {}\n\n".format(revision[0]) + text += "#define ARDUINO_ESP8266_REVISION {}\n".format(revision[0]) + text += "\n" if len(revision) > 1: text += "#define ARDUINO_ESP8266_DEV 1 // developpment version\n" - else: - text += "#define ARDUINO_ESP8266_RELEASE 1 // release version\n" + + text += "#define ARDUINO_ESP8266_RELEASE {}\n".format(git_desc) + text += "#define ARDUINO_ESP8266_RELEASE_{}\n".format(re.sub("[-\.]", "_", git_desc)) try: with open(path, "r") as inp: From 2562defc0547ae58ee3f0f483a629252ac2cd6e7 Mon Sep 17 00:00:00 2001 From: david gauchard Date: Tue, 15 Jun 2021 22:23:58 +0200 Subject: [PATCH 06/10] add missing double-quotes, hide RELEASE* macros when generating dev version --- tools/makecorever.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/makecorever.py b/tools/makecorever.py index fd4f5e382d..bee8a78445 100755 --- a/tools/makecorever.py +++ b/tools/makecorever.py @@ -51,9 +51,9 @@ def git(*args): text += "\n" if len(revision) > 1: text += "#define ARDUINO_ESP8266_DEV 1 // developpment version\n" - - text += "#define ARDUINO_ESP8266_RELEASE {}\n".format(git_desc) - text += "#define ARDUINO_ESP8266_RELEASE_{}\n".format(re.sub("[-\.]", "_", git_desc)) + else: + text += "#define ARDUINO_ESP8266_RELEASE \"{}\"\n".format(git_desc) + text += "#define ARDUINO_ESP8266_RELEASE_{}\n".format(re.sub("[-\.]", "_", git_desc)) try: with open(path, "r") as inp: From 7f679e10769215f9b84500a42009ac06bf122555 Mon Sep 17 00:00:00 2001 From: david gauchard Date: Tue, 15 Jun 2021 23:15:21 +0200 Subject: [PATCH 07/10] +missing `.py` --- package/build_boards_manager_package.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/build_boards_manager_package.sh b/package/build_boards_manager_package.sh index 1a88822971..543f1ef31a 100755 --- a/package/build_boards_manager_package.sh +++ b/package/build_boards_manager_package.sh @@ -115,7 +115,7 @@ ver_define=`echo "${plain_ver}" | tr "[:lower:]." "[:upper:]_"` #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 -b ${outdir} -i cores/esp8266 -p ${srcdir} -v ${ver_define} +python3 ${srcdir}/tools/makecorever.py -b ${outdir} -i cores/esp8266 -p ${srcdir} -v ${ver_define} # Zip the package pushd package/versions/${visiblever} From 2c7565121107e28bf65318394e0c9642835a26ca Mon Sep 17 00:00:00 2001 From: david gauchard Date: Tue, 15 Jun 2021 23:37:09 +0200 Subject: [PATCH 08/10] change form of version given to makecorever --- package/build_boards_manager_package.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/build_boards_manager_package.sh b/package/build_boards_manager_package.sh index 543f1ef31a..0a3a10d213 100755 --- a/package/build_boards_manager_package.sh +++ b/package/build_boards_manager_package.sh @@ -109,13 +109,13 @@ $SED -E "s/name=([a-zA-Z0-9\ -]+).*/name=\1(${ver})/g"\ > ${outdir}/platform.txt # Put core version and short hash of git version into core_version.h -ver_define=`echo "${plain_ver}" | tr "[:lower:]." "[:upper:]_"` +#ver_define=`echo "${plain_ver}" | tr "[:lower:]." "[:upper:]_"` #echo "ver_define: ${ver_define} (plain_ver: ${plain_ver})" #echo "#define ARDUINO_ESP8266_GIT_VER 0x`git rev-parse --short=8 HEAD 2>/dev/null`" >${outdir}/cores/esp8266/core_version.h #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 ${ver_define} +python3 ${srcdir}/tools/makecorever.py -b ${outdir} -i cores/esp8266 -p ${srcdir} -v ${plain_ver} # Zip the package pushd package/versions/${visiblever} From 498d3855ea2f02316e37505b11945aa750dca6cd Mon Sep 17 00:00:00 2001 From: david gauchard Date: Wed, 16 Jun 2021 10:47:21 +0200 Subject: [PATCH 09/10] makecorever: use python string API, remove python RE, new option `-r` for release --- package/build_boards_manager_package.sh | 2 +- tools/makecorever.py | 20 +++++++++++--------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/package/build_boards_manager_package.sh b/package/build_boards_manager_package.sh index 0a3a10d213..7d76df510c 100755 --- a/package/build_boards_manager_package.sh +++ b/package/build_boards_manager_package.sh @@ -115,7 +115,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} +python3 ${srcdir}/tools/makecorever.py -b ${outdir} -i cores/esp8266 -p ${srcdir} -v ${plain_ver} -r # Zip the package pushd package/versions/${visiblever} diff --git a/tools/makecorever.py b/tools/makecorever.py index bee8a78445..02379980ac 100755 --- a/tools/makecorever.py +++ b/tools/makecorever.py @@ -20,10 +20,9 @@ import argparse import os import subprocess -import re -def generate(path, platform_path, git_ver="ffffffff", platform_version="unspecified"): +def generate(path, platform_path, git_ver="ffffffff", platform_version="unspecified", release = False): def git(*args): cmd = ["git", "-C", platform_path] cmd.extend(args) @@ -41,19 +40,20 @@ def git(*args): text += "#define ARDUINO_ESP8266_GIT_DESC {}\n".format(git_desc) text += "\n" - version = re.split("\.", platform_version) + version = platform_version.split(".") # major: if present, skip "unix-" in "unix-3" - text += "#define ARDUINO_ESP8266_MAJOR {}\n".format(re.split("-", version[0])[-1]) + text += "#define ARDUINO_ESP8266_MAJOR {}\n".format(version[0].split("-")[-1]) text += "#define ARDUINO_ESP8266_MINOR {}\n".format(version[1]) # revision can be ".n" or ".n-dev" - revision = re.split("-", version[2]) + revision = version[2].split("-") text += "#define ARDUINO_ESP8266_REVISION {}\n".format(revision[0]) text += "\n" - if len(revision) > 1: - text += "#define ARDUINO_ESP8266_DEV 1 // developpment version\n" - else: + if release: text += "#define ARDUINO_ESP8266_RELEASE \"{}\"\n".format(git_desc) - text += "#define ARDUINO_ESP8266_RELEASE_{}\n".format(re.sub("[-\.]", "_", git_desc)) + #text += "#define ARDUINO_ESP8266_RELEASE_{}\n".format(re.sub("[-\.]", "_", git_desc)) + text += "#define ARDUINO_ESP8266_RELEASE_{}\n".format(git_desc.replace("-","_").replace(".","_")) + else: + text += "#define ARDUINO_ESP8266_DEV 1 // developpment version\n" try: with open(path, "r") as inp: @@ -84,6 +84,7 @@ def git(*args): "-v", "--version", action="store", required=True, help="version variable" ) parser.add_argument("-i", "--include_dir", default="core") + parser.add_argument("-r", "--release", action="store_true", default=False) args = parser.parse_args() @@ -97,4 +98,5 @@ def git(*args): os.path.join(include_dir, "core_version.h"), args.platform_path, platform_version=args.version, + release=args.release ) From 823dfb79fbc1e9adbeb917a11a62b351d4aee483 Mon Sep 17 00:00:00 2001 From: david gauchard Date: Wed, 16 Jun 2021 14:35:50 +0200 Subject: [PATCH 10/10] update per review --- tools/makecorever.py | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/tools/makecorever.py b/tools/makecorever.py index 02379980ac..ab6c436f92 100755 --- a/tools/makecorever.py +++ b/tools/makecorever.py @@ -22,35 +22,49 @@ import subprocess -def generate(path, platform_path, git_ver="ffffffff", platform_version="unspecified", release = False): +def generate(path, platform_path, version="unspecified", release = False): def git(*args): cmd = ["git", "-C", platform_path] cmd.extend(args) proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, universal_newlines=True, stderr=subprocess.DEVNULL) return proc.stdout.readlines()[0].strip() - git_desc = platform_version; + text = "" + + try: + text = "#define ARDUINO_ESP8266_GIT_VER 0x{}\n".format(git("rev-parse", "--short=8", "HEAD")) + except Exception: + pass + + # version is + # - using Arduino-CLI: + # - blah-5.6.7 (official release, coming from platform.txt) + # - blah-5.6.7-dev (intermediate / unofficial / testing release) + # - using git: + # - 5.6.7 (from release script, official release) + # - 5.6.7-42-g00d1e5 (from release script, test release) + git_desc = version try: - git_ver = git("rev-parse", "--short=8", "HEAD") + # in any case, get a better version when git is around git_desc = git("describe", "--tags") except Exception: pass - text = "#define ARDUINO_ESP8266_GIT_VER 0x{}\n".format(git_ver) text += "#define ARDUINO_ESP8266_GIT_DESC {}\n".format(git_desc) text += "\n" - version = platform_version.split(".") + version_split = version.split(".") # major: if present, skip "unix-" in "unix-3" - text += "#define ARDUINO_ESP8266_MAJOR {}\n".format(version[0].split("-")[-1]) - text += "#define ARDUINO_ESP8266_MINOR {}\n".format(version[1]) - # revision can be ".n" or ".n-dev" - revision = version[2].split("-") + text += "#define ARDUINO_ESP8266_MAJOR {}\n".format(version_split[0].split("-")[-1]) + text += "#define ARDUINO_ESP8266_MINOR {}\n".format(version_split[1]) + # revision can be ".n" or ".n-dev" or ".n-42-g00d1e5" + revision = version_split[2].split("-") text += "#define ARDUINO_ESP8266_REVISION {}\n".format(revision[0]) text += "\n" + + # release or dev if release: text += "#define ARDUINO_ESP8266_RELEASE \"{}\"\n".format(git_desc) - #text += "#define ARDUINO_ESP8266_RELEASE_{}\n".format(re.sub("[-\.]", "_", git_desc)) text += "#define ARDUINO_ESP8266_RELEASE_{}\n".format(git_desc.replace("-","_").replace(".","_")) else: text += "#define ARDUINO_ESP8266_DEV 1 // developpment version\n" @@ -97,6 +111,6 @@ def git(*args): generate( os.path.join(include_dir, "core_version.h"), args.platform_path, - platform_version=args.version, + version=args.version, release=args.release )