-
Notifications
You must be signed in to change notification settings - Fork 145
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] Fix package version generation #701
Conversation
This unifies the logic/code for generating pseudo-versions for nightly builds; - Generate pseudo-version if the source repository has uncommitted changes - Fix code to work on macOS - Strip "v" prefix if the passed VERSION has one Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
The script had special handling for pre-releases, because at some point we used `-tp` ("technical preview") as suffix for pre-releases instead of the standard `-alpha`, `-beta`, `-rc`. The problem arised because of that, was that comparing versions wouldn't work, as these suffixes are compared in _alphabetical_ order (which meant that `tp` would come "after" `beta` and `rc`). To work around this, some custom code was added to insert a numeric version _before_ the `tp`, `beta`, and `rc`. We no longer plan to use `-tp` for pre-releases, and instead to just use the common `alpha[.number]`, `beta[.number]`, `rc[.number]` suffixes. This patch removes the custom handling for pre-releases, to simplify the version that's generated. Before: ./rpm/gen-rpm-ver . 22.06.0-beta.0 22.06.0 1.0.beta.0 3091da7 22.06.0-beta.0 ./deb/gen-deb-ver . 22.06.0-beta.0 22.06.0~1.0.beta.0 22.06.0-beta.0 After: ./rpm/gen-rpm-ver . 22.06.0-beta.0 22.06.0~beta.0 1 0b5a1ae 22.06.0-beta.0 ./deb/gen-deb-ver . 22.06.0-beta.0 22.06.0~beta.0 22.06.0-beta.0 Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Before:
After:
Looking where the |
rpm packages, e.g. Fedora 35 now look like;
comparing to an old beta release (which used
So the |
The change from I agree we should fix the
|
Yup! Following our slack chat; the line to look at is this one; docker-ce-packaging/deb/build-deb Lines 46 to 47 in 37aa0a7
That prepends the |
Trying some variations to see what the distro version would look like, and what combinations we could make that are both "sorting" correctly, and (somewhat) human friendly; On Debian: docker run -it --rm debian sh -c '. /etc/os-release && echo "${ID}${VERSION_ID}"'
debian11
On Ubuntu, docker run -it --rm ubuntu sh -c '. /etc/os-release && echo "${ID}${VERSION_ID}"'
ubuntu20.04 edit Tianon confirmed that CalVer is fine for Ubuntu |
|
IMO we shouldn't be publishing packages for either unstable or testing until they're actually released (or deep in one of the stages of Debian Freeze, and thus only testing). |
Gotcha; yes. It's always a bit of a 'chicken and egg' (people want to test those, e.g. |
What I do is for every distro release I support I have multiple release channels. 2nd-ing what @tianon mentioned above around naming. |
Yes, just discussing with Tianon to insert a |
As to "pre-releases"; we're only pushing those to the |
Ah, lol. sourcing cd /go/src/github.com/docker/cli && VERSION=22.04 (Jammy Jellyfish) GITCOMMIT=1496274 LDFLAGS='' GO_LINKMODE=dynamic ./scripts/build/binary && DISABLE_WARN_OUTSIDE_CONTAINER=1 LDFLAGS='' make manpages
/bin/sh: 1: Syntax error: "(" unexpected Guess I need a bit of subshell magic here |
|
The existing version format for our packages use `distro-codename` in the version. Unfortunately, `codename` cannot be used to compare versions, which means that when a user upgrades their distro to a new version, the package won't be updated until a new release happens. This patch changes the format of the version to include `VERSION_ID`, which is numeric, and can be used in version comparison. While we're making changes, this also adds an extra `pkgRevision` number in the version, which can allow us to do a new build/release of a package in between upstream releases. This version is not yet configurable (which can be changed in future). Resulting packages are now formatted as; - name of the package (e.g., "docker-ce") - version (e.g., "22.10.6~beta.0") - "-0" (mostly "best practice", and allows updating for specific situations) - distro (e.g., "ubuntu") - VERSION_ID (e.g. "22.04" or "11") this must be "sortable" to make sure that packages are upgraded when upgrading to a newer distro version ("codename" cannot be used for this, as they're not sorted) - pkgRevision (usually "0", see above) - SUITE ("codename"), e.g. "jammy" or "bullseye". This is mostly for convenience, because some places refer to distro versions by codename, others by version. we prefix the codename with a tilde (~), which effectively excludes it from version comparison. Note that while the `${EPOCH}${EPOCH_SEP}` is part of the version, it is not included in the package's *filename*. Examples: docker-ce_22.10.6~beta.0-0~debian.11.0~bullseye_amd64.deb docker-ce_22.10.6~beta.0-0~ubuntu.22.04.0~jammy_amd64.deb Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Yup! That's ~ what I did |
Alright; pushed a commit with the changes discussed above; PTAL and let me know if that looks sane :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
unify code for pseudo-versions (nightly), and fix for macOS
This unifies the logic/code for generating pseudo-versions for
nightly builds;
deb, rpm: generate versions without special numbers for pre-releases
The script had special handling for pre-releases, because at some point we
used
-tp
("technical preview") as suffix for pre-releases instead of thestandard
-alpha
,-beta
,-rc
.The problem arised because of that, was that comparing versions wouldn't work,
as these suffixes are compared in alphabetical order (which meant that
tp
would come "after"
beta
andrc
). To work around this, some custom codewas added to insert a numeric version before the
tp
,beta
, andrc
.We no longer plan to use
-tp
for pre-releases, and instead to just use thecommon
alpha[.number]
,beta[.number]
,rc[.number]
suffixes.This patch removes the custom handling for pre-releases, to simplify the version
that's generated.
Before:
After:
deb: fix version to allow for distro upgrades
The existing version format for our packages use
distro-codename
in the version.Unfortunately,
codename
cannot be used to compare versions, which means thatwhen a user upgrades their distro to a new version, the package won't be updated
until a new release happens.
This patch changes the format of the version to include
VERSION_ID
, which isnumeric, and can be used in version comparison.
While we're making changes, this also adds an extra
pkgRevision
number in theversion, which can allow us to do a new build/release of a package in between
upstream releases. This version is not yet configurable (which can be changed
in future).
Resulting packages are now formatted as;
packages are upgraded when upgrading to a newer distro version ("codename"
cannot be used for this, as they're not sorted)
because some places refer to distro versions by codename, others by version.
we prefix the codename with a tilde (~), which effectively excludes it from
version comparison.
Note that while the
${EPOCH}${EPOCH_SEP}
is part of the version, it is notincluded in the package's filename.
Examples: