##// END OF EJS Templates
builddeb: add distroseries to tagged versions...
Sean Farley -
r29093:c4f0e764 stable
parent child Browse files
Show More
@@ -1,100 +1,104
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 13 DEBFLAGS=-b
14 14 while [ "$1" ]; do
15 15 case "$1" in
16 16 --distid )
17 17 shift
18 18 DISTID="$1"
19 19 shift
20 20 ;;
21 21 --codename )
22 22 shift
23 23 CODENAME="$1"
24 24 shift
25 25 ;;
26 26 --cleanup )
27 27 shift
28 28 BUILD=
29 29 ;;
30 30 --build )
31 31 shift
32 32 CLEANUP=
33 33 ;;
34 34 --source-only )
35 35 shift
36 36 DEBFLAGS=-S
37 37 ;;
38 38 * )
39 39 echo "Invalid parameter $1!" 1>&2
40 40 exit 1
41 41 ;;
42 42 esac
43 43 done
44 44
45 45 trap "if [ '$CLEANUP' ] ; then rm -r '$PWD/debian' ; fi" EXIT
46 46
47 47 set -u
48 48
49 49 if [ ! -d .hg ]; then
50 50 echo 'You are not inside a Mercurial repository!' 1>&2
51 51 exit 1
52 52 fi
53 53
54 54 gethgversion
55 55 debver="$version"
56 56 if [ -n "$type" ] ; then
57 57 debver="$debver~$type"
58 58 fi
59 59 if [ -n "$distance" ] ; then
60 60 debver="$debver+$distance-$CODENAME-$node"
61 elif [ "$DEBFLAGS" = "-S" ] ; then
62 # for building a ppa (--source-only) for a release (distance == 0), we need
63 # to version the distroseries so that we can upload to launchpad
64 debver="$debver~${CODENAME}1"
61 65 fi
62 66
63 67 control=debian/control
64 68 changelog=debian/changelog
65 69
66 70 if [ "$BUILD" ]; then
67 71 if [ -d debian ] ; then
68 72 echo "Error! debian control directory already exists!"
69 73 exit 1
70 74 fi
71 75
72 76 cp -r $PWD/contrib/debian debian
73 77
74 78 sed -i.tmp "s/__VERSION__/$debver/" $changelog
75 79 sed -i.tmp "s/__DATE__/$(date --rfc-2822)/" $changelog
76 80 sed -i.tmp "s/__CODENAME__/$CODENAME/" $changelog
77 81 rm $changelog.tmp
78 82
79 83 # remove the node from the version string
80 84 SRCFILE="mercurial_$(echo $debver | sed "s,-$node,,").orig.tar.gz"
81 85 "$PWD/hg" archive $SRCFILE
82 86 mv $SRCFILE ..
83 87 debuild -us -uc -i -I $DEBFLAGS
84 88 if [ $? != 0 ]; then
85 89 echo 'debuild failed!'
86 90 exit 1
87 91 fi
88 92
89 93 fi
90 94 if [ "$CLEANUP" ] ; then
91 95 echo
92 96 OUTPUTDIR=${OUTPUTDIR:=packages/$DISTID-$CODENAME}
93 97 mkdir -p "$OUTPUTDIR"
94 98 find ../mercurial*.deb ../mercurial_*.build ../mercurial_*.changes \
95 99 ../mercurial*.dsc ../mercurial*.gz \
96 100 -type f -newer $control -print0 2>/dev/null | \
97 101 xargs -Inarf -0 mv narf "$OUTPUTDIR"
98 102 echo "Built packages for $debver:"
99 103 find "$OUTPUTDIR" -type f -newer $control -name '*.deb'
100 104 fi
General Comments 0
You need to be logged in to leave comments. Login now