donate-cpu: Show cppcheck head git hash and commit time (#2096)

This adds one line in the package report to show the git hash and commit
date. This makes it possible to see exactely which revision the result
was obtained with.

The cppcheck head info line is now shown as

	head-info: 1a25d3f9e (2019-08-30 18:34:14 +0200)
This commit is contained in:
Rikard Falkeborn 2019-09-05 09:08:45 +02:00 committed by Sebastian
parent 04295802f9
commit 02fd1ac7f7
1 changed files with 12 additions and 1 deletions

View File

@ -40,7 +40,7 @@ import platform
# Version scheme (MAJOR.MINOR.PATCH) should orientate on "Semantic Versioning" https://semver.org/
# Every change in this script should result in increasing the version number accordingly (exceptions may be cosmetic
# changes)
CLIENT_VERSION = "1.1.32"
CLIENT_VERSION = "1.1.33"
def check_requirements():
@ -87,6 +87,14 @@ def get_cppcheck(cppcheck_path, work_path):
return False
def get_cppcheck_info(cppcheck_path):
try:
os.chdir(cppcheck_path)
return subprocess.check_output(['git', 'show', "--pretty=%h (%ci)", 'HEAD', '--no-patch', '--no-notes']).decode('utf-8').strip()
except:
return ''
def compile_version(work_path, jobs, version):
if os.path.isfile(work_path + '/' + version + '/cppcheck'):
return True
@ -578,9 +586,11 @@ while True:
results_to_diff = []
cppcheck_options = ''
head_info_msg = ''
cppcheck_head_info = '';
for ver in cppcheck_versions:
if ver == 'head':
current_cppcheck_dir = 'cppcheck'
cppcheck_head_info = get_cppcheck_info(work_path + '/cppcheck')
else:
current_cppcheck_dir = ver
c, errout, info, t, cppcheck_options = scan_package(work_path, current_cppcheck_dir, jobs)
@ -603,6 +613,7 @@ while True:
output += 'python: ' + platform.python_version() + '\n'
output += 'client-version: ' + CLIENT_VERSION + '\n'
output += 'cppcheck: ' + ' '.join(cppcheck_versions) + '\n'
output += 'head-info: ' + cppcheck_head_info + '\n'
output += 'count:' + count + '\n'
output += 'elapsed-time:' + elapsed_time + '\n'
info_output = output