##// END OF EJS Templates
Added tag 3.3.1 for changeset 5b4ed033390b
Added tag 3.3.1 for changeset 5b4ed033390b

File last commit:

r23124:4c490626 stable
r24160:b9ae778d stable
Show More
dockerrpm
57 lines | 1.8 KiB | text/plain | TextLexer
Mads Kiilerich
dockerrpm: check that docker is running correctly before building
r22438 #!/bin/bash -e
Matt Mackall
build: initial support for in-tree autobuilding recipes
r21255
BUILDDIR=$(dirname $0)
ROOTDIR=$(cd $BUILDDIR/..; pwd)
Mads Kiilerich
dockerrpm: check that docker is running correctly before building
r22438 if which docker.io >> /dev/null 2>&1 ; then
Matt Mackall
docker: check for docker.io first
r21642 DOCKER=docker.io
Mads Kiilerich
dockerrpm: check that docker is running correctly before building
r22438 elif which docker >> /dev/null 2>&1 ; then
Matt Mackall
build: initial support for in-tree autobuilding recipes
r21255 DOCKER=docker
Mads Kiilerich
dockerrpm: check that docker is running correctly before building
r22438 else
echo "Error: docker must be installed"
exit 1
Matt Mackall
build: initial support for in-tree autobuilding recipes
r21255 fi
Mads Kiilerich
dockerrpm: check that docker is running correctly before building
r22438 $DOCKER -h 2> /dev/null | grep -q Jansens && { echo "Error: $DOCKER is the Docking System Tray - install docker.io instead"; exit 1; }
$DOCKER version | grep -q "^Client version:" || { echo "Error: unexpected output from \"$DOCKER version\""; exit 1; }
$DOCKER version | grep -q "^Server version:" || { echo "Error: could not get docker server version - check it is running and your permissions"; exit 1; }
Mads Kiilerich
dockerrpm: better handling of specification of docker name
r22439 PLATFORM="$1"
[ "$PLATFORM" ] || { echo "Error: platform name must be specified"; exit 1; }
Mads Kiilerich
docker: add CentOS 5...
r22443 shift # extra params are passed to buildrpm
Mads Kiilerich
dockerrpm: better handling of specification of docker name
r22439
DFILE="$ROOTDIR/contrib/docker/$PLATFORM"
[ -f "$DFILE" ] || { echo "Error: docker file $DFILE not found"; exit 1; }
CONTAINER="hg-dockerrpm-$PLATFORM"
Mads Kiilerich
dockerrpm: run docker build process as the current user, not as root...
r22440 DBUILDUSER=build
(
cat $DFILE
echo RUN groupadd $DBUILDUSER -g `id -g`
echo RUN useradd $DBUILDUSER -u `id -u` -g $DBUILDUSER
) | $DOCKER build --tag $CONTAINER -
Mads Kiilerich
dockerrpm: prepare source outside docker and just run rpmbuild inside docker...
r22441 RPMBUILDDIR=$ROOTDIR/packages/$PLATFORM
Mads Kiilerich
docker: add CentOS 5...
r22443 contrib/buildrpm --rpmbuilddir $RPMBUILDDIR --prepare $*
Mads Kiilerich
dockerrpm: prepare source outside docker and just run rpmbuild inside docker...
r22441
DSHARED=/mnt/shared
$DOCKER run -u $DBUILDUSER --rm -v $RPMBUILDDIR:$DSHARED $CONTAINER \
rpmbuild --define "_topdir $DSHARED" -ba $DSHARED/SPECS/mercurial.spec --clean
Mads Kiilerich
dockerrpm: create a yum/dnf repo from the generated rpms...
r22444
$DOCKER run -u $DBUILDUSER --rm -v $RPMBUILDDIR:$DSHARED $CONTAINER \
createrepo $DSHARED
cat << EOF > $RPMBUILDDIR/mercurial.repo
# Place this file in /etc/yum.repos.d/mercurial.repo
[mercurial]
Mads Kiilerich
buildrpm: fix use of invalid $PLATFORM in mercurial.repo
r23124 name=Mercurial packages for $PLATFORM
Mads Kiilerich
dockerrpm: create a yum/dnf repo from the generated rpms...
r22444 # baseurl=file://$RPMBUILDDIR/
Mads Kiilerich
buildrpm: fix use of invalid $PLATFORM in mercurial.repo
r23124 baseurl=http://hg.example.com/build/$PLATFORM/
Mads Kiilerich
dockerrpm: create a yum/dnf repo from the generated rpms...
r22444 skip_if_unavailable=True
gpgcheck=0
enabled=1
EOF
echo
echo "Build complete - results can be found in $RPMBUILDDIR"