aboutsummaryrefslogtreecommitdiff
path: root/spm.c
blob: ec8b7baca209bfb626aa0728cf4b76b2c5e4a027 (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
/**
 * SPM - Simple Package Manager
 * @file spm.c
 */
#include "spm.h"

int main(int argc, char *argv[]) {
    // not much to see here yet
    // at the moment this will all be random tests, for better or worse
    // everything here is subject to change without notice

    // Initialize configuration data
    init_config_global();
    show_global_config();

    // Ensure external programs are available for use.
    check_runtime_environment();

    // Install a package to test things out
    const char *root = "/tmp/root";
    const char *package = "python";

    Dependencies *deps = NULL;
    dep_init(&deps);
    dep_all(&deps, package);
    printf("%s requires:\n", package);
    dep_show(&deps);

    // Install dependencies first
    for (int i = 0; i < deps->records; i++) {
        install(root, deps->list[i]);
    }
    // Install package
    install(root, package);

    dep_free(&deps);
    free_global_config();
    return 0;
}