Show More
@@ -0,0 +1,19 b'' | |||||
|
1 | #!/bin/sh -eu | |||
|
2 | ||||
|
3 | # This function exists to set up the DOCKER variable and verify that | |||
|
4 | # it's the binary we expect. It also verifies that the docker service | |||
|
5 | # is running on the system and we can talk to it. | |||
|
6 | function checkdocker() { | |||
|
7 | if which docker.io >> /dev/null 2>&1 ; then | |||
|
8 | DOCKER=docker.io | |||
|
9 | elif which docker >> /dev/null 2>&1 ; then | |||
|
10 | DOCKER=docker | |||
|
11 | else | |||
|
12 | echo "Error: docker must be installed" | |||
|
13 | exit 1 | |||
|
14 | fi | |||
|
15 | ||||
|
16 | $DOCKER -h 2> /dev/null | grep -q Jansens && { echo "Error: $DOCKER is the Docking System Tray - install docker.io instead"; exit 1; } | |||
|
17 | $DOCKER version | grep -q "^Client version:" || { echo "Error: unexpected output from \"$DOCKER version\""; exit 1; } | |||
|
18 | $DOCKER version | grep -q "^Server version:" || { echo "Error: could not get docker server version - check it is running and your permissions"; exit 1; } | |||
|
19 | } |
@@ -1,57 +1,48 b'' | |||||
1 | #!/bin/bash -e |
|
1 | #!/bin/bash -e | |
2 |
|
2 | |||
|
3 | . $(dirname $0)/dockerlib.sh | |||
|
4 | ||||
3 | BUILDDIR=$(dirname $0) |
|
5 | BUILDDIR=$(dirname $0) | |
4 | ROOTDIR=$(cd $BUILDDIR/..; pwd) |
|
6 | ROOTDIR=$(cd $BUILDDIR/..; pwd) | |
5 |
|
7 | |||
6 | if which docker.io >> /dev/null 2>&1 ; then |
|
8 | checkdocker | |
7 | DOCKER=docker.io |
|
|||
8 | elif which docker >> /dev/null 2>&1 ; then |
|
|||
9 | DOCKER=docker |
|
|||
10 | else |
|
|||
11 | echo "Error: docker must be installed" |
|
|||
12 | exit 1 |
|
|||
13 | fi |
|
|||
14 |
|
||||
15 | $DOCKER -h 2> /dev/null | grep -q Jansens && { echo "Error: $DOCKER is the Docking System Tray - install docker.io instead"; exit 1; } |
|
|||
16 | $DOCKER version | grep -q "^Client version:" || { echo "Error: unexpected output from \"$DOCKER version\""; exit 1; } |
|
|||
17 | $DOCKER version | grep -q "^Server version:" || { echo "Error: could not get docker server version - check it is running and your permissions"; exit 1; } |
|
|||
18 |
|
9 | |||
19 | PLATFORM="$1" |
|
10 | PLATFORM="$1" | |
20 | [ "$PLATFORM" ] || { echo "Error: platform name must be specified"; exit 1; } |
|
11 | [ "$PLATFORM" ] || { echo "Error: platform name must be specified"; exit 1; } | |
21 | shift # extra params are passed to buildrpm |
|
12 | shift # extra params are passed to buildrpm | |
22 |
|
13 | |||
23 | DFILE="$ROOTDIR/contrib/docker/$PLATFORM" |
|
14 | DFILE="$ROOTDIR/contrib/docker/$PLATFORM" | |
24 | [ -f "$DFILE" ] || { echo "Error: docker file $DFILE not found"; exit 1; } |
|
15 | [ -f "$DFILE" ] || { echo "Error: docker file $DFILE not found"; exit 1; } | |
25 |
|
16 | |||
26 | CONTAINER="hg-dockerrpm-$PLATFORM" |
|
17 | CONTAINER="hg-dockerrpm-$PLATFORM" | |
27 |
|
18 | |||
28 | DBUILDUSER=build |
|
19 | DBUILDUSER=build | |
29 | ( |
|
20 | ( | |
30 | cat $DFILE |
|
21 | cat $DFILE | |
31 | echo RUN groupadd $DBUILDUSER -g `id -g` |
|
22 | echo RUN groupadd $DBUILDUSER -g `id -g` | |
32 | echo RUN useradd $DBUILDUSER -u `id -u` -g $DBUILDUSER |
|
23 | echo RUN useradd $DBUILDUSER -u `id -u` -g $DBUILDUSER | |
33 | ) | $DOCKER build --tag $CONTAINER - |
|
24 | ) | $DOCKER build --tag $CONTAINER - | |
34 |
|
25 | |||
35 | RPMBUILDDIR=$ROOTDIR/packages/$PLATFORM |
|
26 | RPMBUILDDIR=$ROOTDIR/packages/$PLATFORM | |
36 | contrib/buildrpm --rpmbuilddir $RPMBUILDDIR --prepare $* |
|
27 | contrib/buildrpm --rpmbuilddir $RPMBUILDDIR --prepare $* | |
37 |
|
28 | |||
38 | DSHARED=/mnt/shared |
|
29 | DSHARED=/mnt/shared | |
39 | $DOCKER run -u $DBUILDUSER --rm -v $RPMBUILDDIR:$DSHARED $CONTAINER \ |
|
30 | $DOCKER run -u $DBUILDUSER --rm -v $RPMBUILDDIR:$DSHARED $CONTAINER \ | |
40 | rpmbuild --define "_topdir $DSHARED" -ba $DSHARED/SPECS/mercurial.spec --clean |
|
31 | rpmbuild --define "_topdir $DSHARED" -ba $DSHARED/SPECS/mercurial.spec --clean | |
41 |
|
32 | |||
42 | $DOCKER run -u $DBUILDUSER --rm -v $RPMBUILDDIR:$DSHARED $CONTAINER \ |
|
33 | $DOCKER run -u $DBUILDUSER --rm -v $RPMBUILDDIR:$DSHARED $CONTAINER \ | |
43 | createrepo $DSHARED |
|
34 | createrepo $DSHARED | |
44 |
|
35 | |||
45 | cat << EOF > $RPMBUILDDIR/mercurial.repo |
|
36 | cat << EOF > $RPMBUILDDIR/mercurial.repo | |
46 | # Place this file in /etc/yum.repos.d/mercurial.repo |
|
37 | # Place this file in /etc/yum.repos.d/mercurial.repo | |
47 | [mercurial] |
|
38 | [mercurial] | |
48 | name=Mercurial packages for $PLATFORM |
|
39 | name=Mercurial packages for $PLATFORM | |
49 | # baseurl=file://$RPMBUILDDIR/ |
|
40 | # baseurl=file://$RPMBUILDDIR/ | |
50 | baseurl=http://hg.example.com/build/$PLATFORM/ |
|
41 | baseurl=http://hg.example.com/build/$PLATFORM/ | |
51 | skip_if_unavailable=True |
|
42 | skip_if_unavailable=True | |
52 | gpgcheck=0 |
|
43 | gpgcheck=0 | |
53 | enabled=1 |
|
44 | enabled=1 | |
54 | EOF |
|
45 | EOF | |
55 |
|
46 | |||
56 | echo |
|
47 | echo | |
57 | echo "Build complete - results can be found in $RPMBUILDDIR" |
|
48 | echo "Build complete - results can be found in $RPMBUILDDIR" |
General Comments 0
You need to be logged in to leave comments.
Login now