Skip to content

Commit

Permalink
bitbake: make sure that the unresolved dependencies are valid OE reci…
Browse files Browse the repository at this point in the history
…pe names

* with
  https://raw.githubusercontent.com/ros-gbp/moveit-release/release/noetic/moveit_kinematics/1.1.0-1/package.xml
  <depend condition="$ROS_DISTRO != noetic">orocos_kdl</depend>
  <depend condition="$ROS_DISTRO == noetic">liborocos-kdl-dev</depend>
  we have accidentally got orocos_kdl dependency (because ROS_DISTRO was
  missing in evaluate_condition_context)

  which results in dependency on ROS_UNRESOLVED_PLATFORM_PKG_orocos_kdl

* but ROS_UNRESOLVED_PLATFORM_PKG_orocos_kdl = "UNRESOLVED-orocos_kdl"
  never got generated in generated/superflore-ros-distro.inc simply because
  https://github.com/ros-infrastructure/superflore/blob/649543e232fe1f44fcdf12c90ed5e0fc19bad4b8/superflore/generators/bitbake/yocto_recipe.py#L671
  takes last underscore-separated field as PN, so it generated
  ROS_UNRESOLVED_PLATFORM_PKG_kdl = "UNRESOLVED-kdl"
  instead which in the end caused unexpanded dependency issue like:
  ERROR: Nothing PROVIDES '${ROS_UNRESOLVED_PLATFORM_PKG_orocos_kdl}' (but meta-ros/meta-ros1-noetic/generated-recipes/robot-calibration/robot-calibration_0.6.4-1.bb, meta-ros/meta-ros1-noetic/generated-recipes/moveit/moveit-kinematics_1.1.0-1.bb DEPENDS on or otherwise requires it)

* similar issue is reproducible e.g. with jsk_pcl_ros:
  https://raw.githubusercontent.com/tork-a/jsk_recognition-release/release/noetic/jsk_pcl_ros/1.2.15-1/package.xml
  which has:
  <exec_depend>ml_classifiers</exec_depend>
  but there is no ml_classifiers package in noetic, it's only in melodic and dashing
  where it also generated:
  ROS_UNRESOLVED_PLATFORM_PKG_classifiers = "UNRESOLVED-classifiers"
  instead of:
  ROS_UNRESOLVED_PLATFORM_PKG_ml-classifiers = "UNRESOLVED-ml-classifiers"

  and similarly openni_launch which also doesn't exist in noetic, only in melodic
  ROS_UNRESOLVED_PLATFORM_PKG_launch = "UNRESOLVED-launch"
  ROS_UNRESOLVED_PLATFORM_PKG_openni-launch = "UNRESOLVED-openni-launch"

* we could easily fix that by using whole "ROS_UNRESOLVED_PLATFORM_PKG_" prefix
  as a separator before PN, but there is still a risk of using underscore
  in bitbake variable names, because if some build happens to include
  one of these underscore separated strings (e.g. 'kdl') in OVERRIDES variable,
  then the ROS_UNRESOLVED_PLATFORM_PKG_orocos_kdl = "UNRESOLVED-orocos_kdl" assignment will
  be expanded as assignment to variable "ROS_UNRESOLVED_PLATFORM_PKG" with
  "kdl" and "orocos" as an overrides and ${ROS_UNRESOLVED_PLATFORM_PKG_orocos_kdl}
  will still end undefined - using fewer underscores here is better

* but there is still an option that the whole ros package name will match with
  something in OVERRIDES (e.g. MACHINE name can be pretty much anything) and then
  these variables will fail the same, to fix it properly we should use uppercase
  for dependency name as well (while possibly changing the prefix to use dash as
  separators for easier readability), e.g.:
  ROS-UNRESOLVED-PLATFORM-PKG_OROCOS-KDL = "UNRESOLVED-OROCOS-KDL"
  but that would require migration of all manually overriden mappings:
  $ git grep ^ROS_UNRESOLVED_PLATFORM_PKG_ | grep '/ros-distro\.inc' | wc -l
  491
  which is easy, but would cause unwelcome diff between newer and older meta-ros
  branches. To mitigate this we plan to upstream all these manual overrides
  from meta-ros to rosdistro rosdep files and then we can re-evaluate this
  change to upper case when we don't use so many overrides

Signed-off-by: Martin Jansa <martin.jansa@lge.com>
  • Loading branch information
shr-project committed Dec 5, 2020
1 parent fae5cd5 commit b5b1ac3
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions superflore/generators/bitbake/yocto_recipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,13 +373,15 @@ def get_dependencies(
yoctoRecipe.rosdep_cache[dep].add(res)
info('External dependency add: ' + recipe)
except UnresolvedDependency:
unresolved_name = UNRESOLVED_PLATFORM_PKG_REFERENCE_PREFIX\
+ dep + '}'
recipe = self.convert_to_oe_name(unresolved_name, is_native)
oe_dep = self.convert_to_oe_name(dep, is_native)
recipe = UNRESOLVED_PLATFORM_PKG_REFERENCE_PREFIX\
+ oe_dep + '}'
dependencies.add(recipe)
system_dependencies.add(recipe)
# Never add -native.
rosdep_name = self.convert_to_oe_name(unresolved_name, False)
rosdep_dep = self.convert_to_oe_name(dep, False)
rosdep_name = UNRESOLVED_PLATFORM_PKG_REFERENCE_PREFIX\
+ rosdep_dep + '}'
yoctoRecipe.rosdep_cache[dep].add(rosdep_name)
info('Unresolved external dependency add: ' + recipe)

Expand Down

0 comments on commit b5b1ac3

Please sign in to comment.