aboutsummaryrefslogtreecommitdiff
path: root/scenarios/fragments/flavor.py
blob: eeb8345c4f167253088cfec3da2a158cbfd89dab (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
from pathlib import Path
from . import shared
from os.path import exists

def add_path(d):
    for flav, desc in d.items():
        if "path" in desc: continue
        binary = f"garage-{desc['target']}-{desc['version']}"
        desc['path'] = Path(shared.binary_path) / binary
    return d

garage = add_path({
    "garage-local": { "path": "./garage/target/release/garage" },
    "garage-v0.7": { 
        "version": "v0.7.3", 
        "target": "x86_64-unknown-linux-musl", 
    },
    "garage-v0.8": { "version": "89b8087ba81c508ba382aa6c9cb6bb3afa6a43c8", "target": "x86_64-unknown-linux-musl" },
})

warp = {
    "warp-fast": "mixed --obj.size 5M --objects 200 --duration=1m",
    "warp-default": "mixed"
}


def download():
    for flav, desc in garage.items():
        if "version" not in desc: continue
        if exists(desc['path']): continue

        shared.exec(f"mkdir -p {shared.binary_path}")
        shared.exec(f"wget https://garagehq.deuxfleurs.fr/_releases/{desc['version']}/{desc['target']}/garage -O {desc['path']}")
        shared.exec(f"chmod +x {desc['path']}")
        shared.exec(f"{desc['path']} --version")