[PATCH 5/9] chipsec: correct location of installation

Ricardo Neri <[email protected]> Fri, 10 Mar 2017 15:36:17 -0800
Newsgroups dev.linux.lists.oe-chipsec
Message-ID <1489188981-23886-6-git-send-email-ricardo.neri-calderon@linux.intel.com>
--===============3875297134751424919==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable

Now chipsec relies on setuptools to install chipsec. This leads to a
bizarre issue in which the chipsec artifacts are buried under a
directory structure ${D}/${PYTHON_SITEPACKAGES_DIR}${D}/
${PYTHON_SITEPACKAGES_DIR}. Relocate the chipsec binaries to the
expected location.

Also, we use the --root option in setup.py to get rid of the CPU
architecture and the operating system sufix to the package name.

Signed-off-by: Ricardo Neri <[email protected]>
---
 meta-luv/recipes-core/chipsec/chipsec_git.bb | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/meta-luv/recipes-core/chipsec/chipsec_git.bb b/meta-luv/recipe=
s-core/chipsec/chipsec_git.bb
index da0f970..2f7bcb6 100644
--- a/meta-luv/recipes-core/chipsec/chipsec_git.bb
+++ b/meta-luv/recipes-core/chipsec/chipsec_git.bb
@@ -46,6 +46,9 @@ def get_target_arch(d):
 =

 EXTRA_OEMAKE +=3D "ARCH=3D"${@get_target_arch(d)}""
 =

+DISTUTILS_INSTALL_ARGS =3D "--root=3D${D}${PYTHON_SITEPACKAGES_DIR} \
+    --install-data=3D${D}/${datadir}"
+
 fix_mod_path() {
     sed -i -e "s:^INSTALL_MOD_PATH_PREFIX =3D .*:INSTALL_MOD_PATH_PREFIX =
=3D \"${PYTHON_SITEPACKAGES_DIR}\":" ${S}/source/tool/chipsec_main.py
     sed -i -e "s:PYTHONPATH:${PYTHON_SITEPACKAGES_DIR}:" ${WORKDIR}/chipsec
@@ -63,6 +66,19 @@ do_patch_append() {
 do_install_append() {
     install -d ${D}${bindir}
     install -m 0755 ${WORKDIR}/chipsec ${D}${bindir}
+
+    #
+    # FIXME: for some reason chipsec ends up installed in a repeated
+    # directory structure. Thus, we need to move it to its proper location
+    # under PYTHON_SITEPACKAGES_DIR
+    #
+
+    install -d ${D}${PYTHON_SITEPACKAGES_DIR}/${PN}
+    mv ${D}${PYTHON_SITEPACKAGES_DIR}${D}${PYTHON_SITEPACKAGES_DIR}/* ${D}=
${PYTHON_SITEPACKAGES_DIR}/${PN}
+    # remove old files
+    cd ${D}${PYTHON_SITEPACKAGES_DIR}
+    ls | grep -v chipsec | xargs rm -fr
+    cd $OLDPWD
 }
 =

 LUV_TEST_LOG_PARSER=3D"luv-parser-chipsec"
-- =

2.7.4


--===============3875297134751424919==--