summaryrefslogtreecommitdiffstats
path: root/examples/packages/repo/pkg.toml
blob: cdd6a6ce336e4f533372591ea67fa51131890bce (plain)
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
version_is_semver = false
patches = []

[dependencies]
build = []
runtime = []

[sources.src]
hash.type = "sha1"
download_manually = false

[phases]

sourcecheck.script = '''
    filename="/inputs/src-{{this.sources.src.hash.hash}}.source"
    [[ -e $filename ]] || {
        echo  "MISSING: $filename"
        {{state "ERR" "Missing input"}}
        exit 1
    }
'''

patchcheck.script = '''
    {{#if this.patches[0]}}
        {{#each this.patches}}
            if [[ ! -e "/patches/{{this}}" ]]; then
                echo "Does not exist: /patches/{{this}}"
                {{state "ERR" "Missing patch"}}
                exit 1
            fi
        {{/each}}
    {{/if}}
'''

depcheck.script = '''
    {{#each this.dependencies.runtime}}
        # Try to find sha of dependency {{this}}
        exp_sha="$(echo {{this}} | sed 's,.*\ =,,' | sha1sum | sed 's,\ \ -,,')"
        sha1sum /inputs/*pkg | grep "$exp_sha" || {
            echo "FAILED TO FIND SHA: $exp_sha"
            {{state "ERR" "Failed to find SHA"}}
            exit 1
        }
    {{/each}}
'''

build.script = '''
    mkdir /outputs
    echo "{{this.version}}" > /outputs/{{this.name}}-{{this.version}}.pkg

    {{state "OK"}}
'''