Skip to content

Commit

Permalink
Alias CentOS as RHEL (#668)
Browse files Browse the repository at this point in the history
Also move all platform alias registration after the regular platform
registrations. These aliases call `get_os_name_and_version`, which
behaves differently if the calling platform is registered.
  • Loading branch information
cottsay authored Apr 18, 2019
1 parent c55fb69 commit 86dcf07
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/rosdep2/platforms/debian.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,11 @@ def register_installers(context):

def register_platforms(context):
register_debian(context)
register_linaro(context)
register_ubuntu(context)

# Aliases
register_elementary(context)
register_linaro(context)


def register_debian(context):
Expand Down
17 changes: 16 additions & 1 deletion src/rosdep2/platforms/redhat.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@

# Author Tully Foote/[email protected]

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
Expand All @@ -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)
Expand All @@ -71,6 +76,16 @@ def register_rhel(context):
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):
ret_list = []
import rpm
Expand Down

0 comments on commit 86dcf07

Please sign in to comment.