File: recipe.sh

package info (click to toggle)
mercurial 7.1.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 45,080 kB
  • sloc: python: 208,589; ansic: 56,460; tcl: 3,715; sh: 1,839; lisp: 1,483; cpp: 864; makefile: 769; javascript: 649; xml: 36
file content (35 lines) | stat: -rwxr-xr-x 987 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
#!/usr/bin/env bash
: ${HG_CI_REG:=registry.heptapod.net/mercurial/ci-images}
: ${HG_CI_IMAGE_TAG:=v3.3}


# find repo-root without calling hg as this might be run with sudo
THIS="$(readlink -m "$0")"
HERE="$(dirname "$THIS")"
HG_ROOT="$(readlink -m "$HERE"/../../..)"
echo source mercurial repository: "$HG_ROOT"

# find actual user as this might be run with sudo
if [ -n "$SUDO_UID" ]; then
    ACTUAL_UID="$SUDO_UID"
else
    ACTUAL_UID="$(id -u)"
fi
if [ -n "$SUDO_GID" ]; then
    ACTUAL_GID="$SUDO_GID"
else
    ACTUAL_GID="$(id -g)"
fi
echo using user "$ACTUAL_UID:$ACTUAL_GID"
if groups | egrep -q '\<(docker|root)\>' ; then
    docker run --rm -it \
        --user "$ACTUAL_UID:$ACTUAL_GID" \
        -v "$HG_ROOT:/tmp/mercurial-ci" \
        -w "/tmp/mercurial-ci" \
        "$HG_CI_REG/hg-core-pytype:$HG_CI_IMAGE_TAG" \
        ./contrib/check-pytype.sh $1
else
    echo "user not in the docker group" >&2
    echo "(consider running this with \`sudo\`)" >&2
    exit 255
fi