Index parser: support multiple package providers (#1202)

* The APKINDEX parser used to return a dictionary with one package for
  a given package name. This works for the installed packages database,
  because there can only be one provider for a package. But when
  parsing packages from binary repositories, we need to support
  multiple providers for one package. It is now possible to get a
  dictionary with either multiple providers, or just a single provider
  for each package.
* Dependency parsing logic has been adjusted, to support multiple
  providers. For multiple providers, the one with the same package
  name as the package we are looking up is prefered. If there is none
  (eg. "so:libEGL.so.1" is provided by "mesa-egl"), it prefers packages
  that will be installed anyway, and after that packages that are
  already installed. When all else fails, it just picks the first one
  and prints a note in the "pmbootstrap log".
* Added testcases for all functions in pmb.parse.apkindex and
  pmb.parse.depends
* pmbootstrap chroot has a new "--add" parameter to specify packages
  that pmbootstrap should build if neccessary, and install in the
  chroot. This can be used to quickly test the depencency resolution
  of pmbootstrap without doing a full "pmbootstrap install".

Fixes #1122.
This commit is contained in:
Oliver Smith 2018-02-20 19:52:28 +00:00 committed by GitHub
parent 481c99f50c
commit db5e69630e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 850 additions and 231 deletions

View file

@ -91,7 +91,7 @@ def copy_to_buildpath(args, package, suffix="native"):
"/home/pmos/build"], suffix=suffix)
def is_necessary(args, arch, apkbuild, apkindex_path=None):
def is_necessary(args, arch, apkbuild, indexes=None):
"""
Check if the package has already been built. Compared to abuild's check,
this check also works for different architectures, and it recognizes
@ -100,7 +100,7 @@ def is_necessary(args, arch, apkbuild, apkindex_path=None):
:param arch: package target architecture
:param apkbuild: from pmb.parse.apkbuild()
:param apkindex_path: override the APKINDEX.tar.gz path
:param indexes: list of APKINDEX.tar.gz paths
:returns: boolean
"""
# Get package name, version, define start of debug message
@ -109,11 +109,8 @@ def is_necessary(args, arch, apkbuild, apkindex_path=None):
msg = "Build is necessary for package '" + package + "': "
# Get old version from APKINDEX
if apkindex_path:
index_data = pmb.parse.apkindex.read(
args, package, apkindex_path, False)
else:
index_data = pmb.parse.apkindex.read_any_index(args, package, arch)
index_data = pmb.parse.apkindex.package(args, package, arch, False,
indexes)
if not index_data:
logging.debug(msg + "No binary package available")
return True