librados-config: add --release option

so it prints current release name along with release type. it can be
used by tests for querying the branch name

Fixes: https://tracker.ceph.com/issues/42782
Signed-off-by: Kefu Chai <kchai@redhat.com>
This commit is contained in:
Kefu Chai 2019-11-17 23:26:51 +08:00
parent d781797a7b
commit c48edcd9f2

View File

@ -20,6 +20,7 @@
#include <boost/program_options/variables_map.hpp>
#include "include/rados/librados.h"
#include "ceph_ver.h"
namespace po = boost::program_options;
@ -29,7 +30,8 @@ int main(int argc, const char **argv)
desc.add_options()
("help,h", "print this help message")
("version", "library version")
("vernum", "library version code");
("vernum", "library version code")
("release", "print release name");
po::parsed_options parsed =
po::command_line_parser(argc, argv).options(desc).run();
@ -45,6 +47,10 @@ int main(int argc, const char **argv)
std::cout << maj << "." << min << "." << ext << std::endl;
} else if (vm.count("vernum")) {
std::cout << std::hex << LIBRADOS_VERSION_CODE << std::dec << std::endl;
} else if (vm.count("release")) {
std::cout << CEPH_RELEASE_NAME << ' '
<< '(' << CEPH_RELEASE_TYPE << ')'
<< std::endl;
} else {
std::cerr << argv[0] << ": -h or --help for usage" << std::endl;
return 1;