diff --git a/superflore/generators/bitbake/gen_packages.py b/superflore/generators/bitbake/gen_packages.py index 9e96ee33..dba1ce49 100644 --- a/superflore/generators/bitbake/gen_packages.py +++ b/superflore/generators/bitbake/gen_packages.py @@ -12,8 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import os - from catkin_pkg.package import InvalidPackage from rosdistro.dependency_walker import DependencyWalker from rosdistro.manifest_provider import get_release_tag @@ -163,8 +161,9 @@ def _gen_recipe_for_package( pkg_rosinstall, srcrev_cache, skip_keys ): pkg_names = get_package_names(distro) - pkg_dep_walker = DependencyWalker(distro, - evaluate_condition_context=os.environ) + pkg_dep_walker = DependencyWalker( + distro, + evaluate_condition_context=yoctoRecipe._get_condition_context(distro)) pkg_buildtool_deps = pkg_dep_walker.get_depends(pkg_name, "buildtool") pkg_build_deps = pkg_dep_walker.get_depends(pkg_name, "build") pkg_build_export_deps = pkg_dep_walker.get_depends( diff --git a/superflore/generators/bitbake/run.py b/superflore/generators/bitbake/run.py index 74153d64..bcb8b69b 100644 --- a/superflore/generators/bitbake/run.py +++ b/superflore/generators/bitbake/run.py @@ -39,7 +39,6 @@ def main(): - os.environ["ROS_OS_OVERRIDE"] = "openembedded" overlay = None parser = get_parser( 'Generate OpenEmbedded recipes for ROS packages', @@ -162,6 +161,7 @@ def main(): for adistro in selected_targets: yoctoRecipe.reset() distro = get_distro(adistro) + distro_installers, _, distro_changes =\ generate_installers( distro, diff --git a/superflore/generators/bitbake/yocto_recipe.py b/superflore/generators/bitbake/yocto_recipe.py index 2ee3ec0c..1e670f2a 100644 --- a/superflore/generators/bitbake/yocto_recipe.py +++ b/superflore/generators/bitbake/yocto_recipe.py @@ -503,6 +503,14 @@ def _get_ros_version(distro): def _get_ros_python_version(distro): return '2' if distro not in ['melodic'] else '3' + @staticmethod + def _get_condition_context(distro): + context = dict() + context["ROS_OS_OVERRIDE"] = "openembedded" + context["ROS_VERSION"] = yoctoRecipe._get_ros_version(distro) + context["ROS_PYTHON_VERSION"] = yoctoRecipe._get_ros_python_version( + distro) + @staticmethod def generate_superflore_datetime_inc(basepath, dist, now): datetime_dir = '{0}/meta-ros{1}-{2}/conf/ros-distro/include/{2}/' \ @@ -567,7 +575,7 @@ def generate_ros_distro_inc( conf_file.write('# DO NOT OVERRIDE ROS_PYTHON_VERSION\n') conf_file.write( 'ROS_PYTHON_VERSION = "{}"\n\n'.format( - yoctoRecipe._get_ros_python_version(distro))) + yoctoRecipe._get_ros_python_version(distro))) oe_skip_keys = map( lambda skip_key: yoctoRecipe.convert_to_oe_name(skip_key), skip_keys