ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
This will list all packages found between <exec_depend>
, <build_depend>
and <run_depend>
tags from package.xml (or any other file)
grep -RhI -e "^ *<exec_depend>" -e "^ *<build_depend>" -e "^ *<run_depend>" ~/catkin_ws/src | sed -e "s/.*>\(.*\)<.*/\1/" | sort | uniq
Change: ~/catkin_ws/src
to your package src path
grep -RhI -e "^ *<exec_depend>" -e "^ *<build_depend>" -e "^ *<run_depend>" WS_SRC_FOLDER
-e "^ *<exec_depend>" -e "^ *<build_depend>" -e "^ *<run_depend>"
- strings to match if any of those found. ^ *
Matches any spaces from file start~/catkin_ws/src
- at which path start recursive searchsed -e "s/.*>\(.*\)<.*/\1/"
- Removes tags and leaves only package name.
sed -e "s/FIND_THIS/REPLACE_WITH_THIS/"
.*>
- match start tag <...>\(.*\)
match and group package name<.*
- match end tag <...>\1
- replace with first group aka package name| sort | uniq
- sorts lines and removes duplicates (must sort first)If you don't use Noetic <exec_depend> tags needs to be change just check any package.xml file and see what tags you want to extract
rosdep install --from-paths ~/catkin_ws/src --ignore-src -r --reinstall --simulate
Or
rosdep install --from-paths ~/catkin_ws/src --ignore-src -r --reinstall --simulate | sed -e "s/ *sudo -H apt-get install //"
But this returns less packages
2 | No.2 Revision |
This will list all packages found between <exec_depend>
, <build_depend>
and <run_depend>
tags from package.xml (or any other file)
rosdep resolve `grep -RhI -e "^ *<exec_depend>" -e "^ *<build_depend>" -e "^ *<run_depend>" ~/catkin_ws/src/ | sed -e "s/.*>\(.*\)<.*/\1/" | sort -r | uniq | tr "\n" " "` 2>/dev/null | sed -e "s/^#.*//" | tr "\n" " " | sed -e "s/ */ /g" -e "s/ *//" | (echo -n "sudo apt-get install " && cat); echo ""
Just change: ~/catkin_ws/src
to your workspace src path.
Example return: sudo apt-get install ros-noetic-visualization-msgs ros-noetic-velodyne-pointcloud .........
.
Copy paste output to terminal and it will install all dependencies. Note that maybe not all dependencies listed here are installed because you might use packages from source which are not downloaded via apt. I don't think that this would brake anything just redundant download which will be overridden by workspace packages
grep -RhI -e "^ *<exec_depend>" -e "^ *<build_depend>" -e "^ *<run_depend>" ~/catkin_ws/src | sed -e "s/.*>\(.*\)<.*/\1/" | sort | uniq
Change: ~/catkin_ws/src
to your package src path
rosdep install --from-paths ~/catkin_ws/src --ignore-src -r --reinstall --simulate
grep -RhI -e "^ *<exec_depend>" -e "^ *<build_depend>" -e "^ *<run_depend>" WS_SRC_FOLDER~/catkin_ws/src | sed -e "s/.*>\(.*\)<.*/\1/" | sort | uniq
returns rosdep keys as @gvdhoorn mentioned. To get apt packages there is rosdep resolve my_rosdep_key my_rosdep_key2
command grep -RhI
-e "^ *<exec_depend>" -e "^ *<build_depend>" -e "^ *<run_depend>"
- strings to match if any of those found. ^ *
Matches any spaces from ~/catkin_ws/src
- at which path start recursive searchsed -e "s/.*>\(.*\)<.*/\1/"
- Removes tags and leaves only package name.
sed -e "s/FIND_THIS/REPLACE_WITH_THIS/"
.*>
- match start tag <...>\(.*\)
match and group package name<.*
- match end tag <...>\1
- replace with first group aka package name| sort | uniq
- sorts lines and removes duplicates (must sort first)If you 2>/dev/null
redirects stderr to null aka use Noetic <exec_depend> tags needs to be change just check any package.xml file and see what tags you want to extract
rosdep install --from-paths ~/catkin_ws/src --ignore-src -r --reinstall --simulate
Or
rosdep install --from-paths ~/catkin_ws/src --ignore-src -r --reinstall --simulate | sed -e "s/ *sudo -H print stdrr because it's not seen by sed
(echo -n "sudo
//"
But this returns less " && cat); echo "" predends "sudo apt-get install " to the list of apt packages
3 | No.3 Revision |
This will list all packages found between <exec_depend>
, <build_depend>
and <run_depend>
tags from package.xml (or any other file)
rosdep resolve `grep -RhI -e "^ *<exec_depend>" -e "^ *<build_depend>" -e "^ *<run_depend>" *<[a-z,A-Z,_]*depend>" ~/catkin_ws/src/ | sed -e "s/.*>\(.*\)<.*/\1/" | sort -r | uniq | tr "\n" " "` 2>/dev/null | sed -e "s/^#.*//" | tr "\n" " " | sed -e "s/ */ /g" -e "s/ *//" | (echo -n "sudo apt-get install " && cat); echo ""
Just change: ~/catkin_ws/src
to your workspace src path.
Example return: sudo apt-get install ros-noetic-visualization-msgs ros-noetic-velodyne-pointcloud .........
.
Copy paste output to terminal and it will install all dependencies. Note that maybe not all dependencies listed here are installed because you might use packages from source which are not downloaded via apt. I don't think that this would brake anything just redundant download which will be overridden by workspace packages
grep -RhI -e "^ *<exec_depend>" -e "^ *<build_depend>" -e "^ *<run_depend>" ~/catkin_ws/src | sed -e "s/.*>\(.*\)<.*/\1/" | sort | uniq
rosdep install --from-paths ~/catkin_ws/src --ignore-src -r --reinstall --simulate
grep -RhI -e "^ *<exec_depend>" -e "^ *<build_depend>" -e "^ *<run_depend>" ~/catkin_ws/src | sed -e "s/.*>\(.*\)<.*/\1/" | sort | uniq
returns rosdep keys as @gvdhoorn mentioned. To get apt packages there is rosdep resolve my_rosdep_key my_rosdep_key2
command
grep -RhI
-e "^ *<exec_depend>" -e "^ *<build_depend>" -e "^ *<run_depend>"
- strings to match if any of those found. ^ *
Matches any spaces from line start~/catkin_ws/src
- at which path start recursive searchsed -e "s/.*>\(.*\)<.*/\1/"
- Removes tags and leaves only package name.
sed -e "s/FIND_THIS/REPLACE_WITH_THIS/"
.*>
- match start tag <...>\(.*\)
match and group package name<.*
- match end tag <...>\1
- replace with first group aka package name| sort | uniq
- sorts lines and removes duplicates (must sort first)2>/dev/null
redirects stderr to null aka don't print stdrr because it's not seen by sed (echo -n "sudo apt-get install " && cat); echo ""
predends "sudo apt-get install " to the list of apt packages4 | No.4 Revision |
This will list all packages found between <exec_depend>
, <build_depend>
and , <run_depend>
, <depend>
and similar tags (<[a-z,A-Z,_]*depend>
) from package.xml (or any other file)
rosdep resolve `grep -RhI -e "^ *<[a-z,A-Z,_]*depend>" ~/catkin_ws/src/ | sed -e "s/.*>\(.*\)<.*/\1/" | sort -r | uniq | tr "\n" " "` 2>/dev/null | sed -e "s/^#.*//" | tr "\n" " " | sed -e "s/ */ /g" -e "s/ *//" | (echo -n "sudo apt-get install " && cat); echo ""
Just change: ~/catkin_ws/src
to your workspace src path.
Example return: sudo apt-get install ros-noetic-visualization-msgs ros-noetic-velodyne-pointcloud .........
.
Copy paste output to terminal and it will install all dependencies. Note that maybe not all dependencies listed here are installed because you might use packages from source which are not downloaded via apt. I don't think that this would brake anything just redundant download which will be overridden by workspace packages
grep -RhI -e "^ *<exec_depend>" -e "^ *<build_depend>" -e "^ *<run_depend>" ~/catkin_ws/src | sed -e "s/.*>\(.*\)<.*/\1/" | sort | uniq
rosdep install --from-paths ~/catkin_ws/src --ignore-src -r --reinstall --simulate
grep -RhI -e "^ *<exec_depend>" -e "^ *<build_depend>" -e "^ *<run_depend>" ~/catkin_ws/src | sed -e "s/.*>\(.*\)<.*/\1/" | sort | uniq
returns rosdep keys as @gvdhoorn mentioned. To get apt packages there is rosdep resolve my_rosdep_key my_rosdep_key2
command
grep -RhI
-e "^ *<exec_depend>" -e "^ *<build_depend>" -e "^ *<run_depend>"
- strings to match if any of those found. ^ *
Matches any spaces from line start~/catkin_ws/src
- at which path start recursive searchsed -e "s/.*>\(.*\)<.*/\1/"
- Removes tags and leaves only package name.
sed -e "s/FIND_THIS/REPLACE_WITH_THIS/"
.*>
- match start tag <...>\(.*\)
match and group package name<.*
- match end tag <...>\1
- replace with first group aka package name| sort | uniq
- sorts lines and removes duplicates (must sort first)2>/dev/null
redirects stderr to null aka don't print stdrr because it's not seen by sed (echo -n "sudo apt-get install " && cat); echo ""
predends "sudo apt-get install " to the list of apt packages