annotate contrib/packaging/debian/rules @ 46360:1726a53a8494

reverse-branch-cache: switch to doubling allocating scheme In preperation for updating the reverse-branch-cache incrementally whenever a new changeset comes in, avoid bad performance on resize with Python 3.7 (and likely other 3.x versions). Differential Revision: https://phab.mercurial-scm.org/D9778
author Joerg Sonnenberger <joerg@bec.de>
date Fri, 15 Jan 2021 01:20:47 +0100
parents 36178b5c9aeb
children 90481550467c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
26148
7f49efcaa9b4 debian: switch to using debhelper and dh_python2 to build debs
Augie Fackler <augie@google.com>
parents:
diff changeset
1 #!/usr/bin/make -f
7f49efcaa9b4 debian: switch to using debhelper and dh_python2 to build debs
Augie Fackler <augie@google.com>
parents:
diff changeset
2 # Uncomment this to turn on verbose mode.
7f49efcaa9b4 debian: switch to using debhelper and dh_python2 to build debs
Augie Fackler <augie@google.com>
parents:
diff changeset
3 # export DH_VERBOSE=1
7f49efcaa9b4 debian: switch to using debhelper and dh_python2 to build debs
Augie Fackler <augie@google.com>
parents:
diff changeset
4
45006
36178b5c9aeb debian: support building a single deb for multiple py3 versions
Kyle Lippincott <spectral@google.com>
parents: 43320
diff changeset
5 # By default we build a .deb where the native components are built with the
36178b5c9aeb debian: support building a single deb for multiple py3 versions
Kyle Lippincott <spectral@google.com>
parents: 43320
diff changeset
6 # current "default" version of py3 on the build machine. If you wish to build a
36178b5c9aeb debian: support building a single deb for multiple py3 versions
Kyle Lippincott <spectral@google.com>
parents: 43320
diff changeset
7 # .deb that has native components built for multiple versions of py3:
36178b5c9aeb debian: support building a single deb for multiple py3 versions
Kyle Lippincott <spectral@google.com>
parents: 43320
diff changeset
8 #
36178b5c9aeb debian: support building a single deb for multiple py3 versions
Kyle Lippincott <spectral@google.com>
parents: 43320
diff changeset
9 # 1. install python3.x and python3.x-dev for each version you want
36178b5c9aeb debian: support building a single deb for multiple py3 versions
Kyle Lippincott <spectral@google.com>
parents: 43320
diff changeset
10 # 2. set DEB_HG_MULTI_VERSION=1 or DEB_HG_PYTHON_VERSIONS in your environment
36178b5c9aeb debian: support building a single deb for multiple py3 versions
Kyle Lippincott <spectral@google.com>
parents: 43320
diff changeset
11 # (if both are set, DEB_HG_PYTHON_VERSIONS has precedence)
36178b5c9aeb debian: support building a single deb for multiple py3 versions
Kyle Lippincott <spectral@google.com>
parents: 43320
diff changeset
12 #
36178b5c9aeb debian: support building a single deb for multiple py3 versions
Kyle Lippincott <spectral@google.com>
parents: 43320
diff changeset
13 # If you choose `DEB_HG_MULTI_VERSION=1`, it will build for every "supported"
36178b5c9aeb debian: support building a single deb for multiple py3 versions
Kyle Lippincott <spectral@google.com>
parents: 43320
diff changeset
14 # version of py3 that's installed on the build machine. This may not be equal to
36178b5c9aeb debian: support building a single deb for multiple py3 versions
Kyle Lippincott <spectral@google.com>
parents: 43320
diff changeset
15 # the actual versions that are installed, see the comment above where we set
36178b5c9aeb debian: support building a single deb for multiple py3 versions
Kyle Lippincott <spectral@google.com>
parents: 43320
diff changeset
16 # DEB_HG_PYTHON_VERSIONS below. If you choose to set `DEB_HG_PYTHON_VERSIONS`
36178b5c9aeb debian: support building a single deb for multiple py3 versions
Kyle Lippincott <spectral@google.com>
parents: 43320
diff changeset
17 # yourself, set it to a space-separated string of python version numbers, like:
36178b5c9aeb debian: support building a single deb for multiple py3 versions
Kyle Lippincott <spectral@google.com>
parents: 43320
diff changeset
18 # DEB_HG_PYTHON_VERSIONS="3.7 3.8" make deb
36178b5c9aeb debian: support building a single deb for multiple py3 versions
Kyle Lippincott <spectral@google.com>
parents: 43320
diff changeset
19 DEB_HG_MULTI_VERSION?=0
36178b5c9aeb debian: support building a single deb for multiple py3 versions
Kyle Lippincott <spectral@google.com>
parents: 43320
diff changeset
20
26148
7f49efcaa9b4 debian: switch to using debhelper and dh_python2 to build debs
Augie Fackler <augie@google.com>
parents:
diff changeset
21 CPUS=$(shell cat /proc/cpuinfo | grep -E ^processor | wc -l)
7f49efcaa9b4 debian: switch to using debhelper and dh_python2 to build debs
Augie Fackler <augie@google.com>
parents:
diff changeset
22
45006
36178b5c9aeb debian: support building a single deb for multiple py3 versions
Kyle Lippincott <spectral@google.com>
parents: 43320
diff changeset
23 # By default, only build for the version of python3 that the system considers
36178b5c9aeb debian: support building a single deb for multiple py3 versions
Kyle Lippincott <spectral@google.com>
parents: 43320
diff changeset
24 # the 'default' (which should be the one invoked by just running 'python3'
36178b5c9aeb debian: support building a single deb for multiple py3 versions
Kyle Lippincott <spectral@google.com>
parents: 43320
diff changeset
25 # without a minor version). If DEB_HG_PYTHON_VERSIONS is set, this is ignored.
36178b5c9aeb debian: support building a single deb for multiple py3 versions
Kyle Lippincott <spectral@google.com>
parents: 43320
diff changeset
26 ifeq ($(DEB_HG_MULTI_VERSION), 1)
36178b5c9aeb debian: support building a single deb for multiple py3 versions
Kyle Lippincott <spectral@google.com>
parents: 43320
diff changeset
27 # If we're building for multiple versions, use all of the "supported" versions
36178b5c9aeb debian: support building a single deb for multiple py3 versions
Kyle Lippincott <spectral@google.com>
parents: 43320
diff changeset
28 # on the build machine. Note: the mechanism in use here (`py3versions`) is the
36178b5c9aeb debian: support building a single deb for multiple py3 versions
Kyle Lippincott <spectral@google.com>
parents: 43320
diff changeset
29 # recommended one, but it relies on a file written by the python3-minimal
36178b5c9aeb debian: support building a single deb for multiple py3 versions
Kyle Lippincott <spectral@google.com>
parents: 43320
diff changeset
30 # package, and this file is not dynamic and does not account for manual
36178b5c9aeb debian: support building a single deb for multiple py3 versions
Kyle Lippincott <spectral@google.com>
parents: 43320
diff changeset
31 # installations, just the ones that would be installed by `python3-all`. This
36178b5c9aeb debian: support building a single deb for multiple py3 versions
Kyle Lippincott <spectral@google.com>
parents: 43320
diff changeset
32 # includes the `-i` flag, which claims it's to list all "installed" versions,
36178b5c9aeb debian: support building a single deb for multiple py3 versions
Kyle Lippincott <spectral@google.com>
parents: 43320
diff changeset
33 # but it doesn't. This was quite confusing, hence this tale of woe. :)
36178b5c9aeb debian: support building a single deb for multiple py3 versions
Kyle Lippincott <spectral@google.com>
parents: 43320
diff changeset
34 DEB_HG_PYTHON_VERSIONS?=$(shell py3versions -vs)
36178b5c9aeb debian: support building a single deb for multiple py3 versions
Kyle Lippincott <spectral@google.com>
parents: 43320
diff changeset
35 else
36178b5c9aeb debian: support building a single deb for multiple py3 versions
Kyle Lippincott <spectral@google.com>
parents: 43320
diff changeset
36 # If we're building for only one version, identify the "default" version on
36178b5c9aeb debian: support building a single deb for multiple py3 versions
Kyle Lippincott <spectral@google.com>
parents: 43320
diff changeset
37 # the build machine and use that when building; this is just so that we don't
36178b5c9aeb debian: support building a single deb for multiple py3 versions
Kyle Lippincott <spectral@google.com>
parents: 43320
diff changeset
38 # have to duplicate the rules below for multi-version vs. single-version. The
36178b5c9aeb debian: support building a single deb for multiple py3 versions
Kyle Lippincott <spectral@google.com>
parents: 43320
diff changeset
39 # shebang line will still be /usr/bin/python3 (no minor version).
36178b5c9aeb debian: support building a single deb for multiple py3 versions
Kyle Lippincott <spectral@google.com>
parents: 43320
diff changeset
40 DEB_HG_PYTHON_VERSIONS?=$(shell py3versions -vd)
36178b5c9aeb debian: support building a single deb for multiple py3 versions
Kyle Lippincott <spectral@google.com>
parents: 43320
diff changeset
41 endif
36178b5c9aeb debian: support building a single deb for multiple py3 versions
Kyle Lippincott <spectral@google.com>
parents: 43320
diff changeset
42
43310
7574ccd87200 packaging: upgrade Debian packaging to build with Python 3
Denis Laxalde <denis@laxalde.org>
parents: 38009
diff changeset
43 export HGPYTHON3=1
7574ccd87200 packaging: upgrade Debian packaging to build with Python 3
Denis Laxalde <denis@laxalde.org>
parents: 38009
diff changeset
44 export PYTHON=python3
7574ccd87200 packaging: upgrade Debian packaging to build with Python 3
Denis Laxalde <denis@laxalde.org>
parents: 38009
diff changeset
45
26148
7f49efcaa9b4 debian: switch to using debhelper and dh_python2 to build debs
Augie Fackler <augie@google.com>
parents:
diff changeset
46 %:
43310
7574ccd87200 packaging: upgrade Debian packaging to build with Python 3
Denis Laxalde <denis@laxalde.org>
parents: 38009
diff changeset
47 dh $@ --with python3
26148
7f49efcaa9b4 debian: switch to using debhelper and dh_python2 to build debs
Augie Fackler <augie@google.com>
parents:
diff changeset
48
45006
36178b5c9aeb debian: support building a single deb for multiple py3 versions
Kyle Lippincott <spectral@google.com>
parents: 43320
diff changeset
49 # Note: testing can be disabled using the standard `DEB_BUILD_OPTIONS=nocheck`
26148
7f49efcaa9b4 debian: switch to using debhelper and dh_python2 to build debs
Augie Fackler <augie@google.com>
parents:
diff changeset
50 override_dh_auto_test:
7f49efcaa9b4 debian: switch to using debhelper and dh_python2 to build debs
Augie Fackler <augie@google.com>
parents:
diff changeset
51 http_proxy='' dh_auto_test -- TESTFLAGS="-j$(CPUS)"
7f49efcaa9b4 debian: switch to using debhelper and dh_python2 to build debs
Augie Fackler <augie@google.com>
parents:
diff changeset
52
43310
7574ccd87200 packaging: upgrade Debian packaging to build with Python 3
Denis Laxalde <denis@laxalde.org>
parents: 38009
diff changeset
53 override_dh_python3:
43313
a882c088dc2e packaging: use /usr/bin/python3 shebang for scripts in Debian
Denis Laxalde <denis@laxalde.org>
parents: 43310
diff changeset
54 dh_python3 --shebang=/usr/bin/python3
26148
7f49efcaa9b4 debian: switch to using debhelper and dh_python2 to build debs
Augie Fackler <augie@google.com>
parents:
diff changeset
55
43318
cdf6db1f4faf packaging: distinguish clean and build steps from install in Debian
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 43313
diff changeset
56 override_dh_auto_clean:
cdf6db1f4faf packaging: distinguish clean and build steps from install in Debian
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 43313
diff changeset
57 $(MAKE) cleanbutpackages
cdf6db1f4faf packaging: distinguish clean and build steps from install in Debian
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 43313
diff changeset
58 $(MAKE) -C contrib/chg clean
cdf6db1f4faf packaging: distinguish clean and build steps from install in Debian
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 43313
diff changeset
59
cdf6db1f4faf packaging: distinguish clean and build steps from install in Debian
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 43313
diff changeset
60 override_dh_auto_build:
cdf6db1f4faf packaging: distinguish clean and build steps from install in Debian
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 43313
diff changeset
61 $(MAKE) all
cdf6db1f4faf packaging: distinguish clean and build steps from install in Debian
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 43313
diff changeset
62 $(MAKE) -C contrib/chg all
cdf6db1f4faf packaging: distinguish clean and build steps from install in Debian
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 43313
diff changeset
63
45006
36178b5c9aeb debian: support building a single deb for multiple py3 versions
Kyle Lippincott <spectral@google.com>
parents: 43320
diff changeset
64 # Build the native extensions for a specfic python3 version (which must be
36178b5c9aeb debian: support building a single deb for multiple py3 versions
Kyle Lippincott <spectral@google.com>
parents: 43320
diff changeset
65 # installed on the build machine).
36178b5c9aeb debian: support building a single deb for multiple py3 versions
Kyle Lippincott <spectral@google.com>
parents: 43320
diff changeset
66 install-python%:
36178b5c9aeb debian: support building a single deb for multiple py3 versions
Kyle Lippincott <spectral@google.com>
parents: 43320
diff changeset
67 python$* setup.py install --root "$(CURDIR)"/debian/mercurial --install-layout=deb
36178b5c9aeb debian: support building a single deb for multiple py3 versions
Kyle Lippincott <spectral@google.com>
parents: 43320
diff changeset
68
36178b5c9aeb debian: support building a single deb for multiple py3 versions
Kyle Lippincott <spectral@google.com>
parents: 43320
diff changeset
69 # Build the final package. This rule has a dependencies section that causes the
36178b5c9aeb debian: support building a single deb for multiple py3 versions
Kyle Lippincott <spectral@google.com>
parents: 43320
diff changeset
70 # native extensions to be compiled for every version of python3 listed in
36178b5c9aeb debian: support building a single deb for multiple py3 versions
Kyle Lippincott <spectral@google.com>
parents: 43320
diff changeset
71 # DEB_HG_PYTHON_VERSIONS.
36178b5c9aeb debian: support building a single deb for multiple py3 versions
Kyle Lippincott <spectral@google.com>
parents: 43320
diff changeset
72 override_dh_auto_install: $(DEB_HG_PYTHON_VERSIONS:%=install-python%)
34406
0133ca39c688 deb: build and install chg
Kyle Lippincott <spectral@google.com>
parents: 34405
diff changeset
73 # chg
0133ca39c688 deb: build and install chg
Kyle Lippincott <spectral@google.com>
parents: 34405
diff changeset
74 make -C contrib/chg \
34625
f1c2552c2de7 build: "make deb" failed when the base path contained spaces
muxator <a.mux@inwind.it>
parents: 34406
diff changeset
75 DESTDIR="$(CURDIR)"/debian/mercurial \
34406
0133ca39c688 deb: build and install chg
Kyle Lippincott <spectral@google.com>
parents: 34405
diff changeset
76 PREFIX=/usr \
43318
cdf6db1f4faf packaging: distinguish clean and build steps from install in Debian
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 43313
diff changeset
77 install
43320
7b638d25b8e4 packaging: ship only a single binary Debian package
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 43319
diff changeset
78 make install-doc PREFIX="$(CURDIR)"/debian/mercurial/usr
7b638d25b8e4 packaging: ship only a single binary Debian package
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 43319
diff changeset
79 cp contrib/hg-ssh "$(CURDIR)"/debian/mercurial/usr/bin
7b638d25b8e4 packaging: ship only a single binary Debian package
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 43319
diff changeset
80 mkdir -p "$(CURDIR)"/debian/mercurial/usr/share/mercurial
7b638d25b8e4 packaging: ship only a single binary Debian package
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 43319
diff changeset
81 cp contrib/hgk "$(CURDIR)"/debian/mercurial/usr/share/mercurial
7b638d25b8e4 packaging: ship only a single binary Debian package
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 43319
diff changeset
82 mkdir -p "$(CURDIR)"/debian/mercurial/etc/mercurial/hgrc.d/
7b638d25b8e4 packaging: ship only a single binary Debian package
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 43319
diff changeset
83 cp contrib/packaging/debian/*.rc "$(CURDIR)"/debian/mercurial/etc/mercurial/hgrc.d/
34406
0133ca39c688 deb: build and install chg
Kyle Lippincott <spectral@google.com>
parents: 34405
diff changeset
84 # completions
43320
7b638d25b8e4 packaging: ship only a single binary Debian package
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 43319
diff changeset
85 mkdir -p "$(CURDIR)"/debian/mercurial/usr/share/bash-completion/completions
7b638d25b8e4 packaging: ship only a single binary Debian package
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 43319
diff changeset
86 cp contrib/bash_completion "$(CURDIR)"/debian/mercurial/usr/share/bash-completion/completions/hg
7b638d25b8e4 packaging: ship only a single binary Debian package
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 43319
diff changeset
87 mkdir -p "$(CURDIR)"/debian/mercurial/usr/share/zsh/vendor-completions
7b638d25b8e4 packaging: ship only a single binary Debian package
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 43319
diff changeset
88 cp contrib/zsh_completion "$(CURDIR)"/debian/mercurial/usr/share/zsh/vendor-completions/_hg