Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[master] deb,rpm: include dockerd man-page in docker-ce package #1159

Merged
merged 2 commits into from
Jan 27, 2025

Conversation

thaJeztah
Copy link
Member

@thaJeztah thaJeztah commented Jan 25, 2025

rpm: adjust spec to account for varying list of man-page sections

The CLI currently builds man-pages for sections 1, 5, and 8, but this
list may change; for example, the dockerd man-page is currently built
from the CLI repository but intended to be removed.

This patch changes the code to check all (1..9) secions, and install the
man-pages found in them.

This patch also updates the %doc and %files section; from the Fedora packaging
guide (see 1);

The %files section holds a list of all the files that RPM should install
from the package. This list should be exhaustive, so that the RPM system
knows exactly what your package installs. There are some options, though,
to name all the files within a directory to help with packages containing
hundreds of files.
(...)
In addition to naming each file on a line, you can use glob-style wildcards.

But also worth noting that it's NOT needed to mark manpages as %doc, see 2;

Note also that files installed in %{_mandir} are automatically marked by RPM
as documentation. Thus it is not necessary to use %doc.

So this patch:

  • uses wildcards to enumerate all manpages in all sections
  • removes the %doc for manpages, as this is automatic.

deb,rpm: include dockerd man-page in docker-ce package

When splitting the docker CLI from the moby/moby repository, the dockerd
documentation and man-pages were moved to the CLI repository. This was a
bit of a bad choice, as now the documentation and code lived in separate
repositories, but when the CLI and dockerd packages were split, the man
page for dockerd ended up in the CLI package.

Starting with moby@d6e9b5f, the dockerd man-page has been reintegrated
into the moby repository, which means that we can build the man-page
from that repository, and remove it from the CLI repository.

This patch updates the packing to do so:

Before this patch;

dpkg-deb -c docker-ce_0.0.0~20250124134141.b8879a4-1~ubuntu.24.04~noble_arm64.deb | grep -E '^-'
-rw-r--r-- root/root       642 2025-01-24 14:29 ./etc/default/docker
-rwxr-xr-x root/root      2946 2025-01-24 14:29 ./etc/init.d/docker
-rwxr-xr-x root/root   2741336 2025-01-24 19:54 ./usr/bin/docker-proxy
-rw-r--r-- root/root      1727 2025-01-24 14:29 ./usr/lib/systemd/system/docker.service
-rw-r--r-- root/root       295 2025-01-24 14:29 ./usr/lib/systemd/system/docker.socket
-rwxr-xr-x root/root    604336 2025-01-24 19:54 ./usr/libexec/docker/docker-init
-rw-r--r-- root/root      2248 2025-01-24 14:29 ./usr/share/doc/docker-ce/README.md
-rw-r--r-- root/root       168 2025-01-24 19:54 ./usr/share/doc/docker-ce/changelog.Debian.gz

rpm -qpl ./docker-ce-0.0.0~20250124134141.b8879a4-0.fc41.aarch64.rpm
/etc/docker
/usr/bin/docker-proxy
/usr/bin/dockerd
/usr/lib/systemd/system/docker.service
/usr/lib/systemd/system/docker.socket
/usr/libexec/docker/docker-init

With this patch:

dpkg-deb -c docker-ce_0.0.0~20250124134141.b8879a4-1~ubuntu.24.04~noble_arm64.deb | grep -E '^-'
-rw-r--r-- root/root       642 2025-01-24 14:29 ./etc/default/docker
-rwxr-xr-x root/root      2946 2025-01-24 14:29 ./etc/init.d/docker
-rwxr-xr-x root/root   2741336 2025-01-24 20:55 ./usr/bin/docker-proxy
-rwxr-xr-x root/root  79458592 2025-01-24 20:55 ./usr/bin/dockerd
-rw-r--r-- root/root      1727 2025-01-24 14:29 ./usr/lib/systemd/system/docker.service
-rw-r--r-- root/root       295 2025-01-24 14:29 ./usr/lib/systemd/system/docker.socket
-rwxr-xr-x root/root    604336 2025-01-24 20:55 ./usr/libexec/docker/docker-init
-rw-r--r-- root/root      2248 2025-01-24 14:29 ./usr/share/doc/docker-ce/README.md
-rw-r--r-- root/root       166 2025-01-24 20:55 ./usr/share/doc/docker-ce/changelog.Debian.gz
-rw-r--r-- root/root      6561 2025-01-24 20:55 ./usr/share/man/man8/dockerd.8.gz

