Don't hide VCS packages
Treat them like all other packages. They used to cause various problems by hitting edge cases, but this should all be fixed now.
This commit is contained in:
@@ -15,7 +15,7 @@ from typing import List, Set, Dict, Tuple, Optional, Type, Sequence, NamedTuple,
|
||||
|
||||
from .appconfig import REPOSITORIES
|
||||
from .utils import vercmp, version_is_newer_than, extract_upstream_version, split_depends, \
|
||||
split_optdepends
|
||||
split_optdepends, strip_vcs
|
||||
from .pgp import parse_signature
|
||||
|
||||
|
||||
@@ -299,8 +299,8 @@ class Package:
|
||||
@property
|
||||
def realname(self) -> str:
|
||||
if self.repo.startswith("mingw"):
|
||||
return self.name.split("-", 3)[-1]
|
||||
return self.name
|
||||
return strip_vcs(self.name.split("-", 3)[-1])
|
||||
return strip_vcs(self.name)
|
||||
|
||||
@property
|
||||
def git_version(self) -> str:
|
||||
@@ -421,8 +421,8 @@ class Source:
|
||||
@property
|
||||
def realname(self) -> str:
|
||||
if self._package.repo.startswith("mingw"):
|
||||
return self.name.split("-", 2)[-1]
|
||||
return self.name
|
||||
return strip_vcs(self.name.split("-", 2)[-1])
|
||||
return strip_vcs(self.name)
|
||||
|
||||
@property
|
||||
def date(self) -> int:
|
||||
|
||||
@@ -13,7 +13,7 @@ import httpx
|
||||
|
||||
from .appstate import state, Source, CygwinVersions, ArchMapping, get_repositories, get_arch_names, SrcInfoPackage, Package, DepType
|
||||
from .appconfig import CYGWIN_VERSION_CONFIG, REQUEST_TIMEOUT, VERSION_CONFIG, ARCH_MAPPING_CONFIG, SRCINFO_CONFIG, UPDATE_INTERVAL
|
||||
from .utils import version_is_newer_than, arch_version_to_msys, package_name_is_vcs
|
||||
from .utils import version_is_newer_than, arch_version_to_msys
|
||||
from . import appconfig
|
||||
|
||||
|
||||
@@ -175,8 +175,6 @@ async def update_arch_versions() -> None:
|
||||
# a bit hacky, try to get the remaining versions from AUR
|
||||
possible_names = set()
|
||||
for s in state.sources.values():
|
||||
if package_name_is_vcs(s.name):
|
||||
continue
|
||||
for p in s.packages.values():
|
||||
possible_names.update(get_arch_names(p.realname))
|
||||
possible_names.update(get_arch_names(s.realname))
|
||||
|
||||
@@ -116,9 +116,11 @@ def extract_upstream_version(version: str) -> str:
|
||||
"-")[0].split("+", 1)[0].split("~", 1)[-1].split(":", 1)[-1]
|
||||
|
||||
|
||||
def package_name_is_vcs(package_name: str) -> bool:
|
||||
return package_name.endswith(
|
||||
("-cvs", "-svn", "-hg", "-darcs", "-bzr", "-git"))
|
||||
def strip_vcs(package_name: str) -> str:
|
||||
if package_name.endswith(
|
||||
("-cvs", "-svn", "-hg", "-darcs", "-bzr", "-git")):
|
||||
return package_name.rsplit("-", 1)[0]
|
||||
return package_name
|
||||
|
||||
|
||||
def arch_version_to_msys(v: str) -> str:
|
||||
|
||||
@@ -18,7 +18,7 @@ from fastapi.staticfiles import StaticFiles
|
||||
from fastapi_etag import add_exception_handler as add_etag_exception_handler
|
||||
|
||||
from .appstate import state, get_repositories, Package, is_skipped, Source, DepType
|
||||
from .utils import package_name_is_vcs, extract_upstream_version, version_is_newer_than
|
||||
from .utils import extract_upstream_version, version_is_newer_than
|
||||
|
||||
router = APIRouter(default_response_class=HTMLResponse)
|
||||
DIR = os.path.dirname(os.path.realpath(__file__))
|
||||
@@ -226,9 +226,6 @@ async def outofdate(request: Request, response: Response) -> Response:
|
||||
to_update = []
|
||||
all_sources = []
|
||||
for s in state.sources.values():
|
||||
if package_name_is_vcs(s.name):
|
||||
continue
|
||||
|
||||
all_sources.append(s)
|
||||
|
||||
msys_version = extract_upstream_version(s.version)
|
||||
@@ -273,8 +270,6 @@ async def queue(request: Request, response: Response) -> Response:
|
||||
for k, p in sorted(s.packages.items()):
|
||||
if p.name in state.sourceinfos:
|
||||
srcinfo = state.sourceinfos[p.name]
|
||||
if package_name_is_vcs(s.name):
|
||||
continue
|
||||
if version_is_newer_than(srcinfo.build_version, p.version):
|
||||
updates.append((srcinfo, s, p))
|
||||
break
|
||||
@@ -294,8 +289,6 @@ async def new(request: Request, response: Response) -> Response:
|
||||
# Create dummy entries for all GIT only packages
|
||||
available = {}
|
||||
for srcinfo in state.sourceinfos.values():
|
||||
if package_name_is_vcs(srcinfo.pkgbase):
|
||||
continue
|
||||
available[srcinfo.pkgname] = srcinfo
|
||||
for s in state.sources.values():
|
||||
for p in s.packages.values():
|
||||
|
||||
@@ -11,7 +11,7 @@ from app import app
|
||||
from app.appstate import parse_packager
|
||||
from app.fetch import parse_cygwin_versions
|
||||
from app.pgp import parse_signature, SigError, Signature
|
||||
from app.utils import split_optdepends
|
||||
from app.utils import split_optdepends, strip_vcs
|
||||
from fastapi.testclient import TestClient
|
||||
|
||||
|
||||
@@ -92,3 +92,8 @@ def test_split_optdepends():
|
||||
assert split_optdepends(["foo: bar", "foo: quux"]) == {'foo': {'bar', 'quux'}}
|
||||
assert split_optdepends(["foobar"]) == {'foobar': set()}
|
||||
assert split_optdepends(["foobar:"]) == {'foobar': set()}
|
||||
|
||||
|
||||
def test_strip_vcs():
|
||||
assert strip_vcs("foo") == "foo"
|
||||
assert strip_vcs("foo-git") == "foo"
|
||||
|
||||
Reference in New Issue
Block a user