-
Notifications
You must be signed in to change notification settings - Fork 7
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
base: master
Are you sure you want to change the base?
Changes from 6 commits
fa1ce75
cad3e68
3930181
8729aed
ec4ca6e
0220c4e
b7eae18
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,59 @@ | ||||||
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' ' ' | ||||||
} | ||||||
|
||||||
echo | ||||||
echo "This tool reads a gazebodistro file and looks in the system for" | ||||||
echo "all available pkgs corresponding to that distro file" | ||||||
echo | ||||||
|
||||||
BRANCH_NAMES=$(grep version: ${GAZEBO_DISTRO} | awk '{ print $2 }') | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
|
||||||
# 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 | ||||||
mad_output=$(apt-cache madison ${new_pkg}) | ||||||
# skip purely virtual | ||||||
[[ ${mad_output} == "" ]] && continue | ||||||
if [[ -z $(grep 'packages.ros.org\|archive.ubuntu.com' <<< ${mad_output}) ]]; then | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is this line indicating? If we're looking for packages that are sourced from the packages.osrfoundation.org repositories does it make sense to match packages.osrfoundation.org positively rather than assume packages not from packages.ros.org or archive.ubuntu.com are needed? Since I don't have a coherent Ubuntu workstation with all three repositories configured I can't easily experiment with this during review. |
||||||
echo " 3. Found missing 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}" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When I run This is my full output
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Could be the lack of apt-rdepends package installation.
I edited the summary to provide some information. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks, installing This works for me now. Just one last question, what's the rationale for putting this script here instead of |
There was a problem hiding this comment.
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.