##// END OF EJS Templates
build: "make deb" failed when the base path contained spaces...
muxator -
r34626:f1c2552c default
parent child Browse files
Show More
@@ -1,104 +1,104 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 elif [ "$DEBFLAGS" = "-S" ] ; then
61 elif [ "$DEBFLAGS" = "-S" ] ; then
62 # for building a ppa (--source-only) for a release (distance == 0), we need
62 # for building a ppa (--source-only) for a release (distance == 0), we need
63 # to version the distroseries so that we can upload to launchpad
63 # to version the distroseries so that we can upload to launchpad
64 debver="$debver~${CODENAME}1"
64 debver="$debver~${CODENAME}1"
65 fi
65 fi
66
66
67 control=debian/control
67 control=debian/control
68 changelog=debian/changelog
68 changelog=debian/changelog
69
69
70 if [ "$BUILD" ]; then
70 if [ "$BUILD" ]; then
71 if [ -d debian ] ; then
71 if [ -d debian ] ; then
72 echo "Error! debian control directory already exists!"
72 echo "Error! debian control directory already exists!"
73 exit 1
73 exit 1
74 fi
74 fi
75
75
76 cp -r $PWD/contrib/debian debian
76 cp -r "$PWD"/contrib/debian debian
77
77
78 sed -i.tmp "s/__VERSION__/$debver/" $changelog
78 sed -i.tmp "s/__VERSION__/$debver/" $changelog
79 sed -i.tmp "s/__DATE__/$(date --rfc-2822)/" $changelog
79 sed -i.tmp "s/__DATE__/$(date --rfc-2822)/" $changelog
80 sed -i.tmp "s/__CODENAME__/$CODENAME/" $changelog
80 sed -i.tmp "s/__CODENAME__/$CODENAME/" $changelog
81 rm $changelog.tmp
81 rm $changelog.tmp
82
82
83 # remove the node from the version string
83 # remove the node from the version string
84 SRCFILE="mercurial_$(echo $debver | sed "s,-$node,,").orig.tar.gz"
84 SRCFILE="mercurial_$(echo $debver | sed "s,-$node,,").orig.tar.gz"
85 "$PWD/hg" archive $SRCFILE
85 "$PWD/hg" archive $SRCFILE
86 mv $SRCFILE ..
86 mv $SRCFILE ..
87 debuild -us -uc -i -I $DEBFLAGS
87 debuild -us -uc -i -I $DEBFLAGS
88 if [ $? != 0 ]; then
88 if [ $? != 0 ]; then
89 echo 'debuild failed!'
89 echo 'debuild failed!'
90 exit 1
90 exit 1
91 fi
91 fi
92
92
93 fi
93 fi
94 if [ "$CLEANUP" ] ; then
94 if [ "$CLEANUP" ] ; then
95 echo
95 echo
96 OUTPUTDIR=${OUTPUTDIR:=packages/$DISTID-$CODENAME}
96 OUTPUTDIR=${OUTPUTDIR:=packages/$DISTID-$CODENAME}
97 mkdir -p "$OUTPUTDIR"
97 mkdir -p "$OUTPUTDIR"
98 find ../mercurial*.deb ../mercurial_*.build ../mercurial_*.changes \
98 find ../mercurial*.deb ../mercurial_*.build ../mercurial_*.changes \
99 ../mercurial*.dsc ../mercurial*.gz \
99 ../mercurial*.dsc ../mercurial*.gz \
100 -type f -newer $control -print0 2>/dev/null | \
100 -type f -newer $control -print0 2>/dev/null | \
101 xargs -Inarf -0 mv narf "$OUTPUTDIR"
101 xargs -Inarf -0 mv narf "$OUTPUTDIR"
102 echo "Built packages for $debver:"
102 echo "Built packages for $debver:"
103 find "$OUTPUTDIR" -type f -newer $control -name '*.deb'
103 find "$OUTPUTDIR" -type f -newer $control -name '*.deb'
104 fi
104 fi
@@ -1,44 +1,44 b''
1 #!/usr/bin/make -f
1 #!/usr/bin/make -f
2 # Uncomment this to turn on verbose mode.
2 # Uncomment this to turn on verbose mode.
3 # export DH_VERBOSE=1
3 # export DH_VERBOSE=1
4
4
5 CPUS=$(shell cat /proc/cpuinfo | grep -E ^processor | wc -l)
5 CPUS=$(shell cat /proc/cpuinfo | grep -E ^processor | wc -l)
6
6
7 %:
7 %:
8 dh $@ --with python2
8 dh $@ --with python2
9
9
10 override_dh_auto_test:
10 override_dh_auto_test:
11 http_proxy='' dh_auto_test -- TESTFLAGS="-j$(CPUS)"
11 http_proxy='' dh_auto_test -- TESTFLAGS="-j$(CPUS)"
12
12
13 override_dh_python2:
13 override_dh_python2:
14 dh_python2
14 dh_python2
15 find debian/mercurial/usr/share -type d -empty -delete
15 find debian/mercurial/usr/share -type d -empty -delete
16
16
17 override_dh_install:
17 override_dh_install:
18 python$(PYVERS) setup.py install --root $(CURDIR)/debian/mercurial --install-layout=deb
18 python$(PYVERS) setup.py install --root "$(CURDIR)"/debian/mercurial --install-layout=deb
19 # chg
19 # chg
20 make -C contrib/chg \
20 make -C contrib/chg \
21 DESTDIR=$(CURDIR)/debian/mercurial \
21 DESTDIR="$(CURDIR)"/debian/mercurial \
22 PREFIX=/usr \
22 PREFIX=/usr \
23 clean install
23 clean install
24 # remove arch-independent python stuff
24 # remove arch-independent python stuff
25 find $(CURDIR)/debian/mercurial/usr/lib \
25 find "$(CURDIR)"/debian/mercurial/usr/lib \
26 ! -name '*.so' ! -type d -delete , \
26 ! -name '*.so' ! -type d -delete , \
27 -type d -empty -delete
27 -type d -empty -delete
28 python$(PYVERS) setup.py install --root $(CURDIR)/debian/mercurial-common --install-layout=deb
28 python$(PYVERS) setup.py install --root "$(CURDIR)/debian/mercurial-common" --install-layout=deb
29 make install-doc PREFIX=$(CURDIR)/debian/mercurial-common/usr
29 make install-doc PREFIX="$(CURDIR)"/debian/mercurial-common/usr
30 # remove arch-dependent python stuff
30 # remove arch-dependent python stuff
31 find $(CURDIR)/debian/mercurial-common/usr/lib \
31 find "$(CURDIR)"/debian/mercurial-common/usr/lib \
32 -name '*.so' ! -type d -delete , \
32 -name '*.so' ! -type d -delete , \
33 -type d -empty -delete
33 -type d -empty -delete
34 cp contrib/hg-ssh $(CURDIR)/debian/mercurial-common/usr/bin
34 cp contrib/hg-ssh "$(CURDIR)"/debian/mercurial-common/usr/bin
35 mkdir -p $(CURDIR)/debian/mercurial-common/usr/share/mercurial
35 mkdir -p "$(CURDIR)"/debian/mercurial-common/usr/share/mercurial
36 cp contrib/hgk $(CURDIR)/debian/mercurial-common/usr/share/mercurial
36 cp contrib/hgk "$(CURDIR)"/debian/mercurial-common/usr/share/mercurial
37 mkdir -p $(CURDIR)/debian/mercurial-common/etc/mercurial/hgrc.d/
37 mkdir -p "$(CURDIR)"/debian/mercurial-common/etc/mercurial/hgrc.d/
38 cp contrib/debian/*.rc $(CURDIR)/debian/mercurial-common/etc/mercurial/hgrc.d/
38 cp contrib/debian/*.rc "$(CURDIR)"/debian/mercurial-common/etc/mercurial/hgrc.d/
39 # completions
39 # completions
40 mkdir -p $(CURDIR)/debian/mercurial-common/usr/share/bash-completion/completions
40 mkdir -p "$(CURDIR)"/debian/mercurial-common/usr/share/bash-completion/completions
41 cp contrib/bash_completion $(CURDIR)/debian/mercurial-common/usr/share/bash-completion/completions/hg
41 cp contrib/bash_completion "$(CURDIR)"/debian/mercurial-common/usr/share/bash-completion/completions/hg
42 mkdir -p $(CURDIR)/debian/mercurial-common/usr/share/zsh/vendor-completions
42 mkdir -p "$(CURDIR)"/debian/mercurial-common/usr/share/zsh/vendor-completions
43 cp contrib/zsh_completion $(CURDIR)/debian/mercurial-common/usr/share/zsh/vendor-completions/_hg
43 cp contrib/zsh_completion "$(CURDIR)"/debian/mercurial-common/usr/share/zsh/vendor-completions/_hg
44 rm $(CURDIR)/debian/mercurial-common/usr/bin/hg
44 rm "$(CURDIR)"/debian/mercurial-common/usr/bin/hg
General Comments 0
You need to be logged in to leave comments. Login now