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