build is necessary: better binary > aport message

Clearly state which version is being used, and also display the message
when using build --force.

- Old:
WARNING: Package 'ubuntu-app-launch' in your aports folder has version
0_git20180604-r0, but the binary package repositories already have version
0_p20181101174257-r0! See also: <https://postmarketos.org/warning-repo2>

- New:
WARNING: package hello-world: aport version 1-r4 is lower than 1-r5 from
the binary repository. 1-r5 will be used when installing hello-world.
See also: <https://postmarketos.org/warning-repo2>
This commit is contained in:
Oliver Smith 2018-11-06 07:58:05 +01:00
parent 2f7df661d3
commit 56d813421f
2 changed files with 12 additions and 5 deletions

View File

@ -143,7 +143,12 @@ def is_necessary_warn_depends(args, apkbuild, arch, force, depends_built):
:returns: True or False
"""
pkgname = apkbuild["pkgname"]
ret = True if force else pmb.build.is_necessary(args, arch, apkbuild)
# Check if necessary (this warns about binary version > aport version, so
# call it even in force mode)
ret = pmb.build.is_necessary(args, arch, apkbuild)
if force:
ret = True
if not ret and len(depends_built):
# Warn of potentially outdated package

View File

@ -150,10 +150,12 @@ def is_necessary(args, arch, apkbuild, indexes=None):
# a) Binary repo has a newer version
version_old = index_data["version"]
if pmb.parse.version.compare(version_old, version_new) == 1:
logging.warning("WARNING: Package '" + package + "' in your aports folder"
" has version " + version_new + ", but the binary package"
" repositories already have version " + version_old + "!"
" See also: <https://postmarketos.org/warning-repo2>")
logging.warning("WARNING: package {}: aport version {} is lower than"
" {} from the binary repository. {} will be used when"
" installing {}. See also:"
" <https://postmarketos.org/warning-repo2>"
"".format(package, version_new, version_old,
version_old, package))
return False
# b) Aports folder has a newer version