Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sanity_checks: accept dash in packages' version strings #1706

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions tools/sanity_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import sys

from pathlib import Path
from utils import Version, ci_group, is_ci, is_alpinelike, is_debianlike, is_linux, is_macos, is_windows, is_msys
from utils import Version, ci_group, is_ci, is_alpinelike, is_debianlike, is_linux, is_macos, is_windows, is_msys, split_version_revision

PERMITTED_FILES = ['generator.sh', 'meson.build', 'meson_options.txt', 'meson.options', 'LICENSE.build']
PER_PROJECT_PERMITTED_FILES = {
Expand Down Expand Up @@ -255,9 +255,9 @@ def test_releases(self):
# a corresponding tag already.
for i, v in enumerate(versions):
t = f'{name}_{v}'
ver, rev = v.rsplit('-', 1)
with self.subTest(step='valid release name'):
self.assertTrue(re.fullmatch('[a-z0-9._]+', ver))
ver, rev = split_version_revision(v)
with self.subTest(step='valid release version'):
self.assertTrue(re.fullmatch('[^_]+', ver))
self.assertTrue(re.fullmatch('[0-9]+', rev))
if i == 0:
with self.subTest(step='check_source_url'):
Expand Down
3 changes: 3 additions & 0 deletions tools/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,3 +128,6 @@ def is_msys() -> bool:

def is_macos():
return any(platform.mac_ver()[0])

def split_version_revision(version: str) -> T.Tuple[str, str]:
return version.rsplit('-', 1)
5 changes: 3 additions & 2 deletions tools/versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import sys
import time
from typing import TypedDict
from utils import split_version_revision

import requests

Expand Down Expand Up @@ -113,7 +114,7 @@ def get_releases() -> dict[str, WrapInfo]:
def get_wrap_versions() -> dict[str, str]:
'''Return a dict: wrap_name -> wrapdb_version.'''
return {
name: info['versions'][0].split('-')[0]
name: split_version_revision(info['versions'][0])[0]
for name, info in get_releases().items()
if name not in DEPRECATED_WRAPS
}
Expand Down Expand Up @@ -219,7 +220,7 @@ def do_autoupdate(args: Namespace) -> None:
# only allow for ports, since official wraps can't have
# downstream changes
print(f'Updating {name} revision...')
cur_rev = int(releases[name]['versions'][0].split('-')[1])
cur_rev = int(split_version_revision(releases[name]['versions'][0])[1])
releases[name]['versions'].insert(
0, f'{cur_vers[name]}-{cur_rev + 1}'
)
Expand Down
Loading