##// END OF EJS Templates
builddeb: add --distid option to specify Distributor ID...
av6 -
r27210:9b86d298 default
parent child Browse files
Show More
@@ -1,227 +1,227 b''
1 1 # If you want to change PREFIX, do not just edit it below. The changed
2 2 # value wont get passed on to recursive make calls. You should instead
3 3 # override the variable on the command like:
4 4 #
5 5 # % make PREFIX=/opt/ install
6 6
7 7 PREFIX=/usr/local
8 8 export PREFIX
9 9 PYTHON=python
10 10 $(eval HGROOT := $(shell pwd))
11 11 HGPYTHONS ?= $(HGROOT)/build/pythons
12 12 PURE=
13 13 PYFILES:=$(shell find mercurial hgext doc -name '*.py')
14 14 DOCFILES=mercurial/help/*.txt
15 15 export LANGUAGE=C
16 16 export LC_ALL=C
17 17 TESTFLAGS ?= $(shell echo $$HGTESTFLAGS)
18 18
19 19 # Set this to e.g. "mingw32" to use a non-default compiler.
20 20 COMPILER=
21 21
22 22 help:
23 23 @echo 'Commonly used make targets:'
24 24 @echo ' all - build program and documentation'
25 25 @echo ' install - install program and man pages to $$PREFIX ($(PREFIX))'
26 26 @echo ' install-home - install with setup.py install --home=$$HOME ($(HOME))'
27 27 @echo ' local - build for inplace usage'
28 28 @echo ' tests - run all tests in the automatic test suite'
29 29 @echo ' test-foo - run only specified tests (e.g. test-merge1.t)'
30 30 @echo ' dist - run all tests and create a source tarball in dist/'
31 31 @echo ' clean - remove files created by other targets'
32 32 @echo ' (except installed files or dist source tarball)'
33 33 @echo ' update-pot - update i18n/hg.pot'
34 34 @echo
35 35 @echo 'Example for a system-wide installation under /usr/local:'
36 36 @echo ' make all && su -c "make install" && hg version'
37 37 @echo
38 38 @echo 'Example for a local installation (usable in this directory):'
39 39 @echo ' make local && ./hg version'
40 40
41 41 all: build doc
42 42
43 43 local:
44 44 $(PYTHON) setup.py $(PURE) \
45 45 build_py -c -d . \
46 46 build_ext $(COMPILER:%=-c %) -i \
47 47 build_hgexe $(COMPILER:%=-c %) -i \
48 48 build_mo
49 49 env HGRCPATH= $(PYTHON) hg version
50 50
51 51 build:
52 52 $(PYTHON) setup.py $(PURE) build $(COMPILER:%=-c %)
53 53
54 54 wheel:
55 55 FORCE_SETUPTOOLS=1 $(PYTHON) setup.py $(PURE) bdist_wheel $(COMPILER:%=-c %)
56 56
57 57 doc:
58 58 $(MAKE) -C doc
59 59
60 60 clean:
61 61 -$(PYTHON) setup.py clean --all # ignore errors from this command
62 62 find contrib doc hgext i18n mercurial tests \
63 63 \( -name '*.py[cdo]' -o -name '*.so' \) -exec rm -f '{}' ';'
64 64 rm -f $(addprefix mercurial/,$(notdir $(wildcard mercurial/pure/[a-z]*.py)))
65 65 rm -f MANIFEST MANIFEST.in hgext/__index__.py tests/*.err
66 66 if test -d .hg; then rm -f mercurial/__version__.py; fi
67 67 rm -rf build mercurial/locale
68 68 $(MAKE) -C doc clean
69 69
70 70 install: install-bin install-doc
71 71
72 72 install-bin: build
73 73 $(PYTHON) setup.py $(PURE) install --root="$(DESTDIR)/" --prefix="$(PREFIX)" --force
74 74
75 75 install-doc: doc
76 76 cd doc && $(MAKE) $(MFLAGS) install
77 77
78 78 install-home: install-home-bin install-home-doc
79 79
80 80 install-home-bin: build
81 81 $(PYTHON) setup.py $(PURE) install --home="$(HOME)" --prefix="" --force
82 82
83 83 install-home-doc: doc
84 84 cd doc && $(MAKE) $(MFLAGS) PREFIX="$(HOME)" install
85 85
86 86 MANIFEST-doc:
87 87 $(MAKE) -C doc MANIFEST
88 88
89 89 MANIFEST.in: MANIFEST-doc
90 90 hg manifest | sed -e 's/^/include /' > MANIFEST.in
91 91 echo include mercurial/__version__.py >> MANIFEST.in
92 92 sed -e 's/^/include /' < doc/MANIFEST >> MANIFEST.in
93 93
94 94 dist: tests dist-notests
95 95
96 96 dist-notests: doc MANIFEST.in
97 97 TAR_OPTIONS="--owner=root --group=root --mode=u+w,go-w,a+rX-s" $(PYTHON) setup.py -q sdist
98 98
99 99 check: tests
100 100
101 101 tests:
102 102 cd tests && $(PYTHON) run-tests.py $(TESTFLAGS)
103 103
104 104 test-%:
105 105 cd tests && $(PYTHON) run-tests.py $(TESTFLAGS) $@
106 106
107 107 testpy-%:
108 108 @echo Looking for Python $* in $(HGPYTHONS)
109 109 [ -e $(HGPYTHONS)/$*/bin/python ] || ( \
110 110 cd $$(mktemp --directory --tmpdir) && \
111 111 $(MAKE) -f $(HGROOT)/contrib/Makefile.python PYTHONVER=$* PREFIX=$(HGPYTHONS)/$* python )
112 112 cd tests && $(HGPYTHONS)/$*/bin/python run-tests.py $(TESTFLAGS)
113 113
114 114 check-code:
115 115 hg manifest | xargs python contrib/check-code.py
116 116
117 117 update-pot: i18n/hg.pot
118 118
119 119 i18n/hg.pot: $(PYFILES) $(DOCFILES) i18n/posplit i18n/hggettext
120 120 $(PYTHON) i18n/hggettext mercurial/commands.py \
121 121 hgext/*.py hgext/*/__init__.py \
122 122 mercurial/fileset.py mercurial/revset.py \
123 123 mercurial/templatefilters.py mercurial/templatekw.py \
124 124 mercurial/templater.py \
125 125 mercurial/filemerge.py \
126 126 mercurial/hgweb/webcommands.py \
127 127 $(DOCFILES) > i18n/hg.pot.tmp
128 128 # All strings marked for translation in Mercurial contain
129 129 # ASCII characters only. But some files contain string
130 130 # literals like this '\037\213'. xgettext thinks it has to
131 131 # parse them even though they are not marked for translation.
132 132 # Extracting with an explicit encoding of ISO-8859-1 will make
133 133 # xgettext "parse" and ignore them.
134 134 echo $(PYFILES) | xargs \
135 135 xgettext --package-name "Mercurial" \
136 136 --msgid-bugs-address "<mercurial-devel@selenic.com>" \
137 137 --copyright-holder "Matt Mackall <mpm@selenic.com> and others" \
138 138 --from-code ISO-8859-1 --join --sort-by-file --add-comments=i18n: \
139 139 -d hg -p i18n -o hg.pot.tmp
140 140 $(PYTHON) i18n/posplit i18n/hg.pot.tmp
141 141 # The target file is not created before the last step. So it never is in
142 142 # an intermediate state.
143 143 mv -f i18n/hg.pot.tmp i18n/hg.pot
144 144
145 145 %.po: i18n/hg.pot
146 146 # work on a temporary copy for never having a half completed target
147 147 cp $@ $@.tmp
148 148 msgmerge --no-location --update $@.tmp $^
149 149 mv -f $@.tmp $@
150 150
151 151 # Packaging targets
152 152
153 153 osx:
154 154 python -c 'import bdist_mpkg.script_bdist_mpkg' || \
155 155 (echo "Missing bdist_mpkg (easy_install bdist_mpkg)"; false)
156 156 rm -rf dist/mercurial-*.mpkg
157 157 python -m bdist_mpkg.script_bdist_mpkg setup.py --
158 158 python contrib/fixpax.py dist/mercurial-*.mpkg/Contents/Packages/*.pkg/Contents/Archive.pax.gz
159 159 mkdir -p packages/osx
160 160 N=`cd dist && echo mercurial-*.mpkg | sed 's,\.mpkg$$,,'` && hdiutil create -srcfolder dist/$$N.mpkg/ -scrub -volname "$$N" -ov packages/osx/$$N.dmg
161 161 rm -rf dist/mercurial-*.mpkg
162 162
163 163 deb:
164 164 mkdir -p packages/debian-unknown
165 contrib/builddeb --codename unknown
165 contrib/builddeb --distid debian --codename unknown
166 166
167 167 docker-debian-jessie:
168 168 mkdir -p packages/debian-jessie
169 contrib/dockerdeb jessie
169 contrib/dockerdeb debian jessie
170 170
171 171 fedora20:
172 172 mkdir -p packages/fedora20
173 173 contrib/buildrpm
174 174 cp rpmbuild/RPMS/*/* packages/fedora20
175 175 cp rpmbuild/SRPMS/* packages/fedora20
176 176 rm -rf rpmbuild
177 177
178 178 docker-fedora20:
179 179 mkdir -p packages/fedora20
180 180 contrib/dockerrpm fedora20
181 181
182 182 fedora21:
183 183 mkdir -p packages/fedora21
184 184 contrib/buildrpm
185 185 cp rpmbuild/RPMS/*/* packages/fedora21
186 186 cp rpmbuild/SRPMS/* packages/fedora21
187 187 rm -rf rpmbuild
188 188
189 189 docker-fedora21:
190 190 mkdir -p packages/fedora21
191 191 contrib/dockerrpm fedora21
192 192
193 193 centos5:
194 194 mkdir -p packages/centos5
195 195 contrib/buildrpm --withpython
196 196 cp rpmbuild/RPMS/*/* packages/centos5
197 197 cp rpmbuild/SRPMS/* packages/centos5
198 198
199 199 docker-centos5:
200 200 mkdir -p packages/centos5
201 201 contrib/dockerrpm centos5 --withpython
202 202
203 203 centos6:
204 204 mkdir -p packages/centos6
205 205 contrib/buildrpm
206 206 cp rpmbuild/RPMS/*/* packages/centos6
207 207 cp rpmbuild/SRPMS/* packages/centos6
208 208
209 209 docker-centos6:
210 210 mkdir -p packages/centos6
211 211 contrib/dockerrpm centos6
212 212
213 213 centos7:
214 214 mkdir -p packages/centos7
215 215 contrib/buildrpm
216 216 cp rpmbuild/RPMS/*/* packages/centos7
217 217 cp rpmbuild/SRPMS/* packages/centos7
218 218
219 219 docker-centos7:
220 220 mkdir -p packages/centos7
221 221 contrib/dockerrpm centos7
222 222
223 223 .PHONY: help all local build doc clean install install-bin install-doc \
224 224 install-home install-home-bin install-home-doc \
225 225 dist dist-notests check tests check-code update-pot \
226 226 osx fedora20 docker-fedora20 fedora21 docker-fedora21 \
227 227 centos5 docker-centos5 centos6 docker-centos6 centos7 docker-centos7
@@ -1,91 +1,97 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 DISTID=debian
11 12 CODENAME=jessie
12 13 while [ "$1" ]; do
13 14 case "$1" in
15 --distid )
16 shift
17 DISTID="$1"
18 shift
19 ;;
14 20 --codename )
15 21 shift
16 22 CODENAME="$1"
17 23 shift
18 24 ;;
19 25 --cleanup )
20 26 shift
21 27 BUILD=
22 28 ;;
23 29 --build )
24 30 shift
25 31 CLEANUP=
26 32 ;;
27 33 --debbuilddir )
28 34 shift
29 35 DEBBUILDDIR="$1"
30 36 shift
31 37 ;;
32 38 * )
33 39 echo "Invalid parameter $1!" 1>&2
34 40 exit 1
35 41 ;;
36 42 esac
37 43 done
38 44
39 45 trap "if [ '$CLEANUP' ] ; then rm -r '$PWD/debian' ; fi" EXIT
40 46
41 47 set -u
42 48
43 49 if [ ! -d .hg ]; then
44 50 echo 'You are not inside a Mercurial repository!' 1>&2
45 51 exit 1
46 52 fi
47 53
48 54 gethgversion
49 55 debver="$version"
50 56 if [ -n "$type" ] ; then
51 57 debver="$debver~$type"
52 58 fi
53 59 if [ -n "$distance" ] ; then
54 60 debver="$debver+$distance-$node"
55 61 fi
56 62
57 63 control=debian/control
58 64 changelog=debian/changelog
59 65
60 66 if [ "$BUILD" ]; then
61 67 if [ -d debian ] ; then
62 68 echo "Error! debian control directory already exists!"
63 69 exit 1
64 70 fi
65 71
66 72 cp -r $PWD/contrib/debian debian
67 73 chmod -R 0755 debian
68 74
69 75 # This looks like sed -i, but sed -i behaves just differently enough
70 76 # between BSD and GNU sed that I gave up and did the dumb thing.
71 77 sed "s/__VERSION__/$debver/" < $changelog > $changelog.tmp
72 78 date=$(date --rfc-2822)
73 79 sed "s/__DATE__/$date/" < $changelog.tmp > $changelog
74 80 rm $changelog.tmp
75 81
76 82 debuild -us -uc -b
77 83 if [ $? != 0 ]; then
78 84 echo 'debuild failed!'
79 85 exit 1
80 86 fi
81 87
82 88 fi
83 89 if [ "$CLEANUP" ] ; then
84 90 echo
85 OUTPUTDIR=${OUTPUTDIR:=packages/debian-$CODENAME}
91 OUTPUTDIR=${OUTPUTDIR:=packages/$DISTID-$CODENAME}
86 92 find ../mercurial*.deb ../mercurial_*.build ../mercurial_*.changes \
87 93 -type f -newer $control -print0 | \
88 94 xargs -Inarf -0 mv narf "$OUTPUTDIR"
89 95 echo "Built packages for $debver:"
90 96 find "$OUTPUTDIR" -type f -newer $control -name '*.deb'
91 97 fi
@@ -1,34 +1,35 b''
1 1 #!/bin/bash -eu
2 2
3 3 . $(dirname $0)/dockerlib.sh
4 4 . $(dirname $0)/packagelib.sh
5 5
6 6 BUILDDIR=$(dirname $0)
7 7 export ROOTDIR=$(cd $BUILDDIR/..; pwd)
8 8
9 9 checkdocker
10 10
11 CODENAME="$1"
12 PLATFORM="debian-$1"
11 DISTID="$1"
12 CODENAME="$2"
13 PLATFORM="$1-$2"
13 14 shift # extra params are passed to build process
14 15
15 16 OUTPUTDIR=${OUTPUTDIR:=$ROOTDIR/packages/$PLATFORM}
16 17
17 18 initcontainer $PLATFORM
18 19
19 20 # debuild only appears to be able to save built debs etc to .., so we
20 21 # have to share the .. of the current directory with the docker
21 22 # container and hope it's writable. Whee.
22 23 dn=$(basename $PWD)
23 24
24 25 if [ $(uname) = "Darwin" ] ; then
25 26 $DOCKER run -u $DBUILDUSER --rm -v $PWD/..:/mnt $CONTAINER \
26 27 sh -c "cd /mnt/$dn && make clean && make local"
27 28 fi
28 29 $DOCKER run -u $DBUILDUSER --rm -v $PWD/..:/mnt $CONTAINER \
29 sh -c "cd /mnt/$dn && DEB_BUILD_OPTIONS='${DEB_BUILD_OPTIONS:=}' contrib/builddeb --build --codename $CODENAME"
30 contrib/builddeb --cleanup --codename $CODENAME
30 sh -c "cd /mnt/$dn && DEB_BUILD_OPTIONS='${DEB_BUILD_OPTIONS:=}' contrib/builddeb --build --distid $DISTID --codename $CODENAME"
31 contrib/builddeb --cleanup --distid $DISTID --codename $CODENAME
31 32 if [ $(uname) = "Darwin" ] ; then
32 33 $DOCKER run -u $DBUILDUSER --rm -v $PWD/..:/mnt $CONTAINER \
33 34 sh -c "cd /mnt/$dn && make clean"
34 35 fi
General Comments 0
You need to be logged in to leave comments. Login now