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

docker-buildx-plugin packages use incorrect version format #814

Closed
thaJeztah opened this issue Jan 10, 2023 · 6 comments · Fixed by #822
Closed

docker-buildx-plugin packages use incorrect version format #814

thaJeztah opened this issue Jan 10, 2023 · 6 comments · Fixed by #822

Comments

@thaJeztah
Copy link
Member

The version string is not formatted correctly (using -rc2, with a hyphen), which causes 0.10.0-rc2 to be considered newer than 0.10.0;

apt-cache madison docker-buildx-plugin
docker-buildx-plugin | 0.10.0-rc2~ubuntu-jammy | https://download-stage.docker.com/linux/ubuntu jammy/test amd64 Packages
docker-buildx-plugin | 0.10.0~ubuntu-jammy | https://download-stage.docker.com/linux/ubuntu jammy/test amd64 Packages
docker-buildx-plugin | 0.9.1~ubuntu-jammy | https://download-stage.docker.com/linux/ubuntu jammy/test amd64 Packages
docker-buildx-plugin | 0.8.2~ubuntu-jammy | https://download-stage.docker.com/linux/ubuntu jammy/test amd64 Packages

For the docker-ce and docker-ce-cli packages we have code in place to generate a correct version string (using ~ instead of -, and appending a -0 for packaging fixes);

apt-cache madison docker-ce
docker-ce | 5:23.0.0~rc.2-0~ubuntu.22.04.0~jammy | https://download-stage.docker.com/linux/ubuntu jammy/test amd64 Packages
docker-ce | 5:23.0.0~rc.1-0~ubuntu.22.04.0~jammy | https://download-stage.docker.com/linux/ubuntu jammy/test amd64 Packages
docker-ce | 5:23.0.0~beta.1-0~ubuntu.22.04.0~jammy | https://download-stage.docker.com/linux/ubuntu jammy/test amd64 Packages
docker-ce | 5:22.06.0~beta.0-0~ubuntu.22.04.0~jammy | https://download-stage.docker.com/linux/ubuntu jammy/test amd64 Packages
docker-ce | 5:20.10.22~3-0~ubuntu-jammy | https://download-stage.docker.com/linux/ubuntu jammy/test amd64 Packages
docker-ce | 5:20.10.21~3-0~ubuntu-jammy | https://download-stage.docker.com/linux/ubuntu jammy/test amd64 Packages
docker-ce | 5:20.10.20~3-0~ubuntu-jammy | https://download-stage.docker.com/linux/ubuntu jammy/test amd64 Packages
docker-ce | 5:20.10.19~3-0~ubuntu-jammy | https://download-stage.docker.com/linux/ubuntu jammy/test amd64 Packages
docker-ce | 5:20.10.18~3-0~ubuntu-jammy | https://download-stage.docker.com/linux/ubuntu jammy/test amd64 Packages
docker-ce | 5:20.10.17~3-0~ubuntu-jammy | https://download-stage.docker.com/linux/ubuntu jammy/test amd64 Packages
docker-ce | 5:20.10.16~3-0~ubuntu-jammy | https://download-stage.docker.com/linux/ubuntu jammy/test amd64 Packages
docker-ce | 5:20.10.15~3-0~ubuntu-jammy | https://download-stage.docker.com/linux/ubuntu jammy/test amd64 Packages
docker-ce | 5:20.10.14~3-0~ubuntu-jammy | https://download-stage.docker.com/linux/ubuntu jammy/test amd64 Packages
docker-ce | 5:20.10.13~3-0~ubuntu-jammy | https://download-stage.docker.com/linux/ubuntu jammy/test amd64 Packages

Changes for the docker-ce / docker-ce-cli packages were added in #701

But the version-string for Buildx (and other plugins) are passed as-is, and likely because of that result in the incorrect format;

override_dh_gencontrol:
# Use separate version for the buildx-plugin package, then generate the other control files as usual
# TODO override "Source" field in control as well (to point to buildx, as it doesn't match the package name)
dh_gencontrol -pdocker-buildx-plugin -- -v$${BUILDX_VERSION#v}~$${DISTRO}-$${SUITE}
# Use separate version for the compose-plugin package, then generate the other control files as usual
# TODO override "Source" field in control as well (to point to compose, as it doesn't match the package name)
dh_gencontrol -pdocker-compose-plugin -- -v$${COMPOSE_VERSION#v}~$${DISTRO}-$${SUITE}
# Use separate version for the scan-plugin package, then generate the other control files as usual
# TODO override "Source" field in control as well (to point to scan-cli-plugin, as it doesn't match the package name)
# TODO change once we support scan-plugin on other architectures (see dpkg-architecture -L)
if [ "$(TARGET_ARCH)" = "amd64" ]; then \
dh_gencontrol -pdocker-scan-plugin -- -v$${SCAN_VERSION#v}~$${DISTRO}-$${SUITE}; \
fi
dh_gencontrol --remaining-packages

@thaJeztah
Copy link
Member Author

I want to avoid adding an epoch, as that would only dig in deeper;

  • I guess a 0.10.1 release would “fix” it
  • Also (for more details) this only affects those that install from the test channel, because these packages are not yet up in the other channel, so it’s not a disaster, just unfortunate

@tianon
Copy link
Contributor

tianon commented Jan 10, 2023

😞 this is a rough one

The common solution in Debian for a mistake like this is judicious use of something like ~really or +really, so something like 0.10.1~actually0.10.0 to make it clear there was a packaging mistake that led to this situation, which will then sort lower than 0.10.1 or even 0.10.1~rc1.

While we're at it, we should fix 0.10.0~ubuntu-jammy - that ~ makes the "upstream version" 0.10.0~ubuntu and the "deb revision" jammy which isn't what we're looking for. I'd suggest something like 0.10.0-0ubuntu22.04 (so that it has the minimal information for a user and sorts correctly when the user does distribution upgrades and thus needs the newer distribution package to be installed).

@thaJeztah
Copy link
Member Author

So a v0.10.1 indeed would be higher, and we can use the same suffixes as we use for the docker-ce package;

dpkg --compare-versions "0.10.1~ubuntu-jammy" ">>" "0.10.0-rc2~ubuntu-jammy" && echo "OK"
OK

dpkg --compare-versions "0.10.1-0~ubuntu.22.04.0~jammy" ">>" "0.10.0-rc2~ubuntu-jammy" && echo "OK"

@thaJeztah
Copy link
Member Author

@tianon what format would you suggest if we want to mention both the version number (22.04) and codename (jammy)? I recall we included both because;

  • we only used codename (jammy) before [master] Fix package version generation #701
  • we tend to mix/match referring to distro versions by codename and number (so some users may recognise the codename, others know the version)

@tianon
Copy link
Contributor

tianon commented Jan 10, 2023

If you really want both, then what the engine is currently doing is best because it'll sort correctly (with the codename as the very last component, and ~/tilde as the separator so that you only have a single -/hyphen and that your single hyphen is immediately following the "upstream version").

ie, 0.10.1~actually0.10.0-0~ubuntu.22.04~jammy, 0.10.1-0~ubuntu.22.04~jammy, etc

@tianon
Copy link
Contributor

tianon commented Jan 10, 2023

(the -0 then becomes your "escape hatch" if you need to make packaging changes between releases so you can do 0.10.1-1~ubuntu.22.04~jammy, etc)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants