File: build.bash

package info (click to toggle)
bladerf 0.2017.12~rc1-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 14,620 kB
  • sloc: ansic: 50,123; vhdl: 12,873; python: 1,062; tcl: 1,060; xml: 1,017; makefile: 657; sh: 589; csh: 18; cpp: 9
file content (66 lines) | stat: -rw-r--r-- 1,410 bytes parent folder | download
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
#!/usr/bin/env bash

# assuming the script is 3 levels in (host/misc/docker)
dfdir=$(dirname "${0}")
basedir=${dfdir}/../../..

success=""
failure=""

rels=""

if [ $# -gt 0 ]; then
    rels=$*
else
    for dff in $(ls ${dfdir}/*.Dockerfile); do
        rels="${rels} $(basename -s ".Dockerfile" ${dff})"
    done
fi

if [ -z "${rels}" ]; then
    echo "could not find any Dockerfiles to build!"
    exit 1
fi

echo "*** $0: build goals: ${rels}"

for df in ${rels}; do
    rel=$(basename -s ".Dockerfile" ${df})
    echo "*** ${rel}: building"
    cd ${basedir}

    echo -e '\033]2;'${rel} - building'\007'

    docker build -f host/misc/docker/${rel}.Dockerfile \
                 -t nuand/bladerf-buildenv:${rel} \
                 .
    status=$?

    if [ $status -ne 0 ]; then
        echo "*** ${rel}: BUILD FAILED"
        failure="${failure} ${rel}"
        continue
    else
        echo "*** ${rel}: build successful"
    fi

    echo -e '\033]2;'${rel} - testing'\007'

    docker run --rm -t nuand/bladerf-buildenv:${rel} bladeRF-cli --version
    status=$?

    if [ $status -ne 0 ]; then
        echo "*** ${rel}: TEST FAILED"
        failure="${failure} ${rel}"
        continue
    else
        echo "*** ${rel}: test successful"
    fi

    echo "*** ${rel}: PASSED"
    success="${success} ${rel}"
done

echo "RESULTS:"
echo "Successful builds: ${success}"
echo "Failed builds: ${failure}"