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