diff options
Diffstat (limited to 'meta/classes-recipe/perl-version.bbclass')
-rw-r--r-- | meta/classes-recipe/perl-version.bbclass | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/meta/classes-recipe/perl-version.bbclass b/meta/classes-recipe/perl-version.bbclass new file mode 100644 index 0000000000..269ac9eb31 --- /dev/null +++ b/meta/classes-recipe/perl-version.bbclass | |||
@@ -0,0 +1,72 @@ | |||
1 | # | ||
2 | # Copyright OpenEmbedded Contributors | ||
3 | # | ||
4 | # SPDX-License-Identifier: MIT | ||
5 | # | ||
6 | |||
7 | PERL_OWN_DIR = "" | ||
8 | |||
9 | # Determine the staged version of perl from the perl configuration file | ||
10 | # Assign vardepvalue, because otherwise signature is changed before and after | ||
11 | # perl is built (from None to real version in config.sh). | ||
12 | get_perl_version[vardepvalue] = "${PERL_OWN_DIR}" | ||
13 | def get_perl_version(d): | ||
14 | import re | ||
15 | cfg = d.expand('${STAGING_LIBDIR}${PERL_OWN_DIR}/perl5/config.sh') | ||
16 | try: | ||
17 | f = open(cfg, 'r') | ||
18 | except IOError: | ||
19 | return None | ||
20 | l = f.readlines(); | ||
21 | f.close(); | ||
22 | r = re.compile(r"^version='(\d*\.\d*\.\d*)'") | ||
23 | for s in l: | ||
24 | m = r.match(s) | ||
25 | if m: | ||
26 | return m.group(1) | ||
27 | return None | ||
28 | |||
29 | PERLVERSION := "${@get_perl_version(d)}" | ||
30 | PERLVERSION[vardepvalue] = "" | ||
31 | |||
32 | |||
33 | # Determine the staged arch of perl from the perl configuration file | ||
34 | # Assign vardepvalue, because otherwise signature is changed before and after | ||
35 | # perl is built (from None to real version in config.sh). | ||
36 | def get_perl_arch(d): | ||
37 | import re | ||
38 | cfg = d.expand('${STAGING_LIBDIR}${PERL_OWN_DIR}/perl5/config.sh') | ||
39 | try: | ||
40 | f = open(cfg, 'r') | ||
41 | except IOError: | ||
42 | return None | ||
43 | l = f.readlines(); | ||
44 | f.close(); | ||
45 | r = re.compile("^archname='([^']*)'") | ||
46 | for s in l: | ||
47 | m = r.match(s) | ||
48 | if m: | ||
49 | return m.group(1) | ||
50 | return None | ||
51 | |||
52 | PERLARCH := "${@get_perl_arch(d)}" | ||
53 | PERLARCH[vardepvalue] = "" | ||
54 | |||
55 | # Determine the staged arch of perl-native from the perl configuration file | ||
56 | # Assign vardepvalue, because otherwise signature is changed before and after | ||
57 | # perl is built (from None to real version in config.sh). | ||
58 | def get_perl_hostarch(d): | ||
59 | import re | ||
60 | cfg = d.expand('${STAGING_LIBDIR_NATIVE}/perl5/config.sh') | ||
61 | try: | ||
62 | f = open(cfg, 'r') | ||
63 | except IOError: | ||
64 | return None | ||
65 | l = f.readlines(); | ||
66 | f.close(); | ||
67 | r = re.compile("^archname='([^']*)'") | ||
68 | for s in l: | ||
69 | m = r.match(s) | ||
70 | if m: | ||
71 | return m.group(1) | ||
72 | return None | ||