I’m working on perhaps one of the greater paper cuts in the ROS/Ubuntu ecosystem:
Basically, if you try to upgrade to a new Ubuntu release while also having a ROS release installed, the upgrade can cryptically fail because, of course, ROS doesn’t support that, and the Ubuntu upgrader doesn’t know that ROS doesn’t support that. I’m adding that knowledge to the Ubuntu upgrader so we can halt the upgrade before screwing up anyone’s computer with a partial upgrade, and I could use a quick sanity check (cc @dirk-thomas and @jrivero).
What is the best way to detect if a ROS distro is installed? The most robust way I can think of is to look at individual package names. There are two kinds of packages in the ROS repositories: those that are part of a given ROS distro (e.g. ros_environment and the like) and those that are not (e.g. rosdistro, colcon, etc.). I suspect that, for the most part, the latter group of packages will survive an upgrade without issue. The problematic set is the former, those that are part of a given ROS distro.
In order to avoid hard-coding as much as possible, I think it would be ideal if I could check to see if a specific package is installed, one that everyone who has any component of a ROS distro installed will have. For both ROS 1 and 2, I believe that would be ros_environment, can anyone confirm? Does anyone have any better ideas for how to do this? Does anyone see anything else I might be missing before I continue?