diff options
Diffstat (limited to 'meta/classes/ptest.bbclass')
-rw-r--r-- | meta/classes/ptest.bbclass | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/meta/classes/ptest.bbclass b/meta/classes/ptest.bbclass index 97865c9338..e87a9659cb 100644 --- a/meta/classes/ptest.bbclass +++ b/meta/classes/ptest.bbclass | |||
@@ -65,6 +65,38 @@ do_install_ptest_base() { | |||
65 | done | 65 | done |
66 | } | 66 | } |
67 | 67 | ||
68 | PTEST_BINDIR_PKGD_PATH = "${PKGD}${PTEST_PATH}/bin" | ||
69 | |||
70 | # This function needs to run after apply_update_alternative_renames because the | ||
71 | # aforementioned function will update the ALTERNATIVE_LINK_NAME flag. Append is | ||
72 | # used here to make this function to run as late as possible. | ||
73 | PACKAGE_PREPROCESS_FUNCS_append = "${@bb.utils.contains('PTEST_BINDIR', '1', \ | ||
74 | bb.utils.contains('PTEST_ENABLED', '1', ' ptest_update_alternatives', '', d), '', d)}" | ||
75 | |||
76 | python ptest_update_alternatives() { | ||
77 | """ | ||
78 | This function will generate the symlinks in the PTEST_BINDIR_PKGD_PATH | ||
79 | to match the renamed binaries by update-alternatives. | ||
80 | """ | ||
81 | |||
82 | if not bb.data.inherits_class('update-alternatives', d) \ | ||
83 | or not update_alternatives_enabled(d): | ||
84 | return | ||
85 | |||
86 | bb.note("Generating symlinks for ptest") | ||
87 | bin_paths = { os.environ["bindir"], os.environ["base_bindir"], | ||
88 | os.environ["sbindir"], os.environ["base_sbindir"] } | ||
89 | ptest_bindir = d.getVar("PTEST_BINDIR_PKGD_PATH") | ||
90 | os.mkdir(ptest_bindir) | ||
91 | for pkg in (d.getVar('PACKAGES') or "").split(): | ||
92 | alternatives = update_alternatives_alt_targets(d, pkg) | ||
93 | for alt_name, alt_link, alt_target, _ in alternatives: | ||
94 | # Some alternatives are for man pages, | ||
95 | # check if the alternative is in PATH | ||
96 | if os.path.dirname(alt_link) in bin_paths: | ||
97 | os.symlink(alt_target, os.path.join(ptest_bindir, alt_name)) | ||
98 | } | ||
99 | |||
68 | do_configure_ptest_base[dirs] = "${B}" | 100 | do_configure_ptest_base[dirs] = "${B}" |
69 | do_compile_ptest_base[dirs] = "${B}" | 101 | do_compile_ptest_base[dirs] = "${B}" |
70 | do_install_ptest_base[dirs] = "${B}" | 102 | do_install_ptest_base[dirs] = "${B}" |