pmb.helpers.pmaports.get: deal with operators
Fix that APKBUILDs mentioning other packages with an operator could not be found. As we are building the initial branch of v23.12, this currently happens with postmarketos-mkinitfs: it depends on devicepkg-utils>=0.2.0 and currently pmbootstrap will only remove the >=0.2.0 when looking for the pkgname in the APKINDEX of binary packages (which is why it works on master). But it does not yet do that when looking for the pkgname in pmaports. Move the code for stripping the operator to a common place and use it for getting packages from pmaports too. Change the order of operators while at it, try to find <= before =, as otherwise it would cut off example<=1.2.3 as "example<" instead of "example". Reviewed-by: Caleb Connolly <kc@postmarketos.org> (via chat)
This commit is contained in:
parent
1e3c9fc117
commit
8b8f25227f
|
@ -12,6 +12,14 @@ import pmb.helpers.pmaports
|
|||
import pmb.helpers.repo
|
||||
|
||||
|
||||
def remove_operators(package):
|
||||
for operator in [">", ">=", "<=", "=", "<", "~"]:
|
||||
if operator in package:
|
||||
package = package.split(operator)[0]
|
||||
break
|
||||
return package
|
||||
|
||||
|
||||
def get(args, pkgname, arch, replace_subpkgnames=False, must_exist=True):
|
||||
""" Find a package in pmaports, and as fallback in the APKINDEXes of the
|
||||
binary packages.
|
||||
|
|
|
@ -204,6 +204,7 @@ def get(args, pkgname, must_exist=True, subpackages=True):
|
|||
"options": [],
|
||||
... }
|
||||
"""
|
||||
pkgname = pmb.helpers.package.remove_operators(pkgname)
|
||||
if subpackages:
|
||||
aport = find(args, pkgname, must_exist)
|
||||
if aport:
|
||||
|
|
|
@ -5,6 +5,7 @@ import logging
|
|||
import os
|
||||
import tarfile
|
||||
import pmb.chroot.apk
|
||||
import pmb.helpers.package
|
||||
import pmb.helpers.repo
|
||||
import pmb.parse.version
|
||||
|
||||
|
@ -283,10 +284,7 @@ def providers(args, package, arch=None, must_exist=True, indexes=None):
|
|||
arch = arch or pmb.config.arch_native
|
||||
indexes = pmb.helpers.repo.apkindex_files(args, arch)
|
||||
|
||||
for operator in [">", ">=", "=", "<=", "<", "~"]:
|
||||
if operator in package:
|
||||
package = package.split(operator)[0]
|
||||
break
|
||||
package = pmb.helpers.package.remove_operators(package)
|
||||
|
||||
ret = collections.OrderedDict()
|
||||
for path in indexes:
|
||||
|
|
Loading…
Reference in New Issue