diff options
| author | Martin Jansa <martin.jansa@gmail.com> | 2023-05-04 09:33:07 +0200 |
|---|---|---|
| committer | Khem Raj <raj.khem@gmail.com> | 2023-05-04 06:47:00 -0700 |
| commit | 2a0cd3a25a563c12c1e3fd05626e0dee1536354c (patch) | |
| tree | 3faddda17d91221d8403057baaea20691790b3c1 | |
| parent | 7dfddd70496c606beca45a97e5b9970f273a78db (diff) | |
| download | meta-openembedded-2a0cd3a25a563c12c1e3fd05626e0dee1536354c.tar.gz | |
nanopb: fix installed-vs-shipped with multilib
* fixes:
ERROR: QA Issue: nanopb: Files/directories were installed but not shipped in any package:
/usr/lib
/usr/lib/python3.11
/usr/lib/python3.11/site-packages
/usr/lib/python3.11/site-packages/proto
/usr/lib/python3.11/site-packages/proto/nanopb_pb2.py
/usr/lib/python3.11/site-packages/proto/nanopb.proto
/usr/lib/python3.11/site-packages/proto/_utils.py
Please set FILES such that these items are packaged. Alternatively if they are unneeded, avoid installing them or delete them within do_install.
nanopb: 7 installed and not shipped files. [installed-vs-shipped]
when libdir is /usr/lib64 with multilib.
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
2 files changed, 72 insertions, 1 deletions
diff --git a/meta-oe/dynamic-layers/meta-python/recipes-devtools/nanopb/nanopb/0001-CMakeLists.txt-allow-to-set-PYTHON_INSTDIR-from-outs.patch b/meta-oe/dynamic-layers/meta-python/recipes-devtools/nanopb/nanopb/0001-CMakeLists.txt-allow-to-set-PYTHON_INSTDIR-from-outs.patch new file mode 100644 index 0000000000..474f0f1584 --- /dev/null +++ b/meta-oe/dynamic-layers/meta-python/recipes-devtools/nanopb/nanopb/0001-CMakeLists.txt-allow-to-set-PYTHON_INSTDIR-from-outs.patch | |||
| @@ -0,0 +1,67 @@ | |||
| 1 | From 30c79d1b49839a15c05a0d0ca7e54787cd7988c6 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Martin Jansa <Martin.Jansa@gmail.com> | ||
| 3 | Date: Thu, 4 May 2023 07:17:57 +0000 | ||
| 4 | Subject: [PATCH] CMakeLists.txt: allow to set PYTHON_INSTDIR from outside | ||
| 5 | |||
| 6 | CMakeLists.txt used: | ||
| 7 | |||
| 8 | find_package(Python REQUIRED COMPONENTS Interpreter) | ||
| 9 | execute_process( | ||
| 10 | COMMAND ${Python_EXECUTABLE} -c | ||
| 11 | "import os.path, sys, sysconfig; print(os.path.relpath(sysconfig.get_path('purelib'), start=sys.prefix))" | ||
| 12 | OUTPUT_VARIABLE PYTHON_INSTDIR | ||
| 13 | OUTPUT_STRIP_TRAILING_WHITESPACE | ||
| 14 | ) | ||
| 15 | |||
| 16 | but with python3native this returns: | ||
| 17 | |||
| 18 | nanopb/0.4.7-r0/git $ ../recipe-sysroot-native/usr/bin/python3-native/python3 -c "import os.path, sys, sysconfig; print(os.path.relpath(sysconfig.get_path('purelib'), start=sys.prefix))" | ||
| 19 | lib/python3.11/site-packages | ||
| 20 | |||
| 21 | which doesn't respect target libdir which might be lib64 with multilib and with python3targetconfig | ||
| 22 | it also doesn't work right because of the long relative path: | ||
| 23 | |||
| 24 | nanopb/0.4.7-r0/build $ ../recipe-sysroot-native/usr/bin/python3-native/python3 -c "import os.path, sys, sysconfig; print(os.path.relpath(sysconfig.get_path('purelib'), start=sys.prefix))" | ||
| 25 | ../../../../../../../../../../../../usr/lib64/python3.11/site-packages | ||
| 26 | |||
| 27 | CMake Error at cmake_install.cmake:46 (file): | ||
| 28 | file cannot create directory: | ||
| 29 | /OE/lge/build/starfish/nanbield/BUILD/work/o22-starfish-linux/nanopb/0.4.7-r0/image/usr/../../../../../../../../../../../../usr/lib64/python3.11/site-packages/proto. | ||
| 30 | Maybe need administrative privileges. | ||
| 31 | |||
| 32 | Let CMake variable to be passed from the recipe to avoid this as we're already using | ||
| 33 | ${D}${PYTHON_SITEPACKAGES_DIR} in do_install:append anyway. | ||
| 34 | |||
| 35 | Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> | ||
| 36 | Upstream-Status: Pending | ||
| 37 | --- | ||
| 38 | CMakeLists.txt | 16 +++++++++------- | ||
| 39 | 1 file changed, 9 insertions(+), 7 deletions(-) | ||
| 40 | |||
| 41 | diff --git a/CMakeLists.txt b/CMakeLists.txt | ||
| 42 | index 8d241c5..7d3f993 100644 | ||
| 43 | --- a/CMakeLists.txt | ||
| 44 | +++ b/CMakeLists.txt | ||
| 45 | @@ -39,13 +39,15 @@ if(NOT DEFINED CMAKE_INSTALL_CMAKEDIR) | ||
| 46 | set(CMAKE_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/nanopb") | ||
| 47 | endif() | ||
| 48 | |||
| 49 | -find_package(Python REQUIRED COMPONENTS Interpreter) | ||
| 50 | -execute_process( | ||
| 51 | - COMMAND ${Python_EXECUTABLE} -c | ||
| 52 | - "import os.path, sys, sysconfig; print(os.path.relpath(sysconfig.get_path('purelib'), start=sys.prefix))" | ||
| 53 | - OUTPUT_VARIABLE PYTHON_INSTDIR | ||
| 54 | - OUTPUT_STRIP_TRAILING_WHITESPACE | ||
| 55 | -) | ||
| 56 | +if(NOT DEFINED PYTHON_INSTDIR) | ||
| 57 | + find_package(Python REQUIRED COMPONENTS Interpreter) | ||
| 58 | + execute_process( | ||
| 59 | + COMMAND ${Python_EXECUTABLE} -c | ||
| 60 | + "import os.path, sys, sysconfig; print(os.path.relpath(sysconfig.get_path('purelib'), start=sys.prefix))" | ||
| 61 | + OUTPUT_VARIABLE PYTHON_INSTDIR | ||
| 62 | + OUTPUT_STRIP_TRAILING_WHITESPACE | ||
| 63 | + ) | ||
| 64 | +endif() | ||
| 65 | |||
| 66 | if(nanopb_BUILD_GENERATOR) | ||
| 67 | set(generator_protos nanopb) | ||
diff --git a/meta-oe/dynamic-layers/meta-python/recipes-devtools/nanopb/nanopb_0.4.7.bb b/meta-oe/dynamic-layers/meta-python/recipes-devtools/nanopb/nanopb_0.4.7.bb index 897caea2a7..9ad558146c 100644 --- a/meta-oe/dynamic-layers/meta-python/recipes-devtools/nanopb/nanopb_0.4.7.bb +++ b/meta-oe/dynamic-layers/meta-python/recipes-devtools/nanopb/nanopb_0.4.7.bb | |||
| @@ -4,13 +4,17 @@ LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=9db4b73a55a3994384112efcdb37c01f" | |||
| 4 | 4 | ||
| 5 | DEPENDS = "protobuf-native" | 5 | DEPENDS = "protobuf-native" |
| 6 | 6 | ||
| 7 | SRC_URI = "git://github.com/nanopb/nanopb.git;branch=master;protocol=https" | 7 | SRC_URI = "git://github.com/nanopb/nanopb.git;branch=master;protocol=https \ |
| 8 | file://0001-CMakeLists.txt-allow-to-set-PYTHON_INSTDIR-from-outs.patch \ | ||
| 9 | " | ||
| 8 | SRCREV = "b97aa657a706d3ba4a9a6ccca7043c9d6fe41cba" | 10 | SRCREV = "b97aa657a706d3ba4a9a6ccca7043c9d6fe41cba" |
| 9 | 11 | ||
| 10 | S = "${WORKDIR}/git" | 12 | S = "${WORKDIR}/git" |
| 11 | 13 | ||
| 12 | inherit cmake python3native | 14 | inherit cmake python3native |
| 13 | 15 | ||
| 16 | EXTRA_OECMAKE += "-DPYTHON_INSTDIR=${PYTHON_SITEPACKAGES_DIR}" | ||
| 17 | |||
| 14 | do_install:append() { | 18 | do_install:append() { |
| 15 | install -Dm 0755 ${S}/generator/nanopb_generator.py ${D}${bindir}/nanopb_generator.py | 19 | install -Dm 0755 ${S}/generator/nanopb_generator.py ${D}${bindir}/nanopb_generator.py |
| 16 | install -Dm 0755 ${S}/generator/protoc-gen-nanopb ${D}${bindir}/protoc-gen-nanopb | 20 | install -Dm 0755 ${S}/generator/protoc-gen-nanopb ${D}${bindir}/protoc-gen-nanopb |
