[PATCH 4 of 4 STABLE] packaging: ship only a single binary Debian package

Denis Laxalde denis at laxalde.org
Wed Oct 23 11:22:22 EDT 2019


# HG changeset patch
# User Denis Laxalde <denis.laxalde at logilab.fr>
# Date 1571843896 -7200
#      Wed Oct 23 17:18:16 2019 +0200
# Branch stable
# Node ID 9c048b5fa9f02e7a1959e763dcb5e9fa920766f5
# Parent  11c85873e106c85621ef85b67b3c64788e24a8d3
packaging: ship only a single binary Debian package

We merge the mercurial and mercurial-common binary packages into a
single mercurial package. This is essentially to ease installation (and
upgrade) using a simple "dpkg -i" command. This also simplifies
debian/rules by removing arch (in)dependent cleanups during
installation.

We have the mercurial binary Breaks: and Replaces: mercurial-common so
that the latter will be removed upon upgrade.

Also note the change from "override_dh_install" to
"override_dh_auto_install" in debian/rules: this is because we do not
want "make install" to be run automatically as we need the
--install-layout=deb of "setup.py install" (otherwise, files would end
up in $DESTDIR/usr/local).

diff --git a/contrib/packaging/debian/control b/contrib/packaging/debian/control
index cb9c15d..cb9e49a 100644
--- a/contrib/packaging/debian/control
+++ b/contrib/packaging/debian/control
@@ -17,10 +17,14 @@ X-Python3-Version: >= 3.5
 
 Package: mercurial
 Depends:
+ sensible-utils,
  ${shlibs:Depends},
  ${misc:Depends},
  ${python3:Depends},
- mercurial-common (= ${source:Version})
+Recommends: ca-certificates
+Suggests: wish
+Replaces: mercurial-common (<< ${source:Version})
+Breaks: mercurial-common (<< ${source:Version})
 Architecture: any
 Description: fast, easy to use, distributed revision control tool.
  Mercurial is a fast, lightweight Source Control Management system designed
@@ -35,20 +39,3 @@ Description: fast, easy to use, distribu
   * Easy-to-use command-line interface
   * Integrated stand-alone web interface
   * Small Python codebase
-
-Package: mercurial-common
-Architecture: all
-Depends:
- sensible-utils,
- ${misc:Depends},
- ${python3:Depends},
-Recommends: mercurial (= ${source:Version}), ca-certificates
-Suggests: wish
-Breaks: mercurial (<< ${source:Version})
-Replaces: mercurial (<< 2.6.3)
-Description: easy-to-use, scalable distributed version control system (common files)
- Mercurial is a fast, lightweight Source Control Management system designed
- for efficient handling of very large distributed projects.
- .
- This package contains the architecture independent components of Mercurial,
- and is generally useless without the mercurial package.
diff --git a/contrib/packaging/debian/rules b/contrib/packaging/debian/rules
index 90251c2..a1cbe71 100755
--- a/contrib/packaging/debian/rules
+++ b/contrib/packaging/debian/rules
@@ -15,7 +15,6 @@ override_dh_auto_test:
 
 override_dh_python3:
 	dh_python3 --shebang=/usr/bin/python3
-	find debian/mercurial/usr/share -type d -empty -delete
 
 override_dh_auto_clean:
 	$(MAKE) cleanbutpackages
@@ -32,24 +31,14 @@ override_dh_auto_install:
 		DESTDIR="$(CURDIR)"/debian/mercurial \
 		PREFIX=/usr \
 		install
