Skip to content

Commit

Permalink
bitbake: simplify unresolved dependencies handling
Browse files Browse the repository at this point in the history
* use DEPENDENCY instead of PLATFORM_PKG in UNRESOLVED_* variables
  in some cases as documented in previous commit the unresolved
  dependency might be ROS package which just happens to be missing
  in pkg_names, so it's considered as external/system/platform
  package

* parse dependency name by skipping whole
  UNRESOLVED_DEPENDENCY_REF_PREFIX instead of relying on last
  underscore separated string

Signed-off-by: Martin Jansa <martin.jansa@lge.com>
  • Loading branch information
shr-project committed Dec 5, 2020
1 parent b30a573 commit 7f2a716
Showing 1 changed file with 14 additions and 18 deletions.
32 changes: 14 additions & 18 deletions superflore/generators/bitbake/yocto_recipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
from superflore.utils import resolve_dep
import yaml

UNRESOLVED_PLATFORM_PKG_PREFIX = 'ROS_UNRESOLVED_PLATFORM_PKG_'
UNRESOLVED_PLATFORM_PKG_REFERENCE_PREFIX = '${'+UNRESOLVED_PLATFORM_PKG_PREFIX
UNRESOLVED_DEPENDENCY_PREFIX = 'ROS_UNRESOLVED_PLATFORM_PKG_'
UNRESOLVED_DEPENDENCY_REF_PREFIX = '${'+UNRESOLVED_DEPENDENCY_PREFIX


class yoctoRecipe(object):
Expand Down Expand Up @@ -285,7 +285,7 @@ def modify_name_if_native(dep, is_native):
If the name is for an unresolved platform package, move the "-native"
inside the "}" so that it's part of the variable name.
"""
if dep.startswith(UNRESOLVED_PLATFORM_PKG_REFERENCE_PREFIX):
if dep.startswith(UNRESOLVED_DEPENDENCY_REF_PREFIX):
return dep[0:-len('}')] + ('-native}' if is_native else '}')
else:
return dep + ('-native' if is_native else '')
Expand Down Expand Up @@ -374,13 +374,13 @@ def get_dependencies(
info('External dependency add: ' + recipe)
except UnresolvedDependency:
oe_dep = self.convert_to_oe_name(dep, is_native)
recipe = UNRESOLVED_PLATFORM_PKG_REFERENCE_PREFIX\
recipe = UNRESOLVED_DEPENDENCY_REF_PREFIX\
+ oe_dep + '}'
dependencies.add(recipe)
system_dependencies.add(recipe)
# Never add -native.
rosdep_dep = self.convert_to_oe_name(dep, False)
rosdep_name = UNRESOLVED_PLATFORM_PKG_REFERENCE_PREFIX\
rosdep_name = UNRESOLVED_DEPENDENCY_REF_PREFIX\
+ rosdep_dep + '}'
yoctoRecipe.rosdep_cache[dep].add(rosdep_name)
info('Unresolved external dependency add: ' + recipe)
Expand Down Expand Up @@ -685,21 +685,17 @@ def generate_ros_distro_inc(
+ ' they are added, override\n# the settings in'
+ ' ros-distro.inc .\n')
"""
Drop trailing "}" so that "..._foo-native" sorts after
"..._foo".
Drop UNRESOLVED_DEPENDENCY_REF_PREFIX and trailing "}"
so that "..._foo-native" sorts after "..._foo".
"""
unresolved = [p[0:-1] for p in yoctoRecipe.platform_deps
if p.startswith(
UNRESOLVED_PLATFORM_PKG_REFERENCE_PREFIX)]
for p in sorted(unresolved):
"""
PN is last underscore-separated field. NB the trailing '}'
has already been removed.
"""
pn = p.split('_')[-1]
unresolved = [
p[len(UNRESOLVED_DEPENDENCY_REF_PREFIX):-1]
for p in yoctoRecipe.platform_deps if p.startswith(
UNRESOLVED_DEPENDENCY_REF_PREFIX)]
for dep in sorted(unresolved):
conf_file.write(
UNRESOLVED_PLATFORM_PKG_PREFIX + pn + ' = "UNRESOLVED-'
+ pn + '"\n')
UNRESOLVED_DEPENDENCY_PREFIX + dep + ' = "UNRESOLVED-'
+ dep + '"\n')

ok('Wrote {0}'.format(conf_path))
except OSError as e:
Expand Down

0 comments on commit 7f2a716

Please sign in to comment.