Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
34527673
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
34527673
编写于
9月 20, 2021
作者:
Y
Yang Zhao
提交者:
GitHub
9月 20, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-10397]<feature> taosdump add version (#7997)
* add taosdump verison in cmake * add -V feature * taosdump add -V/--version
上级
81ae04cb
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
86 addition
and
0 deletion
+86
-0
src/kit/taosdump/CMakeLists.txt
src/kit/taosdump/CMakeLists.txt
+55
-0
src/kit/taosdump/taosdump.c
src/kit/taosdump/taosdump.c
+31
-0
未找到文件。
src/kit/taosdump/CMakeLists.txt
浏览文件 @
34527673
...
@@ -6,6 +6,61 @@ INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/query/inc)
...
@@ -6,6 +6,61 @@ INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/query/inc)
INCLUDE_DIRECTORIES
(
inc
)
INCLUDE_DIRECTORIES
(
inc
)
AUX_SOURCE_DIRECTORY
(
. SRC
)
AUX_SOURCE_DIRECTORY
(
. SRC
)
FIND_PACKAGE
(
Git
)
IF
(
GIT_FOUND
)
EXECUTE_PROCESS
(
COMMAND
${
GIT_EXECUTABLE
}
log --pretty=oneline -n 1
${
CMAKE_CURRENT_LIST_DIR
}
/taosdump.c
WORKING_DIRECTORY
${
CMAKE_CURRENT_LIST_DIR
}
RESULT_VARIABLE RESULT
OUTPUT_VARIABLE TAOSDUMP_COMMIT_SHA1
)
IF
(
"
${
TAOSDUMP_COMMIT_SHA1
}
"
STREQUAL
""
)
SET
(
TAOSDUMP_COMMIT_SHA1
"unknown"
)
ELSE
()
STRING
(
SUBSTRING
"
${
TAOSDUMP_COMMIT_SHA1
}
"
0 7 TAOSDUMP_COMMIT_SHA1
)
STRING
(
STRIP
"
${
TAOSDUMP_COMMIT_SHA1
}
"
TAOSDUMP_COMMIT_SHA1
)
ENDIF
()
EXECUTE_PROCESS
(
COMMAND
${
GIT_EXECUTABLE
}
status -z -s
${
CMAKE_CURRENT_LIST_DIR
}
/taosdump.c
RESULT_VARIABLE RESULT
OUTPUT_VARIABLE TAOSDUMP_STATUS
)
IF
(
TD_LINUX
)
EXECUTE_PROCESS
(
COMMAND bash
"-c"
"echo '
${
TAOSDUMP_STATUS
}
' | awk '{print $1}'"
RESULT_VARIABLE RESULT
OUTPUT_VARIABLE TAOSDUMP_STATUS
)
ENDIF
(
TD_LINUX
)
ELSE
()
MESSAGE
(
"Git not found"
)
SET
(
TAOSDUMP_COMMIT_SHA1
"unknown"
)
SET
(
TAOSDUMP_STATUS
"unknown"
)
ENDIF
(
GIT_FOUND
)
MESSAGE
(
"taosdump's latest commit in short is:"
${
TAOSDUMP_COMMIT_SHA1
}
)
STRING
(
STRIP
"
${
TAOSDUMP_STATUS
}
"
TAOSDUMP_STATUS
)
IF
(
TAOSDUMP_STATUS MATCHES
"M"
)
SET
(
TAOSDUMP_STATUS
"modified"
)
ELSE
()
SET
(
TAOSDUMP_STATUS
""
)
ENDIF
()
MESSAGE
(
"taosdump's status is:"
${
TAOSDUMP_STATUS
}
)
ADD_DEFINITIONS
(
-DTAOSDUMP_COMMIT_SHA1=
"
${
TAOSDUMP_COMMIT_SHA1
}
"
)
ADD_DEFINITIONS
(
-DTAOSDUMP_STATUS=
"
${
TAOSDUMP_STATUS
}
"
)
MESSAGE
(
"VERNUMBER is:"
${
VERNUMBER
}
)
IF
(
"
${
VERNUMBER
}
"
STREQUAL
""
)
SET
(
TD_VERSION_NUMBER
"TDengine-version-unknown"
)
ELSE
()
SET
(
TD_VERSION_NUMBER
${
VERNUMBER
}
)
ENDIF
()
MESSAGE
(
"TD_VERSION_NUMBER is:"
${
TD_VERSION_NUMBER
}
)
ADD_DEFINITIONS
(
-DTD_VERNUMBER=
"
${
TD_VERSION_NUMBER
}
"
)
IF
(
TD_LINUX
)
IF
(
TD_LINUX
)
ADD_EXECUTABLE
(
taosdump
${
SRC
}
)
ADD_EXECUTABLE
(
taosdump
${
SRC
}
)
IF
(
TD_SOMODE_STATIC
)
IF
(
TD_SOMODE_STATIC
)
...
...
src/kit/taosdump/taosdump.c
浏览文件 @
34527673
...
@@ -386,6 +386,33 @@ struct arguments g_args = {
...
@@ -386,6 +386,33 @@ struct arguments g_args = {
0
,
// dbCount
0
,
// dbCount
};
};
// get taosdump commit number version
#ifndef TAOSDUMP_COMMIT_SHA1
#define TAOSDUMP_COMMIT_SHA1 "unknown"
#endif
#ifndef TD_VERNUMBER
#define TD_VERNUMBER "unknown"
#endif
#ifndef TAOSDUMP_STATUS
#define TAOSDUMP_STATUS "unknown"
#endif
static
void
printVersion
()
{
char
tdengine_ver
[]
=
TD_VERNUMBER
;
char
taosdump_ver
[]
=
TAOSDUMP_COMMIT_SHA1
;
char
taosdump_status
[]
=
TAOSDUMP_STATUS
;
if
(
strlen
(
taosdump_status
)
==
0
)
{
printf
(
"taosdump version %s-%s
\n
"
,
tdengine_ver
,
taosdump_ver
);
}
else
{
printf
(
"taosdump version %s-%s, status:%s
\n
"
,
tdengine_ver
,
taosdump_ver
,
taosdump_status
);
}
}
UNUSED_FUNC
void
errorWrongValue
(
char
*
program
,
char
*
wrong_arg
,
char
*
wrong_value
)
UNUSED_FUNC
void
errorWrongValue
(
char
*
program
,
char
*
wrong_arg
,
char
*
wrong_value
)
{
{
fprintf
(
stderr
,
"%s %s: %s is an invalid value
\n
"
,
program
,
wrong_arg
,
wrong_value
);
fprintf
(
stderr
,
"%s %s: %s is an invalid value
\n
"
,
program
,
wrong_arg
,
wrong_value
);
...
@@ -673,6 +700,10 @@ static void parse_args(
...
@@ -673,6 +700,10 @@ static void parse_args(
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
}
g_args
.
databases
=
true
;
g_args
.
databases
=
true
;
}
else
if
(
0
==
strncmp
(
argv
[
i
],
"--version"
,
strlen
(
"--version"
))
||
0
==
strncmp
(
argv
[
i
],
"-V"
,
strlen
(
"-V"
)))
{
printVersion
();
exit
(
EXIT_SUCCESS
);
}
else
{
}
else
{
continue
;
continue
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录