From db04f8b16e4f5e5fcefaf67523a501948bca16ba Mon Sep 17 00:00:00 2001 From: Takuya ASADA Date: Wed, 10 Jul 2024 14:40:20 +0900 Subject: [PATCH 1/2] Revert "scylla-housekeeping: fix exception on parsing version string" This reverts commit 65fbf72ed0f0980381c3307cda5a6d1b1fde2dfb, since it breaks scylla-housekeeping and SCT because the patch modified version string. We shoudn't modify version string directly, need to pass modified string just for parse_version() instead. --- dist/common/scripts/scylla-housekeeping | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/dist/common/scripts/scylla-housekeeping b/dist/common/scripts/scylla-housekeeping index 0c0bb911d6..5baf61b71a 100755 --- a/dist/common/scripts/scylla-housekeeping +++ b/dist/common/scripts/scylla-housekeeping @@ -96,11 +96,9 @@ def sanitize_version(version): false negative version_compare() checks. """ if version and '-' in version: - version = version.split('-', 1)[0] - # Newer setuptools does not accept ~dev in version strings, need to - # replace it to .dev0 - if version and version.endswith('~dev'): - version = version.replace('~dev', '.dev0') + return version.split('-', 1)[0] + else: + return version def get_repo_file(dir): From 373a7825b52654145be509c1330dda8ef46586f5 Mon Sep 17 00:00:00 2001 From: Takuya ASADA Date: Wed, 10 Jul 2024 14:42:43 +0900 Subject: [PATCH 2/2] scylla-housekeeping: fix exception on parsing version string Since Python 3.12, version parsing becomes strict, parse_version() does not accept the version string like '6.1.0~dev'. To fix this, we need to pass acceptable version string to parse_version() like '6.1.0.dev0', which is allowed on Python version scheme. Also, release canditate version like '6.0.0~rc3' has same issue, it should be replaced to '6.0.0rc3' to compare in parse_version(). reference: https://packaging.python.org/en/latest/specifications/version-specifiers/ Fixes #19564 Closes scylladb/scylladb#19572 --- dist/common/scripts/scylla-housekeeping | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/dist/common/scripts/scylla-housekeeping b/dist/common/scripts/scylla-housekeeping index 5baf61b71a..735063e443 100755 --- a/dist/common/scripts/scylla-housekeeping +++ b/dist/common/scripts/scylla-housekeeping @@ -80,8 +80,20 @@ def get_api(path): return get_json_from_url("http://" + api_address + path) +def parse_scylla_version(version): + # Newer setuptools does not accept ~dev in version strings, need to + # replace it to X.Y.Z.dev0 + if version and version.endswith('~dev'): + version = version.replace('~dev', '.dev0') + # Newer setuptools does not accept ~rcN in version strings, need to + # replace it to X.Y.ZrcN + if version and '~rc' in version: + version = version.replace('~', '') + return parse_version(version) + + def version_compare(a, b): - return parse_version(a) < parse_version(b) + return parse_scylla_version(a) < parse_scylla_version(b) def create_uuid_file(fl):