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