Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add script to get all Debian packages corresponding to a gazebodistro file #4

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
56 changes: 56 additions & 0 deletions tools/gazebodistro_to_pkgs_for_ros.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
if [[ ${#} -ne 1 ]]; then
echo "Usage: ${0} <distro_yaml_file>"
exit -1
fi

GAZEBO_DISTRO=${1}

remove_string_dups()
{
local string=${1}

sed 's/ /\n/g' <<< $string | sort | uniq | tr '\n' ' '

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm pretty sure that sort -u is POSIX and that cuts out a pipeline step.

Suggested change
sed 's/ /\n/g' <<< $string | sort | uniq | tr '\n' ' '
sed 's/ /\n/g' <<< $string | sort -u | tr '\n' ' '

}

echo
echo "This tool reads a gazebodistro file and look in the system for"
j-rivero marked this conversation as resolved.
Show resolved Hide resolved
echo "all available pkgs corresponding to that distro file"
echo

BRANCH_NAMES=$(grep version: ${GAZEBO_DISTRO} | awk '{ print $2 }')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eliminate a pipeline step by having awk only print on matching lines.

Suggested change
BRANCH_NAMES=$(grep version: ${GAZEBO_DISTRO} | awk '{ print $2 }')
BRANCH_NAMES=$(awk '/version:/ { print $2 }' < ${GAZEBO_DISTRO})

# Get packages from gazebodistro file. Some assumptions and ros- filter
total_pkgs=
for branch in ${BRANCH_NAMES}; do
pkg_name=${branch/ign-/ignition-}
pkg_name=${pkg_name/sdf/sdformat}
echo " 1. Getting packages using: ${pkg_name}"
# assume here than when foo1 fails search for foo
pkgs=$(apt-cache search ${pkg_name} | awk '{ print $1 }' | grep -v '^ros-') || pkgs=$(apt-cache search ${pkg_name/1/} | awk '{ print $1 }' | grep -v '^ros-')
total_pkgs="${total_pkgs} ${pkgs}"
done

echo

# Get all packages listed as dependencies
all_deps_pkgs=
for pkg in $(echo ${total_pkgs} | sort | uniq); do
echo " 2. Get dependencies of: ${pkg}"
new_pkgs=$(apt-rdepends ${pkg} 2>/dev/null | grep Depends: | awk '{ print $2 }' | sort | uniq)
all_deps_pkgs="${all_deps_pkgs} ${new_pkgs}"
done

all_deps_pkgs=$(remove_string_dups "${all_deps_pkgs}")
echo

for new_pkg in ${all_deps_pkgs}; do
if [[ -n $(apt-cache madison ${new_pkg} | grep 'packages.osrfoundation.org') ]]; then
echo " 3. Found packages.osrfoundation.org package ${new_pkg}"
osrf_pkgs="${osrf_pkgs} ${new_pkg}"
fi
done

osrf_pkgs=$(remove_string_dups "${osrf_pkgs}")
echo

echo "LIST OF PACKAGES:"
echo "${osrf_pkgs}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I run bash -e gazebodistro_to_pkgs_for_ros.bash ../collection-citadel.yaml nothing is printed here. Is this expected? I guess I don't fully understand what this script is meant to do.

This is my full output
This tool reads a gazebodistro file and look in the system for
all available pkgs corresponding to that distro file

 1. Getting packages using: ignition-cmake2
 1. Getting packages using: ignition-common3
 1. Getting packages using: ignition-fuel-tools4
 1. Getting packages using: ignition-gazebo3
 1. Getting packages using: ignition-gui3
 1. Getting packages using: ignition-launch2
 1. Getting packages using: ignition-math6
 1. Getting packages using: ignition-msgs5
 1. Getting packages using: ignition-physics2
 1. Getting packages using: ignition-plugin1
 1. Getting packages using: ignition-rendering3
 1. Getting packages using: ignition-sensors3
 1. Getting packages using: ignition-tools1
 1. Getting packages using: ignition-transport8
 1. Getting packages using: sdformat9

 2. Get dependencies of: libignition-cmake2-dev
 2. Get dependencies of: libignition-common3
 2. Get dependencies of: libignition-common3-av
 2. Get dependencies of: libignition-common3-av-dev
 2. Get dependencies of: libignition-common3-core-dev
 2. Get dependencies of: libignition-common3-dev
 2. Get dependencies of: libignition-common3-events
 2. Get dependencies of: libignition-common3-events-dev
 2. Get dependencies of: libignition-common3-graphics
 2. Get dependencies of: libignition-common3-graphics-dev
 2. Get dependencies of: libignition-common3-profiler
 2. Get dependencies of: libignition-common3-profiler-dev
 2. Get dependencies of: libignition-fuel-tools4
 2. Get dependencies of: libignition-fuel-tools4-dev
 2. Get dependencies of: libignition-gazebo3
 2. Get dependencies of: libignition-gazebo3-dbg
 2. Get dependencies of: libignition-gazebo3-dev
 2. Get dependencies of: libignition-gazebo3-plugins
 2. Get dependencies of: libignition-gui3
 2. Get dependencies of: libignition-gui3-dev
 2. Get dependencies of: libignition-launch2
 2. Get dependencies of: libignition-launch2-dev
 2. Get dependencies of: libignition-math6
 2. Get dependencies of: libignition-math6-dbg
 2. Get dependencies of: libignition-math6-dev
 2. Get dependencies of: libignition-math6-eigen3-dev
 2. Get dependencies of: libignition-msgs5
 2. Get dependencies of: libignition-msgs5-dev
 2. Get dependencies of: libignition-physics2
 2. Get dependencies of: libignition-physics2-core-dev
 2. Get dependencies of: libignition-physics2-dartsim
 2. Get dependencies of: libignition-physics2-dartsim-dev
 2. Get dependencies of: libignition-physics2-dev
 2. Get dependencies of: libignition-physics2-mesh-dev
 2. Get dependencies of: libignition-physics2-sdf-dev
 2. Get dependencies of: libignition-plugin
 2. Get dependencies of: libignition-plugin-dbg
 2. Get dependencies of: libignition-plugin-dev
 2. Get dependencies of: libignition-plugin0
 2. Get dependencies of: libignition-plugin0-dbg
 2. Get dependencies of: libignition-plugin0-dev
 2. Get dependencies of: libignition-rendering3
 2. Get dependencies of: libignition-rendering3-core-dev
 2. Get dependencies of: libignition-rendering3-dev
 2. Get dependencies of: libignition-rendering3-ogre1
 2. Get dependencies of: libignition-rendering3-ogre1-dev
 2. Get dependencies of: libignition-rendering3-ogre2
 2. Get dependencies of: libignition-rendering3-ogre2-dev
 2. Get dependencies of: libignition-sensors3
 2. Get dependencies of: libignition-sensors3-air-pressure
 2. Get dependencies of: libignition-sensors3-air-pressure-dev
 2. Get dependencies of: libignition-sensors3-altimeter
 2. Get dependencies of: libignition-sensors3-altimeter-dev
 2. Get dependencies of: libignition-sensors3-camera
 2. Get dependencies of: libignition-sensors3-camera-dev
 2. Get dependencies of: libignition-sensors3-core-dev
 2. Get dependencies of: libignition-sensors3-depth-camera
 2. Get dependencies of: libignition-sensors3-depth-camera-dev
 2. Get dependencies of: libignition-sensors3-dev
 2. Get dependencies of: libignition-sensors3-gpu-lidar
 2. Get dependencies of: libignition-sensors3-gpu-lidar-dev
 2. Get dependencies of: libignition-sensors3-imu
 2. Get dependencies of: libignition-sensors3-imu-dev
 2. Get dependencies of: libignition-sensors3-lidar
 2. Get dependencies of: libignition-sensors3-lidar-dev
 2. Get dependencies of: libignition-sensors3-logical-camera
 2. Get dependencies of: libignition-sensors3-logical-camera-dev
 2. Get dependencies of: libignition-sensors3-magnetometer
 2. Get dependencies of: libignition-sensors3-magnetometer-dev
 2. Get dependencies of: libignition-sensors3-rendering
 2. Get dependencies of: libignition-sensors3-rendering-dev
 2. Get dependencies of: libignition-sensors3-rgbd-camera
 2. Get dependencies of: libignition-sensors3-rgbd-camera-dev
 2. Get dependencies of: libignition-sensors3-thermal-camera
 2. Get dependencies of: libignition-sensors3-thermal-camera-dev
 2. Get dependencies of: ignition-tools
 2. Get dependencies of: libignition-tools-dev
 2. Get dependencies of: libignition-transport8
 2. Get dependencies of: libignition-transport8-core-dev
 2. Get dependencies of: libignition-transport8-dbg
 2. Get dependencies of: libignition-transport8-dev
 2. Get dependencies of: libignition-transport8-log
 2. Get dependencies of: libignition-transport8-log-dev
 2. Get dependencies of: libsdformat9
 2. Get dependencies of: libsdformat9-dbg
 2. Get dependencies of: libsdformat9-dev
 2. Get dependencies of: sdformat9-doc
 2. Get dependencies of: sdformat9-sdf


LIST OF PACKAGES:

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uhm weird, there is no 3. step in your execution could you please run it with bash -x and copy the output somewhere please?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nothing is printed here. Is this expected?

Could be the lack of apt-rdepends package installation.

I guess I don't fully understand what this script is meant to do.

I edited the summary to provide some information.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, installing sudo apt install apt-rdepends did the trick. It would be nice to document that.

This works for me now. Just one last question, what's the rationale for putting this script here instead of release-tools?