2022-01-02 21:38:21 +00:00
|
|
|
# Copyright 2022 Oliver Smith
|
2020-02-20 20:07:28 +00:00
|
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
new action: 'pmbootstrap repo_missing'
Add a new action that lists all aports, for which no binary packages
exist. Only list packages that can be built for the relevant arch
(specified with --arch). This works recursively: when a package can be
built for a certain arch, but one of its dependencies
(or their depends) can not be built for that arch, then don't list it.
This action will be used for the new sr.ht based build infrastructure,
to figure out which packages need to be built ahead of time (so we can
trigger each of them as single build job). Determining the order of the
packages to be built is not determined with pmbootstrap, the serverside
code of build.postmarketos.org takes care of that.
For testing purposes, a single package can also be specified and the
action will list if it can be built for that arch with its
dependencies, and what needs to be built exactly.
Add pmb/helpers/package.py to hold functions that work on both pmaports
and (binary package) repos - in contrary to the existing
pmb/helpers/pmaports.py (see previous commit) and pmb/helpers/repo.py,
which only work with one of those.
Refactoring:
* pmb/helpers/pmaports.py: add a get_list() function, which lists all
aports and use it instead of writing the same glob loop over and over
* add pmb.helpers.pmaports.get(), which finds an APKBUILD and parses it
in one step.
* rename pmb.build._package.check_arch to ...check_arch_abort to
distinguish it from the other check_arch function
2018-11-15 07:36:39 +00:00
|
|
|
"""
|
2020-04-10 10:33:50 +00:00
|
|
|
Functions that work with both pmaports and binary package repos. See also:
|
|
|
|
- pmb/helpers/pmaports.py (work with pmaports)
|
|
|
|
- pmb/helpers/repo.py (work with binary package repos)
|
new action: 'pmbootstrap repo_missing'
Add a new action that lists all aports, for which no binary packages
exist. Only list packages that can be built for the relevant arch
(specified with --arch). This works recursively: when a package can be
built for a certain arch, but one of its dependencies
(or their depends) can not be built for that arch, then don't list it.
This action will be used for the new sr.ht based build infrastructure,
to figure out which packages need to be built ahead of time (so we can
trigger each of them as single build job). Determining the order of the
packages to be built is not determined with pmbootstrap, the serverside
code of build.postmarketos.org takes care of that.
For testing purposes, a single package can also be specified and the
action will list if it can be built for that arch with its
dependencies, and what needs to be built exactly.
Add pmb/helpers/package.py to hold functions that work on both pmaports
and (binary package) repos - in contrary to the existing
pmb/helpers/pmaports.py (see previous commit) and pmb/helpers/repo.py,
which only work with one of those.
Refactoring:
* pmb/helpers/pmaports.py: add a get_list() function, which lists all
aports and use it instead of writing the same glob loop over and over
* add pmb.helpers.pmaports.get(), which finds an APKBUILD and parses it
in one step.
* rename pmb.build._package.check_arch to ...check_arch_abort to
distinguish it from the other check_arch function
2018-11-15 07:36:39 +00:00
|
|
|
"""
|
|
|
|
import copy
|
2020-04-10 17:15:34 +00:00
|
|
|
import logging
|
new action: 'pmbootstrap repo_missing'
Add a new action that lists all aports, for which no binary packages
exist. Only list packages that can be built for the relevant arch
(specified with --arch). This works recursively: when a package can be
built for a certain arch, but one of its dependencies
(or their depends) can not be built for that arch, then don't list it.
This action will be used for the new sr.ht based build infrastructure,
to figure out which packages need to be built ahead of time (so we can
trigger each of them as single build job). Determining the order of the
packages to be built is not determined with pmbootstrap, the serverside
code of build.postmarketos.org takes care of that.
For testing purposes, a single package can also be specified and the
action will list if it can be built for that arch with its
dependencies, and what needs to be built exactly.
Add pmb/helpers/package.py to hold functions that work on both pmaports
and (binary package) repos - in contrary to the existing
pmb/helpers/pmaports.py (see previous commit) and pmb/helpers/repo.py,
which only work with one of those.
Refactoring:
* pmb/helpers/pmaports.py: add a get_list() function, which lists all
aports and use it instead of writing the same glob loop over and over
* add pmb.helpers.pmaports.get(), which finds an APKBUILD and parses it
in one step.
* rename pmb.build._package.check_arch to ...check_arch_abort to
distinguish it from the other check_arch function
2018-11-15 07:36:39 +00:00
|
|
|
|
|
|
|
import pmb.helpers.pmaports
|
2018-12-03 20:02:18 +00:00
|
|
|
import pmb.helpers.repo
|
new action: 'pmbootstrap repo_missing'
Add a new action that lists all aports, for which no binary packages
exist. Only list packages that can be built for the relevant arch
(specified with --arch). This works recursively: when a package can be
built for a certain arch, but one of its dependencies
(or their depends) can not be built for that arch, then don't list it.
This action will be used for the new sr.ht based build infrastructure,
to figure out which packages need to be built ahead of time (so we can
trigger each of them as single build job). Determining the order of the
packages to be built is not determined with pmbootstrap, the serverside
code of build.postmarketos.org takes care of that.
For testing purposes, a single package can also be specified and the
action will list if it can be built for that arch with its
dependencies, and what needs to be built exactly.
Add pmb/helpers/package.py to hold functions that work on both pmaports
and (binary package) repos - in contrary to the existing
pmb/helpers/pmaports.py (see previous commit) and pmb/helpers/repo.py,
which only work with one of those.
Refactoring:
* pmb/helpers/pmaports.py: add a get_list() function, which lists all
aports and use it instead of writing the same glob loop over and over
* add pmb.helpers.pmaports.get(), which finds an APKBUILD and parses it
in one step.
* rename pmb.build._package.check_arch to ...check_arch_abort to
distinguish it from the other check_arch function
2018-11-15 07:36:39 +00:00
|
|
|
|
|
|
|
|
2020-04-10 17:15:34 +00:00
|
|
|
def get(args, pkgname, arch, replace_subpkgnames=False, must_exist=True):
|
new action: 'pmbootstrap repo_missing'
Add a new action that lists all aports, for which no binary packages
exist. Only list packages that can be built for the relevant arch
(specified with --arch). This works recursively: when a package can be
built for a certain arch, but one of its dependencies
(or their depends) can not be built for that arch, then don't list it.
This action will be used for the new sr.ht based build infrastructure,
to figure out which packages need to be built ahead of time (so we can
trigger each of them as single build job). Determining the order of the
packages to be built is not determined with pmbootstrap, the serverside
code of build.postmarketos.org takes care of that.
For testing purposes, a single package can also be specified and the
action will list if it can be built for that arch with its
dependencies, and what needs to be built exactly.
Add pmb/helpers/package.py to hold functions that work on both pmaports
and (binary package) repos - in contrary to the existing
pmb/helpers/pmaports.py (see previous commit) and pmb/helpers/repo.py,
which only work with one of those.
Refactoring:
* pmb/helpers/pmaports.py: add a get_list() function, which lists all
aports and use it instead of writing the same glob loop over and over
* add pmb.helpers.pmaports.get(), which finds an APKBUILD and parses it
in one step.
* rename pmb.build._package.check_arch to ...check_arch_abort to
distinguish it from the other check_arch function
2018-11-15 07:36:39 +00:00
|
|
|
""" Find a package in pmaports, and as fallback in the APKINDEXes of the
|
|
|
|
binary packages.
|
|
|
|
:param pkgname: package name (e.g. "hello-world")
|
|
|
|
:param arch: preferred architecture of the binary package. When it
|
|
|
|
can't be found for this arch, we'll still look for another
|
|
|
|
arch to see whether the package exists at all. So make
|
|
|
|
sure to check the returned arch against what you wanted
|
|
|
|
with check_arch(). Example: "armhf"
|
2019-02-15 14:32:39 +00:00
|
|
|
:param replace_subpkgnames: replace all subpkgnames with their main
|
|
|
|
pkgnames in the depends (see #1733)
|
2020-04-10 17:15:34 +00:00
|
|
|
:param must_exist: raise an exception, if not found
|
|
|
|
:returns: * data from the parsed APKBUILD or APKINDEX in the following
|
|
|
|
format: {"arch": ["noarch"],
|
|
|
|
"depends": ["busybox-extras", "lddtree", ...],
|
|
|
|
"pkgname": "postmarketos-mkinitfs",
|
|
|
|
"provides": ["mkinitfs=0..1"],
|
|
|
|
"version": "0.0.4-r10"}
|
|
|
|
* None if the package was not found """
|
new action: 'pmbootstrap repo_missing'
Add a new action that lists all aports, for which no binary packages
exist. Only list packages that can be built for the relevant arch
(specified with --arch). This works recursively: when a package can be
built for a certain arch, but one of its dependencies
(or their depends) can not be built for that arch, then don't list it.
This action will be used for the new sr.ht based build infrastructure,
to figure out which packages need to be built ahead of time (so we can
trigger each of them as single build job). Determining the order of the
packages to be built is not determined with pmbootstrap, the serverside
code of build.postmarketos.org takes care of that.
For testing purposes, a single package can also be specified and the
action will list if it can be built for that arch with its
dependencies, and what needs to be built exactly.
Add pmb/helpers/package.py to hold functions that work on both pmaports
and (binary package) repos - in contrary to the existing
pmb/helpers/pmaports.py (see previous commit) and pmb/helpers/repo.py,
which only work with one of those.
Refactoring:
* pmb/helpers/pmaports.py: add a get_list() function, which lists all
aports and use it instead of writing the same glob loop over and over
* add pmb.helpers.pmaports.get(), which finds an APKBUILD and parses it
in one step.
* rename pmb.build._package.check_arch to ...check_arch_abort to
distinguish it from the other check_arch function
2018-11-15 07:36:39 +00:00
|
|
|
# Cached result
|
|
|
|
cache_key = "pmb.helpers.package.get"
|
2021-10-30 12:20:57 +00:00
|
|
|
if (
|
|
|
|
arch in pmb.helpers.other.cache[cache_key] and
|
|
|
|
pkgname in pmb.helpers.other.cache[cache_key][arch] and
|
|
|
|
replace_subpkgnames in pmb.helpers.other.cache[cache_key][arch][
|
|
|
|
pkgname
|
|
|
|
]
|
|
|
|
):
|
|
|
|
return pmb.helpers.other.cache[cache_key][arch][pkgname][
|
|
|
|
replace_subpkgnames
|
|
|
|
]
|
new action: 'pmbootstrap repo_missing'
Add a new action that lists all aports, for which no binary packages
exist. Only list packages that can be built for the relevant arch
(specified with --arch). This works recursively: when a package can be
built for a certain arch, but one of its dependencies
(or their depends) can not be built for that arch, then don't list it.
This action will be used for the new sr.ht based build infrastructure,
to figure out which packages need to be built ahead of time (so we can
trigger each of them as single build job). Determining the order of the
packages to be built is not determined with pmbootstrap, the serverside
code of build.postmarketos.org takes care of that.
For testing purposes, a single package can also be specified and the
action will list if it can be built for that arch with its
dependencies, and what needs to be built exactly.
Add pmb/helpers/package.py to hold functions that work on both pmaports
and (binary package) repos - in contrary to the existing
pmb/helpers/pmaports.py (see previous commit) and pmb/helpers/repo.py,
which only work with one of those.
Refactoring:
* pmb/helpers/pmaports.py: add a get_list() function, which lists all
aports and use it instead of writing the same glob loop over and over
* add pmb.helpers.pmaports.get(), which finds an APKBUILD and parses it
in one step.
* rename pmb.build._package.check_arch to ...check_arch_abort to
distinguish it from the other check_arch function
2018-11-15 07:36:39 +00:00
|
|
|
|
|
|
|
# Find in pmaports
|
|
|
|
ret = None
|
|
|
|
pmaport = pmb.helpers.pmaports.get(args, pkgname, False)
|
|
|
|
if pmaport:
|
|
|
|
ret = {"arch": pmaport["arch"],
|
|
|
|
"depends": pmb.build._package.get_depends(args, pmaport),
|
2019-02-15 14:32:39 +00:00
|
|
|
"pkgname": pmaport["pkgname"],
|
new action: 'pmbootstrap repo_missing'
Add a new action that lists all aports, for which no binary packages
exist. Only list packages that can be built for the relevant arch
(specified with --arch). This works recursively: when a package can be
built for a certain arch, but one of its dependencies
(or their depends) can not be built for that arch, then don't list it.
This action will be used for the new sr.ht based build infrastructure,
to figure out which packages need to be built ahead of time (so we can
trigger each of them as single build job). Determining the order of the
packages to be built is not determined with pmbootstrap, the serverside
code of build.postmarketos.org takes care of that.
For testing purposes, a single package can also be specified and the
action will list if it can be built for that arch with its
dependencies, and what needs to be built exactly.
Add pmb/helpers/package.py to hold functions that work on both pmaports
and (binary package) repos - in contrary to the existing
pmb/helpers/pmaports.py (see previous commit) and pmb/helpers/repo.py,
which only work with one of those.
Refactoring:
* pmb/helpers/pmaports.py: add a get_list() function, which lists all
aports and use it instead of writing the same glob loop over and over
* add pmb.helpers.pmaports.get(), which finds an APKBUILD and parses it
in one step.
* rename pmb.build._package.check_arch to ...check_arch_abort to
distinguish it from the other check_arch function
2018-11-15 07:36:39 +00:00
|
|
|
"provides": pmaport["provides"],
|
|
|
|
"version": pmaport["pkgver"] + "-r" + pmaport["pkgrel"]}
|
|
|
|
|
|
|
|
# Find in APKINDEX (given arch)
|
2019-04-19 23:23:18 +00:00
|
|
|
if not ret or not pmb.helpers.pmaports.check_arches(ret["arch"], arch):
|
new action: 'pmbootstrap repo_missing'
Add a new action that lists all aports, for which no binary packages
exist. Only list packages that can be built for the relevant arch
(specified with --arch). This works recursively: when a package can be
built for a certain arch, but one of its dependencies
(or their depends) can not be built for that arch, then don't list it.
This action will be used for the new sr.ht based build infrastructure,
to figure out which packages need to be built ahead of time (so we can
trigger each of them as single build job). Determining the order of the
packages to be built is not determined with pmbootstrap, the serverside
code of build.postmarketos.org takes care of that.
For testing purposes, a single package can also be specified and the
action will list if it can be built for that arch with its
dependencies, and what needs to be built exactly.
Add pmb/helpers/package.py to hold functions that work on both pmaports
and (binary package) repos - in contrary to the existing
pmb/helpers/pmaports.py (see previous commit) and pmb/helpers/repo.py,
which only work with one of those.
Refactoring:
* pmb/helpers/pmaports.py: add a get_list() function, which lists all
aports and use it instead of writing the same glob loop over and over
* add pmb.helpers.pmaports.get(), which finds an APKBUILD and parses it
in one step.
* rename pmb.build._package.check_arch to ...check_arch_abort to
distinguish it from the other check_arch function
2018-11-15 07:36:39 +00:00
|
|
|
pmb.helpers.repo.update(args, arch)
|
2019-04-19 23:23:18 +00:00
|
|
|
ret_repo = pmb.parse.apkindex.package(args, pkgname, arch, False)
|
|
|
|
|
|
|
|
# Save as result if there was no pmaport, or if the pmaport can not be
|
|
|
|
# built for the given arch, but there is a binary package for that arch
|
|
|
|
# (e.g. temp/mesa can't be built for x86_64, but Alpine has it)
|
2019-04-21 21:17:31 +00:00
|
|
|
if not ret or (ret_repo and ret_repo["arch"] == arch):
|
2019-04-19 23:23:18 +00:00
|
|
|
ret = ret_repo
|
new action: 'pmbootstrap repo_missing'
Add a new action that lists all aports, for which no binary packages
exist. Only list packages that can be built for the relevant arch
(specified with --arch). This works recursively: when a package can be
built for a certain arch, but one of its dependencies
(or their depends) can not be built for that arch, then don't list it.
This action will be used for the new sr.ht based build infrastructure,
to figure out which packages need to be built ahead of time (so we can
trigger each of them as single build job). Determining the order of the
packages to be built is not determined with pmbootstrap, the serverside
code of build.postmarketos.org takes care of that.
For testing purposes, a single package can also be specified and the
action will list if it can be built for that arch with its
dependencies, and what needs to be built exactly.
Add pmb/helpers/package.py to hold functions that work on both pmaports
and (binary package) repos - in contrary to the existing
pmb/helpers/pmaports.py (see previous commit) and pmb/helpers/repo.py,
which only work with one of those.
Refactoring:
* pmb/helpers/pmaports.py: add a get_list() function, which lists all
aports and use it instead of writing the same glob loop over and over
* add pmb.helpers.pmaports.get(), which finds an APKBUILD and parses it
in one step.
* rename pmb.build._package.check_arch to ...check_arch_abort to
distinguish it from the other check_arch function
2018-11-15 07:36:39 +00:00
|
|
|
|
|
|
|
# Find in APKINDEX (other arches)
|
|
|
|
if not ret:
|
2018-12-03 20:02:18 +00:00
|
|
|
pmb.helpers.repo.update(args)
|
new action: 'pmbootstrap repo_missing'
Add a new action that lists all aports, for which no binary packages
exist. Only list packages that can be built for the relevant arch
(specified with --arch). This works recursively: when a package can be
built for a certain arch, but one of its dependencies
(or their depends) can not be built for that arch, then don't list it.
This action will be used for the new sr.ht based build infrastructure,
to figure out which packages need to be built ahead of time (so we can
trigger each of them as single build job). Determining the order of the
packages to be built is not determined with pmbootstrap, the serverside
code of build.postmarketos.org takes care of that.
For testing purposes, a single package can also be specified and the
action will list if it can be built for that arch with its
dependencies, and what needs to be built exactly.
Add pmb/helpers/package.py to hold functions that work on both pmaports
and (binary package) repos - in contrary to the existing
pmb/helpers/pmaports.py (see previous commit) and pmb/helpers/repo.py,
which only work with one of those.
Refactoring:
* pmb/helpers/pmaports.py: add a get_list() function, which lists all
aports and use it instead of writing the same glob loop over and over
* add pmb.helpers.pmaports.get(), which finds an APKBUILD and parses it
in one step.
* rename pmb.build._package.check_arch to ...check_arch_abort to
distinguish it from the other check_arch function
2018-11-15 07:36:39 +00:00
|
|
|
for arch_i in pmb.config.build_device_architectures:
|
|
|
|
if arch_i != arch:
|
|
|
|
ret = pmb.parse.apkindex.package(args, pkgname, arch_i, False)
|
|
|
|
if ret:
|
|
|
|
break
|
|
|
|
|
|
|
|
# Copy ret (it might have references to caches of the APKINDEX or APKBUILDs
|
|
|
|
# and we don't want to modify those!)
|
|
|
|
if ret:
|
|
|
|
ret = copy.deepcopy(ret)
|
|
|
|
|
|
|
|
# Make sure ret["arch"] is a list (APKINDEX code puts a string there)
|
|
|
|
if ret and isinstance(ret["arch"], str):
|
|
|
|
ret["arch"] = [ret["arch"]]
|
|
|
|
|
2019-02-15 14:32:39 +00:00
|
|
|
# Replace subpkgnames if desired
|
|
|
|
if replace_subpkgnames:
|
|
|
|
depends_new = []
|
|
|
|
for depend in ret["depends"]:
|
2020-04-10 17:15:34 +00:00
|
|
|
depend_data = get(args, depend, arch, must_exist=False)
|
|
|
|
if not depend_data:
|
|
|
|
logging.warning(f"WARNING: {pkgname}: failed to resolve"
|
|
|
|
f" dependency '{depend}'")
|
|
|
|
# Can't replace potential subpkgname
|
|
|
|
if depend not in depends_new:
|
|
|
|
depends_new += [depend]
|
|
|
|
continue
|
|
|
|
depend_pkgname = depend_data["pkgname"]
|
|
|
|
if depend_pkgname not in depends_new:
|
|
|
|
depends_new += [depend_pkgname]
|
2019-02-15 14:32:39 +00:00
|
|
|
ret["depends"] = depends_new
|
|
|
|
|
new action: 'pmbootstrap repo_missing'
Add a new action that lists all aports, for which no binary packages
exist. Only list packages that can be built for the relevant arch
(specified with --arch). This works recursively: when a package can be
built for a certain arch, but one of its dependencies
(or their depends) can not be built for that arch, then don't list it.
This action will be used for the new sr.ht based build infrastructure,
to figure out which packages need to be built ahead of time (so we can
trigger each of them as single build job). Determining the order of the
packages to be built is not determined with pmbootstrap, the serverside
code of build.postmarketos.org takes care of that.
For testing purposes, a single package can also be specified and the
action will list if it can be built for that arch with its
dependencies, and what needs to be built exactly.
Add pmb/helpers/package.py to hold functions that work on both pmaports
and (binary package) repos - in contrary to the existing
pmb/helpers/pmaports.py (see previous commit) and pmb/helpers/repo.py,
which only work with one of those.
Refactoring:
* pmb/helpers/pmaports.py: add a get_list() function, which lists all
aports and use it instead of writing the same glob loop over and over
* add pmb.helpers.pmaports.get(), which finds an APKBUILD and parses it
in one step.
* rename pmb.build._package.check_arch to ...check_arch_abort to
distinguish it from the other check_arch function
2018-11-15 07:36:39 +00:00
|
|
|
# Save to cache and return
|
|
|
|
if ret:
|
2021-10-30 12:20:57 +00:00
|
|
|
if arch not in pmb.helpers.other.cache[cache_key]:
|
|
|
|
pmb.helpers.other.cache[cache_key][arch] = {}
|
|
|
|
if pkgname not in pmb.helpers.other.cache[cache_key][arch]:
|
|
|
|
pmb.helpers.other.cache[cache_key][arch][pkgname] = {}
|
|
|
|
pmb.helpers.other.cache[cache_key][arch][pkgname][
|
|
|
|
replace_subpkgnames
|
|
|
|
] = ret
|
new action: 'pmbootstrap repo_missing'
Add a new action that lists all aports, for which no binary packages
exist. Only list packages that can be built for the relevant arch
(specified with --arch). This works recursively: when a package can be
built for a certain arch, but one of its dependencies
(or their depends) can not be built for that arch, then don't list it.
This action will be used for the new sr.ht based build infrastructure,
to figure out which packages need to be built ahead of time (so we can
trigger each of them as single build job). Determining the order of the
packages to be built is not determined with pmbootstrap, the serverside
code of build.postmarketos.org takes care of that.
For testing purposes, a single package can also be specified and the
action will list if it can be built for that arch with its
dependencies, and what needs to be built exactly.
Add pmb/helpers/package.py to hold functions that work on both pmaports
and (binary package) repos - in contrary to the existing
pmb/helpers/pmaports.py (see previous commit) and pmb/helpers/repo.py,
which only work with one of those.
Refactoring:
* pmb/helpers/pmaports.py: add a get_list() function, which lists all
aports and use it instead of writing the same glob loop over and over
* add pmb.helpers.pmaports.get(), which finds an APKBUILD and parses it
in one step.
* rename pmb.build._package.check_arch to ...check_arch_abort to
distinguish it from the other check_arch function
2018-11-15 07:36:39 +00:00
|
|
|
return ret
|
|
|
|
|
|
|
|
# Could not find the package
|
2020-04-10 17:15:34 +00:00
|
|
|
if not must_exist:
|
|
|
|
return None
|
new action: 'pmbootstrap repo_missing'
Add a new action that lists all aports, for which no binary packages
exist. Only list packages that can be built for the relevant arch
(specified with --arch). This works recursively: when a package can be
built for a certain arch, but one of its dependencies
(or their depends) can not be built for that arch, then don't list it.
This action will be used for the new sr.ht based build infrastructure,
to figure out which packages need to be built ahead of time (so we can
trigger each of them as single build job). Determining the order of the
packages to be built is not determined with pmbootstrap, the serverside
code of build.postmarketos.org takes care of that.
For testing purposes, a single package can also be specified and the
action will list if it can be built for that arch with its
dependencies, and what needs to be built exactly.
Add pmb/helpers/package.py to hold functions that work on both pmaports
and (binary package) repos - in contrary to the existing
pmb/helpers/pmaports.py (see previous commit) and pmb/helpers/repo.py,
which only work with one of those.
Refactoring:
* pmb/helpers/pmaports.py: add a get_list() function, which lists all
aports and use it instead of writing the same glob loop over and over
* add pmb.helpers.pmaports.get(), which finds an APKBUILD and parses it
in one step.
* rename pmb.build._package.check_arch to ...check_arch_abort to
distinguish it from the other check_arch function
2018-11-15 07:36:39 +00:00
|
|
|
raise RuntimeError("Package '" + pkgname + "': Could not find aport, and"
|
|
|
|
" could not find this package in any APKINDEX!")
|
|
|
|
|
|
|
|
|
|
|
|
def depends_recurse(args, pkgname, arch):
|
|
|
|
""" Recursively resolve all of the package's dependencies.
|
|
|
|
:param pkgname: name of the package (e.g. "device-samsung-i9100")
|
|
|
|
:param arch: preferred architecture for binary packages
|
|
|
|
:returns: a list of pkgname_start and all its dependencies, e.g:
|
|
|
|
["busybox-static-armhf", "device-samsung-i9100",
|
|
|
|
"linux-samsung-i9100", ...] """
|
|
|
|
# Cached result
|
|
|
|
cache_key = "pmb.helpers.package.depends_recurse"
|
2021-10-30 12:20:57 +00:00
|
|
|
if (arch in pmb.helpers.other.cache[cache_key] and
|
|
|
|
pkgname in pmb.helpers.other.cache[cache_key][arch]):
|
|
|
|
return pmb.helpers.other.cache[cache_key][arch][pkgname]
|
new action: 'pmbootstrap repo_missing'
Add a new action that lists all aports, for which no binary packages
exist. Only list packages that can be built for the relevant arch
(specified with --arch). This works recursively: when a package can be
built for a certain arch, but one of its dependencies
(or their depends) can not be built for that arch, then don't list it.
This action will be used for the new sr.ht based build infrastructure,
to figure out which packages need to be built ahead of time (so we can
trigger each of them as single build job). Determining the order of the
packages to be built is not determined with pmbootstrap, the serverside
code of build.postmarketos.org takes care of that.
For testing purposes, a single package can also be specified and the
action will list if it can be built for that arch with its
dependencies, and what needs to be built exactly.
Add pmb/helpers/package.py to hold functions that work on both pmaports
and (binary package) repos - in contrary to the existing
pmb/helpers/pmaports.py (see previous commit) and pmb/helpers/repo.py,
which only work with one of those.
Refactoring:
* pmb/helpers/pmaports.py: add a get_list() function, which lists all
aports and use it instead of writing the same glob loop over and over
* add pmb.helpers.pmaports.get(), which finds an APKBUILD and parses it
in one step.
* rename pmb.build._package.check_arch to ...check_arch_abort to
distinguish it from the other check_arch function
2018-11-15 07:36:39 +00:00
|
|
|
|
|
|
|
# Build ret (by iterating over the queue)
|
|
|
|
queue = [pkgname]
|
|
|
|
ret = []
|
|
|
|
while len(queue):
|
|
|
|
pkgname_queue = queue.pop()
|
|
|
|
package = get(args, pkgname_queue, arch)
|
|
|
|
|
|
|
|
# Add its depends to the queue
|
|
|
|
for depend in package["depends"]:
|
|
|
|
if depend not in ret:
|
|
|
|
queue += [depend]
|
2019-02-15 14:32:39 +00:00
|
|
|
|
|
|
|
# Add the pkgname (not possible subpkgname) to ret
|
|
|
|
if package["pkgname"] not in ret:
|
|
|
|
ret += [package["pkgname"]]
|
new action: 'pmbootstrap repo_missing'
Add a new action that lists all aports, for which no binary packages
exist. Only list packages that can be built for the relevant arch
(specified with --arch). This works recursively: when a package can be
built for a certain arch, but one of its dependencies
(or their depends) can not be built for that arch, then don't list it.
This action will be used for the new sr.ht based build infrastructure,
to figure out which packages need to be built ahead of time (so we can
trigger each of them as single build job). Determining the order of the
packages to be built is not determined with pmbootstrap, the serverside
code of build.postmarketos.org takes care of that.
For testing purposes, a single package can also be specified and the
action will list if it can be built for that arch with its
dependencies, and what needs to be built exactly.
Add pmb/helpers/package.py to hold functions that work on both pmaports
and (binary package) repos - in contrary to the existing
pmb/helpers/pmaports.py (see previous commit) and pmb/helpers/repo.py,
which only work with one of those.
Refactoring:
* pmb/helpers/pmaports.py: add a get_list() function, which lists all
aports and use it instead of writing the same glob loop over and over
* add pmb.helpers.pmaports.get(), which finds an APKBUILD and parses it
in one step.
* rename pmb.build._package.check_arch to ...check_arch_abort to
distinguish it from the other check_arch function
2018-11-15 07:36:39 +00:00
|
|
|
ret.sort()
|
|
|
|
|
|
|
|
# Save to cache and return
|
2021-10-30 12:20:57 +00:00
|
|
|
if arch not in pmb.helpers.other.cache[cache_key]:
|
|
|
|
pmb.helpers.other.cache[cache_key][arch] = {}
|
|
|
|
pmb.helpers.other.cache[cache_key][arch][pkgname] = ret
|
new action: 'pmbootstrap repo_missing'
Add a new action that lists all aports, for which no binary packages
exist. Only list packages that can be built for the relevant arch
(specified with --arch). This works recursively: when a package can be
built for a certain arch, but one of its dependencies
(or their depends) can not be built for that arch, then don't list it.
This action will be used for the new sr.ht based build infrastructure,
to figure out which packages need to be built ahead of time (so we can
trigger each of them as single build job). Determining the order of the
packages to be built is not determined with pmbootstrap, the serverside
code of build.postmarketos.org takes care of that.
For testing purposes, a single package can also be specified and the
action will list if it can be built for that arch with its
dependencies, and what needs to be built exactly.
Add pmb/helpers/package.py to hold functions that work on both pmaports
and (binary package) repos - in contrary to the existing
pmb/helpers/pmaports.py (see previous commit) and pmb/helpers/repo.py,
which only work with one of those.
Refactoring:
* pmb/helpers/pmaports.py: add a get_list() function, which lists all
aports and use it instead of writing the same glob loop over and over
* add pmb.helpers.pmaports.get(), which finds an APKBUILD and parses it
in one step.
* rename pmb.build._package.check_arch to ...check_arch_abort to
distinguish it from the other check_arch function
2018-11-15 07:36:39 +00:00
|
|
|
return ret
|
|
|
|
|
|
|
|
|
|
|
|
def check_arch(args, pkgname, arch, binary=True):
|
|
|
|
""" Can a package be built for a certain architecture, or is there a binary
|
|
|
|
package for it?
|
|
|
|
|
|
|
|
:param pkgname: name of the package
|
|
|
|
:param arch: architecture to check against
|
|
|
|
:param binary: set to False to only look at the pmaports, not at binary
|
|
|
|
packages
|
|
|
|
:returns: True when the package can be built, or there is a binary
|
|
|
|
package, False otherwise
|
|
|
|
"""
|
|
|
|
if binary:
|
|
|
|
arches = get(args, pkgname, arch)["arch"]
|
|
|
|
else:
|
|
|
|
arches = pmb.helpers.pmaports.get(args, pkgname)["arch"]
|
2019-04-19 23:20:16 +00:00
|
|
|
return pmb.helpers.pmaports.check_arches(arches, arch)
|