Release 2026.08.06
This commit is contained in:
@@ -1,28 +1,40 @@
|
||||
import re
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
class ArchPkgbuildOptionalWineTests(unittest.TestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
def setUpClass(cls) -> None:
|
||||
repository = Path(__file__).resolve().parents[1]
|
||||
cls.repository = repository
|
||||
versionContents = (
|
||||
repository / "src" / "cthulhu" / "cthulhuVersion.py"
|
||||
).read_text(encoding="utf-8")
|
||||
versionMatch = re.search(r'(?m)^version = "([^"]+)"$', versionContents)
|
||||
if versionMatch is None:
|
||||
raise AssertionError("Unable to read the current Cthulhu version")
|
||||
cls.releaseVersion = versionMatch.group(1)
|
||||
cls.pkgbuilds = [
|
||||
repository / "distro-packages" / "Arch-Linux" / name / "PKGBUILD"
|
||||
for name in ("cthulhu", "cthulhu-git")
|
||||
]
|
||||
cls.helperPkgbuilds = [
|
||||
repository / "distro-packages" / "Arch-Linux" / name / "PKGBUILD"
|
||||
for name in ("cthulhu-wine-access-git",)
|
||||
for name in ("cthulhu-wine-access", "cthulhu-wine-access-git")
|
||||
]
|
||||
|
||||
def test_main_packages_disable_wine_helper_build(self):
|
||||
stableContents = self.pkgbuilds[0].read_text(encoding="utf-8")
|
||||
self.assertNotIn("wine-access", stableContents)
|
||||
@staticmethod
|
||||
def _array_contents(contents: str, arrayName: str) -> str:
|
||||
return contents.split(f"{arrayName}=(", 1)[1].split(")", 1)[0]
|
||||
|
||||
gitContents = self.pkgbuilds[1].read_text(encoding="utf-8")
|
||||
self.assertIn("-Dwine-access=disabled", gitContents)
|
||||
def test_main_packages_disable_wine_helper_build(self) -> None:
|
||||
for pkgbuild in self.pkgbuilds:
|
||||
with self.subTest(pkgbuild=pkgbuild):
|
||||
contents = pkgbuild.read_text(encoding="utf-8")
|
||||
self.assertIn("-Dwine-access=disabled", contents)
|
||||
|
||||
def test_main_packages_do_not_depend_on_wine(self):
|
||||
def test_main_packages_do_not_depend_on_wine(self) -> None:
|
||||
for pkgbuild in self.pkgbuilds:
|
||||
with self.subTest(pkgbuild=pkgbuild):
|
||||
contents = pkgbuild.read_text(encoding="utf-8")
|
||||
@@ -34,35 +46,81 @@ class ArchPkgbuildOptionalWineTests(unittest.TestCase):
|
||||
}
|
||||
self.assertNotIn("wine", dependencyLines)
|
||||
|
||||
def test_main_packages_advertise_matching_optional_helper(self):
|
||||
def test_main_packages_advertise_matching_optional_helper(self) -> None:
|
||||
stableContents = self.pkgbuilds[0].read_text(encoding="utf-8")
|
||||
self.assertNotIn("cthulhu-wine-access", stableContents)
|
||||
self.assertIn(
|
||||
"'cthulhu-wine-access: Wine, Proton, NVDA Controller, and Tolk integration'",
|
||||
self._array_contents(stableContents, "optdepends_x86_64"),
|
||||
)
|
||||
self.assertNotIn(
|
||||
"cthulhu-wine-access",
|
||||
self._array_contents(stableContents, "optdepends"),
|
||||
)
|
||||
|
||||
gitContents = self.pkgbuilds[1].read_text(encoding="utf-8")
|
||||
self.assertIn(
|
||||
"'cthulhu-wine-access-git: Wine, Proton, NVDA Controller, and Tolk integration'",
|
||||
gitContents,
|
||||
self._array_contents(gitContents, "optdepends_x86_64"),
|
||||
)
|
||||
self.assertNotIn(
|
||||
"cthulhu-wine-access-git",
|
||||
self._array_contents(gitContents, "optdepends"),
|
||||
)
|
||||
self.assertNotIn("optdepends_x86_64", gitContents)
|
||||
|
||||
def test_stable_packages_use_current_release_version(self):
|
||||
contents = self.pkgbuilds[0].read_text(encoding="utf-8")
|
||||
self.assertRegex(contents, r"(?m)^pkgver=2026\.05\.25$")
|
||||
def test_stable_packages_use_current_release_version(self) -> None:
|
||||
for pkgbuild in (self.pkgbuilds[0], self.helperPkgbuilds[0]):
|
||||
with self.subTest(pkgbuild=pkgbuild):
|
||||
contents = pkgbuild.read_text(encoding="utf-8")
|
||||
self.assertRegex(
|
||||
contents,
|
||||
rf"(?m)^pkgver={re.escape(self.releaseVersion)}$",
|
||||
)
|
||||
|
||||
def test_optional_helper_packages_own_the_wine_dependency(self):
|
||||
def test_release_metadata_uses_current_release_version(self) -> None:
|
||||
mesonContents = (self.repository / "meson.build").read_text(encoding="utf-8")
|
||||
self.assertRegex(
|
||||
mesonContents,
|
||||
rf"(?m)^ version: '{re.escape(self.releaseVersion)}(?:-[^']+)?',$",
|
||||
)
|
||||
|
||||
expectedSlackwareVersion = f"VERSION=${{VERSION:-{self.releaseVersion}}}"
|
||||
for relativePath in (
|
||||
("distro-packages", "Slackware", "cthulhu.SlackBuild"),
|
||||
("distro-packages", "Slint", "cthulhu.SlackBuild"),
|
||||
):
|
||||
with self.subTest(relativePath=relativePath):
|
||||
contents = self.repository.joinpath(*relativePath).read_text(
|
||||
encoding="utf-8"
|
||||
)
|
||||
self.assertIn(expectedSlackwareVersion, contents)
|
||||
|
||||
slintInfo = (
|
||||
self.repository / "distro-packages" / "Slint" / "cthulhu-info"
|
||||
).read_text(encoding="utf-8")
|
||||
self.assertRegex(
|
||||
slintInfo,
|
||||
rf'(?m)^VERSION="{re.escape(self.releaseVersion)}"$',
|
||||
)
|
||||
|
||||
def test_stable_helper_has_release_contract(self) -> None:
|
||||
contents = self.helperPkgbuilds[0].read_text(encoding="utf-8")
|
||||
self.assertRegex(contents, r"(?m)^arch=\(x86_64\)$")
|
||||
self.assertRegex(contents, r'(?m)^ "cthulhu=\$\{pkgver\}"$')
|
||||
|
||||
def test_optional_helper_packages_own_the_wine_dependency(self) -> None:
|
||||
for pkgbuild in self.helperPkgbuilds:
|
||||
with self.subTest(pkgbuild=pkgbuild):
|
||||
contents = pkgbuild.read_text(encoding="utf-8")
|
||||
self.assertIn("-Dwine-access=enabled", contents)
|
||||
self.assertRegex(contents, r"(?m)^ wine$")
|
||||
|
||||
def test_optional_helper_packages_disable_lto(self):
|
||||
def test_optional_helper_packages_disable_lto(self) -> None:
|
||||
for pkgbuild in self.helperPkgbuilds:
|
||||
with self.subTest(pkgbuild=pkgbuild):
|
||||
contents = pkgbuild.read_text(encoding="utf-8")
|
||||
self.assertRegex(contents, r"(?m)^options=\(!lto\)$")
|
||||
|
||||
def test_git_sources_declare_git_as_a_build_dependency(self):
|
||||
def test_git_sources_declare_git_as_a_build_dependency(self) -> None:
|
||||
for pkgbuild in self.pkgbuilds + self.helperPkgbuilds:
|
||||
with self.subTest(pkgbuild=pkgbuild):
|
||||
contents = pkgbuild.read_text(encoding="utf-8")
|
||||
|
||||
Reference in New Issue
Block a user