aboutsummaryrefslogtreecommitdiff
path: root/include/omc.h
blob: 99e2ebab62a20d4478c95ca5a6ff3a09f7bc6519 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
//! @file omc.h
#ifndef OMC_OMC_H
#define OMC_OMC_H

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <unistd.h>
#include <time.h>
#include <sys/statvfs.h>

#define SYSERROR stderr, "%s:%s:%d: %s\n", path_basename(__FILE__), __FUNCTION__, __LINE__, strerror(errno)
#define OMC_BUFSIZ 8192
#define OMC_NAME_MAX 255
#define OMC_DIRSTACK_MAX 1024
#define OMC_TIME_STR_MAX 128
#define HTTP_ERROR(X) X >= 400

#include "config.h"
#include "template.h"

#include "utils.h"
#include "copy.h"
#include "ini.h"
#include "conda.h"
#include "environment.h"
#include "artifactory.h"
#include "docker.h"
#include "deliverable.h"
#include "str.h"
#include "strlist.h"
#include "system.h"
#include "download.h"
#include "recipe.h"
#include "relocation.h"

#define guard_runtime_free(X) if (X) { runtime_free(X); X = NULL; }
#define guard_strlist_free(X) if (X) { strlist_free(X); X = NULL; }
#define guard_free(X) if (X) { free(X); X = NULL; }

#define COE_CHECK_ABORT(COND, MSG) {\
    if (COND) { \
        msg(OMC_MSG_ERROR, MSG ": Aborting execution (--continue-on-error/-C is not enabled)\n"); \
        exit(1); \
    } \
}

struct OMC_GLOBAL {
    bool verbose; //!< Enable verbose output
    bool always_update_base_environment; //!< Update base environment immediately after activation
    bool continue_on_error; //!< Do not stop on test failures
    bool conda_fresh_start; //!< Always install a new copy of Conda
    struct StrList *conda_packages; //!< Conda packages to install after initial activation
    struct StrList *pip_packages; //!< Pip packages to install after initial activation
    char *tmpdir; //!< Path to temporary storage directory
    char *conda_install_prefix; //!< Path to install conda
    char *sysconfdir; //!< Path where OMC reads its configuration files (mission directory, etc)
    struct Jfrog {
        char *jfrog_artifactory_base_url;
        char *jfrog_artifactory_product;
        char *cli_major_ver;
        char *version;
        char *os;
        char *arch;
        char *remote_filename;
        char *repo;
    } jfrog;
};

/**
 * Free memory allocated in global configuration structure
 */
void globals_free();

#endif //OMC_OMC_H