Ejemplo n.º 1
0
Archivo: serv.py Proyecto: nir0s/serv
    def _lookup_by_mapping():
        """Returns a tuple containing the init system's type and version based
        on a constant mapping of distribution+version to init system..

        See constants.py for the mapping.
        A failover of the version is proposed for when no version is supplied.
        For instance, Arch Linux's version will most probably be "rolling" at
        any given time, which means that the init system cannot be idenfied
        by the version of the distro.

        On top of trying to identify by the distro's ID, if /etc/os-release
        contains an "ID_LIKE" field, it will be tried. That, again is true
        for Arch where the distro's ID changes (Manjaro, Antergos, etc...)
        But the "ID_LIKE" field is always (?) `arch`.
        """
        like = distro.like().lower()
        distribution_id = distro.id().lower()
        version = distro.major_version()
        # init (upstart 1.12.1)
        if distribution_id in ('arch'):
            version = 'any'
        if like in ('arch'):
            version = 'any'
        init_sys = const.DIST_TO_INITSYS.get(
            distribution_id, const.DIST_TO_INITSYS.get(like))
        if init_sys:
            return [init_sys.get(version)] or []
Ejemplo n.º 2
0
import distro
import platform

# Параметры системы
OS_RELEASE = distro.codename().split(' ')[0].lower()
PLATFORM_ARCH = platform.machine()
OS_DISTRIBUTION = distro.id().lower()
OS_VERSION = distro.major_version()

# Адрес загрузки исходного кода nginx
NGINX_URL = "http://nginx.org/download"
NGINX_SRPM_URL_MAINLINE = "http://nginx.org/packages/mainline/centos/{}/SRPMS".format(
    OS_VERSION)
NGINX_SRPM_URL_STABLE = "http://nginx.org/packages/centos/{}/SRPMS".format(
    OS_VERSION)

# Архив со скриптами для создания пакета
DEB_PACKAGE_SCRIPTS_URL_MAINLINE = "http://nginx.org/packages/mainline/{}/pool/nginx/n/nginx".format(
    OS_DISTRIBUTION)
DEB_PACKAGE_SCRIPTS_URL_STABLE = "http://nginx.org/packages/{}/pool/nginx/n/nginx".format(
    OS_DISTRIBUTION)

# Путь до директории сборки пакета
SRC_PATH = "/usr/src/nginx"

# Error build code
DPKG_FAIL_EXIT_CODE = 29

