Remove duplicated suffix on version string
In CMakeLists.txt, it already defines:
if (ANBOX_VERSION_SUFFIX)
set(ANBOX_VERSION "${ANBOX_VERSION}-${ANBOX_VERSION_SUFFIX}")
endif()
So there's no need to add suffix again in code
Signed-off-by: Shengjing Zhu <i@zhsj.me>
This commit is contained in:
parent
00ea7d9641
commit
63022b1604
5 changed files with 2 additions and 47 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -1,39 +0,0 @@
|
|||
/*
|
||||
* 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;
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue