summaryrefslogtreecommitdiff
path: root/ci/ciimage/common.sh
blob: 0169182408d514b2de490846bfc49c7fb34e27e6 (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
#!/bin/bash

###
### Common functions for CI builder files.
### All functions can be accessed in install.sh via:
###
### $ source /ci/common.sh
###

set -e
set -x

base_python_pkgs=(
  pytest
  pytest-xdist
  pytest-subtests
  coverage
  fastjsonschema
)

python_pkgs=(
  cython
  gobject
  PyGObject
  lxml
  gcovr
)

dub_fetch() {
  set +e
  for (( i=1; i<=24; ++i )); do
    dub fetch "$@"
    (( $? == 0 )) && break

    echo "Dub Fetch failed. Retrying in $((i*5))s"
    sleep $((i*5))
  done
  set -e
}

install_minimal_python_packages() {
  rm -f /usr/lib*/python3.*/EXTERNALLY-MANAGED
  python3 -m pip install "${base_python_pkgs[@]}" $*
}

install_python_packages() {
  rm -f /usr/lib*/python3.*/EXTERNALLY-MANAGED
  python3 -m pip install "${base_python_pkgs[@]}" "${python_pkgs[@]}" $*
}