# Параметры компиляции nginx
DEFAULT_CONFIGURE_PARAMS = [
    "--prefix=/etc/nginx",
Ejemplo n.º 3
0
def get_os_distribution_version_major():
    return distro.major_version()
Ejemplo n.º 4
0
def main():
    # configure parser
    parser = optparse.OptionParser()
    parser.add_option('-v',
                      '--verbose',
                      action="count",
                      dest='verbosity',
                      default=1,
                      help='print more information to stdout')
    parser.add_option('-q',
                      '--quiet',
                      action='store_const',
                      const=0,
                      dest='verbosity',
                      help='print less information to stdout')
    parser.add_option('-p',
                      '--package',
                      action='store_true',
                      dest='package',
                      default=True)
    parser.add_option('-n',
                      '--no-package',
                      action='store_false',
                      dest='package')
    (options, args) = parser.parse_args()

    # configure logging
    log = logging.getLogger()
    if options.verbosity >= 2:
        log.setLevel(logging.DEBUG)
    elif options.verbosity == 1:
        log.setLevel(logging.INFO)
    else:
        log.setLevel(logging.WARNING)
    ch = logging.StreamHandler()
    formatter = logging.Formatter("%(levelname)s - %(message)s")
    ch.setFormatter(formatter)
    log.addHandler(ch)

    distro_id = distro.id()
    distro_major_version = distro.major_version()

    if distro_id in ['debian', 'ubuntu']:
        log.info('Detected: {0}'.format(distro_id))
        cmd = ['sudo', 'apt-get', 'update', '-y']
        build.run_cmd(cmd, check_rc='getting updates failed')
        # get prerequisites
        cmd = [
            'sudo', 'DEBIAN_FRONTEND=noninteractive', 'apt-get', 'install',
            '-y', 'curl', 'automake', 'make', 'autoconf2.13', 'texinfo',
            'help2man', 'git', 'gpg', 'lsb-release', 'libtool', 'libbz2-dev',
            'zlib1g-dev', 'libcurl4-gnutls-dev', 'libxml2-dev', 'pkg-config',
            'python3-dev', 'uuid-dev', 'libssl-dev', 'fuse', 'libfuse2',
            'libfuse-dev', 'libmicrohttpd-dev', 'unixodbc-dev'
        ]
        if distro_id in ['debian']:
            # Debian 11's default GCC is version 10.2.
            # Debian containers do not have "ps" command by default.
            cmd.extend(['g++', 'procps'])
        # At this point, we know we're dealing with some version of Ubuntu.
        elif distro_major_version == '20':
            # Compiling LLVM 13's libcxx requires at least GCC 10.
            cmd.extend(['gcc-10', 'g++-10'])
        else:
            # Ubuntu 18 does not have any issues compiling LLVM 13's libcxx
            # because it is using GCC 7 which does not support any C++20 features.
            cmd.append('g++')
        build.run_cmd(cmd, check_rc='installing prerequisites failed')
        cmd = ['sudo', 'apt-get', 'install', '-y', 'autoconf', 'rsync']
        build.run_cmd(cmd, check_rc='installing autoconf failed')
        cmd = ['sudo', 'apt-get', 'install', '-y', 'patchelf']
        build.run_cmd(cmd, check_rc='installing patchelf failed')

    elif distro_id in ['rocky', 'almalinux', 'centos', 'rhel', 'scientific']:
        log.info('Detected: {0}'.format(distro_id))
        # prep
        if distro_id in ['rocky', 'almalinux']:
            cmd = [
                'sudo', 'dnf', 'install', '-y', 'epel-release',
                'dnf-plugins-core'
            ]
            build.run_cmd(cmd, check_rc='rpm dnf install failed')
            cmd = [
                'sudo', 'dnf', 'config-manager', '--set-enabled', 'powertools'
            ]
            build.run_cmd(cmd, check_rc='rpm dnf config-manager failed')
            cmd = [
                'sudo', 'dnf', 'install', '-y', 'procps', 'redhat-lsb-core',
                'rsync'
            ]  # For ps, lsb_release, and rsync.
            build.run_cmd(cmd, check_rc='yum install failed')
        else:
            cmd = ['sudo', 'rpm', '--rebuilddb']
            build.run_cmd(cmd, check_rc='rpm rebuild failed')
        cmd = ['sudo', 'yum', 'clean', 'all']
        build.run_cmd(cmd, check_rc='yum clean failed')
        if distro_id not in ['rocky', 'almalinux']:
            cmd = ['sudo', 'yum', 'install', 'centos-release-scl-rh', '-y']
            build.run_cmd(cmd, check_rc='yum install failed')
        cmd = [
            'sudo', 'yum', 'update', '-y', 'glibc*', 'yum*', 'rpm*', 'python*'
        ]
        build.run_cmd(cmd, check_rc='yum update failed')
        # get prerequisites
        cmd = [
            'sudo', 'yum', 'install', '-y', 'epel-release', 'wget', 'openssl',
            'ca-certificates'
        ]
        build.run_cmd(cmd, check_rc='installing epel failed')
        cmd = [
            'sudo', 'yum', 'install', '-y', 'curl', 'gcc-c++', 'git',
            'autoconf', 'automake', 'texinfo', 'help2man', 'rpm-build',
            'rubygems', 'ruby-devel', 'zlib-devel', 'fuse', 'fuse-devel',
            'bzip2-devel', 'libcurl-devel', 'libmicrohttpd-devel',
            'libxml2-devel', 'libtool', 'libuuid-devel', 'openssl-devel',
            'unixODBC-devel', 'patchelf'
        ]
        if distro_id in ['rocky', 'almalinux']:
            cmd.append('python36-devel')  # python39-devel also available.
        else:
            cmd.append('python3-devel')
        build.run_cmd(cmd, check_rc='installing prerequisites failed')

    elif distro_id in ['opensuse ', 'sles']:
        log.info('Detected: {0}'.format(distro_id))
        # get prerequisites
        cmd = [
            'sudo', 'zypper', 'install', '-y', 'curl', 'tar', 'gzip', 'git',
            'ruby-devel', 'libmicrohttpd-devel', 'makeinfo', 'rubygems',
            'libopenssl-devel', 'rpm-build', 'help2man', 'python-devel',
            'libbz2-devel', 'libcurl-devel', 'libxml2-devel', 'libtool',
            'libuuid-devel', 'uuid-devel', 'unixODBC-devel', 'cyrus-sasl',
            'patchelf'
        ]
        build.run_cmd(cmd, check_rc='installing prerequisites failed')
    else:
        if platform.mac_ver()[0] != '':
            log.info('Detected: {0}'.format(platform.mac_ver()[0]))
            # get prerequisites
            cmd = ['brew', 'install', 'git', 'help2man', 'texinfo', 'libtool']
            build.run_cmd(cmd, check_rc='installing prerequisites failed')
            cmd = ['brew', 'link', 'texinfo', '--force']
            build.run_cmd(cmd, check_rc='linking texinfo failed')
        else:
            log.error(
                'Cannot determine prerequisites for platform [{0}]'.format(
                    distro_id))
            return 1

    # get necessary ruby gems
    if options.package:
        install_rvm_and_ruby()
        install_fpm_gem()
Ejemplo n.º 5
0
    def __init__(self, args):
        self.args = args
        self.configFilePath = os.path.join(args.build_root, 'qt.cmake')
        self.version = os.getenv('VIRCADIA_USE_QT_VERSION', '5.15.2')

        self.assets_url = hifi_utils.readEnviromentVariableFromFile(args.build_root, 'EXTERNAL_BUILD_ASSETS')

        defaultBasePath = os.path.expanduser('~/hifi/qt')
        self.basePath = os.getenv('HIFI_QT_BASE', defaultBasePath)
        if (not os.path.isdir(self.basePath)):
            os.makedirs(self.basePath)
        self.path = os.path.join(self.basePath, self.version)
        self.fullPath = os.path.join(self.path, 'qt5-install')
        self.cmakePath = os.path.join(self.fullPath, 'lib/cmake')

        print("Using qt path {}".format(self.path))
        lockDir, lockName = os.path.split(self.path)
        lockName += '.lock'
        if not os.path.isdir(lockDir):
            os.makedirs(lockDir)

        self.lockFile = os.path.join(lockDir, lockName)

        if (os.getenv('VIRCADIA_USE_PREBUILT_QT')):
            print("Using pre-built Qt5")
            return

        # OS dependent information
        system = platform.system()
        cpu_architecture = platform.machine()

        if 'Windows' == system:
            self.qtUrl = self.assets_url + '/dependencies/vcpkg/qt5-install-5.15.2-windows.tar.gz'
        elif 'Darwin' == system:
            self.qtUrl = self.assets_url + '/dependencies/vcpkg/qt5-install-5.15.2-macos.tar.gz'
        elif 'Linux' == system:
            import distro
            dist = distro.linux_distribution()

            if 'x86_64' == cpu_architecture:
                if distro.id() == 'ubuntu':
                    u_major = int( distro.major_version() )
                    u_minor = int( distro.minor_version() )

                    if u_major == 18:
                        self.qtUrl = self.assets_url + '/dependencies/vcpkg/qt5-install-5.15.2-ubuntu-18.04-amd64.tar.xz'
                    elif u_major > 19:
                        print("We don't support " + distro.name(pretty=True) + " yet. Perhaps consider helping us out?")
                        raise Exception('LINUX DISTRO IS NOT SUPPORTED YET!!!')
                    else:
                        print("Sorry, " + distro.name(pretty=True) + " is old and won't be officially supported. Please consider upgrading.");
                        raise Exception('UNKNOWN LINUX DISTRO VERSION!!!')
                else:
                    print("Sorry, " + distro.name(pretty=True) + " is not supported on x86_64. Please consider helping us out.")
                    print("It's also possible to build Qt for your distribution, please see the documentation at:")
                    print("https://github.com/vircadia/vircadia/tree/master/tools/qt-builder")
                    raise Exception('UNKNOWN LINUX VERSION!!!')
            elif 'aarch64' == cpu_architecture:
                if distro.id() == 'ubuntu':
                    u_major = int( distro.major_version() )
                    u_minor = int( distro.minor_version() )

                    if u_major == 18:
                        self.qtUrl = 'http://motofckr9k.ddns.net/vircadia_packages/qt5-install-5.15.2-ubuntu-18.04-aarch64_test.tar.xz'
                    elif u_major > 19:
                        print("We don't support " + distro.name(pretty=True) + " on aarch64 yet. Perhaps consider helping us out?")
                        raise Exception('LINUX DISTRO IS NOT SUPPORTED YET!!!')
                    else:
                        print("Sorry, " + distro.name(pretty=True) + " is old and won't be officially supported. Please consider upgrading.");
                        raise Exception('UNKNOWN LINUX DISTRO VERSION!!!')

                elif distro.id() == 'debian':
                    u_major = int( distro.major_version() )
                    u_minor = int( distro.minor_version() )

                    if u_major == 10:
                        #self.qtUrl = self.assets_url + '/dependencies/vcpkg/qt5-install-5.12.3-ubuntu-16.04-with-symbols.tar.gz'
                        print("We don't support " + distro.name(pretty=True) + " on aarch64 yet. Perhaps consider helping us out?")
                        raise Exception('LINUX DISTRO IS NOT SUPPORTED YET!!!')
                    elif u_major > 10:
                        print("We don't support " + distro.name(pretty=True) + " on aarch64 yet. Perhaps consider helping us out?")
                        raise Exception('LINUX DISTRO IS NOT SUPPORTED YET!!!')
                    else:
                        print("Sorry, " + distro.name(pretty=True) + " is old and won't be officially supported. Please consider upgrading.");
                        raise Exception('UNKNOWN LINUX DISTRO VERSION!!!')

                else:
                    print("Sorry, " + distro.name(pretty=True) + " is not supported on aarch64. Please consider helping us out.")
                    print("It's also possible to build Qt for your distribution, please see the documentation at:")
                    print("https://github.com/vircadia/vircadia/tree/master/tools/qt-builder")
                    raise Exception('UNKNOWN LINUX VERSION!!!')
            else:
                raise Exception('UNKNOWN CPU ARCHITECTURE!!!')

        else:
            print("System      : " + platform.system())
            print("Architecture: " + platform.architecture())
            print("Machine     : " + platform.machine())
            raise Exception('UNKNOWN OPERATING SYSTEM!!!')
Ejemplo n.º 6
0
    def __init__(self, args):
        self.args = args
        self.configFilePath = os.path.join(args.build_root, 'qt.cmake')
        self.version = os.getenv('VIRCADIA_USE_QT_VERSION', '5.15.2')
        self.assets_url = hifi_utils.readEnviromentVariableFromFile(args.build_root, 'EXTERNAL_BUILD_ASSETS')

        # OS dependent information
        system = platform.system()

        qt_found = False
        system_qt = False

        # Here we handle the 3 possible cases of dealing with Qt:
        if os.getenv('VIRCADIA_USE_SYSTEM_QT', "") != "":
            # 1. Using the system provided Qt. This is only recommended for Qt 5.15.0 and above,
            # as it includes a required fix on Linux.
            #
            # This path only works on Linux as neither Windows nor OSX ship Qt.

            if system != "Linux":
                raise Exception("Using the system Qt is only supported on Linux")

            self.path = None
            self.cmakePath = None

            qt_found = True
            system_qt = True
            print("Using system Qt")

        elif os.getenv('VIRCADIA_QT_PATH', "") != "":
            # 2. Using an user-provided directory.
            # VIRCADIA_QT_PATH must point to a directory with a Qt install in it.

            self.path = os.getenv('VIRCADIA_QT_PATH')
            self.fullPath = self.path
            self.cmakePath = os.path.join(self.fullPath, 'lib', 'cmake')

            qt_found = True
            print("Using Qt from " + self.fullPath)

        else:
            # 3. Using a pre-built Qt.
            #
            # This works somewhat differently from above, notice how path and fullPath are
            # used differently in this case.
            #
            # In the case of an user-provided directory, we just use the user-supplied directory.
            #
            # For a pre-built qt, however, we have to unpack it. The archive is required to contain
            # a qt5-install directory in it.

            self.path = os.path.expanduser("~/vircadia-files/qt")
            self.fullPath = os.path.join(self.path, 'qt5-install')
            self.cmakePath = os.path.join(self.fullPath, 'lib', 'cmake')

            if (not os.path.isdir(self.path)):
                os.makedirs(self.path)

            qt_found = os.path.isdir(self.fullPath)
            print("Using a packaged Qt")


        if not system_qt:
            if qt_found:
                # Sanity check, ensure we have a good cmake directory
                qt5_dir = os.path.join(self.cmakePath, "Qt5")
                if not os.path.isdir(qt5_dir):
                    raise Exception("Failed to find Qt5 directory under " + self.cmakePath + ". There should be a " + qt5_dir)
                else:
                    print("Qt5 check passed, found " + qt5_dir)

            # I'm not sure why this is needed. It's used by hifi_singleton.
            # Perhaps it stops multiple build processes from interferring?
            lockDir, lockName = os.path.split(self.path)
            lockName += '.lock'
            if not os.path.isdir(lockDir):
                os.makedirs(lockDir)

            self.lockFile = os.path.join(lockDir, lockName)

        if qt_found:
            print("Found pre-built Qt5")
            return

        if 'Windows' == system:
            self.qtUrl = self.assets_url + '/dependencies/vcpkg/qt5-install-5.15.2-windows.tar.gz'
        elif 'Darwin' == system:
            self.qtUrl = self.assets_url + '/dependencies/vcpkg/qt5-install-5.15.2-macos.tar.gz'
        elif 'Linux' == system:
            import distro
            cpu_architecture = platform.machine()

            if 'x86_64' == cpu_architecture:
                if distro.id() == 'ubuntu':
                    u_major = int( distro.major_version() )
                    u_minor = int( distro.minor_version() )

                    if u_major == 18:
                        self.qtUrl = self.assets_url + '/dependencies/vcpkg/qt5-install-5.15.2-ubuntu-18.04-amd64.tar.xz'
                    elif u_major > 19:
                        self.__no_qt_package_error()
                    else:
                        self.__unsupported_error()
                else:
                    self.__no_qt_package_error()

            elif 'aarch64' == cpu_architecture:
                if distro.id() == 'ubuntu':
                    u_major = int( distro.major_version() )
                    u_minor = int( distro.minor_version() )

                    if u_major == 18:
                        self.qtUrl = 'http://motofckr9k.ddns.net/vircadia_packages/qt5-install-5.15.2-ubuntu-18.04-aarch64_test.tar.xz'
                    elif u_major > 19:
                        self.__no_qt_package_error()
                    else:
                        self.__unsupported_error()

                elif distro.id() == 'debian':
                    u_major = int( distro.major_version() )

                    if u_major == 10:
                        self.qtUrl = 'https://data.moto9000.moe/vircadia_packages/qt5-install-5.15.2-debian-10-aarch64.tar.xz'
                    elif u_major > 10:
                        self.__no_qt_package_error()
                    else:
                        self.__unsupported_error()

                else:
                    self.__no_qt_package_error()
            else:
                raise Exception('UNKNOWN CPU ARCHITECTURE!!!')

        else:
            print("System      : " + platform.system())
            print("Architecture: " + platform.architecture())
            print("Machine     : " + platform.machine())
            raise Exception('UNKNOWN OPERATING SYSTEM!!!')
Ejemplo n.º 7
0
from __future__ import print_function

from pprint import pformat

import distro


def pprint(obj):
    for line in pformat(obj).split("\n"):
        print(4 * " " + line)


print("os_release_info:")
pprint(distro.os_release_info())
print("lsb_release_info:")
pprint(distro.lsb_release_info())
print("distro_release_info:")
pprint(distro.distro_release_info())
print("id: {0}".format(distro.id()))
print("name: {0}".format(distro.name()))
print("name_pretty: {0}".format(distro.name(True)))
print("version: {0}".format(distro.version()))
print("version_pretty: {0}".format(distro.version(True)))
print("like: {0}".format(distro.like()))
print("codename: {0}".format(distro.codename()))
print("linux_distribution_full: {0}".format(distro.linux_distribution()))
print("linux_distribution: {0}".format(distro.linux_distribution(False)))
print("major_version: {0}".format(distro.major_version()))
print("minor_version: {0}".format(distro.minor_version()))
print("build_number: {0}".format(distro.build_number()))
Ejemplo n.º 8
0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import distro

print 'os_release_info: {0}'.format(distro.os_release_info())
print 'lsb_release_info: {0}'.format(distro.lsb_release_info())
print 'distro_release_info: {0}'.format(distro.distro_release_info())
print 'id: {0}'.format(distro.id())
print 'name: {0}'.format(distro.name())
print 'name_pretty: {0}'.format(distro.name(True))
print 'version: {0}'.format(distro.version())
print 'version_pretty: {0}'.format(distro.version(True))
print 'like: {0}'.format(distro.like())
print 'codename: {0}'.format(distro.codename())
print 'linux_distribution_full: {0}'.format(distro.linux_distribution())
print 'linux_distribution: {0}'.format(distro.linux_distribution(False))
print 'major_version: {0}'.format(distro.major_version())
print 'minor_version: {0}'.format(distro.minor_version())
print 'build_number: {0}'.format(distro.build_number())
Ejemplo n.º 9
0
import distro
import pytest
from six.moves import urllib

# Static globals
METADATA_KERNEL = 'http://169.254.169.254/latest/meta-data/kernel-id'
FIPS_DISABLED = set(['true', 'TRUE', '1', 'on'])

# Markers
VIRTUALIZATION_MARKERS = set(['hvm', 'paravirutal'])
PLAT_MARKERS = set(['el7'])
FIPS_MARKERS = set(['fips_enabled', 'fips_disabled'])

# Platform-specific globals
PLAT = 'el' + distro.major_version()
FIPS = 'fips_disabled' if os.environ.get('SPEL_DISABLEFIPS') in FIPS_DISABLED \
    else 'fips_enabled'
VIRT = 'hvm'
try:
    urllib.request.urlopen(METADATA_KERNEL)
    VIRT = 'paravirtual'
except urllib.error.URLError:
    pass


def pytest_runtest_setup(item):
    if isinstance(item, pytest.Function):
        if not item.get_marker(PLAT):
            if PLAT_MARKERS.intersection(item.keywords):
                pytest.skip('does not run on platform {0}'.format(PLAT))
Ejemplo n.º 10
0
def define_components(reqs):
    """Define all of the components"""
    define_common(reqs)
    define_mercury(reqs)
    define_ompi(reqs)

    isal_build = [
        './autogen.sh ',
        './configure --prefix=$ISAL_PREFIX --libdir=$ISAL_PREFIX/lib',
        'make $JOBS_OPT', 'make install'
    ]
    reqs.define(
        'isal',
        retriever=GitRepoRetriever('https://github.com/01org/isa-l.git'),
        commands=isal_build,
        libs=["isal"])
    reqs.define('isal_crypto',
                retriever=GitRepoRetriever("https://github.com/intel/"
                                           "isa-l_crypto"),
                commands=[
                    './autogen.sh ',
                    './configure --prefix=$ISAL_CRYPTO_PREFIX '
                    '--libdir=$ISAL_CRYPTO_PREFIX/lib', 'make $JOBS_OPT',
                    'make install'
                ],
                libs=['isal_crypto'])

    retriever = GitRepoRetriever("https://github.com/pmem/pmdk.git")

    pmdk_build = [
        "make all \"BUILD_RPMEM=n\" \"NDCTL_ENABLE=n\" "
        "\"NDCTL_DISABLE=y\" $JOBS_OPT install "
        "prefix=$PMDK_PREFIX"
    ]

    reqs.define('pmdk',
                retriever=retriever,
                commands=pmdk_build,
                libs=["pmemobj"])

    retriever = GitRepoRetriever("https://github.com/pmodels/argobots.git",
                                 True)
    reqs.define('argobots',
                retriever=retriever,
                commands=[
                    'git clean -dxf ', './autogen.sh',
                    './configure --prefix=$ARGOBOTS_PREFIX CC=gcc'
                    ' --enable-valgrind', 'make $JOBS_OPT',
                    'make $JOBS_OPT install'
                ],
                requires=['valgrind_devel'],
                libs=['abt'],
                headers=['abt.h'])

    if distro.id() == "ubuntu" and int(distro.major_version()) < 20:
        retriever = GitRepoRetriever('https://github.com/libfuse/libfuse')
        reqs.define('fuse',
                    retriever=retriever,
                    commands=['meson $FUSE_SRC --prefix=$FUSE_PREFIX' \
                              ' -D udevrulesdir=$FUSE_PREFIX/udev' \
                              ' -D disable-mtab=True' \
                              ' -D utils=False',
                              '$ninja -v $JOBS_OPT',
                              '$ninja install'],
                    libs=['fuse3'],
                    defines=["FUSE_USE_VERSION=32"],
                    required_progs=['libtoolize', NINJA_PROG],
                    headers=['fuse3/fuse.h'],
                    out_of_src_build=True)
    else:
        reqs.define('fuse',
                    libs=['fuse3'],
                    defines=["FUSE_USE_VERSION=32"],
                    headers=['fuse3/fuse.h'],
                    package='fuse3-devel')

    retriever = GitRepoRetriever("https://github.com/daos-stack/cart", True)
    fi_opt = ""
    if reqs.get_env("BUILD_TYPE") in ["debug", "dev"]:
        fi_opt = " --with-fault-injection "
    reqs.define(
        'cart',
        retriever=retriever,
        commands=[
            SCONS_EXE + " --config=force $JOBS_OPT " + fi_opt +
            "MERCURY_PREBUILT=$MERCURY_PREFIX "
            "PREFIX=$CART_PREFIX "
            "MPI_PKG=$MPI_PKG "
            "USE_INSTALLED=" + ','.join(reqs.installed) + ' ' + "install"
        ],
        headers=["cart/api.h", "gurt/list.h"],
        libs=["cart", "gurt"],
        requires=['mercury', 'uuid', 'crypto', 'boost', 'yaml'],
        package='cart-devel' if inst(reqs, 'cart') else None)

    reqs.define('fio',
                retriever=GitRepoRetriever('https://github.com/axboe/fio.git'),
                commands=[
                    './configure --prefix="$FIO_PREFIX"', 'make $JOBS_OPT',
                    'make install'
                ],
                progs=['genfio', 'fio'])

    retriever = GitRepoRetriever("https://github.com/spdk/spdk.git", True)
    reqs.define('spdk',
                retriever=retriever,
                commands=['./configure --prefix="$SPDK_PREFIX" --with-shared ' \
                          ' --with-fio="$FIO_SRC"',
                          'make $JOBS_OPT', 'make install',
                          'cp dpdk/build/lib/* "$SPDK_PREFIX/lib"',
                          'mkdir -p "$SPDK_PREFIX/share/spdk"',
                          'cp -r include scripts examples/nvme/fio_plugin ' \
                          '"$SPDK_PREFIX/share/spdk"'],
                libs=['spdk'],
                requires=['fio'])

    url = 'https://github.com/protobuf-c/protobuf-c/releases/download/' \
        'v1.3.0/protobuf-c-1.3.0.tar.gz'
    web_retriever = WebRetriever(url, "08804f8bdbb3d6d44c2ec9e71e47ef6f")
    reqs.define('protobufc',
                retriever=web_retriever,
                commands=[
                    './configure --prefix=$PROTOBUFC_PREFIX '
                    '--disable-protoc', 'make $JOBS_OPT', 'make install'
                ],
                libs=['protobuf-c'],
                headers=['protobuf-c/protobuf-c.h'])
Ejemplo n.º 11
0
    def __init__(self, args):
        self.args = args
        self.configFilePath = os.path.join(args.build_root, 'qt.cmake')
        self.version = os.getenv('VIRCADIA_USE_QT_VERSION', '5.12.3')

        self.assets_url = hifi_utils.readEnviromentVariableFromFile(args.build_root, 'EXTERNAL_BUILD_ASSETS')

        defaultBasePath = os.path.expanduser('~/hifi/qt')
        self.basePath = os.getenv('HIFI_QT_BASE', defaultBasePath)
        if (not os.path.isdir(self.basePath)):
            os.makedirs(self.basePath)
        self.path = os.path.join(self.basePath, self.version)
        self.fullPath = os.path.join(self.path, 'qt5-install')
        self.cmakePath = os.path.join(self.fullPath, 'lib/cmake')

        print("Using qt path {}".format(self.path))
        lockDir, lockName = os.path.split(self.path)
        lockName += '.lock'
        if not os.path.isdir(lockDir):
            os.makedirs(lockDir)

        self.lockFile = os.path.join(lockDir, lockName)

        if (os.getenv('VIRCADIA_USE_PREBUILT_QT')):
            print("Using pre-built Qt5")
            return

        # OS dependent information
        system = platform.system()

        if 'Windows' == system:
            self.qtUrl = self.assets_url + '/dependencies/vcpkg/qt5-install-5.12.3-windows3.tar.gz%3FversionId=5ADqP0M0j5ZfimUHrx4zJld6vYceHEsI'
        elif 'Darwin' == system:
            self.qtUrl = self.assets_url + '/dependencies/vcpkg/qt5-install-5.12.3-macos.tar.gz%3FversionId=bLAgnoJ8IMKpqv8NFDcAu8hsyQy3Rwwz'
        elif 'Linux' == system:
            import distro
            dist = distro.linux_distribution()

            if distro.id() == 'ubuntu':
                u_major = int( distro.major_version() )
                u_minor = int( distro.minor_version() )

                if u_major == 16:
                    self.qtUrl = self.assets_url + '/dependencies/vcpkg/qt5-install-5.12.3-ubuntu-16.04-with-symbols.tar.gz'
                elif u_major == 18:
                    self.qtUrl = self.assets_url + '/dependencies/vcpkg/qt5-install-5.12.3-ubuntu-18.04.tar.gz'
                elif u_major == 19 and u_minor == 10:
                    self.qtUrl = self.assets_url + '/dependencies/vcpkg/qt5-install-5.12.6-ubuntu-19.10.tar.xz'
                elif u_major > 19:
                    print("We don't support " + distro.name(pretty=True) + " yet. Perhaps consider helping us out?")
                    raise Exception('LINUX DISTRO IS NOT SUPPORTED YET!!!')
                else:
                    print("Sorry, " + distro.name(pretty=True) + " is old and won't be officially supported. Please consider upgrading.");
                    raise Exception('UNKNOWN LINUX DISTRO VERSION!!!')
            else:
                print("Sorry, " + distro.name(pretty=True) + " is not supported. Please consider helping us out.")
                print("It's also possible to build Qt for your distribution, please see the documentation at:")
                print("https://github.com/kasenvr/project-athena/tree/master/tools/qt-builder")
                raise Exception('UNKNOWN LINUX VERSION!!!')
        else:
            print("System      : " + platform.system())
            print("Architecture: " + platform.architecture())
            print("Machine     : " + platform.machine())
            raise Exception('UNKNOWN OPERATING SYSTEM!!!')
Ejemplo n.º 12
0
def define_components(reqs):
    """Define all of the components"""
    define_common(reqs)
    define_mercury(reqs)
    define_ompi(reqs)

    isal_build = [
        './autogen.sh ',
        './configure --prefix=$ISAL_PREFIX --libdir=$ISAL_PREFIX/lib',
        'make $JOBS_OPT', 'make install'
    ]
    reqs.define(
        'isal',
        retriever=GitRepoRetriever('https://github.com/01org/isa-l.git'),
        commands=isal_build,
        libs=["isal"])
    reqs.define('isal_crypto',
                retriever=GitRepoRetriever("https://github.com/intel/"
                                           "isa-l_crypto"),
                commands=[
                    './autogen.sh ',
                    './configure --prefix=$ISAL_CRYPTO_PREFIX '
                    '--libdir=$ISAL_CRYPTO_PREFIX/lib', 'make $JOBS_OPT',
                    'make install'
                ],
                libs=['isal_crypto'])

    retriever = GitRepoRetriever("https://github.com/pmem/pmdk.git")

    pmdk_build = [
        "make all \"BUILD_RPMEM=n\" \"NDCTL_ENABLE=n\" "
        "\"NDCTL_DISABLE=y\" $JOBS_OPT install "
        "prefix=$PMDK_PREFIX"
    ]

    reqs.define('pmdk',
                retriever=retriever,
                commands=pmdk_build,
                libs=["pmemobj"])

    retriever = GitRepoRetriever("https://github.com/pmodels/argobots.git",
                                 True)
    reqs.define('argobots',
                retriever=retriever,
                commands=[
                    'git clean -dxf ', './autogen.sh',
                    './configure --prefix=$ARGOBOTS_PREFIX CC=gcc'
                    ' --enable-valgrind', 'make $JOBS_OPT',
                    'make $JOBS_OPT install'
                ],
                requires=['valgrind_devel'],
                libs=['abt'],
                headers=['abt.h'])

    if distro.id() == "ubuntu" and int(distro.major_version()) < 20:
        retriever = GitRepoRetriever('https://github.com/libfuse/libfuse')
        reqs.define('fuse',
                    retriever=retriever,
                    commands=['meson $FUSE_SRC --prefix=$FUSE_PREFIX' \
                              ' -D udevrulesdir=$FUSE_PREFIX/udev' \
                              ' -D disable-mtab=True' \
                              ' -D utils=False',
                              '$ninja -v $JOBS_OPT',
                              '$ninja install'],
                    libs=['fuse3'],
                    defines=["FUSE_USE_VERSION=32"],
                    required_progs=['libtoolize', NINJA_PROG],
                    headers=['fuse3/fuse.h'],
                    out_of_src_build=True)
    else:
        reqs.define('fuse',
                    libs=['fuse3'],
                    defines=["FUSE_USE_VERSION=32"],
                    headers=['fuse3/fuse.h'],
                    package='fuse3-devel')

    reqs.define('fio',
                retriever=GitRepoRetriever('https://github.com/axboe/fio.git'),
                commands=[
                    './configure --prefix="$FIO_PREFIX"', 'make $JOBS_OPT',
                    'make install'
                ],
                progs=['genfio', 'fio'])

    retriever = GitRepoRetriever("https://github.com/spdk/spdk.git", True)
    reqs.define('spdk',
                retriever=retriever,
                commands=['./configure --prefix="$SPDK_PREFIX"' \
                          ' --disable-tests --without-vhost --without-crypto' \
                          ' --without-pmdk --without-vpp --without-rbd' \
                          ' --with-rdma --with-shared' \
                          ' --without-iscsi-initiator --without-isal' \
                          ' --without-vtune', 'make $JOBS_OPT', 'make install',
                          'cp dpdk/build/lib/* "$SPDK_PREFIX/lib"',
                          'mkdir -p "$SPDK_PREFIX/share/spdk"',
                          'cp -r include scripts "$SPDK_PREFIX/share/spdk"'],
                libs=['rte_bus_pci'])

    url = 'https://github.com/protobuf-c/protobuf-c/releases/download/' \
        'v1.3.0/protobuf-c-1.3.0.tar.gz'
    web_retriever = WebRetriever(url, "08804f8bdbb3d6d44c2ec9e71e47ef6f")
    reqs.define('protobufc',
                retriever=web_retriever,
                commands=[
                    './configure --prefix=$PROTOBUFC_PREFIX '
                    '--disable-protoc', 'make $JOBS_OPT', 'make install'
                ],
                libs=['protobuf-c'],
                headers=['protobuf-c/protobuf-c.h'])
Ejemplo n.º 13
0
def cmd_setup(args):
    """Setup environment."""

    if not args.dirs:
        args.kernel = False
        args.rdma_core = False
        args.iproute = False

    if args.installs:
        print(""" This setup script will update your hypervisor to latest
 distribution packages and install docker. Please restart
 the hypervisor to complete the installation. """)
        if args.yes is False and utils.query_yes_no("Do you want to proceed?", 'no') is False:
            exit("Exiting ...")

    supported_os = {
            'fedora' : '26',
            'ubuntu' : '16',
            'rhel' : '8',
            'redhat' : '8',
    }

    # Python API stability is dissaster
    # module platform was deprecated https://docs.python.org/3/library/platform.html
    # Luckily enough, they added distro module before removing platform
    try:
        import distro
        distro_id = distro.id()
        distro_v = distro.major_version()
    except ModuleNotFoundError:
        import platform
        distro_id = platform.dist()[0].lower()
        distro_v = platform.dist()[1].split('.')[0]

    if distro_id not in supported_os.keys() or distro_v < supported_os[distro_id]:
        exit("""  Your hypervisor is not supported. Exiting ...""")

    if args.installs:
        setuphv = utils.get_internal_fn('scripts/')
        if distro_id == 'redhat':
            distro_id = 'rhel'
        setuphv += 'setup-hv.' + distro_id
        subprocess.check_call(setuphv)

    utils.init_config_file()
    section = utils.load_config_file()

    if args.dirs:
        for key, value in section.items():
            if args.force:
                subprocess.call(["sudo", "rm", "-rf", value])
            if os.path.exists(value):
                exit("Please remove " + value + " Exiting ...")

            if key == "kernel" and not args.kernel:
                continue
            if key == "rdma-core" and not args.rdma_core:
                continue
            if key == "iproute2" and not args.iproute:
                continue

            if key == 'os':
                continue

            print("Prepare " + key)
            subprocess.call(["sudo", "mkdir", "-p", value])
            subprocess.call(["sudo", "chown", "-R", utils.username() + ":" + utils.group(), value])

            if key == "src" or key == "logs" or key == "ccache":
                continue

            if key == "kernel":
                key = "linux"

            p = subprocess.Popen(
                [
                    "git", "clone", "ssh://" + utils.username() +
                    "@l-gerrit.mtl.labs.mlnx:29418/upstream/" + key, "."
                ],
                cwd=value)
            p.wait()

            p = subprocess.Popen(
                [
                    "scp", "-p", "-P", "29418",
                    utils.username() + "@l-gerrit.mtl.labs.mlnx:hooks/commit-msg",
                    ".git/hooks/"
                ],
                cwd=value)
            p.wait()

            if key == "linux":
                shutil.copy(
                    os.path.join(
                        os.path.dirname(__file__), "../configs/kconfig-kvm"),
                    value + "/.config")
                p = subprocess.Popen(["make", "olddefconfig"], cwd=value)
                p.wait()

    print("Completed, PLEASE RESTART server")
Ejemplo n.º 14
0
import distro
import pytest
from six.moves import urllib

# Static globals
METADATA_KERNEL = 'http://169.254.169.254/latest/meta-data/kernel-id'
FIPS_DISABLED = set(['true', 'TRUE', '1', 'on'])

# Markers
VIRTUALIZATION_MARKERS = set(['hvm', 'paravirutal'])
PLAT_MARKERS = set(['el7'])
FIPS_MARKERS = set(['fips_enabled', 'fips_disabled'])

# Platform-specific globals
PLAT = 'el' + distro.major_version()
FIPS = 'fips_disabled' if os.environ.get('SPEL_DISABLEFIPS') in FIPS_DISABLED \
    else 'fips_enabled'
VIRT = 'hvm'
try:
    urllib.request.urlopen(METADATA_KERNEL)
    VIRT = 'paravirtual'
except urllib.error.URLError:
    pass


def pytest_runtest_setup(item):
    if isinstance(item, pytest.Function):
        if not item.get_closest_marker(PLAT):
            if PLAT_MARKERS.intersection(item.keywords):
                pytest.skip('does not run on platform {0}'.format(PLAT))
Ejemplo n.º 15
0
def get_os_version():
    if os_type_is_linux():
        return distro.major_version(), distro.minor_version()
    raise UnsupportedOsError(f'The platform is not Linux')
Ejemplo n.º 16
0
 def get_major_version():
     major_version = distro.major_version()
     if not major_version:
         major_version = "UNKNOWN"
     return major_version