rpm -qpl ./docker-ce-0.0.0~20250124134141.b8879a4-0.fc41.aarch64.rpm
/etc/docker
/usr/bin/docker-proxy
/usr/bin/dockerd
/usr/lib/systemd/system/docker.service
/usr/lib/systemd/system/docker.socket
/usr/libexec/docker/docker-init
/usr/share/man/man8/dockerd.8.gz

Given that the dockerd man-page was previously packaged as part of docker-ce-cli,
we need to add a "Replaces:" condition to the package, to prevent dpkg from
detecting it as a conflict when an older version of the docker-ce-cli package
was installed that contains the manpage;

Unpacking docker-ce (5:0.0.0~20250124134141.b8879a4-1~raspbian.12~bookworm) ...
dpkg: error processing archive ./deb/debbuild/raspbian-bookworm/docker-ce_0.0.0~20250124134141.b8879a4-1~raspbian.12~bookworm_armhf.deb (--install):
trying to overwrite '/usr/share/man/man8/dockerd.8.gz', which is also in package docker-ce-cli 5:0.0.0~20250124134141.b8879a4-1~raspbian.12~bookworm

From the Debian manual

7.6.1. Overwriting files in other packages

It is usually an error for a package to contain files which are on the
system in another package. However, if the overwriting package declares
that it Replaces the one containing the file being overwritten, then dpkg
will replace the file from the old package with that from the new. The
file will no longer be listed as “owned” by the old package and will be
taken over by the new package.

- Description for the changelog

- A picture of a cute animal (not mandatory but encouraged)

@thaJeztah
Copy link
Member Author

Hm... something broke with the deb packages; need to check what exactly;

+ make IMAGE=balenalib/rpi-raspbian:bookworm ARCH=armhf verify
docker run  --rm -i \
	-v "$(pwd):/v" \
	-e DEBIAN_FRONTEND=noninteractive \
	-e PACKAGE_REPO=prod \
	-w /v \
	balenalib/rpi-raspbian:bookworm ./verify
Unable to find image 'balenalib/rpi-raspbian:bookworm' locally
bookworm: Pulling from balenalib/rpi-raspbian
52fc6729ed42: Already exists
a13012f956ef: Already exists
6fe3b1e5b1e1: Already exists
3612ba1bb511: Already exists
d353848d6365: Already exists
a3bf02af0185: Already exists
50e13e7b2b49: Already exists
b89eeb886499: Already exists
Digest: sha256:0f3c33faa9d7b1dac778e8afb5854080dcfbddeac7437265598c6076bb0ffc82
Status: Downloaded newer image for balenalib/rpi-raspbian:bookworm
+ verify
+ dpkg --version
+ verify_deb
+ apt-get update
Get:1 http://archive.raspbian.org/raspbian bookworm InRelease [15.0 kB]
Get:2 http://archive.raspbian.org/raspbian bookworm/rpi armhf Packages [1299 B]
Get:3 http://archive.raspbian.org/raspbian bookworm/firmware armhf Packages [1201 B]
Get:4 http://archive.raspbian.org/raspbian bookworm/non-free armhf Packages [147 kB]
Get:5 http://archive.raspbian.org/raspbian bookworm/main armhf Packages [20.0 MB]
Get:6 http://archive.raspbian.org/raspbian bookworm/contrib armhf Packages [72.3 kB]
Fetched 20.2 MB in 3s (7533 kB/s)
Reading package lists...
W: http://archive.raspbian.org/raspbian/dists/bookworm/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.
+ apt-get -y install --no-install-recommends apt-transport-https ca-certificates curl gnupg2 lsb-release
Reading package lists...
Building dependency tree...
Reading state information...
ca-certificates is already the newest version (20230311).
The following NEW packages will be installed:
  apt-transport-https gnupg2 lsb-release
