nbos

nbos

https://git.tonybtw.com/nbos.git git://git.tonybtw.com/nbos.git
843 bytes raw
1
#include "realize.h"
2
3
#include "build.h"
4
5
/**
6
 * realize() - Build every resolved package into the store.
7
 * @a: Arena for transient allocations.
8
 * @all_pkgs: Full package list (passed through to build_pkg()).
9
 * @resolved: Topologically-sorted resolved list. Builds happen in order.
10
 *
11
 * Stops at the first failure and returns its error.
12
 *
13
 * Return: REALIZE_OK_VAL on success, the failing package's error otherwise.
14
 */
15
realize_error realize(
16
    arena              *a,
17
    const pkg_refs     *all_pkgs,
18
    const resolved_list *resolved
19
) {
20
    for (size_t i = 0; i < resolved->len; i++) {
21
        realize_error err = build_pkg(
22
            a,
23
            resolved->data[i].def,
24
            all_pkgs,
25
            resolved->data,
26
            i
27
        );
28
        if (err.kind != REALIZE_OK) return err;
29
    }
30
    return REALIZE_OK_VAL;
31
}