From: Dariusz Michaluk Date: Mon, 25 May 2020 09:06:13 +0000 (+0200) Subject: Remove boost-based cmd line program options X-Git-Tag: submit/tizen/20200728.071123~27 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4f6c3dfddba91f6f43d9c6ffb1eec2a46ecd72f2;p=platform%2Fcore%2Fsecurity%2Fdevice-certificate-manager.git Remove boost-based cmd line program options Available options were 'version' and 'help' only. Checking package metadata (change-id) on platform image can be used instead. Change-Id: I4861509f5983db6a8fcd3d3f0a615017129a7df8 --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 5a96e62..bc0b216 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,3 +1,21 @@ +# Copyright (c) 2017 - 2020 Samsung Electronics Co., Ltd All Rights Reserved +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# @file CMakeLists.txt +# @author Dariusz Michaluk +# @author Jaroslaw Pelczar + CMAKE_MINIMUM_REQUIRED(VERSION 2.6) ##### Configure project version when using @@ -45,9 +63,6 @@ IF(ENABLE_SYSTEMD_SUPPORT AND NOT SYSTEMD_FOUND) message(FATAL_ERROR "systemd support required but systemd not found") ENDIF() -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/dcm_build_config.h.in - ${CMAKE_CURRENT_BINARY_DIR}/dcm_build_config.h) - include_directories(${CMAKE_CURRENT_BINARY_DIR}) include_directories(shared) diff --git a/cmake/CheckFrameworks.cmake b/cmake/CheckFrameworks.cmake index c28272f..631e9c9 100644 --- a/cmake/CheckFrameworks.cmake +++ b/cmake/CheckFrameworks.cmake @@ -11,7 +11,6 @@ FIND_PACKAGE(Boost 1.54 COMPONENTS serialization filesystem - program_options log thread system) diff --git a/cmake/dcm_build_config.h.in b/cmake/dcm_build_config.h.in deleted file mode 100644 index 84b09e1..0000000 --- a/cmake/dcm_build_config.h.in +++ /dev/null @@ -1 +0,0 @@ -#define PROJECT_VERSION "@PROJECT_VERSION@" diff --git a/dcm-daemon/CMakeLists.txt b/dcm-daemon/CMakeLists.txt index e1b684e..7c68e91 100644 --- a/dcm-daemon/CMakeLists.txt +++ b/dcm-daemon/CMakeLists.txt @@ -1,7 +1,20 @@ +# Copyright (c) 2017 - 2020 Samsung Electronics Co., Ltd All Rights Reserved # -# DCM daemon build script -# Jaroslaw Pelczar +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at # +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# @file dcm-daemon/CMakeLists.txt +# @author Dariusz Michaluk +# @author Jaroslaw Pelczar ###### Protobuf generator ####### @@ -63,7 +76,6 @@ target_link_libraries(device-certificate-managerd ${Boost_LOG_LIBRARY} ${Boost_THREAD_LIBRARY} ${Boost_FILESYSTEM_LIBRARY} - ${Boost_PROGRAM_OPTIONS_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${CMAKE_THREAD_LIBS_INIT} device-certificate-manager diff --git a/dcm-daemon/main.cpp b/dcm-daemon/main.cpp index 7ba625e..a5b1166 100644 --- a/dcm-daemon/main.cpp +++ b/dcm-daemon/main.cpp @@ -1,6 +1,6 @@ /****************************************************************** * - * Copyright 2017 - 2018 Samsung Electronics All Rights Reserved. + * Copyright 2017 - 2020 Samsung Electronics All Rights Reserved. * * Author: Jaroslaw Pelczar * @@ -18,7 +18,6 @@ * ******************************************************************/ -#include #include #include @@ -27,7 +26,6 @@ #include #include -#include "dcm_build_config.h" #include "dcmserver.h" #include "logging.h" #include "serviceadapter.h" @@ -41,38 +39,6 @@ #include #endif -namespace po = boost::program_options; - -struct OptionContext { - bool fShowHelp = false; - bool fShowVersion = false; - std::string fSocketName = DCM_UNIX_SOCKET_PATH; - - void parse_options(int argc, char ** argv) - { - po::options_description desc("Allowed options"); - desc.add_options() - ("help", "Print this help") - ("version", "Print version") - ; - - po::variables_map vm; - po::store(po::parse_command_line(argc, argv, desc), vm); - po::notify(vm); - - if(vm.count("help")) { - std::cout << desc << std::endl; - fShowHelp = true; - return; - } - - if(vm.count("version")) { - fShowVersion = true; - return; - } - } -}; - BOOST_LOG_ATTRIBUTE_KEYWORD(_scope, "Scope", boost::log::attributes::named_scope::value_type) BOOST_LOG_ATTRIBUTE_KEYWORD(_timestamp, "TimeStamp", boost::posix_time::ptime) BOOST_LOG_ATTRIBUTE_KEYWORD(_severity, "Severity", log_severity) @@ -132,7 +98,7 @@ void init_logging() cynara * gGlobalCynaraInstance; #endif -int main(int argc, char ** argv) +int main() { int error = 0; @@ -145,25 +111,7 @@ int main(int argc, char ** argv) BOOST_LOG_FUNCTION(); - OptionContext options; - - try { - options.parse_options(argc, argv); - } catch(std::exception& ex) { - BOOST_LOG_SEV(dcm_logger::get(), log_severity::error) << "Failed to parse options: " << ex.what(); - return EXIT_FAILURE; - } - - if(options.fShowHelp) { - return EXIT_SUCCESS; - } - - if(options.fShowVersion) { - BOOST_LOG_SEV(dcm_logger::get(), log_severity::normal) << "Device Certificate Manager version " PROJECT_VERSION; - return EXIT_SUCCESS; - } - - service_adapter serviceAdapter(options.fSocketName); + service_adapter serviceAdapter(DCM_UNIX_SOCKET_PATH); #ifdef USE_CYNARA cynara_configuration * cynara_conf = nullptr;