The following packages will be upgraded:
  curl libcurl4
2 upgraded, 3 newly installed, 0 to remove and 38 not upgraded.
Need to get 1125 kB of archives.
After this operation, 525 kB of additional disk space will be used.
Get:1 http://archive.raspbian.org/raspbian bookworm/main armhf apt-transport-https all 2.6.1 [25.2 kB]
Get:2 http://archive.raspbian.org/raspbian bookworm/main armhf curl armhf 7.88.1-10+rpi1+deb12u8 [302 kB]
Get:3 http://archive.raspbian.org/raspbian bookworm/main armhf libcurl4 armhf 7.88.1-10+rpi1+deb12u8 [346 kB]
Get:4 http://archive.raspbian.org/raspbian bookworm/main armhf gnupg2 all 2.2.40-1.1 [445 kB]
Get:5 http://archive.raspbian.org/raspbian bookworm/main armhf lsb-release all 12.0-1 [6416 B]
debconf: delaying package configuration, since apt-utils is not installed
Fetched 1125 kB in 1s (1180 kB/s)
Selecting previously unselected package apt-transport-https.
(Reading database ... 
(Reading database ... 5%
(Reading database ... 10%
(Reading database ... 15%
(Reading database ... 20%
(Reading database ... 25%
(Reading database ... 30%
(Reading database ... 35%
(Reading database ... 40%
(Reading database ... 45%
(Reading database ... 50%
(Reading database ... 55%
(Reading database ... 60%
(Reading database ... 65%
(Reading database ... 70%
(Reading database ... 75%
(Reading database ... 80%
(Reading database ... 85%
(Reading database ... 90%
(Reading database ... 95%
(Reading database ... 100%
(Reading database ... 9821 files and directories currently installed.)
Preparing to unpack .../apt-transport-https_2.6.1_all.deb ...
Unpacking apt-transport-https (2.6.1) ...
Preparing to unpack .../curl_7.88.1-10+rpi1+deb12u8_armhf.deb ...
Unpacking curl (7.88.1-10+rpi1+deb12u8) over (7.88.1-10+rpi1) ...
Preparing to unpack .../libcurl4_7.88.1-10+rpi1+deb12u8_armhf.deb ...
Unpacking libcurl4:armhf (7.88.1-10+rpi1+deb12u8) over (7.88.1-10+rpi1) ...
Selecting previously unselected package gnupg2.
Preparing to unpack .../gnupg2_2.2.40-1.1_all.deb ...
Unpacking gnupg2 (2.2.40-1.1) ...
Selecting previously unselected package lsb-release.
Preparing to unpack .../lsb-release_12.0-1_all.deb ...
Unpacking lsb-release (12.0-1) ...
Setting up gnupg2 (2.2.40-1.1) ...
Setting up apt-transport-https (2.6.1) ...
Setting up libcurl4:armhf (7.88.1-10+rpi1+deb12u8) ...
Setting up curl (7.88.1-10+rpi1+deb12u8) ...
Setting up lsb-release (12.0-1) ...
Processing triggers for libc-bin (2.36-9+rpi1) ...
++ source /etc/os-release
+++ PRETTY_NAME='Raspbian GNU/Linux 12 (bookworm)'
+++ NAME='Raspbian GNU/Linux'
+++ VERSION_ID=12
+++ VERSION='12 (bookworm)'
+++ VERSION_CODENAME=bookworm
+++ ID=raspbian
+++ ID_LIKE=debian
+++ HOME_URL=http://www.raspbian.org/
+++ SUPPORT_URL=http://www.raspbian.org/RaspbianForums
+++ BUG_REPORT_URL=http://www.raspbian.org/RaspbianBugs
++ echo raspbian
+ DIST_ID=raspbian
++ lsb_release -sc
+ DIST_VERSION=bookworm
+ '[' bookworm = sid ']'
+ install_debian_containerd
+ '[' prod = stage ']'
+ REPO_URL=https://download.docker.com/linux/raspbian
+ echo '[DEBUG] Installing engine dependencies from https://download.docker.com/linux/raspbian'
+ update-ca-certificates -f
[DEBUG] Installing engine dependencies from https://download.docker.com/linux/raspbian
Clearing symlinks in /etc/ssl/certs...
done.
Updating certificates in /etc/ssl/certs...
rehash: warning: skipping ca-certificates.crt,it does not contain exactly one certificate or CRL
140 added, 0 removed; done.
Running hooks in /etc/ca-certificates/update.d...
done.
+ curl -fsSL https://download.docker.com/linux/raspbian/gpg
+ apt-key add -
Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).
OK
+ '[' bookworm = sid ']'
++ dpkg --print-architecture
+ ARCH=armhf
+ echo 'deb [arch=armhf] https://download.docker.com/linux/raspbian bookworm test'
+ apt-get update
Get:1 https://download.docker.com/linux/raspbian bookworm InRelease [26.6 kB]
Hit:2 http://archive.raspbian.org/raspbian bookworm InRelease
Get:3 https://download.docker.com/linux/raspbian bookworm/test armhf Packages [59.4 kB]
Fetched 86.0 kB in 1s (148 kB/s)
Reading package lists...
W: https://download.docker.com/linux/raspbian/dists/bookworm/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.
W: http://archive.raspbian.org/raspbian/dists/bookworm/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.
++ find deb/debbuild/raspbian-bookworm/ -type f -name '*.deb'
+ packages='deb/debbuild/raspbian-bookworm/docker-ce-cli_0.0.0~20250124134141.b8879a4-1~raspbian.12~bookworm_armhf.deb
deb/debbuild/raspbian-bookworm/docker-buildx-plugin_0.20.1-1~raspbian.12~bookworm_armhf.deb
deb/debbuild/raspbian-bookworm/docker-ce_0.0.0~20250124134141.b8879a4-1~raspbian.12~bookworm_armhf.deb
deb/debbuild/raspbian-bookworm/docker-compose-plugin_2.32.4-1~raspbian.12~bookworm_armhf.deb
deb/debbuild/raspbian-bookworm/docker-ce-rootless-extras_0.0.0~20250124134141.b8879a4-1~raspbian.12~bookworm_armhf.deb'
++ echo 'deb/debbuild/raspbian-bookworm/docker-ce-cli_0.0.0~20250124134141.b8879a4-1~raspbian.12~bookworm_armhf.deb
deb/debbuild/raspbian-bookworm/docker-buildx-plugin_0.20.1-1~raspbian.12~bookworm_armhf.deb
deb/debbuild/raspbian-bookworm/docker-ce_0.0.0~20250124134141.b8879a4-1~raspbian.12~bookworm_armhf.deb
deb/debbuild/raspbian-bookworm/docker-compose-plugin_2.32.4-1~raspbian.12~bookworm_armhf.deb
deb/debbuild/raspbian-bookworm/docker-ce-rootless-extras_0.0.0~20250124134141.b8879a4-1~raspbian.12~bookworm_armhf.deb'
++ xargs
++ awk '$0="./"$0'
+ packages='./deb/debbuild/raspbian-bookworm/docker-ce-cli_0.0.0~20250124134141.b8879a4-1~raspbian.12~bookworm_armhf.deb ./deb/debbuild/raspbian-bookworm/docker-buildx-plugin_0.20.1-1~raspbian.12~bookworm_armhf.deb ./deb/debbuild/raspbian-bookworm/docker-ce_0.0.0~20250124134141.b8879a4-1~raspbian.12~bookworm_armhf.deb ./deb/debbuild/raspbian-bookworm/docker-compose-plugin_2.32.4-1~raspbian.12~bookworm_armhf.deb ./deb/debbuild/raspbian-bookworm/docker-ce-rootless-extras_0.0.0~20250124134141.b8879a4-1~raspbian.12~bookworm_armhf.deb'
+ set -x
+ dpkg --ignore-depends=containerd.io,iptables,libdevmapper,libdevmapper1.02.1 --force-depends -i ./deb/debbuild/raspbian-bookworm/docker-ce-cli_0.0.0~20250124134141.b8879a4-1~raspbian.12~bookworm_armhf.deb ./deb/debbuild/raspbian-bookworm/docker-buildx-plugin_0.20.1-1~raspbian.12~bookworm_armhf.deb ./deb/debbuild/raspbian-bookworm/docker-ce_0.0.0~20250124134141.b8879a4-1~raspbian.12~bookworm_armhf.deb ./deb/debbuild/raspbian-bookworm/docker-compose-plugin_2.32.4-1~raspbian.12~bookworm_armhf.deb ./deb/debbuild/raspbian-bookworm/docker-ce-rootless-extras_0.0.0~20250124134141.b8879a4-1~raspbian.12~bookworm_armhf.deb
Selecting previously unselected package docker-ce-cli.
(Reading database ... 9837 files and directories currently installed.)
Preparing to unpack .../docker-ce-cli_0.0.0~20250124134141.b8879a4-1~raspbian.12~bookworm_armhf.deb ...
Unpacking docker-ce-cli (5:0.0.0~20250124134141.b8879a4-1~raspbian.12~bookworm) ...
Selecting previously unselected package docker-buildx-plugin.
Preparing to unpack .../docker-buildx-plugin_0.20.1-1~raspbian.12~bookworm_armhf.deb ...
Unpacking docker-buildx-plugin (0.20.1-1~raspbian.12~bookworm) ...
Selecting previously unselected package docker-ce.
Preparing to unpack .../docker-ce_0.0.0~20250124134141.b8879a4-1~raspbian.12~bookworm_armhf.deb ...
Unpacking docker-ce (5:0.0.0~20250124134141.b8879a4-1~raspbian.12~bookworm) ...
dpkg: error processing archive ./deb/debbuild/raspbian-bookworm/docker-ce_0.0.0~20250124134141.b8879a4-1~raspbian.12~bookworm_armhf.deb (--install):
 trying to overwrite '/usr/share/man/man8/dockerd.8.gz', which is also in package docker-ce-cli 5:0.0.0~20250124134141.b8879a4-1~raspbian.12~bookworm
Selecting previously unselected package docker-compose-plugin.
Preparing to unpack .../docker-compose-plugin_2.32.4-1~raspbian.12~bookworm_armhf.deb ...
Unpacking docker-compose-plugin (2.32.4-1~raspbian.12~bookworm) ...
Selecting previously unselected package docker-ce-rootless-extras.
Preparing to unpack .../docker-ce-rootless-extras_0.0.0~20250124134141.b8879a4-1~raspbian.12~bookworm_armhf.deb ...
Unpacking docker-ce-rootless-extras (5:0.0.0~20250124134141.b8879a4-1~raspbian.12~bookworm) ...
Setting up docker-ce-cli (5:0.0.0~20250124134141.b8879a4-1~raspbian.12~bookworm) ...
Setting up docker-buildx-plugin (0.20.1-1~raspbian.12~bookworm) ...
Setting up docker-compose-plugin (2.32.4-1~raspbian.12~bookworm) ...
Setting up docker-ce-rootless-extras (5:0.0.0~20250124134141.b8879a4-1~raspbian.12~bookworm) ...
dpkg: docker-ce-rootless-extras: dependency problems, but configuring anyway as you requested:
 docker-ce-rootless-extras depends on dbus-user-session; however:
  Package dbus-user-session is not installed.

Errors were encountered while processing:
 ./deb/debbuild/raspbian-bookworm/docker-ce_0.0.0~20250124134141.b8879a4-1~raspbian.12~bookworm_armhf.deb
make: *** [Makefile:95: verify] Error 1
script returned exit code 2

@thaJeztah
Copy link
Member Author

Looks like at least the verify script needs some updating;

+ curl -fsSL https://download.docker.com/linux/raspbian/gpg
+ apt-key add -
Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).
OK

@thaJeztah
Copy link
Member Author

Ah! Because (currently) both still have the same man-page;

Unpacking docker-ce (5:0.0.0~20250124134141.b8879a4-1~raspbian.12~bookworm) ...
dpkg: error processing archive ./deb/debbuild/raspbian-bookworm/docker-ce_0.0.0~20250124134141.b8879a4-1~raspbian.12~bookworm_armhf.deb (--install):
 trying to overwrite '/usr/share/man/man8/dockerd.8.gz', which is also in package docker-ce-cli 5:0.0.0~20250124134141.b8879a4-1~raspbian.12~bookworm

That should go away once the CLI changes are merged, but perhaps the package needs some extra information to indicate it "replaces" docker-cli;

The CLI currently builds man-pages for sections 1, 5, and 8, but this
list may change; for example, the dockerd man-page is currently built
from the CLI repository but intended to be removed.

This patch changes the code to check all (1..9) secions, and install the
man-pages found in them.

This patch also updates the %doc and %files section; from the Fedora packaging
guide (see [1]);

> The %files section holds a list of all the files that RPM should install
> from the package. **This list should be exhaustive**, so that the RPM system
> knows exactly what your package installs. There are some options, though,
> to name all the files within a directory to help with packages containing
> hundreds of files.
> (...)
> In addition to naming each file on a line, you can use glob-style wildcards.

But also worth noting that it's NOT needed to mark manpages as %doc, see [2];

> Note also that files installed in %{_mandir} are automatically marked by RPM
> as documentation. Thus it is not necessary to use %doc.

So this patch:

- uses wildcards to enumerate all manpages in all sections
- removes the %doc for manpages, as this is automatic.

[1]: https://jfearn.fedorapeople.org/en-US/RPM/4/html/RPM_Guide/ch09s05.html
[2]: https://docs.fedoraproject.org/en-US/packaging-guidelines/#_manpages

Signed-off-by: Sebastiaan van Stijn <[email protected]>
@thaJeztah thaJeztah force-pushed the dockerd_manpages branch 2 times, most recently from 67e353b to e9aaf34 Compare January 27, 2025 13:54
@thaJeztah
Copy link
Member Author

Cool; this works now, after adding the Replaces:

@thaJeztah thaJeztah requested a review from vvoland January 27, 2025 14:20
Benehiko
Benehiko previously approved these changes Jan 27, 2025
Copy link
Member

@Benehiko Benehiko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks alright to me although my understanding of debian packaging scripts are really limited 😅

@@ -40,7 +40,8 @@ Suggests: cgroupfs-mount | cgroup-lite
Conflicts: docker (<< 1.5~),
docker-engine,
docker.io
Replaces: docker-engine
Replaces: docker-engine,
docker-ce-cli (<= 5:27)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry I'm a bit noob with this, but why do we need to specify the epoch number here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good question; MAYBE we no longer need to? We never should've had those epochs in the first place (ISTR they had to be added first because of CalVer versioning (where, e.g. 18.03 was not sorted correctly because of the leading 0) and when marketing kinda forced to use non-standard suffixes -ce / -ee), and -tp1 for technical previews, which sorts after -ce / -ee, so unstable releases took priority over stable releases (joy!)).

Let me try what it says

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sigh.. so it doesn't work;

# "nightly" <= 27
dpkg --compare-versions "5:0.0.0~20250124134141.b8879a4-1~debian.12~bookworm" le "5:27" && echo "OK"
OK

# 27.5.1 <= 27
dpkg --compare-versions "5:27.5.1-1~debian.12~bookworm" le "5:27" && echo "OK" || echo "KO"
KO

dpkg --compare-versions "5:27.5.1-1~debian.12~bookworm" le "27" && echo "OK" || echo "KO"
KO

dpkg --compare-versions "5:27.5.1-1~debian.12~bookworm" le "27.5.1" && echo "OK" || echo "KO"
KO

dpkg --compare-versions "5:27.5.1-1~debian.12~bookworm" le "27.5.2" && echo "OK" || echo "KO"
KO

dpkg --compare-versions "5:27.5.1-1~debian.12~bookworm" le "5:27.5.1" && echo "OK" || echo "KO"
KO

dpkg --compare-versions "5:27.5.1-1~debian.12~bookworm" le "5:27.5.2" && echo "OK" || echo "KO"
OK

So perhaps we need to use 28 and << to work around that, but even with that, it looks like we need the epoch;

dpkg --compare-versions "5:27.5.1-1~debian.12~bookworm" lt "28" && echo "OK" || echo "KO"
KO

dpkg --compare-versions "5:27.5.1-1~debian.12~bookworm" lt "5:28" && echo "OK" || echo "KO"
OK

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah i see 🙈

vvoland
vvoland previously approved these changes Jan 27, 2025
@thaJeztah thaJeztah dismissed stale reviews from vvoland and Benehiko via 669215a January 27, 2025 15:17
@thaJeztah
Copy link
Member Author

Updated to << 5:28 🤷‍♂️

@thaJeztah
Copy link
Member Author

Maybe 5:28.0.0 is clearer in that case; let me update once more

When splitting the docker CLI from the moby/moby repository, the dockerd
documentation and man-pages were moved to the CLI repository. This was a
bit of a bad choice, as now the documentation and code lived in separate
repositories, but when the CLI and dockerd packages were split, the man
page for dockerd ended up in the CLI package.

Starting with [moby@d6e9b5f], the dockerd man-page has been reintegrated
into the moby repository, which means that we can build the man-page
from that repository, and remove it from the CLI repository.

This patch updates the packing to do so:

Before this patch;

    dpkg-deb -c docker-ce_0.0.0~20250124134141.b8879a4-1~ubuntu.24.04~noble_arm64.deb | grep -E '^-'
    -rw-r--r-- root/root       642 2025-01-24 14:29 ./etc/default/docker
    -rwxr-xr-x root/root      2946 2025-01-24 14:29 ./etc/init.d/docker
    -rwxr-xr-x root/root   2741336 2025-01-24 19:54 ./usr/bin/docker-proxy
    -rw-r--r-- root/root      1727 2025-01-24 14:29 ./usr/lib/systemd/system/docker.service
    -rw-r--r-- root/root       295 2025-01-24 14:29 ./usr/lib/systemd/system/docker.socket
    -rwxr-xr-x root/root    604336 2025-01-24 19:54 ./usr/libexec/docker/docker-init
    -rw-r--r-- root/root      2248 2025-01-24 14:29 ./usr/share/doc/docker-ce/README.md
    -rw-r--r-- root/root       168 2025-01-24 19:54 ./usr/share/doc/docker-ce/changelog.Debian.gz

    rpm -qpl ./docker-ce-0.0.0~20250124134141.b8879a4-0.fc41.aarch64.rpm
    /etc/docker
    /usr/bin/docker-proxy
    /usr/bin/dockerd
    /usr/lib/systemd/system/docker.service
    /usr/lib/systemd/system/docker.socket
    /usr/libexec/docker/docker-init

With this patch:

    dpkg-deb -c docker-ce_0.0.0~20250124134141.b8879a4-1~ubuntu.24.04~noble_arm64.deb | grep -E '^-'
    -rw-r--r-- root/root       642 2025-01-24 14:29 ./etc/default/docker
    -rwxr-xr-x root/root      2946 2025-01-24 14:29 ./etc/init.d/docker
    -rwxr-xr-x root/root   2741336 2025-01-24 20:55 ./usr/bin/docker-proxy
    -rwxr-xr-x root/root  79458592 2025-01-24 20:55 ./usr/bin/dockerd
    -rw-r--r-- root/root      1727 2025-01-24 14:29 ./usr/lib/systemd/system/docker.service
    -rw-r--r-- root/root       295 2025-01-24 14:29 ./usr/lib/systemd/system/docker.socket
    -rwxr-xr-x root/root    604336 2025-01-24 20:55 ./usr/libexec/docker/docker-init
    -rw-r--r-- root/root      2248 2025-01-24 14:29 ./usr/share/doc/docker-ce/README.md
    -rw-r--r-- root/root       166 2025-01-24 20:55 ./usr/share/doc/docker-ce/changelog.Debian.gz
    -rw-r--r-- root/root      6561 2025-01-24 20:55 ./usr/share/man/man8/dockerd.8.gz

    rpm -qpl ./docker-ce-0.0.0~20250124134141.b8879a4-0.fc41.aarch64.rpm
    /etc/docker
    /usr/bin/docker-proxy
    /usr/bin/dockerd
    /usr/lib/systemd/system/docker.service
    /usr/lib/systemd/system/docker.socket
    /usr/libexec/docker/docker-init
    /usr/share/man/man8/dockerd.8.gz

Given that the dockerd man-page was previously packaged as part of docker-ce-cli,
we need to add a "Replaces:" condition to the package, to prevent dpkg from
detecting it as a conflict when an older version of the docker-ce-cli package
was installed that contains the manpage;

    Unpacking docker-ce (5:0.0.0~20250124134141.b8879a4-1~raspbian.12~bookworm) ...
    dpkg: error processing archive ./deb/debbuild/raspbian-bookworm/docker-ce_0.0.0~20250124134141.b8879a4-1~raspbian.12~bookworm_armhf.deb (--install):
    trying to overwrite '/usr/share/man/man8/dockerd.8.gz', which is also in package docker-ce-cli 5:0.0.0~20250124134141.b8879a4-1~raspbian.12~bookworm

From the [Debian manual][1]

> 7.6.1. Overwriting files in other packages
>
> It is usually an error for a package to contain files which are on the
> system in another package. However, if the overwriting package declares
> that it Replaces the one containing the file being overwritten, then dpkg
> will replace the file from the old package with that from the new. The
> file will no longer be listed as “owned” by the old package and will be
> taken over by the new package.

[1]: https://www.debian.org/doc/debian-policy/ch-relationships.html
[moby@d6e9b5f]: moby/moby@d6e9b5f

Signed-off-by: Sebastiaan van Stijn <[email protected]>
@thaJeztah
Copy link
Member Author

Double checked if a "rc" of v28.0.0 would also be picked up; it does, but that's probably OK; even if it doesn't contain the dockerd manpage, it would consider docker-ce to be replacing "nothing" I guess;

dpkg --compare-versions "5:28.0.0~rc.1-1~debian.12~bookworm" lt "5:28.0.0" && echo "OK" || echo "KO"
OK

Let me bring this one in; we can always touch-up if there's still an issue (hope not!)

@thaJeztah thaJeztah merged commit 90ffcbe into docker:master Jan 27, 2025
8 checks passed
@thaJeztah thaJeztah deleted the dockerd_manpages branch January 27, 2025 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants