From 185882428c346c0f262b14b62b05cc9f690e2a36 Mon Sep 17 00:00:00 2001 From: Andreas Baak Date: Mon, 2 Mar 2015 12:59:52 +0100 Subject: [PATCH] catkin: split up catkin in order to reduce runtime dependencies The catkin package has got a runtime dependency to cmake, make, gcc and other build utilities. These dependencies, however, are only needed if it is desired to build with catkin on the target board. If we do not want to build on the target board, i.e., if we just want to use ros tools like roslaunch, only a small part of catkin (i.e., the corresponding python packages) is required to be deployed on the target board. Therefore, we introduce a new package called catkin-runtime. It installs only the python packages that are required for the ros tools to run. The roslib package now depends on catkin-runtime (previously: catkin). I also tried an alternative approach which just modifies catkin.bb: - add a catkin-runtime package - move PYTHON_SITEPACKAGES_DIR from FILES_catkin to FILES_CATKIN_RUNTIME - make catkin_runtime RDEPEND on the python stuff - make catkin RDEPEND on the cmake, binutils, ..., + catkin-runtime With this setup, for some reason, bitbake thinks that catkin-runtime still RDEPENDS on binutils. Therefore, I split up the catkin recipe into two different recipes. Here, the RDEPENDS are managed correctly. If we want to deploy catkin as a build tool on the board, we can simply add a runtime dependency to catkin. However, this should not be the default setup. Special thanks go to Tobias Henkel (tobias.henkel@bmw-carit.de) who deserves most of the credits for this patch. Signed-off-by: Andreas Baak --- classes/catkin.bbclass | 2 +- recipes-ros/catkin/catkin-runtime_0.5.90.bb | 22 +++++++++++ recipes-ros/catkin/catkin.inc | 26 +++++++++++++ recipes-ros/catkin/catkin_0.5.90.bb | 38 +++++++------------ ...ORKSPACES-Don-t-require-.catkin-file.patch | 0 recipes-ros/ros/roslib_1.10.11.bb | 2 +- 6 files changed, 63 insertions(+), 27 deletions(-) create mode 100644 recipes-ros/catkin/catkin-runtime_0.5.90.bb create mode 100644 recipes-ros/catkin/catkin.inc rename recipes-ros/catkin/{catkin => files}/0001-CATKIN_WORKSPACES-Don-t-require-.catkin-file.patch (100%) diff --git a/classes/catkin.bbclass b/classes/catkin.bbclass index b22b19e..7c55d5d 100644 --- a/classes/catkin.bbclass +++ b/classes/catkin.bbclass @@ -4,7 +4,7 @@ inherit cmake distutils-base ros faulty-solibs -DEPENDS_prepend = "${@['catkin-native ', ''][d.getVar('BPN', True) == 'catkin']}" +DEPENDS_prepend = "${@['catkin-native ', ''][(d.getVar('BPN', True) == 'catkin') | (d.getVar('BPN', True) == 'catkin-runtime')]}" EXTRA_OECMAKE_CATKIN = "\ -DCMAKE_PREFIX_PATH='${STAGING_DIR_HOST}${ros_prefix};${STAGING_DIR_HOST}${prefix};${STAGING_DIR_NATIVE}${ros_prefix};${STAGING_DIR_NATIVE}${prefix}' \ diff --git a/recipes-ros/catkin/catkin-runtime_0.5.90.bb b/recipes-ros/catkin/catkin-runtime_0.5.90.bb new file mode 100644 index 0000000..f2f1f77 --- /dev/null +++ b/recipes-ros/catkin/catkin-runtime_0.5.90.bb @@ -0,0 +1,22 @@ +ROS_SPN = "catkin" + +require catkin.inc + +S = "${WORKDIR}/catkin-${PV}" + +# This package includes ONLY the python packages. +# The catkin_${PV} package includes all other files +# from the catkin tool. +FILES_${PN} = "${PYTHON_SITEPACKAGES_DIR}" + +RDEPENDS_${PN} = "\ + python-catkin-pkg python-argparse python-misc python-multiprocessing \ + python-shell python-subprocess python-xml python-pkgutil" + +# Delete everything but the python packages in order to avoid +# that the QA error [installed-vs-shipped] hits on us. +do_install_append() { + rm -rf ${D}${ros_bindir} + rm -rf ${D}${ros_datadir} + rm -rf ${D}${ros_libdir}/pkgconfig +} diff --git a/recipes-ros/catkin/catkin.inc b/recipes-ros/catkin/catkin.inc new file mode 100644 index 0000000..6397868 --- /dev/null +++ b/recipes-ros/catkin/catkin.inc @@ -0,0 +1,26 @@ +DESCRIPTION = "Low-level build system macros and infrastructure for ROS" +SECTION = "devel" +LICENSE = "BSD" +LIC_FILES_CHKSUM = "file://package.xml;beginline=7;endline=7;md5=d566ef916e9dedc494f5f793a6690ba5" + +DEPENDS = "cmake python-empy python-catkin-pkg python-empy-native python-catkin-pkg-native" + +SRC_URI = "https://github.com/ros/${ROS_SPN}/archive/${PV}.tar.gz;downloadfilename=${ROS_SP}.tar.gz" +SRC_URI[md5sum] = "a0dd74c4a665a56b02af9f8c873c451d" +SRC_URI[sha256sum] = "71441206945e8d77dace831375effde5b5f54b95e3a054106848432eceec58c0" + +SRC_URI += "file://0001-CATKIN_WORKSPACES-Don-t-require-.catkin-file.patch" + +inherit catkin + +FILES_${PN}-dev += "\ + ${ros_datadir}/eigen/cmake \ + ${ros_datadir}/ros/cmake \ + ${ros_datadir}/.catkin \ + ${ros_prefix}/.catkin \ + ${ros_prefix}/.rosinstall \ + ${ros_prefix}/_setup_util.py \ + ${ros_prefix}/env.sh \ + ${ros_prefix}/setup.* \ + " + diff --git a/recipes-ros/catkin/catkin_0.5.90.bb b/recipes-ros/catkin/catkin_0.5.90.bb index 77b71cc..20ab652 100644 --- a/recipes-ros/catkin/catkin_0.5.90.bb +++ b/recipes-ros/catkin/catkin_0.5.90.bb @@ -1,32 +1,20 @@ -DESCRIPTION = "Low-level build system macros and infrastructure for ROS" -SECTION = "devel" -LICENSE = "BSD" -LIC_FILES_CHKSUM = "file://package.xml;beginline=7;endline=7;md5=d566ef916e9dedc494f5f793a6690ba5" +require catkin.inc -DEPENDS = "cmake python-empy python-catkin-pkg python-empy-native python-catkin-pkg-native" -SRC_URI = "https://github.com/ros/${ROS_SPN}/archive/${PV}.tar.gz;downloadfilename=${ROS_SP}.tar.gz" -SRC_URI[md5sum] = "a0dd74c4a665a56b02af9f8c873c451d" -SRC_URI[sha256sum] = "71441206945e8d77dace831375effde5b5f54b95e3a054106848432eceec58c0" - -SRC_URI += "file://0001-CATKIN_WORKSPACES-Don-t-require-.catkin-file.patch" - -inherit catkin - -FILES_${PN}-dev += "\ - ${ros_datadir}/eigen/cmake \ - ${ros_datadir}/ros/cmake \ - ${ros_datadir}/.catkin \ - ${ros_prefix}/.catkin \ - ${ros_prefix}/.rosinstall \ - ${ros_prefix}/_setup_util.py \ - ${ros_prefix}/env.sh \ - ${ros_prefix}/setup.* \ - " +DEPENDS_virtclass-native += "catkin-runtime" RDEPENDS_${PN}_class-native = "" RDEPENDS_${PN} = "cmake make binutils binutils-symlinks gcc gcc-symlinks g++ g++-symlinks \ - python-catkin-pkg python-argparse python-misc python-multiprocessing \ - python-shell python-subprocess python-xml python-pkgutil" + catkin-runtime" + +# The files in ${PYTHON_SITEPACKAGES_DIR} are installed by +# the catkin-runtime package. Therefore, we remove them here +# so that they are not installed. +# Moreover: the ${ros_libdir}/python2.7 is empty. We need to +# remove it, otherwise the QA error [installed-vs-shipped] will hit on us. +do_install_append() { + rm -rf ${D}${PYTHON_SITEPACKAGES_DIR} + rmdir ${D}${ros_libdir}/python2.7 +} BBCLASSEXTEND += "native" diff --git a/recipes-ros/catkin/catkin/0001-CATKIN_WORKSPACES-Don-t-require-.catkin-file.patch b/recipes-ros/catkin/files/0001-CATKIN_WORKSPACES-Don-t-require-.catkin-file.patch similarity index 100% rename from recipes-ros/catkin/catkin/0001-CATKIN_WORKSPACES-Don-t-require-.catkin-file.patch rename to recipes-ros/catkin/files/0001-CATKIN_WORKSPACES-Don-t-require-.catkin-file.patch diff --git a/recipes-ros/ros/roslib_1.10.11.bb b/recipes-ros/ros/roslib_1.10.11.bb index af59dcd..5b45b7a 100644 --- a/recipes-ros/ros/roslib_1.10.11.bb +++ b/recipes-ros/ros/roslib_1.10.11.bb @@ -9,4 +9,4 @@ require ros.inc ROS_PKG_SUBDIR = "core" -RDEPENDS_${PN} = "python-rospkg catkin" +RDEPENDS_${PN} = "python-rospkg catkin-runtime"