]> code.ossystems Code Review - openembedded-core.git/commitdiff
cpan-base: set default UPSTREAM_CHECK_REGEX
authorKonrad Weihmann <kweihmann@outlook.com>
Fri, 9 Apr 2021 16:51:23 +0000 (18:51 +0200)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Sun, 18 Apr 2021 10:29:05 +0000 (11:29 +0100)
as cpan release versions are almost always follow an a.b version scheme,
it's better to filter out beta releases such as a.b.c.
Use the first resource fetched from https://cpan.metacpan.org as base
for calculating the needed regex.
In case nothing can be calculated fall back to nothing.
Add this to cpan-base to enable it for new & old style cpan integration.

Signed-off-by: Konrad Weihmann <kweihmann@outlook.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes/cpan-base.bbclass

index 867edf87073f49b732dbe0e5cf915cc914382b03..1fc3f0bcb03234e97d4f1364602a579ae5941bef 100644 (file)
@@ -16,3 +16,12 @@ def is_target(d):
 
 PERLLIBDIRS = "${libdir}/perl5"
 PERLLIBDIRS_class-native = "${libdir}/perl5"
+
+def cpan_upstream_check_pattern(d):
+    for x in (d.getVar('SRC_URI') or '').split(' '):
+        if x.startswith("https://cpan.metacpan.org"):
+            _pattern = x.split('/')[-1].replace(d.getVar('PV'), '(?P<pver>\d+.\d+)')
+            return _pattern
+    return ''
+
+UPSTREAM_CHECK_REGEX ?= "${@cpan_upstream_check_pattern(d)}"