From f25d121fc50ccd823927ab2527f197ff81b27325 Mon Sep 17 00:00:00 2001 From: Markus Hilger Date: Thu, 15 Oct 2026 18:04:50 +0200 Subject: [PATCH] Version the Python package rpms with ~dev as well confluent_client and confluent_server rpms took the PEP 440 version setup.py needs, 4.0.1.dev5+g..., which rpm sorts after 4.0.1: a released package did not upgrade a development build of it. Stamp the rpm with the ~dev form the other packages already use and keep .dev only for setup.py and the sdist name. The debs already sort right, since stdeb rewrites .dev to ~dev. --- README.md | 4 ++-- confluent_client/confluent_client.spec.tmpl | 3 ++- confluent_common/confluent_common.spec.tmpl | 9 +++++++-- confluent_server/buildrpm | 5 ++++- confluent_server/confluent_server.spec.tmpl | 3 ++- mkversion | 5 +++-- 6 files changed, 20 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index c08d94c7..27d110b0 100644 --- a/README.md +++ b/README.md @@ -32,8 +32,8 @@ Want to help? Submit a [Pull Request](https://github.com/xcat2/confluent/pulls). The top-level `VERSION` file names the release the current branch is working toward. Build scripts call `./mkversion`, which turns it into the version stamped on packages: the tag itself on a release -tag (`4.0.1`), otherwise a development version (`4.0.1.dev5+gdeadbee`, or `4.0.1~dev5+gdeadbee` for -the packages that have no `setup.py`). +tag (`4.0.1`), otherwise a development version (`4.0.1~dev5+gdeadbee`). Packages sort it before the +release it leads up to. Only `setup.py` gets the PEP 440 spelling, `4.0.1.dev5+gdeadbee`. `mkversion` also derives a version from the newest tag reachable from HEAD and uses whichever is higher, so forgetting to bump `VERSION` after tagging the current branch cannot walk the version diff --git a/confluent_client/confluent_client.spec.tmpl b/confluent_client/confluent_client.spec.tmpl index 9de73bd7..82e19b34 100644 --- a/confluent_client/confluent_client.spec.tmpl +++ b/confluent_client/confluent_client.spec.tmpl @@ -1,7 +1,8 @@ %define name confluent_client %define version #VERSION# +# the sdist carries the PEP 440 spelling of the version (.dev, not ~dev) %define fversion %{lua: -sv, _ = string.gsub("#VERSION#", "[~]", "-") +sv, _ = string.gsub("#VERSION#", "[~]", ".") print(sv) } %define release 1 diff --git a/confluent_common/confluent_common.spec.tmpl b/confluent_common/confluent_common.spec.tmpl index 94a1ea73..683f0cc3 100644 --- a/confluent_common/confluent_common.spec.tmpl +++ b/confluent_common/confluent_common.spec.tmpl @@ -1,12 +1,17 @@ %define name confluent_common %define version #VERSION# +# the sdist carries the PEP 440 spelling of the version (.dev, not ~dev) +%define fversion %{lua: +sv, _ = string.gsub("#VERSION#", "[~]", ".") +print(sv) +} %define release 1 Summary: common content for confluent client and server Name: %{name} Version: %{version} Release: %{release} -Source0: %{name}-%{version}.tar.gz +Source0: %{name}-%{fversion}.tar.gz License: UNKNOWN Group: Development/Libraries BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot @@ -19,7 +24,7 @@ Url: http://xcat.sf.net/ This provides the modules common for both client and server %prep -%setup -n %{name}-%{version} -n %{name}-%{version} +%setup -n %{name}-%{fversion} %build python2 setup.py build diff --git a/confluent_server/buildrpm b/confluent_server/buildrpm index 4554e502..0f7e48ab 100755 --- a/confluent_server/buildrpm +++ b/confluent_server/buildrpm @@ -3,7 +3,10 @@ cd `dirname $0` if [ -x ./makeman ]; then ./makeman fi -VERSION=`./makesetup` || exit 1 +./makesetup > /dev/null || exit 1 +# setup.py needs the PEP 440 .dev form, the rpm the ~dev one, which sorts +# before the release it leads up to +VERSION=`../mkversion --tilde` || exit 1 PKGNAME=$(basename $(pwd)) python3 setup.py sdist > /dev/null 2>&1 cp dist/*.tar.gz ~/rpmbuild/SOURCES diff --git a/confluent_server/confluent_server.spec.tmpl b/confluent_server/confluent_server.spec.tmpl index 42c723fb..ddfb9443 100644 --- a/confluent_server/confluent_server.spec.tmpl +++ b/confluent_server/confluent_server.spec.tmpl @@ -1,7 +1,8 @@ %define name confluent_server %define version #VERSION# +# the sdist carries the PEP 440 spelling of the version (.dev, not ~dev) %define fversion %{lua: -sv, _ = string.gsub("#VERSION#", "[~]", "-") +sv, _ = string.gsub("#VERSION#", "[~]", ".") print(sv) } %define release 1 diff --git a/mkversion b/mkversion index d6f85b63..fec5c300 100755 --- a/mkversion +++ b/mkversion @@ -1,8 +1,9 @@ #!/bin/sh # Print the version to stamp on packages built from this checkout. # -# --tilde use "~dev" rather than ".dev" (packages with no setup.py; "~" sorts -# before the release, ".dev" after, but PEP 440 requires ".dev") +# --tilde use "~dev" rather than ".dev": the package version, as "~" sorts +# before the release and ".dev" after it. Only setup.py takes ".dev", +# which PEP 440 requires. # # The root VERSION file names the release this branch is working toward. Release # tags do not always live on master (3.15.2 through 3.15.6 are on branch 3.15), so