aboutsummaryrefslogtreecommitdiff
path: root/include/deliverable.h
blob: 1487ace05fe5217fb0244de09eef20ec2f121f4f (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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
//
// Created by jhunk on 10/5/23.
//

#ifndef OHMYCAL_DELIVERABLE_H
#define OHMYCAL_DELIVERABLE_H

#include <string.h>
#include <stdbool.h>
#include <unistd.h>
#include <sys/utsname.h>
#include "str.h"
#include "ini.h"
#include "environment.h"

#define DELIVERY_DIR "delivery"
#define DELIVERY_PLATFORM_MAX 4
#define DELIVERY_PLATFORM_MAXLEN 65
#define DELIVERY_PLATFORM 0
#define DELIVERY_PLATFORM_CONDA_SUBDIR 1
#define DELIVERY_PLATFORM_CONDA_INSTALLER 2
#define DELIVERY_PLATFORM_RELEASE 3

#define INSTALL_PKG_CONDA 1 << 1
#define INSTALL_PKG_CONDA_DEFERRED 1 << 2
#define INSTALL_PKG_PIP 1 << 3
#define INSTALL_PKG_PIP_DEFERRED 1 << 4

struct Delivery {
    struct System {
        char *arch;
        char platform[DELIVERY_PLATFORM_MAX][DELIVERY_PLATFORM_MAXLEN];
    } system;
    struct Storage {
        char *delivery_dir;
        char *conda_install_prefix;
        char *conda_artifact_dir;
        char *conda_staging_dir;
        char *conda_staging_url;
        char *wheel_artifact_dir;
        char *wheel_staging_dir;
        char *wheel_staging_url;
        char *build_dir;
        char *build_recipes_dir;
        char *build_sources_dir;
        char *build_testing_dir;
    } storage;
    struct Meta {
        // delivery name
        char *name;
        // delivery version
        char *version;
        // build iteration
        int rc;
        // version of python to use
        char *python;
        // URL to previous final configuration
        char *based_on;
        // hst, jwst, roman
        char *mission;
        // HST uses codenames
        char *codename;
        // is this a final release?
        bool final;
        // keep going, or don't
        bool continue_on_error;
    } meta;

    struct Conda {
        char *installer_baseurl;
        char *installer_name;
        char *installer_version;
        char *installer_platform;
        char *installer_arch;
        // packages to install
        struct StrList *conda_packages;
        // conda recipes to be built
        struct StrList *conda_packages_defer;
        // packages to install
        struct StrList *pip_packages;
        // packages to be built
        struct StrList *pip_packages_defer;
    } conda;

    // global runtime variables
    struct Runtime {
        RuntimeEnv *environ;
    } runtime;

    struct Test {
        char *name;
        char *version;
        char *repository;
        char *script;
        char *build_recipe;
        // test-specific runtime variables
        struct Runtime runtime;
    } tests[1000];
};

int delivery_init(struct Delivery *ctx, struct INIFILE *ini, struct INIFILE *cfg);
void delivery_meta_show(struct Delivery *ctx);
void delivery_conda_show(struct Delivery *ctx);
void delivery_tests_show(struct Delivery *ctx);
int delivery_build_recipes(struct Delivery *ctx);
struct StrList *delivery_build_wheels(struct Delivery *ctx);
int delivery_index_wheel_artifacts(struct Delivery *ctx);
void delivery_rewrite_spec(struct Delivery *ctx, char *filename);
int delivery_copy_wheel_artifacts(struct Delivery *ctx);
int delivery_copy_conda_artifacts(struct Delivery *ctx);
void delivery_get_installer(char *installer_url);
void delivery_get_installer_url(struct Delivery *delivery, char *result);
void delivery_install_packages(struct Delivery *ctx, char *conda_install_dir, char *env_name, int type, struct StrList *manifest[]);
int delivery_index_conda_artifacts(struct Delivery *ctx);
void delivery_tests_run(struct Delivery *ctx);

#endif //OHMYCAL_DELIVERABLE_H