diff options
author | Mariano Lopez <just.another.mariano@gmail.com> | 2019-04-09 00:44:13 -0500 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-04-11 21:12:48 +0100 |
commit | 6995ec65e8019dc6fdf96fc9d508ba600b4551d9 (patch) | |
tree | fb6d753ae20487e4a4e16fd32b72eac668f9aa2d | |
parent | 5feccb430bfc56e278f2e3bab87b87ea9973e08f (diff) | |
download | poky-6995ec65e8019dc6fdf96fc9d508ba600b4551d9.tar.gz |
ptest.bbclass: Add feature to populate a binary directory
This adds the functionality to create a binary directory within
PTEST_PATH directory. This directory will be populated with
symlinks pointing to the binaries installed by the package and
then renamed by update-alternatives. This way the ptest only needs
to source this binary directory in order to use the expected
binaries.
To enable this feature just add PTEST_BINDIR = "1" to the recipe.
[YOCTO #12597]
[YOCTO #13238]
(From OE-Core rev: bca35319b89ce668927728c4e2094f6e10cef298)
Signed-off-by: Mariano Lopez <just.another.mariano@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-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}" |