Skip to content

Commit 99049cf

Browse files
committed
Pin openssl to LTS version
1 parent cdd8334 commit 99049cf

3 files changed

Lines changed: 32 additions & 5 deletions

File tree

relenv/python-versions.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,9 +205,9 @@
205205
}
206206
},
207207
"openssl": {
208-
"3.6.1": {
208+
"3.5.5": {
209209
"url": "https://github.com/openssl/openssl/releases/download/openssl-{version}/openssl-{version}.tar.gz",
210-
"sha256": "b1bfedcd5b289ff22aee87c9d600f515767ebf45f77168cb6d64f231f518a82e",
210+
"sha256": "b28c91532a8b65a1f983b4c28b7488174e4a01008e29ce8e69bd789f28bc2a89",
211211
"platforms": [
212212
"linux",
213213
"darwin",

relenv/pyversions.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,10 @@ def verify_signature(
123123
VERSION = None # '3.13.2'
124124
UPDATE = False
125125

126+
PINNED_VERSIONS = {
127+
"openssl": "3.5",
128+
}
129+
126130

127131
def digest(file: str | os.PathLike[str]) -> str:
128132
"""
@@ -249,6 +253,11 @@ def detect_openssl_versions() -> list[str]:
249253
# Find tags like openssl-3.5.4
250254
pattern = r'openssl-(\d+\.\d+\.\d+)"'
251255
matches = re.findall(pattern, content)
256+
257+
pin = PINNED_VERSIONS.get("openssl")
258+
if pin:
259+
matches = [v for v in matches if v == pin or v.startswith(f"{pin}.")]
260+
252261
# Deduplicate and sort
253262
versions = sorted(
254263
set(matches), key=lambda v: [int(x) for x in v.split(".")], reverse=True

tests/test_pyversions_runtime.py

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ def test_detect_openssl_versions(monkeypatch: pytest.MonkeyPatch) -> None:
110110
"""Test OpenSSL version detection from GitHub releases."""
111111
mock_html = """
112112
<html>
113+
<a href="/openssl/openssl/releases/tag/openssl-3.6.1">openssl-3.6.1</a>
113114
<a href="/openssl/openssl/releases/tag/openssl-3.5.4">openssl-3.5.4</a>
114115
<a href="/openssl/openssl/releases/tag/openssl-3.5.3">openssl-3.5.3</a>
115116
<a href="/openssl/openssl/releases/tag/openssl-3.4.0">openssl-3.4.0</a>
@@ -120,14 +121,31 @@ def fake_fetch(url: str) -> str:
120121
return mock_html
121122

122123
monkeypatch.setattr(pyversions, "fetch_url_content", fake_fetch)
124+
125+
# Test with pin "3.5" (current setting)
126+
monkeypatch.setitem(pyversions.PINNED_VERSIONS, "openssl", "3.5")
123127
versions = pyversions.detect_openssl_versions()
124-
assert isinstance(versions, list)
125128
assert "3.5.4" in versions
126129
assert "3.5.3" in versions
127-
assert "3.4.0" in versions
128-
# Verify sorting (latest first)
130+
assert "3.6.1" not in versions
131+
assert "3.4.0" not in versions
129132
assert versions[0] == "3.5.4"
130133

134+
# Test with different pin
135+
monkeypatch.setitem(pyversions.PINNED_VERSIONS, "openssl", "3.4")
136+
versions = pyversions.detect_openssl_versions()
137+
assert "3.4.0" in versions
138+
assert "3.5.4" not in versions
139+
assert "3.6.1" not in versions
140+
141+
# Test with no pin
142+
monkeypatch.delitem(pyversions.PINNED_VERSIONS, "openssl")
143+
versions = pyversions.detect_openssl_versions()
144+
assert "3.6.1" in versions
145+
assert "3.5.4" in versions
146+
assert "3.4.0" in versions
147+
assert versions[0] == "3.6.1"
148+
131149

132150
def test_detect_sqlite_versions(monkeypatch: pytest.MonkeyPatch) -> None:
133151
"""Test SQLite version detection from sqlite.org."""

0 commit comments

Comments
 (0)