Commit c4ba3bd6510434b15b54134a513b618432e09c5a
0 parents
Added versioning
Showing
7 changed files
with
826 additions
and
0 deletions
CMakeLists.txt
0 → 100644
1 | +++ a/CMakeLists.txt | ||
1 | +# -*- mode:cmake -*- | ||
2 | +# Project to make a simple OSDEV versioned binary | ||
3 | +cmake_minimum_required(VERSION 3.0) | ||
4 | +project(osdevversion) | ||
5 | + | ||
6 | +# get the directory containing this cmake script. | ||
7 | +set( OSDEV_CURRENT_CMAKE_DIR ${CMAKE_CURRENT_LIST_DIR} ) | ||
8 | + | ||
9 | +# find python | ||
10 | +find_package(PythonInterp REQUIRED) | ||
11 | +if(NOT PYTHONINTERP_FOUND) | ||
12 | + message(FATAL_ERROR "-- Python interpreter not found.") | ||
13 | +endif() | ||
14 | + | ||
15 | +# build option to test OSDEV Version generation | ||
16 | +option(OPTION_BUILD_TESTS "Build Caelus Version tests ." OFF) | ||
17 | + | ||
18 | +# check environment for locations of configurations if not default. | ||
19 | +if(NOT OSDEV_PRODUCT_SRC_DIR) | ||
20 | + message(FATAL_ERROR "-- ${OSDEV_PRODUCT_SRC_DIR} is not specified.") | ||
21 | +endif() | ||
22 | + | ||
23 | +# set OSDEV_CURRENT_CMAKE_DIR to point to product configuration folder | ||
24 | +set(OSDEV_CONFIG_DIR ${OSDEV_CURRENT_CMAKE_DIR}/osdev_config/) | ||
25 | + | ||
26 | +# Check HSOA Version DIR not overridden by existing environment path | ||
27 | +if(EXISTS $ENV{OSDEV_CONFIG_DIR}) | ||
28 | + set(OSDEV_CONFIG_DIR $ENV{OSDEV_CONFIG_DIR}) | ||
29 | +endif() | ||
30 | + | ||
31 | +if(EXISTS ${OSDEV_CONFIG_DIR}) | ||
32 | + message(STATUS "++ OSDEV_CONFIG_DIR=${OSDEV_CONFIG_DIR}") | ||
33 | +else() | ||
34 | + message(FATAL_ERROR "-- ${OSDEV_CONFIG_DIR} does not exist") | ||
35 | +endif() | ||
36 | + | ||
37 | +# check for product configuration in environment, otherwise set to default | ||
38 | +if(ENV{OSDEV_VERSION_PRODUCT_CONFIG}) | ||
39 | + set(OSDEV_VERSION_PRODUCT_CONFIG $ENV{OSDEV_VERSION_PRODUCT_CONFIG}) | ||
40 | +elseif(OSDEV_VERSION_PRODUCT_CONFIG) | ||
41 | + set(ENV{OSDEV_VERSION_PRODUCT_CONFIG} ${OSDEV_VERSION_PRODUCT_CONFIG}) | ||
42 | +else() | ||
43 | + set(ENV{OSDEV_VERSION_PRODUCT_CONFIG} ${OSDEV_CONFIG_DIR}/product_config.txt) | ||
44 | + set(OSDEV_VERSION_PRODUCT_CONFIG $ENV{OSDEV_VERSION_PRODUCT_CONFIG}) | ||
45 | +endif() | ||
46 | + | ||
47 | +# check product configuration file exists. | ||
48 | +if(EXISTS ${OSDEV_VERSION_PRODUCT_CONFIG}) | ||
49 | + message(STATUS "++ OSDEV_VERSION_PRODUCT_CONFIG=${OSDEV_VERSION_PRODUCT_CONFIG}") | ||
50 | +else() | ||
51 | + message(FATAL_ERROR "-- ${OSDEV_VERSION_PRODUCT_CONFIG} does not exist") | ||
52 | +endif() | ||
53 | + | ||
54 | +# set default target paths for header file | ||
55 | +set(OSDEV_VERSION_SRC_DIR ${CMAKE_CURRENT_BINARY_DIR}/osdev_version/) | ||
56 | +set(OSDEV_VERSION_HEADER_DIR ${CMAKE_CURRENT_BINARY_DIR}/osdev_version/) | ||
57 | +set(OSDEV_VERSION_GENSCRIPT ${OSDEV_CURRENT_CMAKE_DIR}/osdev_create_version_include.sh) | ||
58 | + | ||
59 | +if(NOT EXISTS ${OSDEV_VERSION_HEADER_FILE}) | ||
60 | + message(STATUS "Creating dir ${OSDEV_VERSION_HEADER_DIR}") | ||
61 | + FILE(MAKE_DIRECTORY ${OSDEV_VERSION_HEADER_DIR}) | ||
62 | + EXECUTE_PROCESS( | ||
63 | + COMMAND ${VERSION_GENSCRIPT} ${OSDEV_VERSION_CUSTOMER} ${OSDEV_VERSION_HEADER_DIR} | ||
64 | + WORKING_DIRECORY ${OSDEV_PRODUCT_SRC_DIR} | ||
65 | + COMMENT "First run of version header generator") | ||
66 | +endif() | ||
67 | + | ||
68 | +execute_process( | ||
69 | + COMMAND ${OSDEV_VERSION_GENSCRIPT} ${OSDEV_PRODUCT_SRC_DIR} ${OSDEV_VERSION_HEADER_DIR} | ||
70 | + WORKING_DIRECORY ${OSDEV_PRODUCT_SRC_DIR} | ||
71 | +) | ||
72 | + | ||
73 | +include( ${OSDEV_VERSION_HEADER_DIR}/osdev_version.cmake ) | ||
74 | + | ||
75 | +set(OSDEV_VERSION_INCLUDE_DIR ${OSDEV_VERSION_HEADER_DIR} CACHE STRING "osdev version include dir" FORCE) | ||
76 | +set(OSDEV_VERSION_SRC_FILE ${OSDEV_VERSION_HEADER_DIR}/osdev_version.cpp CACHE STRING "osdev version src file" FORCE) |
README.org
0 → 100644
1 | +++ a/README.org | ||
1 | +# -*- mode: org; mode:auto-revert; -*- | ||
2 | +* OSDEV Versioning Tool | ||
3 | + | ||
4 | +This tool will create the OSDEV version information to embed into the | ||
5 | +mLogic products, based on the "OSDEV Component Lifecycle Management v1.x" | ||
6 | +specifications | ||
7 | + | ||
8 | +The core of this approach is based on the DMX versioning tool for | ||
9 | +C/C++. The script osdev_create_version_include.sh uses environmental | ||
10 | +variables such as OSDEV_SRC_DIR to point to the git repository tree | ||
11 | +and configuration files for the component to be versioned. | ||
12 | + | ||
13 | +There has to be three valid configuration files supplied to the tool to | ||
14 | +create a valid component version. | ||
15 | + | ||
16 | +- mlogic_config.txt | ||
17 | + Managed in this repository. This defines the Architecture and Mlogic | ||
18 | + release information | ||
19 | + | ||
20 | +- product_config.txt | ||
21 | + Managed in the component repository. This defines the | ||
22 | + product/component specific information | ||
23 | + | ||
24 | +- customer_config.txt | ||
25 | + Manage in the build environment. This (if available) defines the | ||
26 | + customer specific information for the component. | ||
27 | + | ||
28 | +See the example configuration files in the osdev_config directory for | ||
29 | +more information on the contents. | ||
30 | + | ||
31 | +* General Usage | ||
32 | + This repository should be added as a submodule, or similar to the main | ||
33 | + repository. | ||
34 | + | ||
35 | + Where possible the script defaults to using the configuration files | ||
36 | + found in the ${OSDEV_SRC_DIR}/osdev_config folder. | ||
37 | + | ||
38 | +| Variable | Default if undefined in environment | Description | | ||
39 | +|-----------------------+----------------------------------------+------------------------------------------------| | ||
40 | +| OSDEV_SRC_DIR | Arg 1 (No Default) | path to component git repository root | | ||
41 | +| OSDEV_VERSION_HDR_DIR | Arg 2 (No Default) | output directory for osdev_version file | | ||
42 | +| OSDEV_CONFIG_DIR | ${OSDEV_SRC_DIR}/osdev_config | path to component configuration file directory | | ||
43 | +| OSDEV_VERSION_PRODUCT | ${OSDEV_CONFIG_DIR}/product_config.txt | product configuration filename | | ||
44 | +| OSDEV_VERSION_CUSTOMER | ${OSDEV_CONFIG_DIR}/customer_config.txt | path to customer configuration file | | ||
45 | + | ||
46 | +- For debugging purposes only: | ||
47 | +| OSDEV_GIT_DIR | Directory where script exists (pwd) | path to this git repository | | ||
48 | +| OSDEV_VERSION_MLOGIC | ${OSDEV_GIT_DIR}/osdev_config/mlogic_config.txt | Architecture version filename | | ||
49 | + | ||
50 | +Note for Yocto/McGraw Environment: | ||
51 | +$OSDEV_VERSION_CUSTOMER should be set to ${MEYN_CUSTOMER_CONFIG_ROOT}/customer_config.txt | ||
52 | + | ||
53 | +The script creates an include file that contains constants that should | ||
54 | +be used to identify a component. The generated source is the best | ||
55 | +reference for the various defined elements. | ||
56 | + | ||
57 | +There are two elements that are required. They are: | ||
58 | + | ||
59 | +- _VER_OSDEV_IDENTIFIER_ | ||
60 | + The full OSDEV component identifier. Visible to the external world, via | ||
61 | + IU or service version. | ||
62 | +- _VER_BUILD_EMBED_SHA_ | ||
63 | + The full embedded build fingerprint. Visible to developers/R&D with | ||
64 | + the command "grep -e ":git:.*:tig:" <fingerprinted binary> | ||
65 | + | ||
66 | +* Defining the Product Identifier | ||
67 | + This tool uses the folder osdev_version in the root of the git | ||
68 | + repository to contain the default product and customer | ||
69 | + identifiers. | ||
70 | + | ||
71 | + To start using this tool you must: | ||
72 | + - copy the osdev_version folder from this repository to the root of the | ||
73 | + product git repository. | ||
74 | + | ||
75 | + - remove the example mlogic_config.txt from the copied folder | ||
76 | + - if required - remove the example customer_config.txt from the copied folder | ||
77 | + | ||
78 | + - edit the product identification file. | ||
79 | + | ||
80 | + Once this is done, you can use the appropriate mechanism to use this | ||
81 | + tool to identify your product. | ||
82 | + | ||
83 | +* C/C++ | ||
84 | + | ||
85 | + | ||
86 | +include the "osdev_verison.h" in the source, and define < | ||
87 | +- How a build fingerprint is embedded into a binary. | ||
88 | +#+BEGIN_SRC c++ | ||
89 | +#include "osdev_version.h" | ||
90 | +/* OSDEV Component identifier define build fingerprint */ | ||
91 | +_static const char *build_id=_VER_BUILD_EMBED_SHA_ | ||
92 | +#+END_SRC | ||
93 | + | ||
94 | +*** PyUAF | ||
95 | + | ||
96 | +*** QT | ||
97 | + An example of using the Component Identifier used in QT User | ||
98 | + interfaces. | ||
99 | +#+BEGIN_SRC c++ Qt Gui | ||
100 | +#include "osdev_version.h" | ||
101 | + | ||
102 | +/* OSDEV Component identifier */ | ||
103 | +a.setProperty("VersionString", QString("%1") | ||
104 | + .arg(_VER_OSDEV_IDENTIFIER_) | ||
105 | + ); | ||
106 | + #+END_SRC | ||
107 | + | ||
108 | +*** Cmake as git submodule | ||
109 | + One mechanism to relate repositories is to use the "git submodule | ||
110 | + add" command, and add the appropriate version of the | ||
111 | + osdev_create_version_include as a submodule in the project folder. | ||
112 | + | ||
113 | + These dependencies are tightly coupled, and have to be adjusted when | ||
114 | + moving from development to release. | ||
115 | + | ||
116 | + Add it to the projects CMakeLists.txt as below, and The project should build | ||
117 | + as usual. | ||
118 | + | ||
119 | +#+BEGIN_SRC cmake | ||
120 | + | ||
121 | +# point the tool to this repository to create version from. | ||
122 | +set (ENV{OSDEV_SRC_DIR} ${CMAKE_SOURCE_DIR}) | ||
123 | + | ||
124 | +# To override default source for product or source information. | ||
125 | +# see the Cmakelists in the osdev_create_version_include folder. | ||
126 | + | ||
127 | +# Add Version control to the Cmake source tree | ||
128 | +ADD_SUBDIRECTORY(osdev_create_version_include) | ||
129 | + | ||
130 | +# add version directory to included directories | ||
131 | +INCLUDE_DIRECTORIES(${OSDEV_VERSION_HEADER_DIR}) | ||
132 | + | ||
133 | +#+END_SRC | ||
134 | +*** Cmake as external source | ||
135 | + This is another approach to managing the architecture dependency, | ||
136 | + using the external source mechanism to add the tool to the source | ||
137 | + tree as a parameter of the Cmake file, or as an environmental | ||
138 | + variable defined by the build system. | ||
139 | + | ||
140 | + copy the ExternalHsoaVersion into a local cmake include folder. if | ||
141 | + one does not exist then create it, and add this to your CMakelists.txt | ||
142 | + | ||
143 | +#+BEGIN_SRC cmake | ||
144 | +# include cmake modules | ||
145 | +LIST( APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake ) | ||
146 | +MESSAGE("CMAKE MODULE PATH:${CMAKE_MODULE_PATH}") | ||
147 | +#+END_SRC | ||
148 | + | ||
149 | + Then you need to include the External resource in your project. You | ||
150 | + can do this with the following: | ||
151 | + | ||
152 | +#+BEGIN_SRC cmake | ||
153 | + | ||
154 | +# define extra git repository Version parameters | ||
155 | +SET(OSDEV_VERSION_TAG "R1_XD1.0.0E0.0.0") | ||
156 | +SET(OSDEV_VERSION_REPO "git@gitlab.osdev.nl:OpenSystemsDevelopment/osdev_versioning.git") | ||
157 | + | ||
158 | +# include OSDEV Version tool as external asset | ||
159 | +INCLUDE( ExternalHsoaVersion ) | ||
160 | + | ||
161 | +# add version directory to included directories | ||
162 | +INCLUDE_DIRECTORIES(${OSDEV_VERSION_HEADER_DIR}) | ||
163 | + | ||
164 | +#+END_SRC | ||
165 | + | ||
166 | +*Note* Defining the variable in the CMake file, overrides any | ||
167 | +environmental settings in the external version approach. | ||
168 | + | ||
169 | + | ||
170 | +* Python | ||
171 | + | ||
172 | + | ||
173 | +* JavaScript | ||
174 | + | ||
175 | + | ||
176 | +* Ansible | ||
177 | + | ||
178 | + | ||
179 | + |
cmake/osdevversion.cmake
0 → 100644
1 | +++ a/cmake/osdevversion.cmake | ||
1 | +# @brief Configures the hsoa_create_version_include versioning information variables | ||
2 | +# and adds the submodule directory. | ||
3 | + | ||
4 | +set(OSDEV_PRODUCT_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}) | ||
5 | +set(OSDEV_VERSION_PRODUCT_CONFIG ${CMAKE_CURRENT_SOURCE_DIR}/osdev_versioning/osdev_config/product_config.txt) | ||
6 | +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/osdev_versioning) |
osdev_config/customer_config.txt
0 → 100755
1 | +++ a/osdev_config/customer_config.txt | ||
1 | +# Configuration file Template HSOA/Mlogic for the | ||
2 | +# "HSOA Component Lifecycle Management v1.5" component versioning standard. | ||
3 | +# | ||
4 | +# - any lines starting with # are considered comments | ||
5 | +# - the comment line "....." above a value specifies the maximum size. | ||
6 | +# - all values may not contain spaces unless specifically noted. | ||
7 | +# - If the comment is "12..." then the value is alphanumeric without spaces. | ||
8 | +# - If the comment is "xx..." then the value is numeric only | ||
9 | +# | ||
10 | +# | ||
11 | +# Customer name (was MC_KLANT in mc_conf.h) | ||
12 | +# TEMPLATE: "12345678901234567890123456789" | ||
13 | +CUSTOMER_NAME="12345678901234567890123456789" | ||
14 | + | ||
15 | +# Customer number (was MC_KLANT in mc_conf.h) | ||
16 | +# The customer number from BAAN | ||
17 | +# TEMPLATE: "xxxxx" | ||
18 | +CUSTOMER_NUMBER="xxxxx" | ||
19 | + | ||
20 | +# Customer release (was MC_KLANT_VERSIE in mc_conf.h) | ||
21 | +# TEMPLATE: "xx" | ||
22 | +CUSTOMER_VERSION="xx" | ||
23 | + | ||
24 | +# Customer build flags (extra customer product specific settings) | ||
25 | +# | ||
26 | +CUSTOMER_BUILD_FLAGS="" |
osdev_config/osdev_config.txt
0 → 100644
1 | +++ a/osdev_config/osdev_config.txt | ||
1 | +# Configuration file Template HSOA/Mlogic for the | ||
2 | +# "HSOA Component Lifecycle Management v1.5" component versioning standard. | ||
3 | +# | ||
4 | +# Configuration file. | ||
5 | +# | ||
6 | +# - any lines starting with # are considered comments | ||
7 | +# - the comment line "....." above a value specifies the maximum size. | ||
8 | +# - all values may not contain spaces unless specifically noted. | ||
9 | +# - If the comment is "12..." then the value is alphanumeric without spaces. | ||
10 | +# - If the comment is "xx..." then the value is numeric only | ||
11 | +# | ||
12 | +# | ||
13 | + | ||
14 | +# HSOA Architecture version identifier | ||
15 | +# | ||
16 | +OSDEV_IDENTIFIER="XD1.0.0E0.0.0" | ||
17 | + | ||
18 | +# OsDev release code | ||
19 | +OSDEV_RELEASE_NAME="R1" |
osdev_config/product_config.txt
0 → 100644
1 | +++ a/osdev_config/product_config.txt | ||
1 | +# Configuration file Template HSOA/Mlogic for the | ||
2 | +# "HSOA Component Lifecycle Management v1.5" component versioning standard. | ||
3 | +# | ||
4 | +# | ||
5 | +# - any lines starting with # are considered comments | ||
6 | +# - the comment line "....." above a value specifies the maximum size. | ||
7 | +# - all values may not contain spaces unless specifically noted. | ||
8 | +# - If the comment is "12..." then the value is alphanumeric without spaces. | ||
9 | +# - If the comment is "xx..." then the value is numeric only | ||
10 | +# | ||
11 | +# | ||
12 | + | ||
13 | +# Manufacturer code | ||
14 | +# | ||
15 | +PRODUCT_MANUFACTURER_CODE="OSDEV" | ||
16 | + | ||
17 | +# Manufacturer url | ||
18 | +# | ||
19 | +PRODUCT_MANUFACTURER_URL="http://www.osdev.nl" | ||
20 | + | ||
21 | +# Product release name (was MC_RELEASE in mc_config.h) | ||
22 | +# | ||
23 | +PRODUCT_RELEASE_NAME="" | ||
24 | + | ||
25 | +# Product build flags (extra product variant specific settings) | ||
26 | +# | ||
27 | +PRODUCT_BUILD_FLAGS="" | ||
28 | + |
osdev_create_version_include.sh
0 → 100755
1 | +++ a/osdev_create_version_include.sh | ||
1 | +#!/bin/bash | ||
2 | + | ||
3 | +# Set this to y to turn on debugging in this script. | ||
4 | +#DEBUG=y | ||
5 | + | ||
6 | +############################################### | ||
7 | +# _test_config_var | ||
8 | +# pass in | ||
9 | +# $1 - config variable to check | ||
10 | +# $2 - Current parse state, 0 = OK, 1 = Failed | ||
11 | +# return parse state on absence or presence of $1. | ||
12 | + | ||
13 | +function _test_config_var () { | ||
14 | + local CONFIG_VAR="${1}" | ||
15 | + local CONFIG_ERR=${2} | ||
16 | + | ||
17 | + # debug test | ||
18 | + if [[ ! -z "${DEBUG}" ]] ; then | ||
19 | + echo "+=+ ${CONFIG_ERR} - Checking ${CONFIG_VAR}" | ||
20 | + fi | ||
21 | + | ||
22 | + # perform test | ||
23 | + if [[ -z $(eval "echo \"\$${CONFIG_VAR}\"") ]] ; then | ||
24 | + CONFIG_ERR=1 | ||
25 | + fi | ||
26 | + return ${CONFIG_ERR} | ||
27 | +} | ||
28 | + | ||
29 | +# Directory of this script, hence the directory of the hsoa_create_version_include repository | ||
30 | +OSDEV_GIT_DIR="$(cd $(dirname ${0}); pwd)" | ||
31 | + | ||
32 | +# What language to generate for | ||
33 | +OSDEV_VERSION_TYPE="C++" | ||
34 | + | ||
35 | +# Where the component/product git repository is, default to where this script is. | ||
36 | +OSDEV_PRODUCT_SRC_DIR="${OSDEV_PRODUCT_SRC_DIR:=$1}" | ||
37 | + | ||
38 | +# configuration file directory (default to current environment) | ||
39 | +OSDEV_CONFIG_DIR="${OSDEV_CONFIG_DIR:=${OSDEV_PRODUCT_SRC_DIR}/osdev_config}" | ||
40 | + | ||
41 | +# path to customer configuration file | ||
42 | +OSDEV_VERSION_CUSTOMER_CONFIG="${OSDEV_VERSION_CUSTOMER_CONFIG:=${OSDEV_GIT_DIR}/osdev_config/customer_config.txt}" | ||
43 | + | ||
44 | +# Architecture version filename | ||
45 | +OSDEV_VERSION_OSDEV_CONFIG="${OSDEV_VERSION_OSDEV_CONFIG:=${OSDEV_GIT_DIR}/osdev_config/osdev_config.txt}" | ||
46 | + | ||
47 | +# product configuration filename | ||
48 | +OSDEV_VERSION_PRODUCT_CONFIG="${OSDEV_VERSION_PRODUCT_CONFIG:=${OSDEV_CONFIG_DIR}/product_config.txt}" | ||
49 | + | ||
50 | +# output header directory (default to environment) | ||
51 | +OSDEV_VERSION_HEADER_DIR="${OSDEV_VERSION_HEADER_DIR:=$2}" | ||
52 | + | ||
53 | +# filename to create | ||
54 | +OSDEV_VERSION_FILE_PREFIX=${OSDEV_VERSION_HEADER_DIR}/osdev_version | ||
55 | + | ||
56 | +if [[ ! -z "${DEBUG}" ]] ; then | ||
57 | + echo "OSDEV_GIT_DIR=${OSDEV_GIT_DIR}" | ||
58 | + echo "OSDEV_CONFIG_DIR=${OSDEV_CONFIG_DIR}" | ||
59 | + echo "OSDEV_PRODUCT_SRC_DIR=${OSDEV_PRODUCT_SRC_DIR}" | ||
60 | + echo "OSDEV_VERSION_CUSTOMER_CONFIG=${OSDEV_VERSION_CUSTOMER_CONFIG}" | ||
61 | + echo "OSDEV_VERSION_PRODUCT_CONFIG=${OSDEV_VERSION_PRODUCT_CONFIG}" | ||
62 | + echo "OSDEV_VERSION_OSDEV_CONFIG=${OSDEV_VERSION_OSDEV_CONFIG}" | ||
63 | + echo "OSDEV_VERSION_HEADER_DIR=${OSDEV_VERSION_HEADER_DIR}" | ||
64 | + echo "OSDEV_VERSION_FILE_PREFIX=${OSDEV_VERSION_FILE_PREFIX}" | ||
65 | +fi | ||
66 | + | ||
67 | +# find local C compiler to test header file | ||
68 | +if [[ -z "${CC}" ]] ; then | ||
69 | + CC="$(which cc)" | ||
70 | +fi | ||
71 | + | ||
72 | +# no error found yet | ||
73 | +CONFIG_ERR=0 | ||
74 | + | ||
75 | +# check osdev_config.txt for architecture configuration | ||
76 | +if [[ ! -e ${OSDEV_VERSION_OSDEV_CONFIG} ]] ; then | ||
77 | + CONFIG_ERR=1 | ||
78 | +else | ||
79 | + if [[ ! -z "${DEBUG}" ]] ; then | ||
80 | + echo "+=+ Debug - parse for ${OSDEV_VERSION_OSDEV_CONFIG}" | ||
81 | + fi | ||
82 | + source ${OSDEV_VERSION_OSDEV_CONFIG} | ||
83 | + CONFIG_ERR= _test_config_var "OSDEV_IDENTIFIER" "${CONFIG_ERR}" | ||
84 | + CONFIG_ERR= _test_config_var "OSDEV_RELEASE_NAME" "${CONFIG_ERR}" | ||
85 | +fi | ||
86 | + | ||
87 | +if [[ 0 -ne ${CONFIG_ERR} ]] ; then | ||
88 | + echo "-- FATAL: osdev_config.txt ${OSDEV_VERSION_OSDEV_CONFIG} does not exist or is corrupt" | ||
89 | + exit 1 | ||
90 | +else | ||
91 | + echo "++ osdev_hsoa:${OSDEV_RELEASE_NAME}_${OSDEV_IDENTIFIER}" | ||
92 | +fi | ||
93 | + | ||
94 | +# check for a product configuration | ||
95 | +if [[ ! -e ${OSDEV_VERSION_PRODUCT_CONFIG} ]] ; then | ||
96 | + CONFIG_ERR=1 | ||
97 | +else | ||
98 | + if [[ ! -z "${DEBUG}" ]] ; then | ||
99 | + echo "+=+ Debug - parse for ${OSDEV_VERSION_PRODUCT_CONFIG}" | ||
100 | + fi | ||
101 | + source ${OSDEV_VERSION_PRODUCT_CONFIG} | ||
102 | + # check required parameters are there | ||
103 | + CONFIG_ERR= _test_config_var "PRODUCT_RELEASE_NAME" "${CONFIG_ERR}" | ||
104 | + CONFIG_ERR= _test_config_var "PRODUCT_MANUFACTURER_CODE" "${CONFIG_ERR}" | ||
105 | +fi | ||
106 | + | ||
107 | +if [[ 0 -ne ${CONFIG_ERR} ]] ; then | ||
108 | + echo "-- FATAL: product_config.txt ${OSDEV_VERSION_PRODUCT_CONFIG} does not exist or is corrupt" | ||
109 | + exit 1 | ||
110 | +else | ||
111 | + echo "++ product:${PRODUCT_MANUFACTURER_CODE}-${PRODUCT_RELEASE_NAME}" | ||
112 | +fi | ||
113 | + | ||
114 | +CUSTOMER_ID="" | ||
115 | +if [[ ! -e ${OSDEV_VERSION_CUSTOMER_CONFIG} ]] ; then | ||
116 | + CONFIG_ERR=1 | ||
117 | +else | ||
118 | + if [[ ! -z "${DEBUG}" ]] ; then | ||
119 | + echo "+=+ Debug - parse for ${OSDEV_VERSION_CUSTOMER_CONFIG}" | ||
120 | + fi | ||
121 | + source ${OSDEV_VERSION_CUSTOMER_CONFIG} | ||
122 | + # check required parameters are there | ||
123 | + CONFIG_ERR= _test_config_var "CUSTOMER_NAME" "${CONFIG_ERR}" | ||
124 | + CONFIG_ERR= _test_config_var "CUSTOMER_NUMBER" "${CONFIG_ERR}" | ||
125 | + CONFIG_ERR= _test_config_var "CUSTOMER_VERSION" "${CONFIG_ERR}" | ||
126 | + | ||
127 | +# do not put customer name in here, because when a plant is sold a name can be changed but | ||
128 | +# customer number and version will not change, they are linked to the location | ||
129 | +# CUSTOMER_ID="${CUSTOMER_NUMBER}.${CUSTOMER_VERSION}_${CUSTOMER_NAME}" | ||
130 | + CUSTOMER_ID="${CUSTOMER_NUMBER}.${CUSTOMER_VERSION}" | ||
131 | +fi | ||
132 | + | ||
133 | +if [[ 0 -ne ${CONFIG_ERR} ]] ; then | ||
134 | + echo "-- FATAL: customer_config.txt ${OSDEV_VERSION_CUSTOMER_CONFIG} does not exist or is corrupt" | ||
135 | + exit 1 | ||
136 | +else | ||
137 | + echo "++ customer: ${CUSTOMER_ID}" | ||
138 | +fi | ||
139 | + | ||
140 | +VER_BUILD_ID_LONG_SHA="$(cd ${OSDEV_PRODUCT_SRC_DIR}; git rev-list HEAD | sed -e 's/\(.*\)/\1/;q;d')" | ||
141 | +VER_BUILD_ID_SHORT_SHA="$(cd ${OSDEV_PRODUCT_SRC_DIR}; git rev-list HEAD | sed -e 's/\(........\).*/\1/;q;d')" | ||
142 | +VER_BUILD_BRANCH="$(cd ${OSDEV_PRODUCT_SRC_DIR}; git name-rev --name-only HEAD)" | ||
143 | +VER_BUILD_DATE="$(cd ${OSDEV_PRODUCT_SRC_DIR}; date +'%Y.%m.%d')" | ||
144 | +VER_BUILD_DATETIME="$(cd ${OSDEV_PRODUCT_SRC_DIR}; date +'%Y.%m.%d.%T')" | ||
145 | +VER_BUILD_TAG="$(cd ${OSDEV_PRODUCT_SRC_DIR}; git describe --abbrev=0 --tags)" | ||
146 | +VER_BUILD_HOST="$(hostname -s)" | ||
147 | + | ||
148 | +# in case version of McGraw+yocto is not defined set it to 1.0 | ||
149 | +if [ -z "$OSDEV_DISTRO_VERSION" ]; then | ||
150 | + OSDEV_DISTRO_VERSION="1.0" | ||
151 | +fi | ||
152 | + | ||
153 | +# split out tag information | ||
154 | +IFS='.' read -ra VER_BUILD_VERSION <<< "$VER_BUILD_TAG" | ||
155 | + | ||
156 | +VER_BUILD_MAJOR="${VER_BUILD_VERSION[0]}" | ||
157 | +VER_BUILD_MINOR="${VER_BUILD_VERSION[1]}" | ||
158 | +VER_BUILD_PATCH="${VER_BUILD_VERSION[2]}" | ||
159 | +VER_BUILD_LETTER="${VER_BUILD_VERSION[3]}" | ||
160 | +VER_BUILD_RELEASENR="1" | ||
161 | + | ||
162 | +# set some defaults if git tag information is not available. | ||
163 | +if [ -z "$VER_BUILD_MAJOR" ] ; then | ||
164 | + VER_BUILD_MAJOR="0" | ||
165 | +fi | ||
166 | +if [ -z "$VER_BUILD_MINOR" ] ; then | ||
167 | + VER_BUILD_MINOR="0" | ||
168 | +fi | ||
169 | +if [ -z "$VER_BUILD_PATCH" ] ; then | ||
170 | + VER_BUILD_PATCH="0" | ||
171 | +fi | ||
172 | +if [ -z "$VER_BUILD_LETTER" ] ; then | ||
173 | + # must be X,T,H,F,S or R, | ||
174 | + VER_BUILD_LETTER="X" | ||
175 | +fi | ||
176 | + | ||
177 | +# short version number | ||
178 | +PRODUCT_RELEASE_SHORT_VERSION="${VER_BUILD_MAJOR}.${VER_BUILD_MINOR}" | ||
179 | + | ||
180 | +# full version number | ||
181 | +PRODUCT_RELEASE_VERSION="${VER_BUILD_MAJOR}.${VER_BUILD_MINOR}.${VER_BUILD_PATCH}.${VER_BUILD_LETTER}" | ||
182 | + | ||
183 | +# full product version for product support, version number template: | ||
184 | +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}" | ||
185 | + | ||
186 | +# Replace spaces in customer name | ||
187 | +CUSTOMER_NAME_STR=$(echo "${CUSTOMER_NAME}" | tr ' ' '_') | ||
188 | + | ||
189 | +# Customer Configuration SHA | ||
190 | +CUSTOMER_BUILD_FLAGS=$(echo $OSDEV_IMAGE_CONFIG_GITSHA) | ||
191 | + | ||
192 | +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:" | ||
193 | + | ||
194 | +# echo extended version information to log/console | ||
195 | +while read -r ECHO_LINE | ||
196 | +do | ||
197 | + echo "${ECHO_LINE}" | ||
198 | +done <<EOFOUT | ||
199 | +------------------------- | ||
200 | +${VER_BUILD_EMBED_SHA} | ||
201 | +------------------------- | ||
202 | +EOFOUT | ||
203 | + | ||
204 | +# ensure include directory exists | ||
205 | +mkdir -p ${OSDEV_VERSION_HEADER_DIR} | ||
206 | + | ||
207 | +# generate a hsoa_version for cmake | ||
208 | +while read -r ECHO_CMAKEFILE | ||
209 | +do | ||
210 | + echo "${ECHO_CMAKEFILE}" | ||
211 | +done <<EOF > ${OSDEV_VERSION_FILE_PREFIX}.cmake | ||
212 | + | ||
213 | +# DO NOT EDIT THIS FILE! | ||
214 | + | ||
215 | +# this file is auto-generated by create_version_include. The script that | ||
216 | +# implements the "HSOA Component Lifecycle Management v1.x" | ||
217 | +# component versioning standard. | ||
218 | + | ||
219 | +# Set in parent scope because of add_subdirectory in hsoaversion.cmake. | ||
220 | +set( OSDEV_VERSION_INCLUDE_DIR "${OSDEV_VERSION_HEADER_DIR}" PARENT_SCOPE ) | ||
221 | +set( OSDEV_VERSION_SRC_FILE "${OSDEV_VERSION_FILE_PREFIX}.cpp" PARENT_SCOPE ) | ||
222 | +set( CURRENT_PROJECT_MANUFACTURER_CODE "${PRODUCT_MANUFACTURER_CODE}" PARENT_SCOPE ) | ||
223 | +set( CURRENT_PROJECT_VERSION_MAJOR "${VER_BUILD_MAJOR}" PARENT_SCOPE ) | ||
224 | +set( CURRENT_PROJECT_VERSION_MINOR "${VER_BUILD_MINOR}" PARENT_SCOPE ) | ||
225 | +set( CURRENT_PROJECT_VERSION_PATCH "${VER_BUILD_PATCH}" PARENT_SCOPE ) | ||
226 | +set( CURRENT_PROJECT_VERSION_LETTER "${VER_BUILD_LETTER}" PARENT_SCOPE ) | ||
227 | +set( CURRENT_PROJECT_VERSION_RELEASENR "${VER_BUILD_RELEASENR}" PARENT_SCOPE ) | ||
228 | +set( CURRENT_PROJECT_VERSION "${VER_BUILD_MAJOR}.${VER_BUILD_MINOR}.${VER_BUILD_PATCH}" PARENT_SCOPE ) | ||
229 | + | ||
230 | +EOF | ||
231 | + | ||
232 | +if [[ ! -z "${DEBUG}" ]] ; then | ||
233 | + cat ${OSDEV_VERSION_FILE_PREFIX}.cmake | ||
234 | +fi | ||
235 | + | ||
236 | +# generate a hsoa_version header file for c/c++ | ||
237 | +while read -r ECHO_HFILE | ||
238 | +do | ||
239 | + echo "${ECHO_HFILE}" | ||
240 | +done <<EOF > ${OSDEV_VERSION_FILE_PREFIX}.h | ||
241 | + | ||
242 | +/* | ||
243 | +DO NOT EDIT THIS FILE! | ||
244 | + | ||
245 | +this file is auto-generated by create_version_include. The script that | ||
246 | +implements the "HSOA Component Lifecycle Management v1.x" | ||
247 | +component versioning standard. | ||
248 | + | ||
249 | +*/ | ||
250 | + | ||
251 | +#ifndef OSDEV_VERSION_DEFINES_H_ | ||
252 | +#define OSDEV_VERSION_DEFINES_H_ | ||
253 | + | ||
254 | +namespace mlogic { | ||
255 | +namespace hsoaversion { | ||
256 | +namespace PRODUCT_${PRODUCT_RELEASE_NAME} { | ||
257 | + | ||
258 | +#if !defined(OSDEV_GNUC_USED) && (defined(__GNUC__) && !defined(__clang__)) | ||
259 | + #define OSDEV_GNUC_USED [[gnu::used]] | ||
260 | +#else | ||
261 | + #define OSDEV_GNUC_USED | ||
262 | +#endif | ||
263 | + | ||
264 | +struct HsoaVersionInfo | ||
265 | +{ | ||
266 | +/* mlogic specific information */ | ||
267 | +OSDEV_GNUC_USED static const char* VER_OSDEV_RELEASE_NAME_; | ||
268 | +OSDEV_GNUC_USED static const char* VER_OSDEV_IDENTIFIER_; | ||
269 | + | ||
270 | +/* customer specific information */ | ||
271 | +OSDEV_GNUC_USED static const char* VER_CUSTOMER_NAME_; | ||
272 | +OSDEV_GNUC_USED static const char* VER_CUSTOMER_NUMBER_; | ||
273 | +OSDEV_GNUC_USED static const char* VER_CUSTOMER_OSDEV_VERSION_; | ||
274 | +OSDEV_GNUC_USED static const char* VER_CUSTOMER_ID_; | ||
275 | + | ||
276 | +/* product specific information */ | ||
277 | +OSDEV_GNUC_USED static const char* VER_PRODUCT_RELEASE_NAME_; | ||
278 | +OSDEV_GNUC_USED static const char* VER_PRODUCT_RELEASE_VSHORT_; | ||
279 | +OSDEV_GNUC_USED static const char* VER_PRODUCT_RELEASE_VFULL_; | ||
280 | +OSDEV_GNUC_USED static const char* VER_PRODUCT_OSDEV_VERSION_; | ||
281 | +OSDEV_GNUC_USED static const char* VER_PRODUCT_MANUFACTURER_CODE_; | ||
282 | +OSDEV_GNUC_USED static const char* VER_PRODUCT_MANUFACTURER_URL_; | ||
283 | + | ||
284 | +/* version major, minor, sub and letter. */ | ||
285 | +OSDEV_GNUC_USED static const char* VER_BUILD_MAJOR_; | ||
286 | +OSDEV_GNUC_USED static const char* VER_BUILD_MINOR_; | ||
287 | +OSDEV_GNUC_USED static const char* VER_BUILD_PATCH_; | ||
288 | +OSDEV_GNUC_USED static const char* VER_BUILD_RELEASENR_; | ||
289 | +OSDEV_GNUC_USED static const char* VER_BUILD_LETTER_; | ||
290 | + | ||
291 | +/* Git build specific information to embed into the program */ | ||
292 | +OSDEV_GNUC_USED static const char* VER_BUILD_ID_SHORT_SHA_; | ||
293 | +OSDEV_GNUC_USED static const char* VER_BUILD_ID_LONG_SHA_; | ||
294 | +OSDEV_GNUC_USED static const char* VER_BUILD_DATE_; | ||
295 | +OSDEV_GNUC_USED static const char* VER_BUILD_DATETIME_; | ||
296 | +OSDEV_GNUC_USED static const char* VER_BUILD_EMBED_SHA_; | ||
297 | +OSDEV_GNUC_USED static const char* VER_BUILD_CUSTOMER_FLAGS_; | ||
298 | +OSDEV_GNUC_USED static const char* VER_BUILD_PRODUCT_FLAGS_; | ||
299 | +}; | ||
300 | + | ||
301 | +} // namespace PRODUCT_... | ||
302 | +} // namespace hsoaversion | ||
303 | +} // namespace mlogic | ||
304 | + | ||
305 | +#endif /* OSDEV_VERSION_DEFINES_H_ */ | ||
306 | + | ||
307 | +EOF | ||
308 | + | ||
309 | +if [[ ! -z "${DEBUG}" ]] ; then | ||
310 | + cat ${OSDEV_VERSION_FILE_PREFIX}.h | ||
311 | +fi | ||
312 | + | ||
313 | +# generate a hsoa_version source file for c/c++ | ||
314 | +while read -r ECHO_CPPFILE | ||
315 | +do | ||
316 | + echo "${ECHO_CPPFILE}" | ||
317 | +done <<EOF > ${OSDEV_VERSION_FILE_PREFIX}.cpp | ||
318 | + | ||
319 | +/* | ||
320 | +DO NOT EDIT THIS FILE! | ||
321 | + | ||
322 | +this file is auto-generated by create_version_include. The script that | ||
323 | +implements the "HSOA Component Lifecycle Management v1.x" | ||
324 | +component versioning standard. | ||
325 | + | ||
326 | +*/ | ||
327 | + | ||
328 | +#include "hsoa_version.h" | ||
329 | + | ||
330 | +using namespace mlogic::hsoaversion::PRODUCT_${PRODUCT_RELEASE_NAME}; | ||
331 | + | ||
332 | +/* mlogic specific information */ | ||
333 | +OSDEV_GNUC_USED const char* HsoaVersionInfo::VER_OSDEV_RELEASE_NAME_= "${OSDEV_RELEASE_NAME}"; | ||
334 | +OSDEV_GNUC_USED const char* HsoaVersionInfo::VER_OSDEV_IDENTIFIER_ = "${OSDEV_IDENTIFIER}"; | ||
335 | + | ||
336 | +/* customer specific information */ | ||
337 | +OSDEV_GNUC_USED const char* HsoaVersionInfo::VER_CUSTOMER_NAME_ = "${CUSTOMER_NAME_STR}"; | ||
338 | +OSDEV_GNUC_USED const char* HsoaVersionInfo::VER_CUSTOMER_NUMBER_ = "${CUSTOMER_NUMBER}"; | ||
339 | +OSDEV_GNUC_USED const char* HsoaVersionInfo::VER_CUSTOMER_OSDEV_VERSION_= "${CUSTOMER_VERSION}"; | ||
340 | +OSDEV_GNUC_USED const char* HsoaVersionInfo::VER_CUSTOMER_ID_ = "${CUSTOMER_ID}"; | ||
341 | + | ||
342 | +/* product specific information */ | ||
343 | +OSDEV_GNUC_USED const char* HsoaVersionInfo::VER_PRODUCT_RELEASE_NAME_ = "${PRODUCT_RELEASE_NAME}"; | ||
344 | +OSDEV_GNUC_USED const char* HsoaVersionInfo::VER_PRODUCT_RELEASE_VSHORT_= "${PRODUCT_RELEASE_SHORT_VERSION}"; | ||
345 | +OSDEV_GNUC_USED const char* HsoaVersionInfo::VER_PRODUCT_RELEASE_VFULL_ = "${PRODUCT_RELEASE_VERSION}"; | ||
346 | +OSDEV_GNUC_USED const char* HsoaVersionInfo::VER_PRODUCT_OSDEV_VERSION_ = "${PRODUCT_FULL_VERSION}"; | ||
347 | +OSDEV_GNUC_USED const char* HsoaVersionInfo::VER_PRODUCT_MANUFACTURER_CODE_ = "${PRODUCT_MANUFACTURER_CODE}"; | ||
348 | +OSDEV_GNUC_USED const char* HsoaVersionInfo::VER_PRODUCT_MANUFACTURER_URL_ = "${PRODUCT_MANUFACTURER_URL}"; | ||
349 | + | ||
350 | +/* version major, minor, sub and letter. */ | ||
351 | +OSDEV_GNUC_USED const char* HsoaVersionInfo::VER_BUILD_MAJOR_ = "${VER_BUILD_MAJOR}"; | ||
352 | +OSDEV_GNUC_USED const char* HsoaVersionInfo::VER_BUILD_MINOR_ = "${VER_BUILD_MINOR}"; | ||
353 | +OSDEV_GNUC_USED const char* HsoaVersionInfo::VER_BUILD_PATCH_ = "${VER_BUILD_PATCH}"; | ||
354 | +OSDEV_GNUC_USED const char* HsoaVersionInfo::VER_BUILD_RELEASENR_ = "${VER_BUILD_RELEASENR}"; | ||
355 | +OSDEV_GNUC_USED const char* HsoaVersionInfo::VER_BUILD_LETTER_ = "${VER_BUILD_LETTER}"; | ||
356 | + | ||
357 | +/* Git build specific information to embed into the program */ | ||
358 | +OSDEV_GNUC_USED const char* HsoaVersionInfo::VER_BUILD_ID_SHORT_SHA_ = "${VER_BUILD_ID_SHORT_SHA}"; | ||
359 | +OSDEV_GNUC_USED const char* HsoaVersionInfo::VER_BUILD_ID_LONG_SHA_ = "${VER_BUILD_ID_LONG_SHA}"; | ||
360 | +OSDEV_GNUC_USED const char* HsoaVersionInfo::VER_BUILD_DATE_ = "${VER_BUILD_DATE}"; | ||
361 | +OSDEV_GNUC_USED const char* HsoaVersionInfo::VER_BUILD_DATETIME_ = "${VER_BUILD_DATETIME}"; | ||
362 | +OSDEV_GNUC_USED const char* HsoaVersionInfo::VER_BUILD_EMBED_SHA_ = "${VER_BUILD_EMBED_SHA}"; | ||
363 | +OSDEV_GNUC_USED const char* HsoaVersionInfo::VER_BUILD_CUSTOMER_FLAGS_= "${CUSTOMER_BUILD_FLAGS}"; | ||
364 | +OSDEV_GNUC_USED const char* HsoaVersionInfo::VER_BUILD_PRODUCT_FLAGS_ = "${PRODUCT_BUILD_FLAGS}"; | ||
365 | + | ||
366 | +EOF | ||
367 | + | ||
368 | +if [[ ! -z "${DEBUG}" ]] ; then | ||
369 | + cat ${OSDEV_VERSION_FILE_PREFIX}.h | ||
370 | +fi | ||
371 | + | ||
372 | +# generate a hsoa_version for python | ||
373 | +while read -r ECHO_HFILE | ||
374 | +do | ||
375 | + echo "${ECHO_HFILE}" | ||
376 | +done <<EOF > ${OSDEV_VERSION_FILE_PREFIX}.py | ||
377 | + | ||
378 | +# | ||
379 | +# DO NOT EDIT THIS FILE! | ||
380 | +# | ||
381 | +# this file is auto-generated by create_version_include. The script that | ||
382 | +# implements the "HSOA Component Lifecycle Management v1.x" | ||
383 | +# component versioning standard. | ||
384 | +# | ||
385 | +# | ||
386 | + | ||
387 | +# mlogic specific information | ||
388 | +VER_OSDEV_RELEASE_NAME_ = "${OSDEV_RELEASE_NAME}" | ||
389 | +VER_OSDEV_IDENTIFIER_ = "${OSDEV_IDENTIFIER}" | ||
390 | + | ||
391 | +# customer specific information | ||
392 | +VER_CUSTOMER_NAME_ = "${CUSTOMER_NAME_STR}" | ||
393 | +VER_CUSTOMER_NUMBER_ = "${CUSTOMER_NUMBER}" | ||
394 | +VER_CUSTOMER_OSDEV_VERSION_ = "${CUSTOMER_VERSION}" | ||
395 | +VER_CUSTOMER_ID_ = "${CUSTOMER_ID}" | ||
396 | + | ||
397 | +# product specific information | ||
398 | +VER_PRODUCT_RELEASE_NAME_ = "${PRODUCT_RELEASE_NAME}" | ||
399 | +VER_PRODUCT_RELEASE_VSHORT_ = "${PRODUCT_RELEASE_SHORT_VERSION}" | ||
400 | +VER_PRODUCT_RELEASE_VFULL_ = "${PRODUCT_RELEASE_VERSION}" | ||
401 | +VER_PRODUCT_OSDEV_VERSION_ = "${PRODUCT_FULL_VERSION}" | ||
402 | +VER_PRODUCT_MANUFACTURER_CODE_ = "${PRODUCT_MANUFACTURER_CODE}" | ||
403 | + | ||
404 | +# version major, minor, sub and letter. | ||
405 | +VER_BUILD_MAJOR_ = "${VER_BUILD_MAJOR}" | ||
406 | +VER_BUILD_MINOR_ = "${VER_BUILD_MINOR}" | ||
407 | +VER_BUILD_PATCH_ = "${VER_BUILD_PATCH}" | ||
408 | +VER_BUILD_LETTER_ = "${VER_BUILD_LETTER}" | ||
409 | + | ||
410 | +# Git build specific information to embed into the program | ||
411 | +VER_BUILD_ID_SHORT_SHA_ = "${VER_BUILD_ID_SHORT_SHA}" | ||
412 | +VER_BUILD_ID_LONG_SHA_ = "${VER_BUILD_ID_LONG_SHA}" | ||
413 | +VER_BUILD_DATE_ = "${VER_BUILD_DATE}" | ||
414 | +VER_BUILD_DATETIME_ = "${VER_BUILD_DATETIME}" | ||
415 | +VER_BUILD_EMBED_SHA_ = "${VER_BUILD_EMBED_SHA}" | ||
416 | +VER_BUILD_CUSTOMER_FLAGS_ = "${CUSTOMER_BUILD_FLAGS}" | ||
417 | +VER_BUILD_PRODUCT_FLAGS_ = "${PRODUCT_BUILD_FLAGS}" | ||
418 | + | ||
419 | +EOF | ||
420 | + | ||
421 | +if [[ ! -z "${DEBUG}" ]] ; then | ||
422 | + cat ${OSDEV_VERSION_FILE_PREFIX}.py | ||
423 | +fi | ||
424 | + | ||
425 | +# test python output | ||
426 | +if [[ ! -z "$(which pylint)" ]] ; then | ||
427 | + echo "++ testing ${OSDEV_VERSION_FILE_PREFIX}.py" | ||
428 | + pylint -E ${OSDEV_VERSION_FILE_PREFIX}.py | ||
429 | +else | ||
430 | + echo "++ pylint not available to test ${OSDEV_VERSION_FILE_PREFIX}.py" | ||
431 | +fi | ||
432 | + | ||
433 | +# generate a hsoa_version for JavaScript | ||
434 | +while read -r ECHO_HFILE | ||
435 | +do | ||
436 | + echo "${ECHO_HFILE}" | ||
437 | +done <<EOF > ${OSDEV_VERSION_FILE_PREFIX}.js | ||
438 | + | ||
439 | +/* | ||
440 | +DO NOT EDIT THIS FILE! | ||
441 | + | ||
442 | +this file is auto-generated by create_version_include. The script that | ||
443 | +implements the "HSOA Component Lifecycle Management v1.x" | ||
444 | +component versioning standard. | ||
445 | + | ||
446 | +*/ | ||
447 | + | ||
448 | +/* mlogic specific information */ | ||
449 | +const VER_OSDEV_RELEASE_NAME_ = "${OSDEV_RELEASE_NAME}" | ||
450 | +const VER_OSDEV_IDENTIFIER_ = "${OSDEV_IDENTIFIER}" | ||
451 | + | ||
452 | +/* customer specific information */ | ||
453 | +const VER_CUSTOMER_NAME_ = "${CUSTOMER_NAME_STR}" | ||
454 | +const VER_CUSTOMER_NUMBER_ = "${CUSTOMER_NUMBER}" | ||
455 | +const VER_CUSTOMER_OSDEV_VERSION_ = "${CUSTOMER_VERSION}" | ||
456 | +const VER_CUSTOMER_ID_ = "${CUSTOMER_ID}" | ||
457 | + | ||
458 | +/* product specific information */ | ||
459 | +const VER_PRODUCT_RELEASE_NAME_ = "${PRODUCT_RELEASE_NAME}" | ||
460 | +const VER_PRODUCT_RELEASE_VSHORT_ = "${PRODUCT_RELEASE_SHORT_VERSION}" | ||
461 | +const VER_PRODUCT_RELEASE_VFULL_ = "${PRODUCT_RELEASE_VERSION}" | ||
462 | +const VER_PRODUCT_OSDEV_VERSION_ = "${PRODUCT_FULL_VERSION}" | ||
463 | +const VER_PRODUCT_MANUFACTURER_CODE_ = "${PRODUCT_MANUFACTURER_CODE}" | ||
464 | + | ||
465 | +/* version major, minor, sub and letter. */ | ||
466 | +const VER_BUILD_MAJOR_ = "${VER_BUILD_MAJOR}" | ||
467 | +const VER_BUILD_MINOR_ = "${VER_BUILD_MINOR}" | ||
468 | +const VER_BUILD_PATCH_ = "${VER_BUILD_PATCH}" | ||
469 | +const VER_BUILD_LETTER_ = "${VER_BUILD_LETTER}" | ||
470 | + | ||
471 | +/* Git build specific information to embed into the program */ | ||
472 | +const VER_BUILD_ID_SHORT_SHA_ = "${VER_BUILD_ID_SHORT_SHA}" | ||
473 | +const VER_BUILD_ID_LONG_SHA_ = "${VER_BUILD_ID_LONG_SHA}" | ||
474 | +const VER_BUILD_DATE_ = "${VER_BUILD_DATE}" | ||
475 | +const VER_BUILD_DATETIME_ = "${VER_BUILD_DATETIME}" | ||
476 | +const VER_BUILD_EMBED_SHA_ = "${VER_BUILD_EMBED_SHA}" | ||
477 | +const VER_BUILD_CUSTOMER_FLAGS_ = "${CUSTOMER_BUILD_FLAGS}" | ||
478 | +const VER_BUILD_PRODUCT_FLAGS_ = "${PRODUCT_BUILD_FLAGS}" | ||
479 | + | ||
480 | +EOF | ||
481 | + | ||
482 | +if [[ ! -z "${DEBUG}" ]] ; then | ||
483 | + cat ${OSDEV_VERSION_FILE_PREFIX}.js | ||
484 | +fi | ||
485 | + | ||
486 | +# test JavaScript output with node | ||
487 | +if [[ ! -z "$(which node)" ]] ; then | ||
488 | + echo "++ testing ${OSDEV_VERSION_FILE_PREFIX}.js" | ||
489 | + node ${OSDEV_VERSION_FILE_PREFIX}.js | ||
490 | +else | ||
491 | + echo "++ node not available to test ${OSDEV_VERSION_FILE_PREFIX}.js" | ||
492 | +fi |