Skip to content

Commit

Permalink
Initial OpenEmbedded support for rosdep
Browse files Browse the repository at this point in the history
  * Requires related changes in rospkg 1.1.8 and rosdistro
    ros/rosdistro#20763
  * Let us map the generic system dependency name into a recipe name
    available from OE layer index at http://layers.openembedded.org
  * Mapping is based on PACKAGE_ARGUMENT free form format of
    <package>@<meta-layer>, where <package> resides in the OE <meta-layer>
  * Please see the proposal below:
    https://discourse.ros.org/t/a-proposal-for-a-superflore-oe-recipe-generation-scheme/8401
  • Loading branch information
andre-rosa committed Apr 11, 2019
1 parent fe63aaa commit 24c3859
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 4 deletions.
6 changes: 5 additions & 1 deletion doc/rosdep_yaml_format.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ rosdep supports both a *simple* and *versioned* syntax.
The names above resolve as follows:

* ``ROSDEP_NAME`` is the name referred to by manifest files. Examples: ``log4cxx`` or ``gtest``.
* ``OS_NAME`` is the name of an OS. Examples: ``ubuntu``, ``osx``, ``fedora``, ``debian``, or ``windows``.
* ``OS_NAME`` is the name of an OS. Examples: ``ubuntu``, ``osx``, ``fedora``, ``debian``, ``openembedded``, or ``windows``.
* ``OS_VERSION`` (*optional*) is the name of specific versions in the OS. Examples: ``lucid`` or ``squeeze``. If no ``OS_VERSION`` is specified, the rule is assumed to apply to all versions.
* ``PACKAGE_MANAGER`` (*optional in ROS Electric, required in ROS Fuerte*) is a key to select which package manager to use for this rosdep. Examples: ``apt``, ``pip``, ``macports``.
* ``PACKAGE_ARGUMENT`` is free-form YAML that is be passed to the handler for the specified ``PACKAGE_MANAGER``.
Expand Down Expand Up @@ -100,6 +100,10 @@ OS name identifiers and supported package managers
* ``portage`` (default)
* ``source``

* ``openembedded`` : OpenEmbedded

* TODO: define a remote installation method for cross compiled packages

* ``osx`` : Apple OS X

* TODO: special notes on macports vs. homebrew
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
version=__version__, # noqa:F821
packages=['rosdep2', 'rosdep2.platforms'],
package_dir={'': 'src'},
install_requires=['catkin_pkg >= 0.4.0', 'rospkg >= 1.0.37', 'rosdistro >= 0.7.0', 'PyYAML >= 3.1'],
install_requires=['catkin_pkg >= 0.4.0', 'rospkg >= 1.1.8', 'rosdistro >= 0.7.0', 'PyYAML >= 3.1'],
test_suite='nose.collector',
test_requires=['mock', 'nose >= 1.0'],
scripts=['scripts/rosdep', 'scripts/rosdep-source'],
Expand Down
3 changes: 2 additions & 1 deletion src/rosdep2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ def create_default_installer_context(verbose=False):
from .platforms import arch
from .platforms import cygwin
from .platforms import debian
from .platforms import openembedded
from .platforms import gentoo
from .platforms import opensuse
from .platforms import osx
Expand All @@ -68,7 +69,7 @@ def create_default_installer_context(verbose=False):
from .platforms import slackware
from .platforms import source

platform_mods = [arch, cygwin, debian, gentoo, opensuse, osx, redhat, slackware, freebsd]
platform_mods = [arch, cygwin, debian, gentoo, openembedded, opensuse, osx, redhat, slackware, freebsd]
installer_mods = [source, pip, gem] + platform_mods

context = InstallerContext()
Expand Down
81 changes: 81 additions & 0 deletions src/rosdep2/platforms/openembedded.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# Copyright (c) 2019, LG Electronics, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the Willow Garage, Inc. nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.

# Author Andre Rosa/[email protected]

import subprocess
from rospkg.os_detect import OS_OPENEMBEDDED, OsDetect
from ..installers import PackageManagerInstaller
OPKG_INSTALLER = 'opkg'


def register_installers(context):
context.set_installer(OPKG_INSTALLER, OpkgInstaller())


def register_platforms(context):
register_oe(context)


def register_oe(context):
context.add_os_installer_key(OS_OPENEMBEDDED, OPKG_INSTALLER)
context.set_default_os_installer_key(OS_OPENEMBEDDED, lambda self: OPKG_INSTALLER)
context.set_os_version_type(OS_OPENEMBEDDED, OsDetect.get_codename)


def opkg_detect(pkgs, exec_fn=None):
"""
Given a list of package, return the list of installed packages.
:param pkgs: list of package names, optionally followed by a fixed version (`foo=3.0`)
:param exec_fn: function to execute Popen and read stdout (for testing)
:return: list elements in *pkgs* that were found installed on the system
"""
return []


class OpkgInstaller(PackageManagerInstaller):
"""
An implementation of the Installer for use on oe systems.
"""

def __init__(self):
super(OpkgInstaller, self).__init__(opkg_detect)

def get_version_strings(self):
output = subprocess.check_output(['opkg', '--version'])
version = output.splitlines()[0].split(' ')[2]
return [('opkg {}').format(version)]

def get_install_command(self, resolved, interactive=True, reinstall=False, quiet=False):
packages = self.get_packages_to_install(resolved, reinstall=reinstall)
if not packages:
return []
base_cmd = ['opkg', 'install']
if quiet:
base_cmd.append('-V')
return []
2 changes: 1 addition & 1 deletion stdeb.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[DEFAULT]
Depends: ca-certificates, python-rospkg (>= 1.0.37), python-yaml, python-catkin-pkg (>= 0.4.0), python-rosdistro (>= 0.7.0)
Depends: ca-certificates, python-rospkg (>= 1.1.8), python-yaml, python-catkin-pkg (>= 0.4.0), python-rosdistro (>= 0.7.0)
Depends3: ca-certificates, python3-rospkg (>= 1.0.37), python3-yaml, python3-catkin-pkg (>= 0.4.0), python3-rosdistro (>= 0.7.0)
Conflicts: python3-rosdep, python-rosdep2, python3-rosdep2
Conflicts3: python-rosdep, python-rosdep2, python3-rosdep2
Expand Down

0 comments on commit 24c3859

Please sign in to comment.