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