Show More
@@ -1,60 +1,55 b'' | |||||
1 | #!/bin/bash -e |
|
1 | #!/bin/bash -e | |
2 |
|
2 | |||
3 | BUILDDIR=$(dirname $0) |
|
3 | BUILDDIR=$(dirname $0) | |
4 | export ROOTDIR=$(cd $BUILDDIR/../..; pwd) |
|
4 | export ROOTDIR=$(cd $BUILDDIR/../..; pwd) | |
5 |
|
5 | |||
6 | PLATFORM="$1" |
|
6 | PLATFORM="$1" | |
7 | shift # extra params are passed to buildrpm |
|
7 | shift # extra params are passed to buildrpm | |
8 |
|
8 | |||
9 | DOCKERFILE="$PLATFORM" |
|
9 | DOCKERFILE="$PLATFORM" | |
10 | OS_RELEASE="${PLATFORM//[a-z]/}" |
|
10 | OS_RELEASE="${PLATFORM//[a-z]/}" | |
11 | case "$PLATFORM" in |
|
11 | case "$PLATFORM" in | |
12 | fedora*) |
|
12 | fedora*) | |
13 | DOCKERFILE="${PLATFORM//[0-9]/}.template" |
|
13 | DOCKERFILE="${PLATFORM//[0-9]/}.template" | |
14 | ;; |
|
14 | ;; | |
15 | esac |
|
15 | esac | |
16 |
|
16 | |||
17 | DOCKER=$($BUILDDIR/hg-docker docker-path) |
|
17 | DOCKER=$($BUILDDIR/hg-docker docker-path) | |
18 |
|
18 | |||
19 | CONTAINER=hg-docker-$PLATFORM |
|
19 | CONTAINER=hg-docker-$PLATFORM | |
20 |
|
20 | |||
21 | if [[ -z "${HG_DOCKER_OWN_USER}" ]]; then |
|
21 | DOCKERUID=$(id -u) | |
22 | DOCKERUID=1000 |
|
22 | DOCKERGID=$(id -g) | |
23 | DOCKERGID=1000 |
|
|||
24 | else |
|
|||
25 | DOCKERUID=$(id -u) |
|
|||
26 | DOCKERGID=$(id -g) |
|
|||
27 | fi |
|
|||
28 |
|
23 | |||
29 | $BUILDDIR/hg-docker build \ |
|
24 | $BUILDDIR/hg-docker build \ | |
30 | --build-arg UID=$DOCKERUID \ |
|
25 | --build-arg UID=$DOCKERUID \ | |
31 | --build-arg GID=$DOCKERGID \ |
|
26 | --build-arg GID=$DOCKERGID \ | |
32 | --build-arg OS_RELEASE=${OS_RELEASE:-latest} \ |
|
27 | --build-arg OS_RELEASE=${OS_RELEASE:-latest} \ | |
33 | $BUILDDIR/docker/$DOCKERFILE $CONTAINER |
|
28 | $BUILDDIR/docker/$DOCKERFILE $CONTAINER | |
34 |
|
29 | |||
35 | RPMBUILDDIR=$ROOTDIR/packages/$PLATFORM |
|
30 | RPMBUILDDIR=$ROOTDIR/packages/$PLATFORM | |
36 | mkdir -p $RPMBUILDDIR |
|
31 | mkdir -p $RPMBUILDDIR | |
37 | $ROOTDIR/contrib/packaging/buildrpm --rpmbuilddir $RPMBUILDDIR --prepare $* |
|
32 | $ROOTDIR/contrib/packaging/buildrpm --rpmbuilddir $RPMBUILDDIR --prepare $* | |
38 |
|
33 | |||
39 | DSHARED=/mnt/shared |
|
34 | DSHARED=/mnt/shared | |
40 | DBUILDUSER=build |
|
35 | DBUILDUSER=build | |
41 |
|
36 | |||
42 | $DOCKER run -e http_proxy -e https_proxy -u $DBUILDUSER --rm -v $RPMBUILDDIR:$DSHARED $CONTAINER \ |
|
37 | $DOCKER run -e http_proxy -e https_proxy -u $DBUILDUSER --rm -v $RPMBUILDDIR:$DSHARED $CONTAINER \ | |
43 | rpmbuild --define "_topdir $DSHARED" -ba $DSHARED/SPECS/mercurial.spec --clean |
|
38 | rpmbuild --define "_topdir $DSHARED" -ba $DSHARED/SPECS/mercurial.spec --clean | |
44 |
|
39 | |||
45 | $DOCKER run -e http_proxy -e https_proxy -u $DBUILDUSER --rm -v $RPMBUILDDIR:$DSHARED $CONTAINER \ |
|
40 | $DOCKER run -e http_proxy -e https_proxy -u $DBUILDUSER --rm -v $RPMBUILDDIR:$DSHARED $CONTAINER \ | |
46 | createrepo $DSHARED |
|
41 | createrepo $DSHARED | |
47 |
|
42 | |||
48 | cat << EOF > $RPMBUILDDIR/mercurial.repo |
|
43 | cat << EOF > $RPMBUILDDIR/mercurial.repo | |
49 | # Place this file in /etc/yum.repos.d/mercurial.repo |
|
44 | # Place this file in /etc/yum.repos.d/mercurial.repo | |
50 | [mercurial] |
|
45 | [mercurial] | |
51 | name=Mercurial packages for $PLATFORM |
|
46 | name=Mercurial packages for $PLATFORM | |
52 | # baseurl=file://$RPMBUILDDIR/ |
|
47 | # baseurl=file://$RPMBUILDDIR/ | |
53 | baseurl=http://hg.example.com/build/$PLATFORM/ |
|
48 | baseurl=http://hg.example.com/build/$PLATFORM/ | |
54 | skip_if_unavailable=True |
|
49 | skip_if_unavailable=True | |
55 | gpgcheck=0 |
|
50 | gpgcheck=0 | |
56 | enabled=1 |
|
51 | enabled=1 | |
57 | EOF |
|
52 | EOF | |
58 |
|
53 | |||
59 | echo |
|
54 | echo | |
60 | echo "Build complete - results can be found in $RPMBUILDDIR" |
|
55 | echo "Build complete - results can be found in $RPMBUILDDIR" |
General Comments 0
You need to be logged in to leave comments.
Login now