summaryrefslogtreecommitdiffstats
path: root/meta/classes/perl-version.bbclass
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2017-06-11 08:36:31 -0400
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-12-11 22:02:57 +0000
commit557884aecadf627da2fac8303d5203064210ff7e (patch)
treec2e5b1c2fb83acd5760b388dcbb74d5af8b67b02 /meta/classes/perl-version.bbclass
parentb366f7ecccc824e4322e6b11383df0f51ebbb5ab (diff)
downloadpoky-557884aecadf627da2fac8303d5203064210ff7e.tar.gz
cpan-base.bbclass: Move PERLVERSION and get_perl_version to a new file
It is possible for non-CPAN recipes to contain perl modules. These perl modules must reside in the versioned perl library directory in order to work in normal circumstances.. Export this logic to a separate class so that it can be reused without the rest of the cpan logic. Without this, dpkg will not export its perl code to the correct location and will not be found by utilities that expect to use it. (From OE-Core rev: 6907280335dd47f2fd3a3f4cf809357c3caff65d) Signed-off-by: Tom Rini <trini@konsulko.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Armin Kuster <akuster808@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/perl-version.bbclass')
-rw-r--r--meta/classes/perl-version.bbclass24
1 files changed, 24 insertions, 0 deletions
diff --git a/meta/classes/perl-version.bbclass b/meta/classes/perl-version.bbclass
new file mode 100644
index 0000000000..fafe68a775
--- /dev/null
+++ b/meta/classes/perl-version.bbclass
@@ -0,0 +1,24 @@
1PERL_OWN_DIR = "${@["", "/perl-native"][(bb.data.inherits_class('native', d))]}"
2
3# Determine the staged version of perl from the perl configuration file
4# Assign vardepvalue, because otherwise signature is changed before and after
5# perl is built (from None to real version in config.sh).
6get_perl_version[vardepvalue] = "${PERL_OWN_DIR}"
7def get_perl_version(d):
8 import re
9 cfg = d.expand('${STAGING_LIBDIR}${PERL_OWN_DIR}/perl/config.sh')
10 try:
11 f = open(cfg, 'r')
12 except IOError:
13 return None
14 l = f.readlines();
15 f.close();
16 r = re.compile("^version='(\d*\.\d*\.\d*)'")
17 for s in l:
18 m = r.match(s)
19 if m:
20 return m.group(1)
21 return None
22
23PERLVERSION := "${@get_perl_version(d)}"
24PERLVERSION[vardepvalue] = ""