Skip to content
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

append git version info during Espressif install #5955

Closed
wants to merge 2 commits into from

Conversation

gojimmypi
Copy link
Contributor

Description

As noted in #5948 (comment) there can be several Espressif wolfSSL component installs in multiple directories for various ESP-IDF versions.

As the installation is a file copy process, the GitHub version information is currently lost at install time. The user at runtime only has the LIBWOLFSSL_VERSION_STRING and LIBWOLFSSL_VERSION_HEX release values available.

This update will add a few #DEFINE values to the installed component wolfssl version.h file such as:

#undef  LIBWOLFSSL_VERSION_GIT_HASH
#define LIBWOLFSSL_VERSION_GIT_HASH adb406e1eebf05e452afca98fa9bf3ccd7abcfca
#undef  LIBWOLFSSL_VERSION_GIT_SHORT_HASH
#define LIBWOLFSSL_VERSION_GIT_SHORT_HASH adb406e1e
#undef  LIBWOLFSSL_VERSION_GIT_HASH_DATE
#define LIBWOLFSSL_VERSION_GIT_HASH_DATE "Sat Jan 5 09:00:00 2013 +0100"

The Espressif ./setup.sh now exists with a value of 0 instead of 1 if all was successful.

Fixes zd# n/a

Testing

Run the ./setup.sh for Espressif component install as explained in the Setup for Linux and observe the update to version.h as noted in the output.

The command can also be run manually as desired:

./append_wolfssl_git_version.sh

resulting in this example output:

Adding git version info to file: /mnt/c/SysGCC/esp32/esp-idf/v5.0/components/wolfssl/wolfssl/version.h
Update complete.

Windows install does not yet have this feature at this time. WSL can be used as a substitute.

Checklist

  • added tests
  • updated/added doxygen
  • updated appropriate READMEs
  • Updated manual and documentation

@dgarske dgarske self-assigned this Jan 9, 2023
Copy link
Contributor

@dgarske dgarske left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that none of the ESP-IDF stuff gets included with make dist?

The include.am only has these three files:

EXTRA_DIST+= IDE/Espressif/ESP-IDF/setup_win.bat
EXTRA_DIST+= IDE/Espressif/ESP-IDF/dummy_test_paths.h
EXTRA_DIST+= IDE/Espressif/ESP-IDF/compileAllExamples.sh

@dgarske dgarske removed their assignment Jan 10, 2023
@gojimmypi
Copy link
Contributor Author

@dgarske I've added the Espressif updates to include.am to #5956 in 50820b6.

It seemed more relevant there and as this PR's append_wolfssl_git_version.sh is specifically not included in the the dist since there will be no git info to append.

@gojimmypi gojimmypi marked this pull request as draft January 19, 2023 20:24
@gojimmypi
Copy link
Contributor Author

I've converted this to a draft to consider other options.

Copy link
Contributor

@bandi13 bandi13 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this something that might be useful for the entire project not just Espressif?

@gojimmypi
Copy link
Contributor Author

Is this something that might be useful for the entire project not just Espressif?

I would definitely like to see version information everywhere. If it were up to me, I'd have date/version info in each source file.

Admittedly this PR modifying source code is a little wonky.

Thanks @douzzer for the makefile idea as implemented for Espressif in #6018

If everyone likes the idea, I'll create a new PR that includes runtime display in version.h

@wolfSSL-Bot
Copy link

Can one of the admins verify this patch?

@gojimmypi
Copy link
Contributor Author

As #6018 was merged, I think it is a better idea to have a more soft version detection, something other than modification of source files.

See the LIBWOLFSSL_SAVE_INFO CMake function for examples of saving various interesting version attributes at compile time.

Here's an example of displaying those values at runtime in the Espressif embedded environment:

#if defined(LIBWOLFSSL_VERSION_GIT_HASH)
    ESP_LOGI(TAG, "LIBWOLFSSL_VERSION_GIT_HASH = %s", LIBWOLFSSL_VERSION_GIT_HASH);
#endif

#if defined(LIBWOLFSSL_VERSION_GIT_SHORT_HASH )
    ESP_LOGI(TAG, "LIBWOLFSSL_VERSION_GIT_SHORT_HASH = %s", LIBWOLFSSL_VERSION_GIT_SHORT_HASH);
#endif

#if defined(LIBWOLFSSL_VERSION_GIT_HASH_DATE)
    ESP_LOGI(TAG, "LIBWOLFSSL_VERSION_GIT_HASH_DATE = %s", LIBWOLFSSL_VERSION_GIT_HASH_DATE);
#endif

@gojimmypi gojimmypi closed this Feb 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants