diff options
author | Tom Rini <trini@konsulko.com> | 2017-06-11 08:36:31 -0400 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-06-12 15:08:31 +0100 |
commit | 329f602c30bca560e95e1f2ea25b7045153166d3 (patch) | |
tree | 1065c8ea79e154d7f57f115e61383bb9ad4511e2 /meta/classes | |
parent | 00e83cb02954b61ecfa9f30f6779ec323b95197c (diff) | |
download | poky-329f602c30bca560e95e1f2ea25b7045153166d3.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: f4edc200d3a9645f9674eae0f8d10926680ba4f8)
Signed-off-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r-- | meta/classes/cpan-base.bbclass | 24 | ||||
-rw-r--r-- | meta/classes/perl-version.bbclass | 24 |
2 files changed, 25 insertions, 23 deletions
diff --git a/meta/classes/cpan-base.bbclass b/meta/classes/cpan-base.bbclass index 55ac052695..577fcd63ce 100644 --- a/meta/classes/cpan-base.bbclass +++ b/meta/classes/cpan-base.bbclass | |||
@@ -7,27 +7,7 @@ FILES_${PN} += "${libdir}/perl ${datadir}/perl" | |||
7 | DEPENDS += "${@["perl", "perl-native"][(bb.data.inherits_class('native', d))]}" | 7 | DEPENDS += "${@["perl", "perl-native"][(bb.data.inherits_class('native', d))]}" |
8 | RDEPENDS_${PN} += "${@["perl", ""][(bb.data.inherits_class('native', d))]}" | 8 | RDEPENDS_${PN} += "${@["perl", ""][(bb.data.inherits_class('native', d))]}" |
9 | 9 | ||
10 | PERL_OWN_DIR = "${@["", "/perl-native"][(bb.data.inherits_class('native', d))]}" | 10 | inherit perl-version |
11 | |||
12 | # Determine the staged version of perl from the perl configuration file | ||
13 | # Assign vardepvalue, because otherwise signature is changed before and after | ||
14 | # perl is built (from None to real version in config.sh). | ||
15 | get_perl_version[vardepvalue] = "${PERL_OWN_DIR}" | ||
16 | def get_perl_version(d): | ||
17 | import re | ||
18 | cfg = d.expand('${STAGING_LIBDIR}${PERL_OWN_DIR}/perl/config.sh') | ||
19 | try: | ||
20 | f = open(cfg, 'r') | ||
21 | except IOError: | ||
22 | return None | ||
23 | l = f.readlines(); | ||
24 | f.close(); | ||
25 | r = re.compile("^version='(\d*\.\d*\.\d*)'") | ||
26 | for s in l: | ||
27 | m = r.match(s) | ||
28 | if m: | ||
29 | return m.group(1) | ||
30 | return None | ||
31 | 11 | ||
32 | def is_target(d): | 12 | def is_target(d): |
33 | if not bb.data.inherits_class('native', d): | 13 | if not bb.data.inherits_class('native', d): |
@@ -36,5 +16,3 @@ def is_target(d): | |||
36 | 16 | ||
37 | PERLLIBDIRS = "${libdir}/perl" | 17 | PERLLIBDIRS = "${libdir}/perl" |
38 | PERLLIBDIRS_class-native = "${libdir}/perl-native" | 18 | PERLLIBDIRS_class-native = "${libdir}/perl-native" |
39 | PERLVERSION := "${@get_perl_version(d)}" | ||
40 | PERLVERSION[vardepvalue] = "" | ||
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 @@ | |||
1 | PERL_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). | ||
6 | get_perl_version[vardepvalue] = "${PERL_OWN_DIR}" | ||
7 | def 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 | |||
23 | PERLVERSION := "${@get_perl_version(d)}" | ||
24 | PERLVERSION[vardepvalue] = "" | ||