@@ -52,7 +52,10 @@ SECTION = "devel/python"
SRC_URI:prepend = "${PYPI_SRC_URI} "
S = "${UNPACKDIR}/${PYPI_PACKAGE}-${PV}"
-UPSTREAM_CHECK_PYPI_PACKAGE ?= "${PYPI_PACKAGE}"
+def pypi_normalize_regex(d):
+ # Use a regex wildcard instead of hyphen as the filenames
+ # may or may not have been normalised properly.
+ return pypi_normalize(d).replace("-", "[_-]")
# Use the simple repository API rather than the potentially unstable project URL
# More information on the pypi API specification is avaialble here:
@@ -60,7 +63,7 @@ UPSTREAM_CHECK_PYPI_PACKAGE ?= "${PYPI_PACKAGE}"
#
# NOTE: All URLs for the simple API MUST request canonical normalized URLs per the spec
UPSTREAM_CHECK_URI ?= "https://pypi.org/simple/${@pypi_normalize(d)}/"
-UPSTREAM_CHECK_REGEX ?= "(?i)${UPSTREAM_CHECK_PYPI_PACKAGE}-(?P<pver>(\d+[\.\-_]*)+).(tar\.gz|tgz|zip|tar\.bz2)"
+UPSTREAM_CHECK_REGEX ?= "(?i)${@pypi_normalize_regex(d)}-(?P<pver>(\d+(\.[\d\-]+)*(\.post\d+)?))\.(tar\.gz|tgz|zip|tar\.bz2)"
CVE_PRODUCT ?= "python:${PYPI_PACKAGE}"
Currently the upstream release checker fetches the Simple API release index which lists all of the uploaded files. However the naming rules have evolved over time[1] so matching the value of PYPI_PACKAGE fails if the sdist filename was not normalised but then is normalised. Remove UPSTREAM_CHECK_PYPI_PACKAGE which is mostly unused[2] and instead transform the PYPI_PACKAGE into a regular expression that handles both - and _ being used in the filename. Change the version number match so that it handles .postN suffixes, as defined in the Version Specifiers documentation[3]. We don't want to match any alphanumeric characters as this would also match development snapshots and release candidates. Finally escape the . between the version and the extension, so this matches a literal . and not any character. Across oe-core and meta-oe this improves the upstream detection quite significantly: - 93 recipes move from a broken check to up-to-date - 21 recipes move from a broken check to needing an update - 30 recipes move from up-to-date to needing an update [1] Specifically PEP-0427 introduced normalisation of special characters to underscores and lowercasing. [2] No users in oe-core, three in meta-oe which are no longer needed after this change. [3] https://packaging.python.org/en/latest/specifications/version-specifiers/ Signed-off-by: Ross Burton <ross.burton@arm.com> --- meta/classes-recipe/pypi.bbclass | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)