Show More
@@ -1,323 +1,323 | |||
|
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 | export PREFIX=/usr/local |
|
8 | 8 | PYTHON=python |
|
9 | 9 | $(eval HGROOT := $(shell pwd)) |
|
10 | 10 | HGPYTHONS ?= $(HGROOT)/build/pythons |
|
11 | 11 | PURE= |
|
12 | 12 | PYFILES:=$(shell find mercurial hgext doc -name '*.py') |
|
13 | 13 | DOCFILES=mercurial/help/*.txt |
|
14 | 14 | export LANGUAGE=C |
|
15 | 15 | export LC_ALL=C |
|
16 | 16 | TESTFLAGS ?= $(shell echo $$HGTESTFLAGS) |
|
17 | 17 | OSXVERSIONFLAGS ?= $(shell echo $$OSXVERSIONFLAGS) |
|
18 | 18 | |
|
19 | 19 | # Set this to e.g. "mingw32" to use a non-default compiler. |
|
20 | 20 | COMPILER= |
|
21 | 21 | |
|
22 | 22 | COMPILERFLAG_tmp_ = |
|
23 | 23 | COMPILERFLAG_tmp_${COMPILER} ?= -c $(COMPILER) |
|
24 | 24 | COMPILERFLAG=${COMPILERFLAG_tmp_${COMPILER}} |
|
25 | 25 | |
|
26 | 26 | help: |
|
27 | 27 | @echo 'Commonly used make targets:' |
|
28 | 28 | @echo ' all - build program and documentation' |
|
29 | 29 | @echo ' install - install program and man pages to $$PREFIX ($(PREFIX))' |
|
30 | 30 | @echo ' install-home - install with setup.py install --home=$$HOME ($(HOME))' |
|
31 | 31 | @echo ' local - build for inplace usage' |
|
32 | 32 | @echo ' tests - run all tests in the automatic test suite' |
|
33 | 33 | @echo ' test-foo - run only specified tests (e.g. test-merge1.t)' |
|
34 | 34 | @echo ' dist - run all tests and create a source tarball in dist/' |
|
35 | 35 | @echo ' clean - remove files created by other targets' |
|
36 | 36 | @echo ' (except installed files or dist source tarball)' |
|
37 | 37 | @echo ' update-pot - update i18n/hg.pot' |
|
38 | 38 | @echo |
|
39 | 39 | @echo 'Example for a system-wide installation under /usr/local:' |
|
40 | 40 | @echo ' make all && su -c "make install" && hg version' |
|
41 | 41 | @echo |
|
42 | 42 | @echo 'Example for a local installation (usable in this directory):' |
|
43 | 43 | @echo ' make local && ./hg version' |
|
44 | 44 | |
|
45 | 45 | all: build doc |
|
46 | 46 | |
|
47 | 47 | local: |
|
48 | 48 | $(PYTHON) setup.py $(PURE) \ |
|
49 | 49 | build_py -c -d . \ |
|
50 | 50 | build_ext $(COMPILERFLAG) -i \ |
|
51 | 51 | build_hgexe $(COMPILERFLAG) -i \ |
|
52 | 52 | build_mo |
|
53 | 53 | env HGRCPATH= $(PYTHON) hg version |
|
54 | 54 | |
|
55 | 55 | build: |
|
56 | 56 | $(PYTHON) setup.py $(PURE) build $(COMPILERFLAG) |
|
57 | 57 | |
|
58 | 58 | wheel: |
|
59 | 59 | FORCE_SETUPTOOLS=1 $(PYTHON) setup.py $(PURE) bdist_wheel $(COMPILERFLAG) |
|
60 | 60 | |
|
61 | 61 | doc: |
|
62 | 62 | $(MAKE) -C doc |
|
63 | 63 | |
|
64 | 64 | cleanbutpackages: |
|
65 | 65 | -$(PYTHON) setup.py clean --all # ignore errors from this command |
|
66 | 66 | find contrib doc hgext hgext3rd i18n mercurial tests hgdemandimport \ |
|
67 | 67 | \( -name '*.py[cdo]' -o -name '*.so' \) -exec rm -f '{}' ';' |
|
68 | 68 | rm -f MANIFEST MANIFEST.in hgext/__index__.py tests/*.err |
|
69 | 69 | rm -f mercurial/__modulepolicy__.py |
|
70 | 70 | if test -d .hg; then rm -f mercurial/__version__.py; fi |
|
71 | 71 | rm -rf build mercurial/locale |
|
72 | 72 | $(MAKE) -C doc clean |
|
73 | 73 | $(MAKE) -C contrib/chg distclean |
|
74 | 74 | |
|
75 | 75 | clean: cleanbutpackages |
|
76 | 76 | rm -rf packages |
|
77 | 77 | |
|
78 | 78 | install: install-bin install-doc |
|
79 | 79 | |
|
80 | 80 | install-bin: build |
|
81 | 81 | $(PYTHON) setup.py $(PURE) install --root="$(DESTDIR)/" --prefix="$(PREFIX)" --force |
|
82 | 82 | |
|
83 | 83 | install-doc: doc |
|
84 | 84 | cd doc && $(MAKE) $(MFLAGS) install |
|
85 | 85 | |
|
86 | 86 | install-home: install-home-bin install-home-doc |
|
87 | 87 | |
|
88 | 88 | install-home-bin: build |
|
89 | 89 | $(PYTHON) setup.py $(PURE) install --home="$(HOME)" --prefix="" --force |
|
90 | 90 | |
|
91 | 91 | install-home-doc: doc |
|
92 | 92 | cd doc && $(MAKE) $(MFLAGS) PREFIX="$(HOME)" install |
|
93 | 93 | |
|
94 | 94 | MANIFEST-doc: |
|
95 | 95 | $(MAKE) -C doc MANIFEST |
|
96 | 96 | |
|
97 | 97 | MANIFEST.in: MANIFEST-doc |
|
98 | 98 | hg manifest | sed -e 's/^/include /' > MANIFEST.in |
|
99 | 99 | echo include mercurial/__version__.py >> MANIFEST.in |
|
100 | 100 | sed -e 's/^/include /' < doc/MANIFEST >> MANIFEST.in |
|
101 | 101 | |
|
102 | 102 | dist: tests dist-notests |
|
103 | 103 | |
|
104 | 104 | dist-notests: doc MANIFEST.in |
|
105 | 105 | TAR_OPTIONS="--owner=root --group=root --mode=u+w,go-w,a+rX-s" $(PYTHON) setup.py -q sdist |
|
106 | 106 | |
|
107 | 107 | check: tests |
|
108 | 108 | |
|
109 | 109 | tests: |
|
110 | 110 | cd tests && $(PYTHON) run-tests.py $(TESTFLAGS) |
|
111 | 111 | |
|
112 | 112 | test-%: |
|
113 | 113 | cd tests && $(PYTHON) run-tests.py $(TESTFLAGS) $@ |
|
114 | 114 | |
|
115 | 115 | testpy-%: |
|
116 | 116 | @echo Looking for Python $* in $(HGPYTHONS) |
|
117 | 117 | [ -e $(HGPYTHONS)/$*/bin/python ] || ( \ |
|
118 | 118 | cd $$(mktemp --directory --tmpdir) && \ |
|
119 | 119 | $(MAKE) -f $(HGROOT)/contrib/Makefile.python PYTHONVER=$* PREFIX=$(HGPYTHONS)/$* python ) |
|
120 | 120 | cd tests && $(HGPYTHONS)/$*/bin/python run-tests.py $(TESTFLAGS) |
|
121 | 121 | |
|
122 | 122 | check-code: |
|
123 | 123 | hg manifest | xargs python contrib/check-code.py |
|
124 | 124 | |
|
125 | 125 | format-c: |
|
126 | 126 | clang-format --style file -i \ |
|
127 | 127 | `hg files 'set:(**.c or **.cc or **.h) and not "listfile:contrib/clang-format-ignorelist"'` |
|
128 | 128 | |
|
129 | 129 | update-pot: i18n/hg.pot |
|
130 | 130 | |
|
131 | 131 | i18n/hg.pot: $(PYFILES) $(DOCFILES) i18n/posplit i18n/hggettext |
|
132 | 132 | $(PYTHON) i18n/hggettext mercurial/commands.py \ |
|
133 | 133 | hgext/*.py hgext/*/__init__.py \ |
|
134 | 134 | mercurial/fileset.py mercurial/revset.py \ |
|
135 | 135 | mercurial/templatefilters.py \ |
|
136 | 136 | mercurial/templatefuncs.py \ |
|
137 | 137 | mercurial/templatekw.py \ |
|
138 | 138 | mercurial/filemerge.py \ |
|
139 | 139 | mercurial/hgweb/webcommands.py \ |
|
140 | 140 | mercurial/util.py \ |
|
141 | 141 | $(DOCFILES) > i18n/hg.pot.tmp |
|
142 | 142 | # All strings marked for translation in Mercurial contain |
|
143 | 143 | # ASCII characters only. But some files contain string |
|
144 | 144 | # literals like this '\037\213'. xgettext thinks it has to |
|
145 | 145 | # parse them even though they are not marked for translation. |
|
146 | 146 | # Extracting with an explicit encoding of ISO-8859-1 will make |
|
147 | 147 | # xgettext "parse" and ignore them. |
|
148 | 148 | echo $(PYFILES) | xargs \ |
|
149 | 149 | xgettext --package-name "Mercurial" \ |
|
150 | 150 | --msgid-bugs-address "<mercurial-devel@mercurial-scm.org>" \ |
|
151 | 151 | --copyright-holder "Matt Mackall <mpm@selenic.com> and others" \ |
|
152 | 152 | --from-code ISO-8859-1 --join --sort-by-file --add-comments=i18n: \ |
|
153 | 153 | -d hg -p i18n -o hg.pot.tmp |
|
154 | 154 | $(PYTHON) i18n/posplit i18n/hg.pot.tmp |
|
155 | 155 | # The target file is not created before the last step. So it never is in |
|
156 | 156 | # an intermediate state. |
|
157 | 157 | mv -f i18n/hg.pot.tmp i18n/hg.pot |
|
158 | 158 | |
|
159 | 159 | %.po: i18n/hg.pot |
|
160 | 160 | # work on a temporary copy for never having a half completed target |
|
161 | 161 | cp $@ $@.tmp |
|
162 | 162 | msgmerge --no-location --update $@.tmp $^ |
|
163 | 163 | mv -f $@.tmp $@ |
|
164 | 164 | |
|
165 | 165 | # Packaging targets |
|
166 | 166 | |
|
167 | 167 | osx: |
|
168 | 168 | rm -rf build/mercurial |
|
169 | 169 | /usr/bin/python2.7 setup.py install --optimize=1 \ |
|
170 | 170 | --root=build/mercurial/ --prefix=/usr/local/ \ |
|
171 | 171 | --install-lib=/Library/Python/2.7/site-packages/ |
|
172 | 172 | make -C doc all install DESTDIR="$(PWD)/build/mercurial/" |
|
173 | 173 | # Place a bogon .DS_Store file in the target dir so we can be |
|
174 | 174 | # sure it doesn't get included in the final package. |
|
175 | 175 | touch build/mercurial/.DS_Store |
|
176 | 176 | # install zsh completions - this location appears to be |
|
177 | 177 | # searched by default as of macOS Sierra. |
|
178 | 178 | install -d build/mercurial/usr/local/share/zsh/site-functions/ |
|
179 | 179 | install -m 0644 contrib/zsh_completion build/mercurial/usr/local/share/zsh/site-functions/_hg |
|
180 | 180 | # install bash completions - there doesn't appear to be a |
|
181 | 181 | # place that's searched by default for bash, so we'll follow |
|
182 | 182 | # the lead of Apple's git install and just put it in a |
|
183 | 183 | # location of our own. |
|
184 | 184 | install -d build/mercurial/usr/local/hg/contrib/ |
|
185 | 185 | install -m 0644 contrib/bash_completion build/mercurial/usr/local/hg/contrib/hg-completion.bash |
|
186 | 186 | make -C contrib/chg \ |
|
187 | 187 | HGPATH=/usr/local/bin/hg \ |
|
188 | 188 | PYTHON=/usr/bin/python2.7 \ |
|
189 | 189 | HGEXTDIR=/Library/Python/2.7/site-packages/hgext \ |
|
190 | 190 | DESTDIR=../../build/mercurial \ |
|
191 | 191 | PREFIX=/usr/local \ |
|
192 | 192 | clean install |
|
193 | 193 | mkdir -p $${OUTPUTDIR:-dist} |
|
194 | 194 | HGVER=$$(python contrib/genosxversion.py $(OSXVERSIONFLAGS) build/mercurial/Library/Python/2.7/site-packages/mercurial/__version__.py) && \ |
|
195 | 195 | OSXVER=$$(sw_vers -productVersion | cut -d. -f1,2) && \ |
|
196 | 196 | pkgbuild --filter \\.DS_Store --root build/mercurial/ \ |
|
197 | 197 | --identifier org.mercurial-scm.mercurial \ |
|
198 | 198 | --version "$${HGVER}" \ |
|
199 | 199 | build/mercurial.pkg && \ |
|
200 | 200 | productbuild --distribution contrib/macosx/distribution.xml \ |
|
201 | 201 | --package-path build/ \ |
|
202 | 202 | --version "$${HGVER}" \ |
|
203 | 203 | --resources contrib/macosx/ \ |
|
204 | 204 | "$${OUTPUTDIR:-dist/}"/Mercurial-"$${HGVER}"-macosx"$${OSXVER}".pkg |
|
205 | 205 | |
|
206 | 206 | deb: |
|
207 | 207 | contrib/packaging/builddeb |
|
208 | 208 | |
|
209 | 209 | ppa: |
|
210 | 210 | contrib/packaging/builddeb --source-only |
|
211 | 211 | |
|
212 | 212 | contrib/packaging/docker/debian-%: contrib/packaging/docker/debian.template |
|
213 | 213 | sed "s/__CODENAME__/$*/" $< > $@ |
|
214 | 214 | |
|
215 | 215 | docker-debian-jessie: contrib/packaging/docker/debian-jessie |
|
216 | 216 | contrib/packaging/dockerdeb debian jessie |
|
217 | 217 | |
|
218 | 218 | docker-debian-stretch: contrib/packaging/docker/debian-stretch |
|
219 | 219 | contrib/packaging/dockerdeb debian stretch |
|
220 | 220 | |
|
221 | 221 | contrib/packaging/docker/ubuntu-%: contrib/packaging/docker/ubuntu.template |
|
222 | 222 | sed "s/__CODENAME__/$*/" $< > $@ |
|
223 | 223 | |
|
224 | 224 | docker-ubuntu-trusty: contrib/packaging/docker/ubuntu-trusty |
|
225 | 225 | contrib/packaging/dockerdeb ubuntu trusty |
|
226 | 226 | |
|
227 | 227 | docker-ubuntu-trusty-ppa: contrib/packaging/docker/ubuntu-trusty |
|
228 | 228 | contrib/packaging/dockerdeb ubuntu trusty --source-only |
|
229 | 229 | |
|
230 | 230 | docker-ubuntu-xenial: contrib/packaging/docker/ubuntu-xenial |
|
231 | 231 | contrib/packaging/dockerdeb ubuntu xenial |
|
232 | 232 | |
|
233 | 233 | docker-ubuntu-xenial-ppa: contrib/packaging/docker/ubuntu-xenial |
|
234 | 234 | contrib/packaging/dockerdeb ubuntu xenial --source-only |
|
235 | 235 | |
|
236 | 236 | docker-ubuntu-artful: contrib/packaging/docker/ubuntu-artful |
|
237 | 237 | contrib/packaging/dockerdeb ubuntu artful |
|
238 | 238 | |
|
239 | 239 | docker-ubuntu-artful-ppa: contrib/packaging/docker/ubuntu-artful |
|
240 | 240 | contrib/packaging/dockerdeb ubuntu artful --source-only |
|
241 | 241 | |
|
242 | 242 | docker-ubuntu-bionic: contrib/packaging/docker/ubuntu-bionic |
|
243 | 243 | contrib/packaging/dockerdeb ubuntu bionic |
|
244 | 244 | |
|
245 | 245 | docker-ubuntu-bionic-ppa: contrib/packaging/docker/ubuntu-bionic |
|
246 | 246 | contrib/packaging/dockerdeb ubuntu bionic --source-only |
|
247 | 247 | |
|
248 | 248 | fedora20: |
|
249 | 249 | mkdir -p packages/fedora20 |
|
250 | contrib/buildrpm | |
|
250 | contrib/packaging/buildrpm | |
|
251 | 251 | cp rpmbuild/RPMS/*/* packages/fedora20 |
|
252 | 252 | cp rpmbuild/SRPMS/* packages/fedora20 |
|
253 | 253 | rm -rf rpmbuild |
|
254 | 254 | |
|
255 | 255 | docker-fedora20: |
|
256 | 256 | mkdir -p packages/fedora20 |
|
257 | 257 | contrib/packaging/dockerrpm fedora20 |
|
258 | 258 | |
|
259 | 259 | fedora21: |
|
260 | 260 | mkdir -p packages/fedora21 |
|
261 | contrib/buildrpm | |
|
261 | contrib/packaging/buildrpm | |
|
262 | 262 | cp rpmbuild/RPMS/*/* packages/fedora21 |
|
263 | 263 | cp rpmbuild/SRPMS/* packages/fedora21 |
|
264 | 264 | rm -rf rpmbuild |
|
265 | 265 | |
|
266 | 266 | docker-fedora21: |
|
267 | 267 | mkdir -p packages/fedora21 |
|
268 | 268 | contrib/packaging/dockerrpm fedora21 |
|
269 | 269 | |
|
270 | 270 | centos5: |
|
271 | 271 | mkdir -p packages/centos5 |
|
272 | contrib/buildrpm --withpython | |
|
272 | contrib/packaging/buildrpm --withpython | |
|
273 | 273 | cp rpmbuild/RPMS/*/* packages/centos5 |
|
274 | 274 | cp rpmbuild/SRPMS/* packages/centos5 |
|
275 | 275 | |
|
276 | 276 | docker-centos5: |
|
277 | 277 | mkdir -p packages/centos5 |
|
278 | 278 | contrib/packaging/dockerrpm centos5 --withpython |
|
279 | 279 | |
|
280 | 280 | centos6: |
|
281 | 281 | mkdir -p packages/centos6 |
|
282 | contrib/buildrpm --withpython | |
|
282 | contrib/packaging/buildrpm --withpython | |
|
283 | 283 | cp rpmbuild/RPMS/*/* packages/centos6 |
|
284 | 284 | cp rpmbuild/SRPMS/* packages/centos6 |
|
285 | 285 | |
|
286 | 286 | docker-centos6: |
|
287 | 287 | mkdir -p packages/centos6 |
|
288 | 288 | contrib/packaging/dockerrpm centos6 --withpython |
|
289 | 289 | |
|
290 | 290 | centos7: |
|
291 | 291 | mkdir -p packages/centos7 |
|
292 | contrib/buildrpm | |
|
292 | contrib/packaging/buildrpm | |
|
293 | 293 | cp rpmbuild/RPMS/*/* packages/centos7 |
|
294 | 294 | cp rpmbuild/SRPMS/* packages/centos7 |
|
295 | 295 | |
|
296 | 296 | docker-centos7: |
|
297 | 297 | mkdir -p packages/centos7 |
|
298 | 298 | contrib/packaging/dockerrpm centos7 |
|
299 | 299 | |
|
300 | 300 | linux-wheels: linux-wheels-x86_64 linux-wheels-i686 |
|
301 | 301 | |
|
302 | 302 | linux-wheels-x86_64: |
|
303 | 303 | docker run -e "HGTEST_JOBS=$(shell nproc)" --rm -ti -v `pwd`:/src quay.io/pypa/manylinux1_x86_64 /src/contrib/build-linux-wheels.sh |
|
304 | 304 | |
|
305 | 305 | linux-wheels-i686: |
|
306 | 306 | docker run -e "HGTEST_JOBS=$(shell nproc)" --rm -ti -v `pwd`:/src quay.io/pypa/manylinux1_i686 linux32 /src/contrib/build-linux-wheels.sh |
|
307 | 307 | |
|
308 | 308 | .PHONY: help all local build doc cleanbutpackages clean install install-bin \ |
|
309 | 309 | install-doc install-home install-home-bin install-home-doc \ |
|
310 | 310 | dist dist-notests check tests check-code format-c update-pot \ |
|
311 | 311 | osx deb ppa \ |
|
312 | 312 | docker-debian-jessie \ |
|
313 | 313 | docker-debian-stretch \ |
|
314 | 314 | docker-ubuntu-trusty docker-ubuntu-trusty-ppa \ |
|
315 | 315 | docker-ubuntu-xenial docker-ubuntu-xenial-ppa \ |
|
316 | 316 | docker-ubuntu-artful docker-ubuntu-artful-ppa \ |
|
317 | 317 | docker-ubuntu-bionic docker-ubuntu-bionic-ppa \ |
|
318 | 318 | fedora20 docker-fedora20 \ |
|
319 | 319 | fedora21 docker-fedora21 \ |
|
320 | 320 | centos5 docker-centos5 \ |
|
321 | 321 | centos6 docker-centos6 \ |
|
322 | 322 | centos7 docker-centos7 \ |
|
323 | 323 | linux-wheels |
@@ -1,162 +1,162 | |||
|
1 | 1 | #!/bin/bash -e |
|
2 | 2 | # |
|
3 | 3 | # Build a Mercurial RPM from the current repo |
|
4 | 4 | # |
|
5 | 5 | # Tested on |
|
6 | 6 | # - Fedora 20 |
|
7 | 7 | # - CentOS 5 |
|
8 | 8 | # - centOS 6 |
|
9 | 9 | |
|
10 |
. $(dirname $0)/packag |
|
|
10 | . $(dirname $0)/packagelib.sh | |
|
11 | 11 | |
|
12 | 12 | BUILD=1 |
|
13 | 13 | RPMBUILDDIR="$PWD/rpmbuild" |
|
14 | 14 | |
|
15 | 15 | while [ "$1" ]; do |
|
16 | 16 | case "$1" in |
|
17 | 17 | --prepare ) |
|
18 | 18 | shift |
|
19 | 19 | BUILD= |
|
20 | 20 | ;; |
|
21 | 21 | --withpython | --with-python) |
|
22 | 22 | shift |
|
23 | 23 | PYTHONVER=2.7.14 |
|
24 | 24 | PYTHONMD5=cee2e4b33ad3750da77b2e85f2f8b724 |
|
25 | 25 | ;; |
|
26 | 26 | --rpmbuilddir ) |
|
27 | 27 | shift |
|
28 | 28 | RPMBUILDDIR="$1" |
|
29 | 29 | shift |
|
30 | 30 | ;; |
|
31 | 31 | * ) |
|
32 | 32 | echo "Invalid parameter $1!" 1>&2 |
|
33 | 33 | exit 1 |
|
34 | 34 | ;; |
|
35 | 35 | esac |
|
36 | 36 | done |
|
37 | 37 | |
|
38 | cd "`dirname $0`/.." | |
|
38 | cd "`dirname $0`/../.." | |
|
39 | 39 | |
|
40 | 40 | specfile=$PWD/contrib/packaging/mercurial.spec |
|
41 | 41 | if [ ! -f $specfile ]; then |
|
42 | 42 | echo "Cannot find $specfile!" 1>&2 |
|
43 | 43 | exit 1 |
|
44 | 44 | fi |
|
45 | 45 | |
|
46 | 46 | if [ ! -d .hg ]; then |
|
47 | 47 | echo 'You are not inside a Mercurial repository!' 1>&2 |
|
48 | 48 | exit 1 |
|
49 | 49 | fi |
|
50 | 50 | |
|
51 | 51 | gethgversion |
|
52 | 52 | |
|
53 | 53 | # TODO: handle distance/node set, and type set |
|
54 | 54 | |
|
55 | 55 | if [ -z "$type" ] ; then |
|
56 | 56 | release=1 |
|
57 | 57 | else |
|
58 | 58 | release=0.9_$type |
|
59 | 59 | fi |
|
60 | 60 | |
|
61 | 61 | if [ -n "$distance" ] ; then |
|
62 | 62 | release=$release+$distance_$node |
|
63 | 63 | fi |
|
64 | 64 | |
|
65 | 65 | if [ "$PYTHONVER" ]; then |
|
66 | 66 | release=$release+$PYTHONVER |
|
67 | 67 | RPMPYTHONVER=$PYTHONVER |
|
68 | 68 | else |
|
69 | 69 | RPMPYTHONVER=%{nil} |
|
70 | 70 | fi |
|
71 | 71 | |
|
72 | 72 | mkdir -p $RPMBUILDDIR/{SOURCES,BUILD,SRPMS,RPMS} |
|
73 | 73 | $HG archive -t tgz $RPMBUILDDIR/SOURCES/mercurial-$version-$release.tar.gz |
|
74 | 74 | if [ "$PYTHONVER" ]; then |
|
75 | 75 | ( |
|
76 | 76 | mkdir -p build |
|
77 | 77 | cd build |
|
78 | 78 | PYTHON_SRCFILE=Python-$PYTHONVER.tgz |
|
79 | 79 | [ -f $PYTHON_SRCFILE ] || curl -Lo $PYTHON_SRCFILE http://www.python.org/ftp/python/$PYTHONVER/$PYTHON_SRCFILE |
|
80 | 80 | if [ "$PYTHONMD5" ]; then |
|
81 | 81 | echo "$PYTHONMD5 $PYTHON_SRCFILE" | md5sum -w -c |
|
82 | 82 | fi |
|
83 | 83 | ln -f $PYTHON_SRCFILE $RPMBUILDDIR/SOURCES/$PYTHON_SRCFILE |
|
84 | 84 | |
|
85 | 85 | DOCUTILSVER=`sed -ne "s/^%global docutilsname docutils-//p" $specfile` |
|
86 | 86 | DOCUTILS_SRCFILE=docutils-$DOCUTILSVER.tar.gz |
|
87 | 87 | [ -f $DOCUTILS_SRCFILE ] || curl -Lo $DOCUTILS_SRCFILE http://downloads.sourceforge.net/project/docutils/docutils/$DOCUTILSVER/$DOCUTILS_SRCFILE |
|
88 | 88 | DOCUTILSMD5=`sed -ne "s/^%global docutilsmd5 //p" $specfile` |
|
89 | 89 | if [ "$DOCUTILSMD5" ]; then |
|
90 | 90 | echo "$DOCUTILSMD5 $DOCUTILS_SRCFILE" | md5sum -w -c |
|
91 | 91 | fi |
|
92 | 92 | ln -f $DOCUTILS_SRCFILE $RPMBUILDDIR/SOURCES/$DOCUTILS_SRCFILE |
|
93 | 93 | ) |
|
94 | 94 | fi |
|
95 | 95 | |
|
96 | 96 | mkdir -p $RPMBUILDDIR/SPECS |
|
97 | 97 | rpmspec=$RPMBUILDDIR/SPECS/mercurial.spec |
|
98 | 98 | |
|
99 | 99 | sed -e "s,^Version:.*,Version: $version," \ |
|
100 | 100 | -e "s,^Release:.*,Release: $release," \ |
|
101 | 101 | $specfile > $rpmspec |
|
102 | 102 | |
|
103 | 103 | echo >> $rpmspec |
|
104 | 104 | echo "%changelog" >> $rpmspec |
|
105 | 105 | |
|
106 | 106 | if echo $version | grep '+' > /dev/null 2>&1; then |
|
107 | 107 | latesttag="`echo $version | sed -e 's/+.*//'`" |
|
108 | 108 | $HG log -r .:"$latesttag" -fM \ |
|
109 | 109 | --template '{date|hgdate}\t{author}\t{desc|firstline}\n' | python -c ' |
|
110 | 110 | import sys, time |
|
111 | 111 | |
|
112 | 112 | def datestr(date, format): |
|
113 | 113 | return time.strftime(format, time.gmtime(float(date[0]) - date[1])) |
|
114 | 114 | |
|
115 | 115 | changelog = [] |
|
116 | 116 | for l in sys.stdin.readlines(): |
|
117 | 117 | tok = l.split("\t") |
|
118 | 118 | hgdate = tuple(int(v) for v in tok[0].split()) |
|
119 | 119 | changelog.append((datestr(hgdate, "%F"), tok[1], hgdate, tok[2])) |
|
120 | 120 | prevtitle = "" |
|
121 | 121 | for l in sorted(changelog, reverse=True): |
|
122 | 122 | title = "* %s %s" % (datestr(l[2], "%a %b %d %Y"), l[1]) |
|
123 | 123 | if prevtitle != title: |
|
124 | 124 | prevtitle = title |
|
125 | 125 | |
|
126 | 126 | print title |
|
127 | 127 | print "- %s" % l[3].strip() |
|
128 | 128 | ' >> $rpmspec |
|
129 | 129 | |
|
130 | 130 | else |
|
131 | 131 | |
|
132 | 132 | $HG log \ |
|
133 | 133 | --template '{date|hgdate}\t{author}\t{desc|firstline}\n' \ |
|
134 | 134 | .hgtags | python -c ' |
|
135 | 135 | import sys, time |
|
136 | 136 | |
|
137 | 137 | def datestr(date, format): |
|
138 | 138 | return time.strftime(format, time.gmtime(float(date[0]) - date[1])) |
|
139 | 139 | |
|
140 | 140 | for l in sys.stdin.readlines(): |
|
141 | 141 | tok = l.split("\t") |
|
142 | 142 | hgdate = tuple(int(v) for v in tok[0].split()) |
|
143 | 143 | print "* %s %s\n- %s" % (datestr(hgdate, "%a %b %d %Y"), tok[1], tok[2]) |
|
144 | 144 | ' >> $rpmspec |
|
145 | 145 | |
|
146 | 146 | fi |
|
147 | 147 | |
|
148 | 148 | sed -i \ |
|
149 | 149 | -e "s/^%define withpython.*$/%define withpython $RPMPYTHONVER/" \ |
|
150 | 150 | $rpmspec |
|
151 | 151 | |
|
152 | 152 | if [ "$BUILD" ]; then |
|
153 | 153 | rpmbuild --define "_topdir $RPMBUILDDIR" -ba $rpmspec --clean |
|
154 | 154 | if [ $? = 0 ]; then |
|
155 | 155 | echo |
|
156 | 156 | echo "Built packages for $version-$release:" |
|
157 | 157 | find $RPMBUILDDIR/*RPMS/ -type f -newer $rpmspec |
|
158 | 158 | fi |
|
159 | 159 | else |
|
160 | 160 | echo "Prepared sources for $version-$release $rpmspec are in $RPMBUILDDIR/SOURCES/ - use like:" |
|
161 | 161 | echo "rpmbuild --define '_topdir $RPMBUILDDIR' -ba $rpmspec --clean" |
|
162 | 162 | fi |
@@ -1,37 +1,37 | |||
|
1 | 1 | #!/bin/bash -e |
|
2 | 2 | |
|
3 | 3 | . $(dirname $0)/dockerlib.sh |
|
4 | 4 | |
|
5 | 5 | BUILDDIR=$(dirname $0) |
|
6 | 6 | export ROOTDIR=$(cd $BUILDDIR/../..; pwd) |
|
7 | 7 | |
|
8 | 8 | checkdocker |
|
9 | 9 | |
|
10 | 10 | PLATFORM="$1" |
|
11 | 11 | shift # extra params are passed to buildrpm |
|
12 | 12 | |
|
13 | 13 | initcontainer $PLATFORM |
|
14 | 14 | |
|
15 | 15 | RPMBUILDDIR=$ROOTDIR/packages/$PLATFORM |
|
16 | contrib/buildrpm --rpmbuilddir $RPMBUILDDIR --prepare $* | |
|
16 | contrib/packaging/buildrpm --rpmbuilddir $RPMBUILDDIR --prepare $* | |
|
17 | 17 | |
|
18 | 18 | DSHARED=/mnt/shared |
|
19 | 19 | $DOCKER run -e http_proxy -e https_proxy -u $DBUILDUSER --rm -v $RPMBUILDDIR:$DSHARED $CONTAINER \ |
|
20 | 20 | rpmbuild --define "_topdir $DSHARED" -ba $DSHARED/SPECS/mercurial.spec --clean |
|
21 | 21 | |
|
22 | 22 | $DOCKER run -e http_proxy -e https_proxy -u $DBUILDUSER --rm -v $RPMBUILDDIR:$DSHARED $CONTAINER \ |
|
23 | 23 | createrepo $DSHARED |
|
24 | 24 | |
|
25 | 25 | cat << EOF > $RPMBUILDDIR/mercurial.repo |
|
26 | 26 | # Place this file in /etc/yum.repos.d/mercurial.repo |
|
27 | 27 | [mercurial] |
|
28 | 28 | name=Mercurial packages for $PLATFORM |
|
29 | 29 | # baseurl=file://$RPMBUILDDIR/ |
|
30 | 30 | baseurl=http://hg.example.com/build/$PLATFORM/ |
|
31 | 31 | skip_if_unavailable=True |
|
32 | 32 | gpgcheck=0 |
|
33 | 33 | enabled=1 |
|
34 | 34 | EOF |
|
35 | 35 | |
|
36 | 36 | echo |
|
37 | 37 | echo "Build complete - results can be found in $RPMBUILDDIR" |
General Comments 0
You need to be logged in to leave comments.
Login now