Remove boost-based cmd line program options 04/234304/9
authorDariusz Michaluk <d.michaluk@samsung.com>
Mon, 25 May 2020 09:06:13 +0000 (11:06 +0200)
committerDariusz Michaluk <d.michaluk@samsung.com>
Mon, 6 Jul 2020 09:59:38 +0000 (11:59 +0200)
Available options were 'version' and 'help' only.
Checking package metadata (change-id) on platform image can be used instead.

Change-Id: I4861509f5983db6a8fcd3d3f0a615017129a7df8

CMakeLists.txt
cmake/CheckFrameworks.cmake
cmake/dcm_build_config.h.in [deleted file]
dcm-daemon/CMakeLists.txt
dcm-daemon/main.cpp

index 5a96e62..bc0b216 100644 (file)
@@ -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 <d.michaluk@samsung.com>
+# @author      Jaroslaw Pelczar <j.pelczar@samsung.com>
+
 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)
 
index c28272f..631e9c9 100644 (file)
@@ -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 (file)
index 84b09e1..0000000
+++ /dev/null
@@ -1 +0,0 @@
-#define PROJECT_VERSION                "@PROJECT_VERSION@"
index e1b684e..7c68e91 100644 (file)
@@ -1,7 +1,20 @@
+# Copyright (c) 2017 - 2020 Samsung Electronics Co., Ltd All Rights Reserved
 #
-# DCM daemon build script
-# Jaroslaw Pelczar <j.pelczar@samsung.com>
+#    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 <d.michaluk@samsung.com>
+# @author      Jaroslaw Pelczar <j.pelczar@samsung.com>
 
 ###### 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
index 7ba625e..a5b1166 100644 (file)
@@ -1,6 +1,6 @@
 /******************************************************************
  *
- * Copyright 2017 - 2018 Samsung Electronics All Rights Reserved.
+ * Copyright 2017 - 2020 Samsung Electronics All Rights Reserved.
  *
  * Author: Jaroslaw Pelczar <j.pelczar@samsung.com>
  *
@@ -18,7 +18,6 @@
  *
  ******************************************************************/
 
-#include <boost/program_options.hpp>
 #include <boost/asio.hpp>
 
 #include <iostream>
@@ -27,7 +26,6 @@
 #include <sys/stat.h>
 #include <sys/signal.h>
 
-#include "dcm_build_config.h"
 #include "dcmserver.h"
 #include "logging.h"
 #include "serviceadapter.h"
 #include <cynara-client.h>
 #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;