Merge branch 'feature/std_shell_cmds' into 'develop'

gitlab build number added



See merge request !15
This commit is contained in:
tkl 2016-08-11 10:12:02 +00:00
commit caa07ae20f
3 changed files with 10 additions and 2 deletions

View File

@ -21,7 +21,7 @@ static void *cmd_echo_on_cb(const char *cmd);
static void *cmd_echo_off_cb(const char *cmd);
struct command cmd_kosmos_version = {
.command = "uname",
.command = "kname",
.description = "Print current kosmos version.",
.command_callback = cmd_kosmos_version_cb
};
@ -55,6 +55,8 @@ static void *cmd_kosmos_version_cb(const char *cmd)
write(shell_object.shell_device, MAJOR_VERSION, strlen(MAJOR_VERSION));
write(shell_object.shell_device, ".", 1);
write(shell_object.shell_device, MINOR_VERSION, strlen(MINOR_VERSION));
write(shell_object.shell_device, ".", 1);
write(shell_object.shell_device, BUILD_NUMBER, strlen(BUILD_NUMBER));
return NULL;
}

View File

@ -6,5 +6,5 @@
#define KERNEL_VERSION "unknown"
#define MAJOR_VERSION "unknown"
#define MINOR_VERSION "unknown"
#define BUILD_NUMBER "unknown"
#endif /* VERSION_H */

View File

@ -12,6 +12,8 @@ def get_current_numbers():
config["sw_major"] = os.environ["SW_MAJOR"]
if os.environ.has_key("SW_MINOR"):
config["sw_minor"] = os.environ["SW_MINOR"]
if os.environ.has_key("CI_BUILD_ID"):
config["build_id"] = os.environ["CI_BUILD_ID"]
return config
def generate_include(numbers):
@ -31,6 +33,10 @@ def generate_include(numbers):
f.write("#define MINOR_VERSION\t\"" + numbers["sw_minor"] + "\"\n")
else:
f.write("#define MINOR_VERSION\t\"unknown\"\n")
if numbers.has_key("build_id"):
f.write("#define BUILD_NUMBER\t\"" + numbers["build_id"] + "\"\n")
else:
f.write("#define BUILD_NUMBER\t\"unknown\"\n")
f.write("\n#endif /* VERSION_H */\n")
f.close()