diff --git a/.daily_canary b/.daily_canary index 945c9b46d684..d8f4ad07a7b2 100644 --- a/.daily_canary +++ b/.daily_canary @@ -1 +1 @@ -. \ No newline at end of file +It's a new canary diff --git a/CMakeLists.txt b/CMakeLists.txt index 0c09414efd62..e29c956c33cf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -485,7 +485,8 @@ if(BUILD_TESTS) if(NOT UNSAFE_VERSION) # Unsafe builds do not follow normal version conventions add_test(NAME versionifier_test - COMMAND ${PYTHON} ${CMAKE_SOURCE_DIR}/python/versionifier.py + COMMAND ${PYTHON} + ${CMAKE_SOURCE_DIR}/python/ccf/_versionifier.py ) add_test(NAME github_version_lts_test diff --git a/python/versionifier.py b/python/ccf/_versionifier.py similarity index 82% rename from python/versionifier.py rename to python/ccf/_versionifier.py index b42484e863ab..2d7aba487b1f 100644 --- a/python/versionifier.py +++ b/python/ccf/_versionifier.py @@ -50,34 +50,42 @@ def to_python_version(original): v = to_python_version("1.2.3") assert v.release == (1, 2, 3) + assert v == to_python_version("ccf-1.2.3") v = to_python_version("ccf-1.2.3") assert v.release == (1, 2, 3) + assert v == to_python_version("ccf-1.2.3") v = to_python_version("ccf-1.2.3-a42") assert v.release == (1, 2, 3) assert v.pre == ("a", 42) + assert v < to_python_version("ccf-1.2.3") # -x precedes main release v = to_python_version("ccf-1.2.3-rc1") assert v.release == (1, 2, 3) assert v.pre == ("rc", 1) + assert v < to_python_version("ccf-1.2.3") # RC precedes main release v = to_python_version("ccf-1.2.3-dev2") assert v.release == (1, 2, 3) assert v.dev == 2 + assert v < to_python_version("ccf-1.2.3") # dev precedes main release v = to_python_version("ccf-1.2.3-dev3-5-deadbeef") assert v.release == (1, 2, 3) assert v.dev == 3 assert v.local == "5.deadbeef" + assert v < to_python_version("ccf-1.2.3") # dev precedes main release v = to_python_version("ccf-1.2.3-42-deadbeef") assert v.release == (1, 2, 3) assert v.post == 42 assert v.local == "deadbeef" + assert v > to_python_version("ccf-1.2.3") # -N comes after main release v = to_python_version("ccf-2.0.0-rc4-26-g49d7b7941+unsafe") assert v.release == (2, 0, 0) assert v.pre == ("rc", 4) assert v.post == 26 assert v.local == "g49d7b7941unsafe" + assert v < to_python_version("ccf-2.0.0") # RC precedes main release diff --git a/python/setup.py b/python/setup.py index bd835ffed989..16ce08fd09d7 100644 --- a/python/setup.py +++ b/python/setup.py @@ -7,7 +7,8 @@ # pylint: disable=import-error import version # type: ignore -import versionifier +# pylint: disable=protected-access +import ccf._versionifier PACKAGE_NAME = "ccf" UTILITIES_PATH = "utils" @@ -23,7 +24,7 @@ setup( name=PACKAGE_NAME, - version=str(versionifier.to_python_version(version.CCF_VERSION)), + version=str(ccf._versionifier.to_python_version(version.CCF_VERSION)), description="Set of tools and utilities for the Confidential Consortium Framework (CCF)", long_description=long_description, long_description_content_type="text/markdown", diff --git a/tests/infra/consortium.py b/tests/infra/consortium.py index dec95e7ec49b..1699677c11fa 100644 --- a/tests/infra/consortium.py +++ b/tests/infra/consortium.py @@ -710,7 +710,7 @@ def check_for_service(self, remote_node, status, recovery_count=None): r = c.get("/node/network").body.json() current_status = r["service_status"] current_cert = r["service_certificate"] - if remote_node.version_after("ccf-2.0.4"): + if remote_node.version_after("ccf-2.0.3"): current_recovery_count = r["recovery_count"] else: assert "recovery_count" not in r @@ -729,7 +729,7 @@ def check_for_service(self, remote_node, status, recovery_count=None): assert ( current_status == status.value ), f"Service status {current_status} (expected {status.value})" - if remote_node.version_after("ccf-2.0.4"): + if remote_node.version_after("ccf-2.0.3"): assert ( recovery_count is None or current_recovery_count == recovery_count ), f"Current recovery count {current_recovery_count} is not expected {recovery_count}" diff --git a/tests/infra/node.py b/tests/infra/node.py index f5ffda22c1e5..891ab623be0c 100644 --- a/tests/infra/node.py +++ b/tests/infra/node.py @@ -22,6 +22,9 @@ import time import http +# pylint: disable=protected-access +import ccf._versionifier + # pylint: disable=import-error, no-name-in-module from setuptools.extern.packaging.version import Version # type: ignore @@ -99,14 +102,10 @@ def version_after(version, cmp_version): # It is assumed that version is None for latest development # branch (i.e. main) return True - rc, _ = version_rc(cmp_version) - self_rc, self_num_rc_tkns = version_rc(version) - ver = Version(strip_version(cmp_version)) - self_ver = Version(strip_version(version)) - return self_ver > ver or ( - self_ver == ver - and (not self_rc or self_rc > rc or (self_rc == rc and self_num_rc_tkns > 3)) - ) + + return ccf._versionifier.to_python_version( + version + ) > ccf._versionifier.to_python_version(cmp_version) class Node: diff --git a/tests/lts_compatibility.py b/tests/lts_compatibility.py index ec2bd60bccca..f2fd2e5dfa65 100644 --- a/tests/lts_compatibility.py +++ b/tests/lts_compatibility.py @@ -484,11 +484,11 @@ def run_ledger_compatibility_since_first(args, local_branch, use_snapshot): committed_ledger_dirs, snapshots_dir=snapshots_dir, ) - # Recovery count is not stored in pre-2.0.4 ledgers + # Recovery count is not stored in pre-2.0.3 ledgers network.recover( args, expected_recovery_count=1 - if not infra.node.version_after(previous_version, "ccf-2.0.4") + if not infra.node.version_after(previous_version, "ccf-2.0.3") else None, )