From 4d975fc426f37698604a2a2b26309838417bb060 Mon Sep 17 00:00:00 2001 From: Alexis Ballier Date: Wed, 11 Dec 2019 16:52:22 +0100 Subject: dev-ros/roslaunch: remove yaml.load() usages Package-Manager: Portage-2.3.81, Repoman-2.3.20 Signed-off-by: Alexis Ballier --- dev-ros/roslaunch/files/yaml.patch | 44 +++++++++++++++++++ dev-ros/roslaunch/roslaunch-1.14.3-r1.ebuild | 63 ++++++++++++++++++++++++++++ dev-ros/roslaunch/roslaunch-1.14.3.ebuild | 63 ---------------------------- dev-ros/roslaunch/roslaunch-9999.ebuild | 2 +- 4 files changed, 108 insertions(+), 64 deletions(-) create mode 100644 dev-ros/roslaunch/files/yaml.patch create mode 100644 dev-ros/roslaunch/roslaunch-1.14.3-r1.ebuild delete mode 100644 dev-ros/roslaunch/roslaunch-1.14.3.ebuild diff --git a/dev-ros/roslaunch/files/yaml.patch b/dev-ros/roslaunch/files/yaml.patch new file mode 100644 index 000000000000..135e9927c408 --- /dev/null +++ b/dev-ros/roslaunch/files/yaml.patch @@ -0,0 +1,44 @@ +Index: roslaunch/src/roslaunch/loader.py +=================================================================== +--- roslaunch.orig/src/roslaunch/loader.py ++++ roslaunch/src/roslaunch/loader.py +@@ -98,7 +98,7 @@ def convert_value(value, type_): + raise ValueError("%s is not a '%s' type"%(value, type_)) + elif type_ == 'yaml': + try: +- return yaml.load(value) ++ return yaml.safe_load(value) + except yaml.parser.ParserError as e: + raise ValueError(e) + else: +@@ -409,7 +409,7 @@ class Loader(object): + if rosparam is None: + import rosparam + try: +- data = yaml.load(text) ++ data = yaml.safe_load(text) + # #3162: if there is no YAML, load() will return an + # empty string. We want an empty dictionary instead + # for our representation of empty. +Index: roslaunch/test/unit/test_roslaunch_dump_params.py +=================================================================== +--- roslaunch.orig/test/unit/test_roslaunch_dump_params.py ++++ roslaunch/test/unit/test_roslaunch_dump_params.py +@@ -53,7 +53,7 @@ class TestDumpParams(unittest.TestCase): + o, e = p.communicate() + self.assert_(p.returncode == 0, "Return code nonzero for param dump! Code: %d" % (p.returncode)) + +- self.assertEquals({'/noop': 'noop'}, yaml.load(o)) ++ self.assertEquals({'/noop': 'noop'}, yaml.safe_load(o)) + + p = Popen([cmd, '--dump-params', 'roslaunch', 'test-dump-rosparam.launch'], stdout = PIPE) + o, e = p.communicate() +@@ -95,7 +95,7 @@ class TestDumpParams(unittest.TestCase): + '/noparam1': 'value1', + '/noparam2': 'value2', + } +- output_val = yaml.load(o) ++ output_val = yaml.safe_load(o) + if not val == output_val: + for k, v in val.items(): + if k not in output_val: diff --git a/dev-ros/roslaunch/roslaunch-1.14.3-r1.ebuild b/dev-ros/roslaunch/roslaunch-1.14.3-r1.ebuild new file mode 100644 index 000000000000..cc74b7791b52 --- /dev/null +++ b/dev-ros/roslaunch/roslaunch-1.14.3-r1.ebuild @@ -0,0 +1,63 @@ +# Copyright 1999-2019 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=5 + +ROS_REPO_URI="https://github.com/ros/ros_comm" +KEYWORDS="~amd64 ~arm" +ROS_SUBDIR=tools/${PN} +PYTHON_COMPAT=( python{2_7,3_5,3_6} pypy{,3} ) + +inherit ros-catkin user + +DESCRIPTION="Tool for easily launching multiple ROS nodes" +LICENSE="BSD" +SLOT="0" +IUSE="" + +RDEPEND=" + dev-ros/roslib[${PYTHON_USEDEP}] + dev-python/rospkg[${PYTHON_USEDEP}] + dev-ros/rosclean[${PYTHON_USEDEP}] + dev-python/pyyaml[${PYTHON_USEDEP}] + dev-ros/rosgraph_msgs[${CATKIN_MESSAGES_PYTHON_USEDEP}] + dev-ros/rosparam[${PYTHON_USEDEP}] + dev-ros/rosmaster[${PYTHON_USEDEP}] + dev-ros/rosout +" +DEPEND="${RDEPEND} + test? ( + dev-util/rosdep[${PYTHON_USEDEP}] + dev-python/nose[${PYTHON_USEDEP}] + dev-ros/test_rosmaster + )" +PATCHES=( "${FILESDIR}/timeout.patch" "${FILESDIR}/yaml.patch" ) + +src_test() { + rosdep update + ros-catkin_src_test +} + +src_install() { + ros-catkin_src_install + + dodir /etc/ros + sed -e "s/@PKG_VERSION@/${PV}/" "${FILESDIR}/roscore.xml.in" > "${ED}/etc/ros/roscore.xml" || die + + newinitd "${FILESDIR}/roscore.initd" roscore + newconfd "${FILESDIR}/roscore.confd" roscore + + newinitd "${FILESDIR}/roslaunch.initd" roslaunch + newconfd "${FILESDIR}/roslaunch.confd" roslaunch + + doenvd "${FILESDIR}/40roslaunch" + + # Needed by test_roslaunch + insinto /usr/share/${PN} + doins test/xml/noop.launch +} + +pkg_preinst() { + enewgroup ros + enewuser ros -1 -1 /home/ros ros +} diff --git a/dev-ros/roslaunch/roslaunch-1.14.3.ebuild b/dev-ros/roslaunch/roslaunch-1.14.3.ebuild deleted file mode 100644 index be129d151484..000000000000 --- a/dev-ros/roslaunch/roslaunch-1.14.3.ebuild +++ /dev/null @@ -1,63 +0,0 @@ -# Copyright 1999-2019 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=5 - -ROS_REPO_URI="https://github.com/ros/ros_comm" -KEYWORDS="~amd64 ~arm" -ROS_SUBDIR=tools/${PN} -PYTHON_COMPAT=( python{2_7,3_5,3_6} pypy{,3} ) - -inherit ros-catkin user - -DESCRIPTION="Tool for easily launching multiple ROS nodes" -LICENSE="BSD" -SLOT="0" -IUSE="" - -RDEPEND=" - dev-ros/roslib[${PYTHON_USEDEP}] - dev-python/rospkg[${PYTHON_USEDEP}] - dev-ros/rosclean[${PYTHON_USEDEP}] - dev-python/pyyaml[${PYTHON_USEDEP}] - dev-ros/rosgraph_msgs[${CATKIN_MESSAGES_PYTHON_USEDEP}] - dev-ros/rosparam[${PYTHON_USEDEP}] - dev-ros/rosmaster[${PYTHON_USEDEP}] - dev-ros/rosout -" -DEPEND="${RDEPEND} - test? ( - dev-util/rosdep[${PYTHON_USEDEP}] - dev-python/nose[${PYTHON_USEDEP}] - dev-ros/test_rosmaster - )" -PATCHES=( "${FILESDIR}/timeout.patch" ) - -src_test() { - rosdep update - ros-catkin_src_test -} - -src_install() { - ros-catkin_src_install - - dodir /etc/ros - sed -e "s/@PKG_VERSION@/${PV}/" "${FILESDIR}/roscore.xml.in" > "${ED}/etc/ros/roscore.xml" || die - - newinitd "${FILESDIR}/roscore.initd" roscore - newconfd "${FILESDIR}/roscore.confd" roscore - - newinitd "${FILESDIR}/roslaunch.initd" roslaunch - newconfd "${FILESDIR}/roslaunch.confd" roslaunch - - doenvd "${FILESDIR}/40roslaunch" - - # Needed by test_roslaunch - insinto /usr/share/${PN} - doins test/xml/noop.launch -} - -pkg_preinst() { - enewgroup ros - enewuser ros -1 -1 /home/ros ros -} diff --git a/dev-ros/roslaunch/roslaunch-9999.ebuild b/dev-ros/roslaunch/roslaunch-9999.ebuild index be129d151484..cc74b7791b52 100644 --- a/dev-ros/roslaunch/roslaunch-9999.ebuild +++ b/dev-ros/roslaunch/roslaunch-9999.ebuild @@ -31,7 +31,7 @@ DEPEND="${RDEPEND} dev-python/nose[${PYTHON_USEDEP}] dev-ros/test_rosmaster )" -PATCHES=( "${FILESDIR}/timeout.patch" ) +PATCHES=( "${FILESDIR}/timeout.patch" "${FILESDIR}/yaml.patch" ) src_test() { rosdep update -- cgit v1.2.3-65-gdbad