Skip to content

Commit

Permalink
WIP oe
Browse files Browse the repository at this point in the history
  • Loading branch information
andre-rosa committed Mar 6, 2019
1 parent fe63aaa commit 21d2b87
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 2 deletions.
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 oe
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, oe, opensuse, osx, redhat, slackware, freebsd]
installer_mods = [source, pip, gem] + platform_mods

context = InstallerContext()
Expand Down
2 changes: 1 addition & 1 deletion src/rosdep2/installers.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ def set_default_os_installer_key(self, os_key, installer_key):
if not installer_key(self.os_detect) in self.os_installers[os_key]:
raise KeyError('installer [%s] is not associated with OS [%s]. call add_os_installer_key() first' % (installer_key(self.os_detect), os_key))
if self.verbose:
print('set default installer for OS [%s]' % (os_key,))
print('set default installer [%s] for OS [%s]' % (installer_key(self.os_detect), os_key,))
self.default_os_installer[os_key] = installer_key

def get_default_os_installer_key(self, os_key):
Expand Down
58 changes: 58 additions & 0 deletions src/rosdep2/platforms/oe.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
from __future__ import print_function
import subprocess, sys
from rospkg.os_detect import OS_OPENEMBEDDED, OsDetect
from ..installers import PackageManagerInstaller
from ..shell_utils import read_stdout
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
"""
print('TBD: opkg_detect')
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):
print('TBD OpkgInstaller::get_version_strings')
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):
print('TBD OpkgInstaller::_get_install_command')
packages = self.get_packages_to_install(resolved, reinstall=reinstall)
if not packages:
return []
base_cmd = ['opkg', 'install']
if quiet:
base_cmd.append('-V')
return []

0 comments on commit 21d2b87

Please # to comment.