Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame] | 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 | |
Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame] | 29 | |
| 30 | # Determine the staged arch of perl from the perl configuration file |
| 31 | # Assign vardepvalue, because otherwise signature is changed before and after |
| 32 | # perl is built (from None to real version in config.sh). |
| 33 | def get_perl_arch(d): |
| 34 | import re |
| 35 | cfg = d.expand('${STAGING_LIBDIR}${PERL_OWN_DIR}/perl5/config.sh') |
| 36 | try: |
| 37 | f = open(cfg, 'r') |
| 38 | except IOError: |
| 39 | return None |
| 40 | l = f.readlines(); |
| 41 | f.close(); |
| 42 | r = re.compile("^archname='([^']*)'") |
| 43 | for s in l: |
| 44 | m = r.match(s) |
| 45 | if m: |
| 46 | return m.group(1) |
| 47 | return None |
| 48 | |
Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame] | 49 | # Determine the staged arch of perl-native from the perl configuration file |
| 50 | # Assign vardepvalue, because otherwise signature is changed before and after |
| 51 | # perl is built (from None to real version in config.sh). |
| 52 | def get_perl_hostarch(d): |
| 53 | import re |
| 54 | cfg = d.expand('${STAGING_LIBDIR_NATIVE}/perl5/config.sh') |
| 55 | try: |
| 56 | f = open(cfg, 'r') |
| 57 | except IOError: |
| 58 | return None |
| 59 | l = f.readlines(); |
| 60 | f.close(); |
| 61 | r = re.compile("^archname='([^']*)'") |
| 62 | for s in l: |
| 63 | m = r.match(s) |
| 64 | if m: |
| 65 | return m.group(1) |
| 66 | return None |