osdev_create_version_include.sh
17.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
#!/bin/bash
# Set this to y to turn on debugging in this script.
#DEBUG=y
###############################################
# _test_config_var
# pass in
# $1 - config variable to check
# $2 - Current parse state, 0 = OK, 1 = Failed
# return parse state on absence or presence of $1.
function _test_config_var () {
local CONFIG_VAR="${1}"
local CONFIG_ERR=${2}
# debug test
if [[ ! -z "${DEBUG}" ]] ; then
echo "+=+ ${CONFIG_ERR} - Checking ${CONFIG_VAR}"
fi
# perform test
if [[ -z $(eval "echo \"\$${CONFIG_VAR}\"") ]] ; then
CONFIG_ERR=1
fi
return ${CONFIG_ERR}
}
# Directory of this script, hence the directory of the hsoa_create_version_include repository
OSDEV_GIT_DIR="$(cd $(dirname ${0}); pwd)"
# What language to generate for
OSDEV_VERSION_TYPE="C++"
# Where the component/product git repository is, default to where this script is.
OSDEV_PRODUCT_SRC_DIR="${OSDEV_PRODUCT_SRC_DIR:=$1}"
# configuration file directory (default to current environment)
OSDEV_CONFIG_DIR="${OSDEV_CONFIG_DIR:=${OSDEV_PRODUCT_SRC_DIR}/osdev_config}"
# path to customer configuration file
OSDEV_VERSION_CUSTOMER_CONFIG="${OSDEV_VERSION_CUSTOMER_CONFIG:=${OSDEV_GIT_DIR}/osdev_config/customer_config.txt}"
# Architecture version filename
OSDEV_VERSION_OSDEV_CONFIG="${OSDEV_VERSION_OSDEV_CONFIG:=${OSDEV_GIT_DIR}/osdev_config/osdev_config.txt}"
# product configuration filename
OSDEV_VERSION_PRODUCT_CONFIG="${OSDEV_VERSION_PRODUCT_CONFIG:=${OSDEV_CONFIG_DIR}/product_config.txt}"
# output header directory (default to environment)
OSDEV_VERSION_HEADER_DIR="${OSDEV_VERSION_HEADER_DIR:=$2}"
# filename to create
OSDEV_VERSION_FILE_PREFIX=${OSDEV_VERSION_HEADER_DIR}/osdev_version
if [[ ! -z "${DEBUG}" ]] ; then
echo "OSDEV_GIT_DIR=${OSDEV_GIT_DIR}"
echo "OSDEV_CONFIG_DIR=${OSDEV_CONFIG_DIR}"
echo "OSDEV_PRODUCT_SRC_DIR=${OSDEV_PRODUCT_SRC_DIR}"
echo "OSDEV_VERSION_CUSTOMER_CONFIG=${OSDEV_VERSION_CUSTOMER_CONFIG}"
echo "OSDEV_VERSION_PRODUCT_CONFIG=${OSDEV_VERSION_PRODUCT_CONFIG}"
echo "OSDEV_VERSION_OSDEV_CONFIG=${OSDEV_VERSION_OSDEV_CONFIG}"
echo "OSDEV_VERSION_HEADER_DIR=${OSDEV_VERSION_HEADER_DIR}"
echo "OSDEV_VERSION_FILE_PREFIX=${OSDEV_VERSION_FILE_PREFIX}"
fi
# find local C compiler to test header file
if [[ -z "${CC}" ]] ; then
CC="$(which cc)"
fi
# no error found yet
CONFIG_ERR=0
# check osdev_config.txt for architecture configuration
if [[ ! -e ${OSDEV_VERSION_OSDEV_CONFIG} ]] ; then
CONFIG_ERR=1
else
if [[ ! -z "${DEBUG}" ]] ; then
echo "+=+ Debug - parse for ${OSDEV_VERSION_OSDEV_CONFIG}"
fi
source ${OSDEV_VERSION_OSDEV_CONFIG}
CONFIG_ERR= _test_config_var "OSDEV_IDENTIFIER" "${CONFIG_ERR}"
CONFIG_ERR= _test_config_var "OSDEV_RELEASE_NAME" "${CONFIG_ERR}"
fi
if [[ 0 -ne ${CONFIG_ERR} ]] ; then
echo "-- FATAL: osdev_config.txt ${OSDEV_VERSION_OSDEV_CONFIG} does not exist or is corrupt"
exit 1
else
echo "++ osdev_hsoa:${OSDEV_RELEASE_NAME}_${OSDEV_IDENTIFIER}"
fi
# check for a product configuration
if [[ ! -e ${OSDEV_VERSION_PRODUCT_CONFIG} ]] ; then
CONFIG_ERR=1
else
if [[ ! -z "${DEBUG}" ]] ; then
echo "+=+ Debug - parse for ${OSDEV_VERSION_PRODUCT_CONFIG}"
fi
source ${OSDEV_VERSION_PRODUCT_CONFIG}
# check required parameters are there
CONFIG_ERR= _test_config_var "PRODUCT_RELEASE_NAME" "${CONFIG_ERR}"
CONFIG_ERR= _test_config_var "PRODUCT_MANUFACTURER_CODE" "${CONFIG_ERR}"
fi
if [[ 0 -ne ${CONFIG_ERR} ]] ; then
echo "-- FATAL: product_config.txt ${OSDEV_VERSION_PRODUCT_CONFIG} does not exist or is corrupt"
exit 1
else
echo "++ product:${PRODUCT_MANUFACTURER_CODE}-${PRODUCT_RELEASE_NAME}"
fi
CUSTOMER_ID=""
if [[ ! -e ${OSDEV_VERSION_CUSTOMER_CONFIG} ]] ; then
CONFIG_ERR=1
else
if [[ ! -z "${DEBUG}" ]] ; then
echo "+=+ Debug - parse for ${OSDEV_VERSION_CUSTOMER_CONFIG}"
fi
source ${OSDEV_VERSION_CUSTOMER_CONFIG}
# check required parameters are there
CONFIG_ERR= _test_config_var "CUSTOMER_NAME" "${CONFIG_ERR}"
CONFIG_ERR= _test_config_var "CUSTOMER_NUMBER" "${CONFIG_ERR}"
CONFIG_ERR= _test_config_var "CUSTOMER_VERSION" "${CONFIG_ERR}"
# do not put customer name in here, because when a plant is sold a name can be changed but
# customer number and version will not change, they are linked to the location
# CUSTOMER_ID="${CUSTOMER_NUMBER}.${CUSTOMER_VERSION}_${CUSTOMER_NAME}"
CUSTOMER_ID="${CUSTOMER_NUMBER}.${CUSTOMER_VERSION}"
fi
if [[ 0 -ne ${CONFIG_ERR} ]] ; then
echo "-- FATAL: customer_config.txt ${OSDEV_VERSION_CUSTOMER_CONFIG} does not exist or is corrupt"
exit 1
else
echo "++ customer: ${CUSTOMER_ID}"
fi
VER_BUILD_ID_LONG_SHA="$(cd ${OSDEV_PRODUCT_SRC_DIR}; git rev-list HEAD | sed -e 's/\(.*\)/\1/;q;d')"
VER_BUILD_ID_SHORT_SHA="$(cd ${OSDEV_PRODUCT_SRC_DIR}; git rev-list HEAD | sed -e 's/\(........\).*/\1/;q;d')"
VER_BUILD_BRANCH="$(cd ${OSDEV_PRODUCT_SRC_DIR}; git name-rev --name-only HEAD)"
VER_BUILD_DATE="$(cd ${OSDEV_PRODUCT_SRC_DIR}; date +'%Y.%m.%d')"
VER_BUILD_DATETIME="$(cd ${OSDEV_PRODUCT_SRC_DIR}; date +'%Y.%m.%d.%T')"
VER_BUILD_TAG="$(cd ${OSDEV_PRODUCT_SRC_DIR}; git describe --abbrev=0 --tags)"
VER_BUILD_HOST="$(hostname -s)"
# in case version of McGraw+yocto is not defined set it to 1.0
if [ -z "$OSDEV_DISTRO_VERSION" ]; then
OSDEV_DISTRO_VERSION="1.0"
fi
# split out tag information
IFS='.' read -ra VER_BUILD_VERSION <<< "$VER_BUILD_TAG"
VER_BUILD_MAJOR="${VER_BUILD_VERSION[0]}"
VER_BUILD_MINOR="${VER_BUILD_VERSION[1]}"
VER_BUILD_PATCH="${VER_BUILD_VERSION[2]}"
VER_BUILD_LETTER="${VER_BUILD_VERSION[3]}"
VER_BUILD_RELEASENR="1"
# set some defaults if git tag information is not available.
if [ -z "$VER_BUILD_MAJOR" ] ; then
VER_BUILD_MAJOR="0"
fi
if [ -z "$VER_BUILD_MINOR" ] ; then
VER_BUILD_MINOR="0"
fi
if [ -z "$VER_BUILD_PATCH" ] ; then
VER_BUILD_PATCH="0"
fi
if [ -z "$VER_BUILD_LETTER" ] ; then
# must be X,T,H,F,S or R,
VER_BUILD_LETTER="X"
fi
# short version number
PRODUCT_RELEASE_SHORT_VERSION="${VER_BUILD_MAJOR}.${VER_BUILD_MINOR}"
# full version number
PRODUCT_RELEASE_VERSION="${VER_BUILD_MAJOR}.${VER_BUILD_MINOR}.${VER_BUILD_PATCH}.${VER_BUILD_LETTER}"
# full product version for product support, version number template:
PRODUCT_FULL_VERSION="${OSDEV_RELEASE_NAME}_${OSDEV_IDENTIFIER}_${PRODUCT_MANUFACTURER_CODE}-${PRODUCT_RELEASE_NAME}_${PRODUCT_RELEASE_VERSION}_${CUSTOMER_ID}_${VER_BUILD_ID_SHORT_SHA}_${VER_BUILD_DATETIME}"
# Replace spaces in customer name
CUSTOMER_NAME_STR=$(echo "${CUSTOMER_NAME}" | tr ' ' '_')
# Customer Configuration SHA
CUSTOMER_BUILD_FLAGS=$(echo $OSDEV_IMAGE_CONFIG_GITSHA)
VER_BUILD_EMBED_SHA=":git:${VER_BUILD_BRANCH}:${VER_BUILD_TAG}:${VER_BUILD_HOST}:${VER_BUILD_ID_LONG_SHA}:${PRODUCT_FULL_VERSION}:${PRODUCT_BUILD_FLAGS}:${CUSTOMER_BUILD_FLAGS}:tig:"
# echo extended version information to log/console
while read -r ECHO_LINE
do
echo "${ECHO_LINE}"
done <<EOFOUT
-------------------------
${VER_BUILD_EMBED_SHA}
-------------------------
EOFOUT
# ensure include directory exists
mkdir -p ${OSDEV_VERSION_HEADER_DIR}
# generate a hsoa_version for cmake
while read -r ECHO_CMAKEFILE
do
echo "${ECHO_CMAKEFILE}"
done <<EOF > ${OSDEV_VERSION_FILE_PREFIX}.cmake
# DO NOT EDIT THIS FILE!
# this file is auto-generated by create_version_include. The script that
# implements the "HSOA Component Lifecycle Management v1.x"
# component versioning standard.
# Set in parent scope because of add_subdirectory in hsoaversion.cmake.
set( OSDEV_VERSION_INCLUDE_DIR "${OSDEV_VERSION_HEADER_DIR}" PARENT_SCOPE )
set( OSDEV_VERSION_SRC_FILE "${OSDEV_VERSION_FILE_PREFIX}.cpp" PARENT_SCOPE )
set( CURRENT_PROJECT_MANUFACTURER_CODE "${PRODUCT_MANUFACTURER_CODE}" PARENT_SCOPE )
set( CURRENT_PROJECT_VERSION_MAJOR "${VER_BUILD_MAJOR}" PARENT_SCOPE )
set( CURRENT_PROJECT_VERSION_MINOR "${VER_BUILD_MINOR}" PARENT_SCOPE )
set( CURRENT_PROJECT_VERSION_PATCH "${VER_BUILD_PATCH}" PARENT_SCOPE )
set( CURRENT_PROJECT_VERSION_LETTER "${VER_BUILD_LETTER}" PARENT_SCOPE )
set( CURRENT_PROJECT_VERSION_RELEASENR "${VER_BUILD_RELEASENR}" PARENT_SCOPE )
set( CURRENT_PROJECT_VERSION "${VER_BUILD_MAJOR}.${VER_BUILD_MINOR}.${VER_BUILD_PATCH}" PARENT_SCOPE )
EOF
if [[ ! -z "${DEBUG}" ]] ; then
cat ${OSDEV_VERSION_FILE_PREFIX}.cmake
fi
# generate a hsoa_version header file for c/c++
while read -r ECHO_HFILE
do
echo "${ECHO_HFILE}"
done <<EOF > ${OSDEV_VERSION_FILE_PREFIX}.h
/*
DO NOT EDIT THIS FILE!
this file is auto-generated by create_version_include. The script that
implements the "HSOA Component Lifecycle Management v1.x"
component versioning standard.
*/
#ifndef OSDEV_VERSION_DEFINES_H_
#define OSDEV_VERSION_DEFINES_H_
namespace mlogic {
namespace hsoaversion {
namespace PRODUCT_${PRODUCT_RELEASE_NAME} {
#if !defined(OSDEV_GNUC_USED) && (defined(__GNUC__) && !defined(__clang__))
#define OSDEV_GNUC_USED [[gnu::used]]
#else
#define OSDEV_GNUC_USED
#endif
struct HsoaVersionInfo
{
/* mlogic specific information */
OSDEV_GNUC_USED static const char* VER_OSDEV_RELEASE_NAME_;
OSDEV_GNUC_USED static const char* VER_OSDEV_IDENTIFIER_;
/* customer specific information */
OSDEV_GNUC_USED static const char* VER_CUSTOMER_NAME_;
OSDEV_GNUC_USED static const char* VER_CUSTOMER_NUMBER_;
OSDEV_GNUC_USED static const char* VER_CUSTOMER_OSDEV_VERSION_;
OSDEV_GNUC_USED static const char* VER_CUSTOMER_ID_;
/* product specific information */
OSDEV_GNUC_USED static const char* VER_PRODUCT_RELEASE_NAME_;
OSDEV_GNUC_USED static const char* VER_PRODUCT_RELEASE_VSHORT_;
OSDEV_GNUC_USED static const char* VER_PRODUCT_RELEASE_VFULL_;
OSDEV_GNUC_USED static const char* VER_PRODUCT_OSDEV_VERSION_;
OSDEV_GNUC_USED static const char* VER_PRODUCT_MANUFACTURER_CODE_;
OSDEV_GNUC_USED static const char* VER_PRODUCT_MANUFACTURER_URL_;
/* version major, minor, sub and letter. */
OSDEV_GNUC_USED static const char* VER_BUILD_MAJOR_;
OSDEV_GNUC_USED static const char* VER_BUILD_MINOR_;
OSDEV_GNUC_USED static const char* VER_BUILD_PATCH_;
OSDEV_GNUC_USED static const char* VER_BUILD_RELEASENR_;
OSDEV_GNUC_USED static const char* VER_BUILD_LETTER_;
/* Git build specific information to embed into the program */
OSDEV_GNUC_USED static const char* VER_BUILD_ID_SHORT_SHA_;
OSDEV_GNUC_USED static const char* VER_BUILD_ID_LONG_SHA_;
OSDEV_GNUC_USED static const char* VER_BUILD_DATE_;
OSDEV_GNUC_USED static const char* VER_BUILD_DATETIME_;
OSDEV_GNUC_USED static const char* VER_BUILD_EMBED_SHA_;
OSDEV_GNUC_USED static const char* VER_BUILD_CUSTOMER_FLAGS_;
OSDEV_GNUC_USED static const char* VER_BUILD_PRODUCT_FLAGS_;
};
} // namespace PRODUCT_...
} // namespace hsoaversion
} // namespace mlogic
#endif /* OSDEV_VERSION_DEFINES_H_ */
EOF
if [[ ! -z "${DEBUG}" ]] ; then
cat ${OSDEV_VERSION_FILE_PREFIX}.h
fi
# generate a hsoa_version source file for c/c++
while read -r ECHO_CPPFILE
do
echo "${ECHO_CPPFILE}"
done <<EOF > ${OSDEV_VERSION_FILE_PREFIX}.cpp
/*
DO NOT EDIT THIS FILE!
this file is auto-generated by create_version_include. The script that
implements the "HSOA Component Lifecycle Management v1.x"
component versioning standard.
*/
#include "hsoa_version.h"
using namespace mlogic::hsoaversion::PRODUCT_${PRODUCT_RELEASE_NAME};
/* mlogic specific information */
OSDEV_GNUC_USED const char* HsoaVersionInfo::VER_OSDEV_RELEASE_NAME_= "${OSDEV_RELEASE_NAME}";
OSDEV_GNUC_USED const char* HsoaVersionInfo::VER_OSDEV_IDENTIFIER_ = "${OSDEV_IDENTIFIER}";
/* customer specific information */
OSDEV_GNUC_USED const char* HsoaVersionInfo::VER_CUSTOMER_NAME_ = "${CUSTOMER_NAME_STR}";
OSDEV_GNUC_USED const char* HsoaVersionInfo::VER_CUSTOMER_NUMBER_ = "${CUSTOMER_NUMBER}";
OSDEV_GNUC_USED const char* HsoaVersionInfo::VER_CUSTOMER_OSDEV_VERSION_= "${CUSTOMER_VERSION}";
OSDEV_GNUC_USED const char* HsoaVersionInfo::VER_CUSTOMER_ID_ = "${CUSTOMER_ID}";
/* product specific information */
OSDEV_GNUC_USED const char* HsoaVersionInfo::VER_PRODUCT_RELEASE_NAME_ = "${PRODUCT_RELEASE_NAME}";
OSDEV_GNUC_USED const char* HsoaVersionInfo::VER_PRODUCT_RELEASE_VSHORT_= "${PRODUCT_RELEASE_SHORT_VERSION}";
OSDEV_GNUC_USED const char* HsoaVersionInfo::VER_PRODUCT_RELEASE_VFULL_ = "${PRODUCT_RELEASE_VERSION}";
OSDEV_GNUC_USED const char* HsoaVersionInfo::VER_PRODUCT_OSDEV_VERSION_ = "${PRODUCT_FULL_VERSION}";
OSDEV_GNUC_USED const char* HsoaVersionInfo::VER_PRODUCT_MANUFACTURER_CODE_ = "${PRODUCT_MANUFACTURER_CODE}";
OSDEV_GNUC_USED const char* HsoaVersionInfo::VER_PRODUCT_MANUFACTURER_URL_ = "${PRODUCT_MANUFACTURER_URL}";
/* version major, minor, sub and letter. */
OSDEV_GNUC_USED const char* HsoaVersionInfo::VER_BUILD_MAJOR_ = "${VER_BUILD_MAJOR}";
OSDEV_GNUC_USED const char* HsoaVersionInfo::VER_BUILD_MINOR_ = "${VER_BUILD_MINOR}";
OSDEV_GNUC_USED const char* HsoaVersionInfo::VER_BUILD_PATCH_ = "${VER_BUILD_PATCH}";
OSDEV_GNUC_USED const char* HsoaVersionInfo::VER_BUILD_RELEASENR_ = "${VER_BUILD_RELEASENR}";
OSDEV_GNUC_USED const char* HsoaVersionInfo::VER_BUILD_LETTER_ = "${VER_BUILD_LETTER}";
/* Git build specific information to embed into the program */
OSDEV_GNUC_USED const char* HsoaVersionInfo::VER_BUILD_ID_SHORT_SHA_ = "${VER_BUILD_ID_SHORT_SHA}";
OSDEV_GNUC_USED const char* HsoaVersionInfo::VER_BUILD_ID_LONG_SHA_ = "${VER_BUILD_ID_LONG_SHA}";
OSDEV_GNUC_USED const char* HsoaVersionInfo::VER_BUILD_DATE_ = "${VER_BUILD_DATE}";
OSDEV_GNUC_USED const char* HsoaVersionInfo::VER_BUILD_DATETIME_ = "${VER_BUILD_DATETIME}";
OSDEV_GNUC_USED const char* HsoaVersionInfo::VER_BUILD_EMBED_SHA_ = "${VER_BUILD_EMBED_SHA}";
OSDEV_GNUC_USED const char* HsoaVersionInfo::VER_BUILD_CUSTOMER_FLAGS_= "${CUSTOMER_BUILD_FLAGS}";
OSDEV_GNUC_USED const char* HsoaVersionInfo::VER_BUILD_PRODUCT_FLAGS_ = "${PRODUCT_BUILD_FLAGS}";
EOF
if [[ ! -z "${DEBUG}" ]] ; then
cat ${OSDEV_VERSION_FILE_PREFIX}.h
fi
# generate a hsoa_version for python
while read -r ECHO_HFILE
do
echo "${ECHO_HFILE}"
done <<EOF > ${OSDEV_VERSION_FILE_PREFIX}.py
#
# DO NOT EDIT THIS FILE!
#
# this file is auto-generated by create_version_include. The script that
# implements the "HSOA Component Lifecycle Management v1.x"
# component versioning standard.
#
#
# mlogic specific information
VER_OSDEV_RELEASE_NAME_ = "${OSDEV_RELEASE_NAME}"
VER_OSDEV_IDENTIFIER_ = "${OSDEV_IDENTIFIER}"
# customer specific information
VER_CUSTOMER_NAME_ = "${CUSTOMER_NAME_STR}"
VER_CUSTOMER_NUMBER_ = "${CUSTOMER_NUMBER}"
VER_CUSTOMER_OSDEV_VERSION_ = "${CUSTOMER_VERSION}"
VER_CUSTOMER_ID_ = "${CUSTOMER_ID}"
# product specific information
VER_PRODUCT_RELEASE_NAME_ = "${PRODUCT_RELEASE_NAME}"
VER_PRODUCT_RELEASE_VSHORT_ = "${PRODUCT_RELEASE_SHORT_VERSION}"
VER_PRODUCT_RELEASE_VFULL_ = "${PRODUCT_RELEASE_VERSION}"
VER_PRODUCT_OSDEV_VERSION_ = "${PRODUCT_FULL_VERSION}"
VER_PRODUCT_MANUFACTURER_CODE_ = "${PRODUCT_MANUFACTURER_CODE}"
# version major, minor, sub and letter.
VER_BUILD_MAJOR_ = "${VER_BUILD_MAJOR}"
VER_BUILD_MINOR_ = "${VER_BUILD_MINOR}"
VER_BUILD_PATCH_ = "${VER_BUILD_PATCH}"
VER_BUILD_LETTER_ = "${VER_BUILD_LETTER}"
# Git build specific information to embed into the program
VER_BUILD_ID_SHORT_SHA_ = "${VER_BUILD_ID_SHORT_SHA}"
VER_BUILD_ID_LONG_SHA_ = "${VER_BUILD_ID_LONG_SHA}"
VER_BUILD_DATE_ = "${VER_BUILD_DATE}"
VER_BUILD_DATETIME_ = "${VER_BUILD_DATETIME}"
VER_BUILD_EMBED_SHA_ = "${VER_BUILD_EMBED_SHA}"
VER_BUILD_CUSTOMER_FLAGS_ = "${CUSTOMER_BUILD_FLAGS}"
VER_BUILD_PRODUCT_FLAGS_ = "${PRODUCT_BUILD_FLAGS}"
EOF
if [[ ! -z "${DEBUG}" ]] ; then
cat ${OSDEV_VERSION_FILE_PREFIX}.py
fi
# test python output
if [[ ! -z "$(which pylint)" ]] ; then
echo "++ testing ${OSDEV_VERSION_FILE_PREFIX}.py"
pylint -E ${OSDEV_VERSION_FILE_PREFIX}.py
else
echo "++ pylint not available to test ${OSDEV_VERSION_FILE_PREFIX}.py"
fi
# generate a hsoa_version for JavaScript
while read -r ECHO_HFILE
do
echo "${ECHO_HFILE}"
done <<EOF > ${OSDEV_VERSION_FILE_PREFIX}.js
/*
DO NOT EDIT THIS FILE!
this file is auto-generated by create_version_include. The script that
implements the "HSOA Component Lifecycle Management v1.x"
component versioning standard.
*/
/* mlogic specific information */
const VER_OSDEV_RELEASE_NAME_ = "${OSDEV_RELEASE_NAME}"
const VER_OSDEV_IDENTIFIER_ = "${OSDEV_IDENTIFIER}"
/* customer specific information */
const VER_CUSTOMER_NAME_ = "${CUSTOMER_NAME_STR}"
const VER_CUSTOMER_NUMBER_ = "${CUSTOMER_NUMBER}"
const VER_CUSTOMER_OSDEV_VERSION_ = "${CUSTOMER_VERSION}"
const VER_CUSTOMER_ID_ = "${CUSTOMER_ID}"
/* product specific information */
const VER_PRODUCT_RELEASE_NAME_ = "${PRODUCT_RELEASE_NAME}"
const VER_PRODUCT_RELEASE_VSHORT_ = "${PRODUCT_RELEASE_SHORT_VERSION}"
const VER_PRODUCT_RELEASE_VFULL_ = "${PRODUCT_RELEASE_VERSION}"
const VER_PRODUCT_OSDEV_VERSION_ = "${PRODUCT_FULL_VERSION}"
const VER_PRODUCT_MANUFACTURER_CODE_ = "${PRODUCT_MANUFACTURER_CODE}"
/* version major, minor, sub and letter. */
const VER_BUILD_MAJOR_ = "${VER_BUILD_MAJOR}"
const VER_BUILD_MINOR_ = "${VER_BUILD_MINOR}"
const VER_BUILD_PATCH_ = "${VER_BUILD_PATCH}"
const VER_BUILD_LETTER_ = "${VER_BUILD_LETTER}"
/* Git build specific information to embed into the program */
const VER_BUILD_ID_SHORT_SHA_ = "${VER_BUILD_ID_SHORT_SHA}"
const VER_BUILD_ID_LONG_SHA_ = "${VER_BUILD_ID_LONG_SHA}"
const VER_BUILD_DATE_ = "${VER_BUILD_DATE}"
const VER_BUILD_DATETIME_ = "${VER_BUILD_DATETIME}"
const VER_BUILD_EMBED_SHA_ = "${VER_BUILD_EMBED_SHA}"
const VER_BUILD_CUSTOMER_FLAGS_ = "${CUSTOMER_BUILD_FLAGS}"
const VER_BUILD_PRODUCT_FLAGS_ = "${PRODUCT_BUILD_FLAGS}"
EOF
if [[ ! -z "${DEBUG}" ]] ; then
cat ${OSDEV_VERSION_FILE_PREFIX}.js
fi
# test JavaScript output with node
if [[ ! -z "$(which node)" ]] ; then
echo "++ testing ${OSDEV_VERSION_FILE_PREFIX}.js"
node ${OSDEV_VERSION_FILE_PREFIX}.js
else
echo "++ node not available to test ${OSDEV_VERSION_FILE_PREFIX}.js"
fi