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