This command will return all system dependencies for a given ROS package (I explicitly specified OS name and ROS version):
$ rosdep keys image_transport --rosdistro=jade --os=ubuntu:trusty | xargs rosdep resolve
#ROSDEP[rosconsole]
#apt
ros-indigo-rosconsole
#ROSDEP[catkin]
#apt
ros-indigo-catkin
#ROSDEP[roscpp]
#apt
ros-indigo-roscpp
#ROSDEP[message_filters]
#apt
ros-indigo-message-filters
#ROSDEP[pluginlib]
#apt
ros-indigo-pluginlib
#ROSDEP[roslib]
#apt
ros-indigo-roslib
#ROSDEP[sensor_msgs]
#apt
ros-indigo-sensor-msgs
You can filter it further to get only dependencies:
rosdep keys image_transport --rosdistro=jade --os=ubuntu:trusty| xargs rosdep resolve | grep -v "#"
ros-indigo-rosconsole
ros-indigo-catkin
ros-indigo-roscpp
ros-indigo-message-filters
ros-indigo-pluginlib
ros-indigo-roslib
ros-indigo-sensor-msgs
This might not be what you are looking for since it's not recursive and it works only for ROS packages (not rosdep keys).
Originally posted by Mani with karma: 1704 on 2015-10-29
This answer was ACCEPTED on the original site
Post score: 1
Original comments
Comment by theNerd247 on 2015-10-29:
Exactly what I needed. Thanks! Recursion can be done using a simple bash script.