Gentoo Archives: gentoo-dev

From: hasufell <hasufell@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] New eclass: ros-catkin.eclass, new USE_EXPAND: ROS_MESSAGES, new categories: dev-ros and ros-meta for review.
Date: Fri, 18 Sep 2015 08:36:18
Message-Id: 55FBCCF2.7080508@gentoo.org
In Reply to: [gentoo-dev] New eclass: ros-catkin.eclass, new USE_EXPAND: ROS_MESSAGES, new categories: dev-ros and ros-meta for review. by Alexis Ballier
1 How about something like
2
3 case ${EAPI} in
4 5) : ;;
5 *) die "EAPI=${EAPI:-0} is not supported" ;;
6 esac
7
8 to force people to stay up2date... then you can also drop most of those
9 redunant "|| die"s for EAPI functions
10
11
12 >
13 > IUSE="test"
14 > RDEPEND="
15 > dev-util/catkin${CATKIN_PYTHON_USEDEP}
16 > dev-python/empy${CATKIN_PYTHON_USEDEP}
17 > "
18 > DEPEND="${RDEPEND}"
19 >
20 > if [ -n "${CATKIN_DO_PYTHON_MULTIBUILD}" ] ; then
21 > RDEPEND="${RDEPEND} dev-lang/python-exec:2"
22 > fi
23 >
24 > # @ECLASS-VARIABLE: CATKIN_HAS_MESSAGES
25 > # @DESCRIPTION:
26 > # Set it to a non-empty value before inherit to tell the eclass the package has messages to build.
27 > # Messages will be built based on ROS_MESSAGES USE_EXPANDed variable.
28 >
29 > # @ECLASS-VARIABLE: CATKIN_MESSAGES_TRANSITIVE_DEPS
30 > # @DESCRIPTION:
31 > # Some messages have dependencies on other messages.
32 > # In that case, CATKIN_MESSAGES_TRANSITIVE_DEPS should contain a space-separated list of atoms
33 > # representing those dependencies. The eclass uses it to ensure proper dependencies on these packages.
34 > if [ -n "${CATKIN_HAS_MESSAGES}" ] ; then
35 > IUSE="${IUSE} +ros_messages_python +ros_messages_cxx ros_messages_eus ros_messages_lisp"
36 > RDEPEND="${RDEPEND}
37 > ros_messages_cxx? ( dev-ros/gencpp:=${CATKIN_PYTHON_USEDEP} )
38 > ros_messages_eus? ( dev-ros/geneus:=${CATKIN_PYTHON_USEDEP} )
39 > ros_messages_python? ( dev-ros/genpy:=${CATKIN_PYTHON_USEDEP} )
40 > ros_messages_lisp? ( dev-ros/genlisp:=${CATKIN_PYTHON_USEDEP} )
41 > dev-ros/message_runtime
42 > "
43 > DEPEND="${DEPEND} ${RDEPEND}
44 > dev-ros/message_generation
45 > dev-ros/genmsg${CATKIN_PYTHON_USEDEP}
46 > "
47 > if [ -n "${CATKIN_MESSAGES_TRANSITIVE_DEPS}" ] ; then
48 > for i in ${CATKIN_MESSAGES_TRANSITIVE_DEPS} ; do
49 > ds="${i}[ros_messages_python?,ros_messages_cxx?,ros_messages_lisp?,ros_messages_eus?] ros_messages_python? ( ${i}[${PYTHON_USEDEP}] )"
50 > RDEPEND="${RDEPEND} ${ds}"
51 > DEPEND="${DEPEND} ${ds}"
52 > done
53 > fi
54 > fi
55 >
56
57 Keep in mind what this implies when you change these dependencies
58 without bumping the ebuilds that use them.
59
60 >
61 > # @FUNCTION: ros-catkin_src_test_internal
62 > # @DESCRIPTION:
63 > # Decorator around cmake-utils_src_test to ensure tests are built before running them.
64 > ros-catkin_src_test_internal() {
65 > cd "${BUILD_DIR}"
66
67 here is definitely a "|| die" missing, alternatively
68 emake -C "${BUILD_DIR}" ...
69 should work too and it seems cmake-utils_src_test already switches to
70 "${BUILD_DIR}" (with missing error handling, lol)
71
72
73
74 >
75 > # @FUNCTION: ros-catkin_src_install_with_python
76 > # @DESCRIPTION:
77 > # Decorator around cmake-utils_src_install to ensure python scripts are properly handled w.r.t. python-exec2.
78 > ros-catkin_src_install_with_python() {
79 > python_export PYTHON_SCRIPTDIR
80 > cmake-utils_src_install
81 > if [ ! -f "${T}/.catkin_python_symlinks_generated" -a -d "${D}/${PYTHON_SCRIPTDIR}" ]; then
82 > dodir /usr/bin
83 > for i in "${D}/${PYTHON_SCRIPTDIR}"/* ; do
84 > dosym ../lib/python-exec/python-exec2 "/usr/bin/${i##*/}" || die
85 > done
86 > touch "${T}/.catkin_python_symlinks_generated"
87
88 touch can fail too, e.g. if the directory does not exist, so "|| die"
89 seems to make sense too

Replies