-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extend node.info #2830
Extend node.info #2830
Changes from all commits
21c35a1
4b27993
e027318
e6c2f4c
ad90e8d
bc4b177
2d80042
299b248
6f1e366
6a78546
063988f
1c94629
13f22e1
1d976e5
dd1f875
5fafa63
06666a7
9eec82f
0ff3084
825e350
d054d17
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -93,12 +93,14 @@ make EXTRA_CCFLAGS="-DLUA_NUMBER_INTEGRAL .... | |
``` | ||
|
||
### Tag Your Build | ||
Identify your firmware builds by editing `app/include/user_version.h` | ||
Identify your firmware builds by setting the environment variable `USER_PROLOG`. | ||
You may also edit `app/include/user_version.h`. The variable `USER_PROLOG` will be included in `NODE_VERSION_LONG`. | ||
|
||
```c | ||
#define NODE_VERSION "NodeMCU " ESP_SDK_VERSION_STRING "." NODE_VERSION_XSTR(NODE_VERSION_INTERNAL) | ||
#define NODE_VERSION "NodeMCU " ESP_SDK_VERSION_STRING "." NODE_VERSION_XSTR(NODE_VERSION_INTERNAL) " " NODE_VERSION_LONG | ||
|
||
#ifndef BUILD_DATE | ||
#define BUILD_DATE "YYYYMMDD" | ||
#define BUILD_DATE "unspecified" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, I only now realized that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @HHHartmann However, we'd have to invert that order of precedence. If we do
in the script the |
||
#endif | ||
``` | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
#!/usr/bin/env bash | ||
HHHartmann marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
USER_MODULES_H=app/include/user_modules.h | ||
|
||
COMMIT_ID="$(git rev-parse HEAD)" | ||
BRANCH="$(git rev-parse --abbrev-ref HEAD | sed -E 's/[\/\\]+/_/g')" | ||
RELEASE="$(git describe --tags --long | sed -E 's/(.*)-(.*)-.*/\1 +\2/g' | sed 's/ +0$//')" | ||
RELEASE_DTS=$(TZ=UTC git show --quiet --date=format-local:"%Y%m%d%H%M" --format="%cd" HEAD) | ||
|
||
MODULES=$(awk '/^[ \t]*#define LUA_USE_MODULES/{modules=modules sep tolower(substr($2,17));sep=","}END{if(length(modules)==0)modules="-";print modules}' $USER_MODULES_H | tr -d '\r') | ||
|
||
# create temp buildinfo | ||
TEMPFILE=/tmp/buildinfo.h | ||
cat > $TEMPFILE << EndOfMessage | ||
#ifndef __BUILDINFO_H__ | ||
#define __BUILDINFO_H__ | ||
|
||
#include "user_config.h" | ||
|
||
#define BUILDINFO_STR_HELPER(x) #x | ||
#define BUILDINFO_TO_STR(x) BUILDINFO_STR_HELPER(x) | ||
|
||
#ifdef LUA_FLASH_STORE | ||
#define BUILDINFO_LFS LUA_FLASH_STORE | ||
#else | ||
#define BUILDINFO_LFS 0 | ||
#endif | ||
|
||
#ifdef CLIENT_SSL_ENABLE | ||
#define BUILDINFO_SSL true | ||
#define BUILDINFO_SSL_STR "true" | ||
#else | ||
#define BUILDINFO_SSL false | ||
#define BUILDINFO_SSL_STR "false" | ||
#endif | ||
|
||
#ifdef LUA_NUMBER_INTEGRAL | ||
#define BUILDINFO_BUILD_TYPE "integer" | ||
#else | ||
#define BUILDINFO_BUILD_TYPE "float" | ||
#endif | ||
|
||
#define USER_PROLOG "$USER_PROLOG" | ||
#define BUILDINFO_BRANCH "$BRANCH" | ||
#define BUILDINFO_COMMIT_ID "$COMMIT_ID" | ||
#define BUILDINFO_RELEASE "$RELEASE" | ||
#define BUILDINFO_RELEASE_DTS "$RELEASE_DTS" | ||
#define BUILDINFO_MODULES "$MODULES" | ||
|
||
#define NODE_VERSION_LONG \\ | ||
USER_PROLOG "\n" \\ | ||
"\tbranch: " BUILDINFO_BRANCH "\n" \\ | ||
"\tcommit: " BUILDINFO_COMMIT_ID "\n" \\ | ||
"\trelease: " BUILDINFO_RELEASE "\n" \\ | ||
"\trelease DTS: " BUILDINFO_RELEASE_DTS "\n" \\ | ||
"\tSSL: " BUILDINFO_SSL_STR "\n" \\ | ||
"\tbuild type: " BUILDINFO_BUILD_TYPE "\n" \\ | ||
"\tLFS: " BUILDINFO_TO_STR(BUILDINFO_LFS) "\n" \\ | ||
"\tmodules: " BUILDINFO_MODULES "\n" | ||
|
||
EndOfMessage | ||
|
||
echo "#endif /* __BUILDINFO_H__ */" >> $TEMPFILE | ||
|
||
diff -q $TEMPFILE app/include/buildinfo.h || cp $TEMPFILE app/include/buildinfo.h | ||
rm $TEMPFILE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might belong in a separate PR, but I'm not going to complain too much.