##// END OF EJS Templates
builddeb: add flag for a source-only deb...
Sean Farley -
r28994:8797f03d stable
parent child Browse files
Show More
@@ -1,96 +1,101
1 1 #!/bin/sh -e
2 2 #
3 3 # Build a Mercurial debian package from the current repo
4 4 #
5 5 # Tested on Jessie (stable as of original script authoring.)
6 6
7 7 . $(dirname $0)/packagelib.sh
8 8
9 9 BUILD=1
10 10 CLEANUP=1
11 11 DISTID=`(lsb_release -is 2> /dev/null | tr '[:upper:]' '[:lower:]') || echo debian`
12 12 CODENAME=`lsb_release -cs 2> /dev/null || echo unknown`
13 DEBFLAGS=-b
13 14 while [ "$1" ]; do
14 15 case "$1" in
15 16 --distid )
16 17 shift
17 18 DISTID="$1"
18 19 shift
19 20 ;;
20 21 --codename )
21 22 shift
22 23 CODENAME="$1"
23 24 shift
24 25 ;;
25 26 --cleanup )
26 27 shift
27 28 BUILD=
28 29 ;;
29 30 --build )
30 31 shift
31 32 CLEANUP=
32 33 ;;
34 --source-only )
35 shift
36 DEBFLAGS=-S
37 ;;
33 38 * )
34 39 echo "Invalid parameter $1!" 1>&2
35 40 exit 1
36 41 ;;
37 42 esac
38 43 done
39 44
40 45 trap "if [ '$CLEANUP' ] ; then rm -r '$PWD/debian' ; fi" EXIT
41 46
42 47 set -u
43 48
44 49 if [ ! -d .hg ]; then
45 50 echo 'You are not inside a Mercurial repository!' 1>&2
46 51 exit 1
47 52 fi
48 53
49 54 gethgversion
50 55 debver="$version"
51 56 if [ -n "$type" ] ; then
52 57 debver="$debver~$type"
53 58 fi
54 59 if [ -n "$distance" ] ; then
55 60 debver="$debver+$distance-$node"
56 61 fi
57 62
58 63 control=debian/control
59 64 changelog=debian/changelog
60 65
61 66 if [ "$BUILD" ]; then
62 67 if [ -d debian ] ; then
63 68 echo "Error! debian control directory already exists!"
64 69 exit 1
65 70 fi
66 71
67 72 cp -r $PWD/contrib/debian debian
68 73 chmod -R 0755 debian
69 74
70 75 sed -i.tmp "s/__VERSION__/$debver/" $changelog
71 76 sed -i.tmp "s/__DATE__/$(date --rfc-2822)/" $changelog
72 77 sed -i.tmp "s/__CODENAME__/$CODENAME/" $changelog
73 78 rm $changelog.tmp
74 79
75 80 # remove the node from the version string
76 81 SRCFILE="mercurial_$(echo $debver | sed "s,-$node,,").orig.tar.gz"
77 82 "$PWD/hg" archive $SRCFILE
78 83 mv $SRCFILE ..
79 debuild -us -uc -i -I -b
84 debuild -us -uc -i -I $DEBFLAGS
80 85 if [ $? != 0 ]; then
81 86 echo 'debuild failed!'
82 87 exit 1
83 88 fi
84 89
85 90 fi
86 91 if [ "$CLEANUP" ] ; then
87 92 echo
88 93 OUTPUTDIR=${OUTPUTDIR:=packages/$DISTID-$CODENAME}
89 94 mkdir -p "$OUTPUTDIR"
90 95 find ../mercurial*.deb ../mercurial_*.build ../mercurial_*.changes \
91 96 ../mercurial*.dsc ../mercurial*.gz \
92 97 -type f -newer $control -print0 2>/dev/null | \
93 98 xargs -Inarf -0 mv narf "$OUTPUTDIR"
94 99 echo "Built packages for $debver:"
95 100 find "$OUTPUTDIR" -type f -newer $control -name '*.deb'
96 101 fi
General Comments 0
You need to be logged in to leave comments. Login now