-
Bug
-
Resolution: Duplicate
-
Undefined
-
None
-
None
-
None
-
False
-
-
False
-
-
-
DP Sprint 22, DP Sprint 23, DP Sprint 24
Description of problem:
The regular expression created by "create_midstream_matcher" in https://gitlab.com/redhat/rhel-ai/wheels/builder/-/blob/main/package_plugins/utils.py does not handle some types of versions correctly, e.g. versions with two digits or post releases. It also accepts suffixes it should not accept.
Version numbers (base image, wheels, builder, etc):
v23.27.0
Steps to Reproduce:
>>> from package_plugins.utils import create_midstream_matcher
>>> matcher = create_midstream_matcher()
# versions with two digits
>>> matcher("test", "v1.2+rhai1")
# post versions
>>> matcher("test", "v1.2.3.post1+rhai1")
# epoch
>>> matcher("test", "v0!1.2.3+rhai1")
# regular matchers should NOT accept a suffix.
>>> matcher("test", "v1.2.3+rhai1.whatever")
<Version('1.2.3+rhai1.whatever')>
Additional info:
The regular expression for midstream matcher could be simplified. It could delegate PEP 440 validation and parsing to packaging.version.Version().
r"^(v\d+.*\+rhai\d+)$"
or
rf"^(v\d+.*\+rhai\d+\.{re.escape(accelerator)})$"
- duplicates
-
AIPCC-7745 Refactor create_midstream_matcher regex for readability & optional upstream tag support
-
- Closed
-
- is related to
-
AIPCC-7724 Failures to build llama-stack>=0.2.23rc1 from source
-
- Closed
-
- mentioned on