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

login
register
mail settings
Submitter Denis Laxalde
Date Oct. 23, 2019, 3:22 p.m.
Message ID <9c048b5fa9f02e7a1959.1571844142@steppe.local>
Download mbox | patch
Permalink /patch/42539/
State Accepted
Headers show

Comments

Denis Laxalde - Oct. 23, 2019, 3:22 p.m.
# HG changeset patch
# User Denis Laxalde <denis.laxalde@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).
Yuya Nishihara - Oct. 24, 2019, 1:11 p.m.
On Wed, 23 Oct 2019 17:22:22 +0200, Denis Laxalde wrote:
> # HG changeset patch
> # User Denis Laxalde <denis.laxalde@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

> +Replaces: mercurial-common (<< ${source:Version})
> +Breaks: mercurial-common (<< ${source:Version})

I'm not pretty sure if replaces/breaks should be versioned because our
package will conflicts with future official mercurial-common packages.
But that wouldn't matter since our package wouldn't be used if there are
more recent versions available in the debian repository.
Gregory Szorc - Oct. 25, 2019, 3:38 a.m.
On Thu, Oct 24, 2019 at 6:22 AM Yuya Nishihara <yuya@tcha.org> wrote:

> On Wed, 23 Oct 2019 17:22:22 +0200, Denis Laxalde wrote:
> > # HG changeset patch
> > # User Denis Laxalde <denis.laxalde@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
>
> > +Replaces: mercurial-common (<< ${source:Version})
> > +Breaks: mercurial-common (<< ${source:Version})
>
> I'm not pretty sure if replaces/breaks should be versioned because our
> package will conflicts with future official mercurial-common packages.
> But that wouldn't matter since our package wouldn't be used if there are
> more recent versions available in the debian repository.
>

Mike,

Would you mind looking this over real quick to see if we're doing Debian
packaging correctly?
Denis Laxalde - Oct. 25, 2019, 12:01 p.m.
Yuya Nishihara a écrit :
> On Wed, 23 Oct 2019 17:22:22 +0200, Denis Laxalde wrote:
> > # HG changeset patch
> > # User Denis Laxalde <denis.laxalde@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
> 
> > +Replaces: mercurial-common (<< ${source:Version})
> > +Breaks: mercurial-common (<< ${source:Version})
> 
> I'm not pretty sure if replaces/breaks should be versioned because our
> package will conflicts with future official mercurial-common packages.
> But that wouldn't matter since our package wouldn't be used if there are
> more recent versions available in the debian repository.

The version information in Replaces:/Breaks: are indeed problematic if we
try to install our package over the one currently in
Debian (e.g. the one in experimental).

  $ sudo apt install mercurial/experimental
  [...]
  $ sudo apt install ./packages/debian-buster/mercurial_5.2~rc0+15-buster-a2ff3aff81d2_amd64.deb
  Reading package lists... Done
  Building dependency tree       
  Reading state information... Done
  Note, selecting 'mercurial' instead of './packages/debian-buster/mercurial_5.2~rc0+15-buster-a2ff3aff81d2_amd64.deb'
  Some packages could not be installed. This may mean that you have
  requested an impossible situation or if you are using the unstable
  distribution that some required packages have not yet been created
  or been moved out of Incoming.
  The following information may help to resolve the situation:
  
  The following packages have unmet dependencies:
   mercurial : Breaks: mercurial-common (< 5.2~rc0+15-buster-a2ff3aff81d2) but 5.2~rc0-1 is to be installed
  E: Unable to correct problems, you have held broken packages.

Without (<< ${source:Version}), the install works fine.
I'll send a follow-up.
Julien Cristau - Oct. 26, 2019, 5:14 p.m.
On Wed, Oct 23, 2019 at 05:22:22PM +0200, Denis Laxalde wrote:
> 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.
> 
Diverging from the debian packaging this way is super bad, means you
can't cleanly go back to the debian-provided version.  And the provided
rationale seems quite dubious to me.

Cheers,
Julien
Denis Laxalde - Oct. 27, 2019, 5:29 p.m.
Julien Cristau a écrit :
> On Wed, Oct 23, 2019 at 05:22:22PM +0200, Denis Laxalde wrote:
> > 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.
> > 
> Diverging from the debian packaging this way is super bad, means you
> can't cleanly go back to the debian-provided version.  And the provided
> rationale seems quite dubious to me.

Can you elaborate on "super bad" and "can't cleanly go back"? As far as
I can tell, after having install the in-repo single binary package,
running "apt install mercurial/stable" works fine and gives back the
debian-provided version.

Patch

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