Mercurial > hg
annotate contrib/dockerdeb @ 26108:05306b9359d3
builddeb: rework how output dir and platform are specified
This makes it possible to write tests for both builddeb and dockerdeb
that actually build .debs and then sanity check the contents.
author | Augie Fackler <augie@google.com> |
---|---|
date | Tue, 25 Aug 2015 00:02:44 -0400 |
parents | 4c4d0012db4f |
children | 7f49efcaa9b4 |
rev | line source |
---|---|
24973
4c4d0012db4f
dockerdeb: rules to build a debian package using docker
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1 #!/bin/bash -eu |
4c4d0012db4f
dockerdeb: rules to build a debian package using docker
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
2 |
4c4d0012db4f
dockerdeb: rules to build a debian package using docker
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
3 . $(dirname $0)/dockerlib.sh |
4c4d0012db4f
dockerdeb: rules to build a debian package using docker
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
4 . $(dirname $0)/packagelib.sh |
4c4d0012db4f
dockerdeb: rules to build a debian package using docker
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
5 |
4c4d0012db4f
dockerdeb: rules to build a debian package using docker
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
6 BUILDDIR=$(dirname $0) |
4c4d0012db4f
dockerdeb: rules to build a debian package using docker
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
7 export ROOTDIR=$(cd $BUILDDIR/..; pwd) |
4c4d0012db4f
dockerdeb: rules to build a debian package using docker
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
8 |
4c4d0012db4f
dockerdeb: rules to build a debian package using docker
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
9 checkdocker |
4c4d0012db4f
dockerdeb: rules to build a debian package using docker
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
10 |
26108
05306b9359d3
builddeb: rework how output dir and platform are specified
Augie Fackler <augie@google.com>
parents:
24973
diff
changeset
|
11 DEBPLATFORM="$1" |
24973
4c4d0012db4f
dockerdeb: rules to build a debian package using docker
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
12 PLATFORM="debian-$1" |
4c4d0012db4f
dockerdeb: rules to build a debian package using docker
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
13 shift # extra params are passed to build process |
4c4d0012db4f
dockerdeb: rules to build a debian package using docker
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
14 |
4c4d0012db4f
dockerdeb: rules to build a debian package using docker
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
15 initcontainer $PLATFORM |
4c4d0012db4f
dockerdeb: rules to build a debian package using docker
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
16 |
26108
05306b9359d3
builddeb: rework how output dir and platform are specified
Augie Fackler <augie@google.com>
parents:
24973
diff
changeset
|
17 DEBBUILDDIR=${OUTPUTDIR:=$ROOTDIR/packages/$PLATFORM} |
05306b9359d3
builddeb: rework how output dir and platform are specified
Augie Fackler <augie@google.com>
parents:
24973
diff
changeset
|
18 OUTPUTDIR=$DEBBUILDDIR/staged contrib/builddeb --release $DEBPLATFORM --prepare |
24973
4c4d0012db4f
dockerdeb: rules to build a debian package using docker
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
19 |
4c4d0012db4f
dockerdeb: rules to build a debian package using docker
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
20 DSHARED=/mnt/shared/ |
4c4d0012db4f
dockerdeb: rules to build a debian package using docker
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
21 if [ $(uname) = "Darwin" ] ; then |
4c4d0012db4f
dockerdeb: rules to build a debian package using docker
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
22 $DOCKER run -u $DBUILDUSER --rm -v $DEBBUILDDIR:$DSHARED -v $PWD:/mnt/hg $CONTAINER \ |
4c4d0012db4f
dockerdeb: rules to build a debian package using docker
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
23 sh -c "cd /mnt/hg && make clean && make local" |
4c4d0012db4f
dockerdeb: rules to build a debian package using docker
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
24 fi |
4c4d0012db4f
dockerdeb: rules to build a debian package using docker
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
25 $DOCKER run -u $DBUILDUSER --rm -v $DEBBUILDDIR:$DSHARED -v $PWD:/mnt/hg $CONTAINER \ |
4c4d0012db4f
dockerdeb: rules to build a debian package using docker
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
26 sh -c "cd /mnt/hg && make PREFIX=$DSHARED/staged/usr install" |
4c4d0012db4f
dockerdeb: rules to build a debian package using docker
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
27 $DOCKER run -u $DBUILDUSER --rm -v $DEBBUILDDIR:$DSHARED $CONTAINER \ |
4c4d0012db4f
dockerdeb: rules to build a debian package using docker
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
28 dpkg-deb --build $DSHARED/staged |
4c4d0012db4f
dockerdeb: rules to build a debian package using docker
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
29 if [ $(uname) = "Darwin" ] ; then |
4c4d0012db4f
dockerdeb: rules to build a debian package using docker
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
30 $DOCKER run -u $DBUILDUSER --rm -v $DEBBUILDDIR:$DSHARED -v $PWD:/mnt/hg $CONTAINER \ |
4c4d0012db4f
dockerdeb: rules to build a debian package using docker
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
31 sh -c "cd /mnt/hg && make clean" |
4c4d0012db4f
dockerdeb: rules to build a debian package using docker
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
32 fi |
4c4d0012db4f
dockerdeb: rules to build a debian package using docker
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
33 |
4c4d0012db4f
dockerdeb: rules to build a debian package using docker
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
34 gethgversion |
4c4d0012db4f
dockerdeb: rules to build a debian package using docker
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
35 |
4c4d0012db4f
dockerdeb: rules to build a debian package using docker
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
36 rm -r $DEBBUILDDIR/staged |
4c4d0012db4f
dockerdeb: rules to build a debian package using docker
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
37 mv $DEBBUILDDIR/staged.deb $DEBBUILDDIR/mercurial-$version-$release.deb |
4c4d0012db4f
dockerdeb: rules to build a debian package using docker
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
38 |
4c4d0012db4f
dockerdeb: rules to build a debian package using docker
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
39 echo |
4c4d0012db4f
dockerdeb: rules to build a debian package using docker
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
40 echo "Build complete - results can be found in $DEBBUILDDIR" |