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