forked from Mirror/pmbootstrap
build: package: allow building old versions of packages with --force (MR 2457)
It may be desirable to test older versions of packages, allow them to be built when --force is specified and print a warning that they won't be installed automatically. Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
This commit is contained in:
parent
8ac2e48a21
commit
2106e13f97
1 changed files with 16 additions and 7 deletions
|
@ -480,18 +480,27 @@ def packages(
|
|||
channel = pmb.config.pmaports.read_config(aports)["channel"]
|
||||
index_data = pmb.parse.apkindex.package(name, arch, False)
|
||||
# Make sure we aren't building a package that will never be used! This can happen if
|
||||
# building with --src with an outdated pmaports checkout.
|
||||
# building with --src with an outdated pmaports checkout. Unless --force is used
|
||||
# in which case we assume it was intentional.
|
||||
if (
|
||||
index_data
|
||||
and pmb.parse.version.compare(index_data.version, f"{pkgver}-r{apkbuild['pkgrel']}")
|
||||
== 1
|
||||
):
|
||||
raise NonBugError(
|
||||
f"A binary package for {name} has a newer version ({index_data.version})"
|
||||
f" than the source ({pkgver}-{apkbuild['pkgrel']}). Please ensure your pmaports branch is up"
|
||||
" to date and that you don't have a newer version of the package in your local"
|
||||
f" binary repo ({context.config.work / 'packages' / channel / pkg_arch})."
|
||||
)
|
||||
if force:
|
||||
logging.warning(
|
||||
f"WARNING: A binary package for {name} has a newer version ({index_data.version})"
|
||||
f" than the source ({pkgver}-{apkbuild['pkgrel']}). The package to be build will"
|
||||
f" not be installed automatically, use 'apk add {name}={pkgver}-r{apkbuild['pkgrel']}'"
|
||||
" to install it."
|
||||
)
|
||||
else:
|
||||
raise NonBugError(
|
||||
f"A binary package for {name} has a newer version ({index_data.version})"
|
||||
f" than the source ({pkgver}-{apkbuild['pkgrel']}). Please ensure your pmaports branch is up"
|
||||
" to date and that you don't have a newer version of the package in your local"
|
||||
f" binary repo ({context.config.work / 'packages' / channel / pkg_arch})."
|
||||
)
|
||||
build_queue.append(
|
||||
{
|
||||
"name": name,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue