7 #ifndef COMPATIBILITY_AGENT_UTILS_HPP
8 #define COMPATIBILITY_AGENT_UTILS_HPP
10 #define AGENT_NAME "compatibility"
11 #define AGENT_DESC "compatibility agent"
12 #define AGENT_ARS "compatibility_ars"
18 #include <boost/program_options.hpp>
19 #include "yaml-cpp/yaml.h"
20 #include "json/json.h"
37 void bail(
int exitval);
42 std::string& types, std::string& rules,
string& jFile,
44 void appendToJson(
const std::vector<tuple<string, string, bool>>& resultPair,
45 const std::string& fileName,
bool& printComma);
47 const std::vector<tuple<string, string, bool>>& resultPair,
48 const std::string& fileName);
51 const string& second_name,
const string& second_type,
52 const map<tuple<string, string, string, string>,
bool>& rule_list);
54 const string& file_location);
56 const string& file_location);
Database handler for COMPATIBILITY.
map< tuple< string, string, string, string >, bool > initialize_rule_list(const string &file_location)
Read YAML file of rules and parse it as map.
unordered_map< string, string > initialize_license_map(const string &file_location)
Parse license type CSV and create a map.
bool processUploadId(const CompatibilityState &state, int uploadId, CompatibilityDatabaseHandler &databaseHandler, int groupId)
bool parseCliOptions(int argc, char **argv, CompatibilityCliOptions &dest, std::string &types, std::string &rules, string &jFile, string &mainLicense)
Parse the options sent by CLI to CliOptions object.
void printResultToStdout(const std::vector< tuple< string, string, bool >> &resultPair, const std::string &fileName)
CompatibilityState getState(DbManager &dbManager, CompatibilityCliOptions &&cliOptions)
Create a new state for the current agent based on CliOptions.
int writeARS(const CompatibilityState &state, int arsId, int uploadId, int success, DbManager &dbManager)
int queryAgentId(DbManager &dbManager)
std::set< std::string > mainLicenseToSet(const string &mainLicense)
void appendToJson(const std::vector< tuple< string, string, bool >> &resultPair, const std::string &fileName, bool &printComma)
bool are_licenses_compatible(const string &first_name, const string &first_type, const string &second_name, const string &second_type, const map< tuple< string, string, string, string >, bool > &rule_list)
Check the licenses against rules and get the compatibility result.
Store the options sent through the CLI.
Store the state of the agent.
The main FOSSology CPP library.
The main FOSSology C library.
fo_dbManager * dbManager
fo_dbManager object