-	# remove arch-independent python stuff
-	find "$(CURDIR)"/debian/mercurial/usr/lib \
-		! -name '*.so' ! -type d -delete , \
-		-type d -empty -delete
-	python3 setup.py install --root "$(CURDIR)/debian/mercurial-common" --install-layout=deb
-	make install-doc PREFIX="$(CURDIR)"/debian/mercurial-common/usr
-	# remove arch-dependent python stuff
-	find "$(CURDIR)"/debian/mercurial-common/usr/lib \
-		-name '*.so' ! -type d -delete , \
-		-type d -empty -delete
-	cp contrib/hg-ssh "$(CURDIR)"/debian/mercurial-common/usr/bin
-	mkdir -p "$(CURDIR)"/debian/mercurial-common/usr/share/mercurial
-	cp contrib/hgk "$(CURDIR)"/debian/mercurial-common/usr/share/mercurial
-	mkdir -p "$(CURDIR)"/debian/mercurial-common/etc/mercurial/hgrc.d/
-	cp contrib/packaging/debian/*.rc "$(CURDIR)"/debian/mercurial-common/etc/mercurial/hgrc.d/
+	make install-doc PREFIX="$(CURDIR)"/debian/mercurial/usr
+	cp contrib/hg-ssh "$(CURDIR)"/debian/mercurial/usr/bin
+	mkdir -p "$(CURDIR)"/debian/mercurial/usr/share/mercurial
+	cp contrib/hgk "$(CURDIR)"/debian/mercurial/usr/share/mercurial
+	mkdir -p "$(CURDIR)"/debian/mercurial/etc/mercurial/hgrc.d/
+	cp contrib/packaging/debian/*.rc "$(CURDIR)"/debian/mercurial/etc/mercurial/hgrc.d/
 	# completions
-	mkdir -p "$(CURDIR)"/debian/mercurial-common/usr/share/bash-completion/completions
-	cp contrib/bash_completion "$(CURDIR)"/debian/mercurial-common/usr/share/bash-completion/completions/hg
-	mkdir -p "$(CURDIR)"/debian/mercurial-common/usr/share/zsh/vendor-completions
-	cp contrib/zsh_completion "$(CURDIR)"/debian/mercurial-common/usr/share/zsh/vendor-completions/_hg
-	rm "$(CURDIR)"/debian/mercurial-common/usr/bin/hg
+	mkdir -p "$(CURDIR)"/debian/mercurial/usr/share/bash-completion/completions
+	cp contrib/bash_completion "$(CURDIR)"/debian/mercurial/usr/share/bash-completion/completions/hg
+	mkdir -p "$(CURDIR)"/debian/mercurial/usr/share/zsh/vendor-completions
+	cp contrib/zsh_completion "$(CURDIR)"/debian/mercurial/usr/share/zsh/vendor-completions/_hg
diff --git a/tests/test-debian-packages.t b/tests/test-debian-packages.t
index 5d31e46..ac02ad8 100644
--- a/tests/test-debian-packages.t
+++ b/tests/test-debian-packages.t
@@ -13,18 +13,16 @@ Ensure debuild doesn't run the testsuite
   $ make deb > $OUTPUTDIR/build.log 2>&1
   $ cd $OUTPUTDIR
   $ ls *.deb | grep -v 'dbg'
-  mercurial-common_*.deb (glob)
   mercurial_*.deb (glob)
-main deb should have .so but no .py
+should have .so and .py
   $ dpkg --contents mercurial_*.deb | egrep '(localrepo|parsers)'
   * ./usr/lib/python3/dist-packages/mercurial/cext/parsers*.so (glob)
-mercurial-common should have py but no .so or pyc
-  $ dpkg --contents mercurial-common_*.deb | egrep '(localrepo|parsers.*so)'
   * ./usr/lib/python3/dist-packages/mercurial/localrepo.py (glob)
-zsh completions should be in the common package
-  $ dpkg --contents mercurial-common_*.deb | egrep 'zsh.*[^/]$'
+  * ./usr/lib/python3/dist-packages/mercurial/pure/parsers.py (glob)
+should have zsh completions
+  $ dpkg --contents mercurial_*.deb | egrep 'zsh.*[^/]$'
   * ./usr/share/zsh/vendor-completions/_hg (glob)
-chg should be installed alongside hg, in the 'mercurial' package
+should have chg
   $ dpkg --contents mercurial_*.deb | egrep 'chg$'
   * ./usr/bin/chg (glob)
 chg should come with a man page


More information about the Mercurial-devel mailing list