提交 05928107 编写于 作者: S Simon Fels 提交者: GitHub

Merge pull request #350 from zhsj/fix-version-suffix

Remove duplicated suffix on version string
......@@ -63,7 +63,6 @@ set(SOURCES
anbox/config.cpp
anbox/not_reachable.cpp
anbox/build/version.cpp
anbox/build/version.h.in
anbox/android/intent.cpp
......
/*
* Copyright (C) 2017 Simon Fels <morphis@gravedo.de>
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 3, as published
* by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranties of
* MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "anbox/build/version.h"
#include "anbox/utils.h"
#include <cstring>
namespace anbox {
namespace build {
static std::string init_version_string() {
std::string v;
if (!version_suffix || std::strlen(version_suffix) == 0)
v = utils::string_format("%s", version);
else
v = utils::string_format("%s-%s", version, version_suffix);
return v;
}
std::string print_version() {
static const std::string v{init_version_string()};
return v;
}
} // namespace build
} // namespace anbox
......@@ -27,11 +27,6 @@ namespace anbox {
namespace build {
/// @brief version marks the version
static constexpr const char *version{"@ANBOX_VERSION@"};
/// @brief version_suffix is an additional suffix which can be amended to
/// the major version number to indicate a dev build for example.
static constexpr const char *version_suffix{"@ANBOX_VERSION_SUFFIX@"};
/// @brief version queries the version of Anbox
std::string print_version();
} // namespace build
} // namespace anbox
......
......@@ -53,7 +53,7 @@ class SystemInformation {
std::stringstream s;
s << "version: "
<< anbox::build::print_version()
<< anbox::build::version
<< std::endl;
if (anbox::utils::is_env_set("SNAP_REVISION")) {
......
......@@ -26,7 +26,7 @@ anbox::cmds::Version::Version()
cli::Name{"version"}, cli::Usage{"version"},
cli::Description{"print the version of the daemon"}} {
action([](const cli::Command::Context& ctxt) {
ctxt.cout << "anbox " << build::print_version() << std::endl;
ctxt.cout << "anbox " << build::version << std::endl;
return 0;
});
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册