LCOV - code coverage report
Current view: top level - oks/apps - oks_clone_repository.cxx (source / functions) Coverage Total Hit
Test: code.result Lines: 0.0 % 37 0
Test Date: 2026-07-12 15:23:06 Functions: 0.0 % 1 0

            Line data    Source code
       1              : // DUNE DAQ modification notice:
       2              : // This file has been modified from the original ATLAS oks source for the DUNE DAQ project.
       3              : // Fork baseline commit: oks-08-03-04 (2022-04-14).
       4              : // Renamed since fork: yes (from bin/oks_clone_repository.cpp to apps/oks_clone_repository.cxx).
       5              : 
       6              : /**
       7              :  *  \file oks_clone_repository.cpp
       8              :  *
       9              :  *  This file is part of the OKS package.
      10              :  *  Author: <Igor.Soloviev@cern.ch>
      11              :  */
      12              : 
      13              : #include "oks/kernel.hpp"
      14              : 
      15              : #include <string.h>
      16              : #include <stdlib.h>
      17              : 
      18              : #include <boost/program_options.hpp>
      19              : 
      20              : using namespace dunedaq::oks;
      21              : 
      22              : int
      23            0 : main(int argc, char **argv)
      24              : {
      25            0 :   std::string config_version, user_dir, branch_name;
      26            0 :   bool verbose = false;
      27              : 
      28            0 :   try
      29              :     {
      30            0 :       boost::program_options::options_description desc("Clone and checkout oks repository.\n\n"
      31              :           "By default the master branch is checkout. The \"branch\" command line option can be used to specify particular one. A branch will be created, if does not exist yet.\n"
      32              :           "TDAQ_DB_VERSION process environment variable or \"version\" command line option can be used to specify particular version.\n"
      33              :           "The output directory can be specified via command line, otherwise temporal directory will be created and its name will be reported.\n"
      34              :           "If TDAQ_DB_USER_REPOSITORY process environment variable is set, the utility makes no effect.\n\n"
      35            0 :           "The command line options are");
      36              : 
      37            0 :       std::vector<std::string> app_types_list;
      38            0 :       std::vector<std::string> segments_list;
      39              : 
      40            0 :       desc.add_options()
      41            0 :         ("branch,b", boost::program_options::value<std::string>(&branch_name), "checkout or create given branch name")
      42            0 :         ("version,e", boost::program_options::value<std::string>(&config_version), "oks config version in type:value format, where type is \"hash\", \"date\" or \"tag\"")
      43            0 :         ("output-directory,o", boost::program_options::value<std::string>(&user_dir), "output directory; if not defined, create temporal")
      44            0 :         ("verbose,v", "print verbose information")
      45            0 :         ("help,h", "print help message");
      46              : 
      47            0 :       boost::program_options::variables_map vm;
      48            0 :       boost::program_options::store(boost::program_options::parse_command_line(argc, argv, desc), vm);
      49              : 
      50            0 :       if (vm.count("help"))
      51              :         {
      52            0 :           std::cout << desc << std::endl;
      53            0 :           return EXIT_SUCCESS;
      54              :         }
      55              : 
      56            0 :       if (vm.count("verbose"))
      57            0 :         verbose = true;
      58              : 
      59            0 :       boost::program_options::notify(vm);
      60            0 :     }
      61            0 :   catch (std::exception& ex)
      62              :     {
      63            0 :       std::cerr << "Command line parsing errors occurred:\n" << ex.what() << std::endl;
      64            0 :       return EXIT_FAILURE;
      65            0 :     }
      66              : 
      67            0 :   if (!getenv("TDAQ_DB_USER_REPOSITORY"))
      68              :     {
      69            0 :       if(!user_dir.empty())
      70            0 :         setenv("TDAQ_DB_USER_REPOSITORY_PATH", user_dir.c_str(), 1);
      71              : 
      72            0 :       OksKernel k(user_dir.empty() && !verbose, verbose, false, true, config_version.empty() ? nullptr : config_version.c_str(), branch_name);
      73              : 
      74            0 :       if (!k.get_user_repository_root().empty())
      75              :         {
      76            0 :           k.unset_repository_created();
      77              : 
      78            0 :           if (user_dir.empty())
      79            0 :             std::cout << k.get_user_repository_root() << std::endl;
      80              :         }
      81            0 :     }
      82              : 
      83              :   return EXIT_SUCCESS;
      84            0 : }
        

Generated by: LCOV version 2.0-1