3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-02-04 16:26:17 +00:00

Fix NuGet packaging to handle dynamic glibc versions (#8474)

* Initial plan

* Fix NuGet package to support any glibc version

Make mk_nuget_task.py more robust by using pattern matching for glibc versions
instead of hardcoding specific versions. This fixes the issue where builds with
newer glibc versions (e.g., 2.39) were not recognized, causing the linux-x64
runtime to be missing from the NuGet package.

Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>

* Optimize regex patterns with non-capturing groups

Use non-capturing groups (?:) instead of capturing groups () for better
performance, as the captured groups are not used.

Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
This commit is contained in:
Copilot 2026-02-02 09:16:27 -08:00 committed by GitHub
parent 9007728ddb
commit 20e19b97ee
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -15,6 +15,7 @@ import sys
import os.path
import shutil
import subprocess
import re
def mk_dir(d):
if not os.path.exists(d):
@ -33,13 +34,29 @@ os_info = { 'x64-ubuntu-latest' : ('so', 'linux-x64'),
'arm64-osx' : ('dylib', 'osx-arm64'),
'debian' : ('so', 'linux-x64') }
# Pattern-based mappings for more flexible matching
# These patterns handle version numbers and other variable parts
os_patterns = [
(re.compile(r'x64-glibc-\d+(?:\.\d+)*'), 'so', 'linux-x64'), # Matches x64-glibc-2.35, x64-glibc-2.39, etc.
(re.compile(r'arm64-glibc-\d+(?:\.\d+)*'), 'so', 'linux-arm64'), # Matches arm64-glibc-* with version
]
def classify_package(f, arch):
# First try exact matches from the dictionary
for os_name in os_info:
if os_name in f:
ext, dst = os_info[os_name]
return os_name, f[:-4], ext, dst
# Then try pattern-based matching for more flexible version handling
for pattern, ext, dst in os_patterns:
match = pattern.search(f)
if match:
matched_os_name = match.group(0)
return matched_os_name, f[:-4], ext, dst
print("Could not classify", f)
return None