Commit 98a5dfc9 authored by Jochen Sprickerhof's avatar Jochen Sprickerhof

New upstream version 0.15.2

parent fe10ecf6
0.15.2 (2019-05-17)
-------------------
- Migrate to yaml.safe_load to avoid yaml.load vulnerabilities.
- https://github.com/ros-infrastructure/rosdep/pull/675
- Improve text feeback and prompts
- https://github.com/ros-infrastructure/rosdep/pull/675
- https://github.com/ros-infrastructure/rosdep/pull/670
- https://github.com/ros-infrastructure/rosdep/pull/665
- Add support for MX Linux
- https://github.com/ros-infrastructure/rosdep/pull/674
- Add support for OpenEmbedded
- https://github.com/ros-infrastructure/rosdep/pull/673
- Add support for Alpine
- https://github.com/ros-infrastructure/rosdep/pull/673
- Add support for CentOS and improve RHEL
- https://github.com/ros-infrastructure/rosdep/pull/668
- https://github.com/ros-infrastructure/rosdep/pull/667
0.15.1 (2019-02-19)
-------------------
- Change GitHub url's which no longer work.
......
......@@ -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``.
......@@ -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
......
......@@ -8,7 +8,7 @@ setup(
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'],
......
......@@ -55,9 +55,11 @@ except ImportError:
def create_default_installer_context(verbose=False):
from .platforms import alpine
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
......@@ -68,7 +70,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 = [alpine, arch, cygwin, debian, gentoo, openembedded, opensuse, osx, redhat, slackware, freebsd]
installer_mods = [source, pip, gem] + platform_mods
context = InstallerContext()
......
__version__ = '0.15.1'
__version__ = '0.15.2'
......@@ -219,7 +219,7 @@ class InstallerContext(object):
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):
......
......@@ -87,7 +87,7 @@ rosdep check <stacks-and-packages>...
check if the dependencies of package(s) have been met.
rosdep install <stacks-and-packages>...
generate a bash script and then execute it.
download and install the dependencies of a given package or packages.
rosdep db
generate the dependency database and print it to the console.
......
# Copyright (c) 2018, SEQSENSE, 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 Atsushi Watanabe/atsushi.w@ieee.org
import os
from rospkg.os_detect import OS_ALPINE
from .pip import PIP_INSTALLER
from .source import SOURCE_INSTALLER
from ..installers import PackageManagerInstaller
from ..shell_utils import read_stdout
APK_INSTALLER = 'apk'
def register_installers(context):
context.set_installer(APK_INSTALLER, ApkInstaller())
def register_platforms(context):
context.add_os_installer_key(OS_ALPINE, APK_INSTALLER)
context.add_os_installer_key(OS_ALPINE, PIP_INSTALLER)
context.add_os_installer_key(OS_ALPINE, SOURCE_INSTALLER)
context.set_default_os_installer_key(OS_ALPINE, lambda self: APK_INSTALLER)
def apk_detect(pkgs, exec_fn=read_stdout):
"""
Given a list of packages, return a list of which are already installed.
:param exec_fn: function to execute Popen and read stdout (for testing)
"""
if not pkgs:
return []
cmd = ['apk', 'info', '--installed']
cmd.extend(pkgs)
std_out = exec_fn(cmd)
return std_out.splitlines()
class ApkInstaller(PackageManagerInstaller):
def __init__(self):
super(ApkInstaller, self).__init__(apk_detect)
def get_install_command(self, resolved, interactive=True, reinstall=False, quiet=False):
pkgs = self.get_packages_to_install(resolved, reinstall=reinstall)
if not pkgs:
return []
cmd = self.elevate_priv(['apk', 'add'])
if interactive:
cmd.append('--interactive')
if quiet:
cmd.append('--quiet')
cmd.extend(pkgs)
return [cmd]
......@@ -31,7 +31,7 @@ from __future__ import print_function
import subprocess
import sys
from rospkg.os_detect import OS_DEBIAN, OS_LINARO, OS_UBUNTU, OS_ELEMENTARY, OsDetect
from rospkg.os_detect import OS_DEBIAN, OS_LINARO, OS_UBUNTU, OS_ELEMENTARY, OS_MX, OsDetect, read_os_release
from .pip import PIP_INSTALLER
from .gem import GEM_INSTALLER
......@@ -49,9 +49,12 @@ def register_installers(context):
def register_platforms(context):
register_debian(context)
register_linaro(context)
register_ubuntu(context)
# Aliases
register_elementary(context)
register_linaro(context)
register_mx(context)
def register_debian(context):
......@@ -83,6 +86,18 @@ def register_elementary(context):
context.set_os_override(OS_UBUNTU, context.os_detect.get_codename())
def register_mx(context):
# MX is an alias for Debian. If MX is detected and it's
# not set as an override, force Debian.
(os_name, os_version) = context.get_os_name_and_version()
if os_name == OS_MX and not context.os_override:
print('rosdep detected OS: [%s] aliasing it to: [%s]' %
(OS_MX, OS_DEBIAN), file=sys.stderr)
release_info = read_os_release()
version = read_os_release()["VERSION"]
context.set_os_override(OS_DEBIAN, version[version.find("(") + 1:version.find(")")])
def register_ubuntu(context):
context.add_os_installer_key(OS_UBUNTU, APT_INSTALLER)
context.add_os_installer_key(OS_UBUNTU, PIP_INSTALLER)
......
# 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/andre.rosa@lge.com
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.
NOTE: These are stubs currently and will be filled after semantics are fully defined.
: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
"""
raise NotImplementedError("opkg_detect is not implemented yet")
class OpkgInstaller(PackageManagerInstaller):
"""
An implementation of the Installer for use on oe systems.
NOTE: These are stubs currently and will be filled after semantics are fully defined.
"""
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):
raise NotImplementedError('get_install_command is not implemented yet')
......@@ -27,9 +27,11 @@
# Author Tully Foote/tfoote@willowgarage.com
from __future__ import print_function
import subprocess
import sys
from rospkg.os_detect import OS_RHEL, OS_FEDORA
from rospkg.os_detect import OS_CENTOS, OS_RHEL, OS_FEDORA
from .pip import PIP_INSTALLER
from .source import SOURCE_INSTALLER
......@@ -53,6 +55,9 @@ def register_platforms(context):
register_fedora(context)
register_rhel(context)
# Aliases
register_centos(context)
def register_fedora(context):
context.add_os_installer_key(OS_FEDORA, PIP_INSTALLER)
......@@ -68,6 +73,17 @@ def register_rhel(context):
context.add_os_installer_key(OS_RHEL, YUM_INSTALLER)
context.add_os_installer_key(OS_RHEL, SOURCE_INSTALLER)
context.set_default_os_installer_key(OS_RHEL, lambda self: YUM_INSTALLER)
context.set_os_version_type(OS_RHEL, lambda self: self.get_version().split('.', 1)[0])
def register_centos(context):
# CentOS is an alias for RHEL. If CentOS is detected and it's not set as
# an override force RHEL.
(os_name, os_version) = context.get_os_name_and_version()
if os_name == OS_CENTOS and not context.os_override:
print('rosdep detected OS: [%s] aliasing it to: [%s]' %
(OS_CENTOS, OS_RHEL), file=sys.stderr)
context.set_os_override(OS_RHEL, os_version.split('.', 1)[0])
def rpm_detect_py(packages):
......
......@@ -118,7 +118,7 @@ def load_rdmanifest(contents):
:raises: :exc:`InvalidRdmanifest`
"""
try:
return yaml.load(contents)
return yaml.safe_load(contents)
except yaml.scanner.ScannerError as ex:
raise InvalidRdmanifest('Failed to parse yaml in %s: Error: %s' % (contents, ex))
......
......@@ -87,7 +87,7 @@ def create_tempfile_from_string_and_execute(string_script, path=None, exec_fn=No
fh = tempfile.NamedTemporaryFile('w', delete=False)
fh.write(string_script)
fh.close()
print('Executing script below with cwd=%s\n{{{\n%s\n}}}\n' % (path, string_script))
rd_debug('Executing script below with cwd=%s\n{{{\n%s\n}}}\n' % (path, string_script))
try:
os.chmod(fh.name, stat.S_IRWXU)
if exec_fn is None:
......
......@@ -203,7 +203,7 @@ def cache_data_source_loader(sources_cache_dir, verbose=False):
if verbose:
print('loading cached data source:\n\t%s\n\t%s' % (uri, filepath), file=sys.stderr)
with open(filepath) as f:
rosdep_data = yaml.load(f.read())
rosdep_data = yaml.safe_load(f.read())
else:
rosdep_data = {}
return CachedDataSource(type_, uri, tags, rosdep_data, origin=filepath)
......
[DEFAULT]
Depends: ca-certificates, python-rospkg (>= 1.0.37), 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)
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.1.8), 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
Copyright-File: LICENSE
......
# Copyright (c) 2018, SEQSENSE, 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 Atsushi Watanabe/atsushi.w@ieee.org
import os
import traceback
from mock import Mock, patch
import rospkg.os_detect
def get_test_dir():
# not used yet
return os.path.abspath(os.path.join(os.path.dirname(__file__), 'alpine'))
def test_apk_detect():
from rosdep2.platforms.alpine import apk_detect
m = Mock(return_value='')
expected = []
val = apk_detect([], exec_fn=m)
assert val == expected, 'Result was: %s' % val
m.assert_not_called()
m = Mock(return_value='')
expected = []
val = apk_detect(['a'], exec_fn=m)
assert val == expected, 'Result was: %s' % val
m.assert_called_with(['apk', 'info', '--installed', 'a'])
m = Mock(return_value='\n'.join(['a', 'b']))
expected = ['a', 'b']
val = apk_detect(['a', 'b'], exec_fn=m)
assert val == expected, 'Result was: %s' % val
m.assert_called_with(['apk', 'info', '--installed', 'a', 'b'])
def test_ApkInstaller():
from rosdep2.platforms.alpine import ApkInstaller
@patch.object(ApkInstaller, 'get_packages_to_install')
def test(mock_method):
installer = ApkInstaller()
mock_method.return_value = []
assert [] == installer.get_install_command(['nonexistingfakepackage'])
mock_method.return_value = ['a-dev', 'b-dev']
expected = [['sudo', '-H', 'apk', 'add', 'a-dev', 'b-dev']]
val = installer.get_install_command(['notused'], interactive=False, quiet=False)
assert val == expected, 'Result was: %s' % val
expected = [['sudo', '-H', 'apk', 'add', '--interactive', 'a-dev', 'b-dev']]
val = installer.get_install_command(['notused'], interactive=True, quiet=False)
assert val == expected, 'Result was: %s' % val
expected = [['sudo', '-H', 'apk', 'add', '--quiet', 'a-dev', 'b-dev']]
val = installer.get_install_command(['notused'], interactive=False, quiet=True)
assert val == expected, 'Result was: %s' % val
try:
test()
except AssertionError:
traceback.print_exc()
raise
......@@ -59,7 +59,7 @@ def get_test_dir():
def _subtest_rep112_rdmanifest(resolved):
test_dir = get_test_dir()
path = os.path.join(test_dir, 'rep112-example.rdmanifest')
manifest = yaml.load(open(path))
manifest = yaml.safe_load(open(path))
assert resolved.manifest == manifest
assert resolved.manifest_url == path
......@@ -102,7 +102,7 @@ def test_SourceInstall():
test_dir = get_test_dir()
path = os.path.join(test_dir, 'rep112-example.rdmanifest')
manifest = yaml.load(open(path))
manifest = yaml.safe_load(open(path))
resolved = SourceInstall.from_manifest(manifest, path)
_subtest_rep112_rdmanifest(resolved)
......@@ -272,7 +272,7 @@ def test_fetch_file():
def test_download_rdmanifest():
test_dir = get_test_dir()
with open(os.path.join(test_dir, 'rep112-example.rdmanifest')) as f:
expected = yaml.load(f)
expected = yaml.safe_load(f)
from rosdep2.platforms.source import download_rdmanifest, DownloadFailed
url = 'file://%s' % os.path.join(test_dir, 'rep112-example.rdmanifest')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment