@@ -219,6 +219,11 @@ not and can not work as people would expect it should:
non reproducible, and people would be quite surprised and
disappointed.
+* +LIBFOO_VERSION_PREFIX+ may contain the version prefix used by the
+ package. +pkg-stats+ uses this prefix when checking for the latest
+ version of packages.
+ Example: +LIBFOO_VERSION_PREFIX = v+
+
* +LIBFOO_SOURCE+ may contain the name of the tarball of the package,
which Buildroot will use to download the tarball from
+LIBFOO_SITE+. If +HOST_LIBFOO_SOURCE+ is not specified, it defaults
@@ -89,6 +89,7 @@ class Package:
all_licenses = dict()
all_license_files = list()
all_versions = dict()
+ all_versions_prefixes = dict()
all_ignored_cves = dict()
all_cpeids = dict()
# This is the list of all possible checks. Add new checks to this list so
@@ -258,10 +259,16 @@ class Package:
def set_current_version(self):
"""
Fills in the .current_version field
+ If needed, filter out the version prefix
"""
var = self.pkgvar()
if var in self.all_versions:
- self.current_version = self.all_versions[var]
+ version = self.all_versions[var]
+
+ if var in self.all_versions_prefixes:
+ version = version.removeprefix(self.all_versions_prefixes[var])
+
+ self.current_version = version
def set_cpeid(self):
"""
@@ -418,7 +425,8 @@ def package_init_make_info():
# Fetch all variables at once
variables = subprocess.check_output(["make", "--no-print-directory", "-s",
"BR2_HAVE_DOT_CONFIG=y", "printvars",
- "VARS=%_LICENSE %_LICENSE_FILES %_VERSION %_IGNORE_CVES %_CPE_ID"])
+ "VARS=%_LICENSE %_LICENSE_FILES %_VERSION %VERSION_PREFIX \
+ %_IGNORE_CVES %_CPE_ID"])
variable_list = variables.decode().splitlines()
# We process first the host package VERSION, and then the target
@@ -452,6 +460,10 @@ def package_init_make_info():
pkgvar = pkgvar[:-8]
Package.all_versions[pkgvar] = value
+ elif pkgvar.endswith("_VERSION_PREFIX"):
+ pkgvar = pkgvar[:-15]
+ Package.all_versions_prefixes[pkgvar] = value
+
elif pkgvar.endswith("_IGNORE_CVES"):
pkgvar = pkgvar[:-12]
Package.all_ignored_cves[pkgvar] = value.split()
Packages using a version prefix are problematic for pkg-stats, because release-monitoring.org doesn't include the prefix in its versions. As a consequence, pkg-stat reports as outdated packages that actually aren't. Ideally release-monitoring.org would give us the prefix used by the package since it stores this information per-package. Unfortunately, the prefix is not part of the information we get from its API. We cannot blindly remove prefixes from every package because some of them use commit hashes (so for example a prefix 'v' to be removed cannot be distinguished from the letter 'v' being the beginning of a commit hash). Instead, this commit introduces support for a new '<PKG>_VERSION_PREFIX', which can be used to indicate the prefix used by the package. pkg-stats consumes this variable and removes the prefix from the version when reporting or comparing versions. The documentation is also updated accordingly. Signed-off-by: Raphaël Mélotte <raphael.melotte@mind.be> --- docs/manual/adding-packages-generic.adoc | 5 +++++ support/scripts/pkg-stats | 16 ++++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-)