FOSSology  4.4.0
Open Source License Compliance by Open Source Software
libfodbreposysconf.c File Reference

api for db, sysconfig, repo. you can create/drop a DB/sysconfig/repo More...

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <libfossscheduler.h>
#include <libfossdb.h>
#include "libfodbreposysconf.h"
Include dependency graph for libfodbreposysconf.c:

Go to the source code of this file.

Macros

#define TESTDBDIR   "../../../testing/db/"
 
#define CREATEDB   TESTDBDIR "/createTestDB.php"
 

Functions

fo_dbManagercreateTestEnvironment (const char *srcDirs, const char *doConnectAsAgent, int initDbTables)
 
void dropTestEnvironment (fo_dbManager *dbManager, const char *srcDir, const char *doConnectAsAgent)
 
static void command_output (char *command)
 get command output More...
 
int create_db_repo_sysconf (int type, char *agent_name, char *sysconfdir)
 
void drop_db_repo_sysconf (char *DBName)
 drop db, sysconfig dir and repo More...
 
char * get_test_name ()
 get the test name just created by create_db_repo_sysconf() More...
 
char * get_db_name ()
 get the DB name just created by create_db_repo_sysconf() More...
 
char * get_sysconfdir ()
 get sysconfig dir path just created by create_db_repo_sysconf() More...
 
char * get_dbconf ()
 get Db.conf path just created by create_db_repo_sysconf() More...
 
char * get_confFile ()
 
char * get_repodir ()
 get repo path just created by create_db_repo_sysconf() More...
 
char * createTestConfDir (char *cwd, char *agentName)
 create a dummy sysConfDir for a given agent More...
 

Variables

static char * Sysconf = NULL
 
static char DBName [ARRAY_LENGTH]
 
static char DBConf [ARRAY_LENGTH]
 
static char RepoDir [ARRAY_LENGTH]
 
static char confFile [ARRAY_LENGTH]
 

Detailed Description

api for db, sysconfig, repo. you can create/drop a DB/sysconfig/repo

Definition in file libfodbreposysconf.c.

Function Documentation

◆ command_output()

static void command_output ( char *  command)
static

get command output

Parameters
char*command - the command will be executed

Definition at line 121 of file libfodbreposysconf.c.

◆ create_db_repo_sysconf()

int create_db_repo_sysconf ( int  type,
char *  agent_name,
char *  sysconfdir 
)

\biref create DB, the db name looks like fosstestxxxxx

Parameters
inttype - 0 on create db, sysconf dir and repository, the db is empty 1 on create db, sysconf dir and repository, the db is initialized
Returns
0 on sucess, other on failure

Definition at line 154 of file libfodbreposysconf.c.

◆ createTestConfDir()

char* createTestConfDir ( char *  cwd,
char *  agentName 
)

create a dummy sysConfDir for a given agent

Parameters
char*cwd - Current directory of the agent's Unit test
char*agentName - Name of the agent for which the directory is to be created
Returns
repo path

Definition at line 338 of file libfodbreposysconf.c.

◆ drop_db_repo_sysconf()

void drop_db_repo_sysconf ( char *  DBName)

drop db, sysconfig dir and repo

Parameters
char*DBName - the db name, looks like fosstestxxxx

Definition at line 227 of file libfodbreposysconf.c.

◆ get_db_name()

char* get_db_name ( )

get the DB name just created by create_db_repo_sysconf()

Returns
the DB name

Definition at line 261 of file libfodbreposysconf.c.

◆ get_dbconf()

char* get_dbconf ( )

get Db.conf path just created by create_db_repo_sysconf()

Returns
Db.conf path

Definition at line 288 of file libfodbreposysconf.c.

◆ get_repodir()

char* get_repodir ( )

get repo path just created by create_db_repo_sysconf()

Returns
repo path

Definition at line 304 of file libfodbreposysconf.c.

◆ get_sysconfdir()

char* get_sysconfdir ( )

get sysconfig dir path just created by create_db_repo_sysconf()

Returns
the sysconfig dir path

Definition at line 276 of file libfodbreposysconf.c.

◆ get_test_name()

char* get_test_name ( )

get the test name just created by create_db_repo_sysconf()

Returns
the test name

Definition at line 248 of file libfodbreposysconf.c.