##// END OF EJS Templates
builddeb: new script for building a deb package...
Augie Fackler -
r24971:ab75baaf default
parent child Browse files
Show More
@@ -0,0 +1,76 b''
1 #!/bin/sh -e
2 #
3 # Build a Mercurial debian package from the current repo
4 #
5 # Tested on Jessie (stable as of original script authoring.)
6
7 BUILD=1
8 DEBBUILDDIR="$PWD/debbuild"
9 while [ "$1" ]; do
10 case "$1" in
11 --prepare )
12 shift
13 BUILD=
14 ;;
15 --debbuilddir )
16 shift
17 DEBBUILDDIR="$1"
18 shift
19 ;;
20 * )
21 echo "Invalid parameter $1!" 1>&2
22 exit 1
23 ;;
24 esac
25 done
26
27 set -u
28
29 rm -rf $DEBBUILDDIR
30 mkdir -p $DEBBUILDDIR
31
32 if [ ! -d .hg ]; then
33 echo 'You are not inside a Mercurial repository!' 1>&2
34 exit 1
35 fi
36
37 # build local hg and use it
38 python setup.py build_py -c -d .
39 HG="$PWD/hg"
40
41 $HG version > /dev/null || { echo 'abort: hg version failed!'; exit 1 ; }
42
43 hgversion=`$HG version | sed -ne 's/.*(version \(.*\))$/\1/p'`
44
45 if echo $hgversion | grep -- '-' > /dev/null 2>&1; then
46 # nightly build case, version is like 1.3.1+250-20b91f91f9ca
47 version=`echo $hgversion | cut -d- -f1`
48 release=`echo $hgversion | cut -d- -f2 | sed -e 's/+.*//'`
49 else
50 # official tag, version is like 1.3.1
51 version=`echo $hgversion | sed -e 's/+.*//'`
52 release='0'
53 fi
54
55 cp -r $PWD/contrib/debian $DEBBUILDDIR/DEBIAN
56 chmod -R 0755 $DEBBUILDDIR/DEBIAN
57
58 control=$DEBBUILDDIR/DEBIAN/control
59
60 # This looks like sed -i, but sed -i behaves just differently enough
61 # between BSD and GNU sed that I gave up and did the dumb thing.
62 sed "s/__VERSION__/$version/" < $control > $control.tmp
63 mv $control.tmp $control
64
65 if [ "$BUILD" ]; then
66 dpkg-deb --build $DEBBUILDDIR
67 mv $DEBBUILDDIR.deb $DEBBUILDDIR/mercurial-$version-$release.deb
68 if [ $? = 0 ]; then
69 echo
70 echo "Built packages for $version-$release:"
71 find $DEBBUILDDIR/ -type f -newer $control
72 fi
73 else
74 echo "Prepared sources for $version-$release $control are in $DEBBUILDDIR - use like:"
75 echo "dpkg-deb --build $DEBBUILDDIR"
76 fi
@@ -0,0 +1,9 b''
1 Package: mercurial
2 Version: __VERSION__
3 Section: vcs
4 Priority: optional
5 Architecture: all
6 Depends: python
7 Conflicts: mercurial-common
8 Maintainer: Mercurial Developers <mercurial-devel@selenic.com>
9 Description: Mercurial (probably nightly) package built by upstream.
@@ -157,6 +157,12 b' osx:'
157 157 N=`cd dist && echo mercurial-*.mpkg | sed 's,\.mpkg$$,,'` && hdiutil create -srcfolder dist/$$N.mpkg/ -scrub -volname "$$N" -ov packages/osx/$$N.dmg
158 158 rm -rf dist/mercurial-*.mpkg
159 159
160 debian-jessie:
161 mkdir -p packages/debian-jessie
162 contrib/builddeb
163 mv debbuild/*.deb packages/debian-jessie
164 rm -rf debbuild
165
160 166 fedora20:
161 167 mkdir -p packages/fedora20
162 168 contrib/buildrpm
General Comments 0
You need to be logged in to leave comments. Login now