diff options
author | Hanoh Haim <hhaim@cisco.com> | 2015-12-13 15:43:59 +0200 |
---|---|---|
committer | Hanoh Haim <hhaim@cisco.com> | 2015-12-13 15:43:59 +0200 |
commit | 301341ddb1bf17387d7fea19667bedd40fce4509 (patch) | |
tree | 590c8f329f2ab68c7da3f1f8f4c55f81243a08bc /linux_dpdk | |
parent | e72d1f1a7514a902873a3206bd236945bdfe6dde (diff) |
add git sha to version
Diffstat (limited to 'linux_dpdk')
-rwxr-xr-x | linux_dpdk/ws_main.py | 17 | ||||
-rwxr-xr-x | linux_dpdk/wscript | 3 |
2 files changed, 20 insertions, 0 deletions
diff --git a/linux_dpdk/ws_main.py b/linux_dpdk/ws_main.py index 566ceb1a..e5ac40fb 100755 --- a/linux_dpdk/ws_main.py +++ b/linux_dpdk/ws_main.py @@ -12,6 +12,7 @@ import shutil; import copy; import re import uuid +import subprocess # these variables are mandatory ('/' are converted automatically) @@ -702,6 +703,15 @@ def get_build_num (): return s; def create_version_files (): + git_sha="N/A" + try: + r=commands.getstatusoutput("git log --pretty=format:'%H' -n 1") + if r[0]==0: + git_sha=r[1] + except : + pass; + + s ='' s +="#ifndef __TREX_VER_FILE__ \n" s +="#define __TREX_VER_FILE__ \n" @@ -712,6 +722,7 @@ def create_version_files (): s +='extern const char * get_build_date(void); \n' s +='extern const char * get_build_time(void); \n' s +='#define VERSION_UIID "%s" \n' % uuid.uuid1() + s +='#define VERSION_GIT_SHA "%s" \n' % git_sha s +='#define VERSION_BUILD_NUM "%s" \n' % get_build_num() s +="#ifdef __cplusplus \n" s +=" } \n" @@ -877,6 +888,12 @@ def publish_ext(bld): +def test (bld): + r=commands.getstatusoutput("git log --pretty=format:'%H' -n 1") + if r[0]==0: + print r[1] + + diff --git a/linux_dpdk/wscript b/linux_dpdk/wscript index be048bd8..459e2201 100755 --- a/linux_dpdk/wscript +++ b/linux_dpdk/wscript @@ -45,6 +45,9 @@ def publish_web(bld): def sync(bld): ws_main.sync(bld) +def test(bld): + ws_main.test(bld) + |