Ejemplo n.º 1
0
def setup_tinfoil(config_only=False, basepath=None, tracking=False):
    """Initialize tinfoil api from bitbake"""
    import scriptpath
    orig_cwd = os.path.abspath(os.curdir)
    try:
        if basepath:
            os.chdir(basepath)
        bitbakepath = scriptpath.add_bitbake_lib_path()
        if not bitbakepath:
            logger.error("Unable to find bitbake by searching parent directory of this script or PATH")
            sys.exit(1)

        import bb.tinfoil
        tinfoil = bb.tinfoil.Tinfoil(tracking=tracking)
        try:
            tinfoil.logger.setLevel(logger.getEffectiveLevel())
            tinfoil.prepare(config_only)
        except bb.tinfoil.TinfoilUIException:
            tinfoil.shutdown()
            raise DevtoolError('Failed to start bitbake environment')
        except:
            tinfoil.shutdown()
            raise
    finally:
        os.chdir(orig_cwd)
    return tinfoil
Ejemplo n.º 2
0
def setup_tinfoil(config_only=False, basepath=None, tracking=False):
    """Initialize tinfoil api from bitbake"""
    import scriptpath
    orig_cwd = os.path.abspath(os.curdir)
    try:
        if basepath:
            os.chdir(basepath)
        bitbakepath = scriptpath.add_bitbake_lib_path()
        if not bitbakepath:
            logger.error("Unable to find bitbake by searching parent directory of this script or PATH")
            sys.exit(1)

        import bb.tinfoil
        tinfoil = bb.tinfoil.Tinfoil(tracking=tracking)
        try:
            tinfoil.prepare(config_only)
            tinfoil.logger.setLevel(logger.getEffectiveLevel())
        except bb.tinfoil.TinfoilUIException:
            tinfoil.shutdown()
            raise DevtoolError('Failed to start bitbake environment')
        except:
            tinfoil.shutdown()
            raise
    finally:
        os.chdir(orig_cwd)
    return tinfoil
Ejemplo n.º 3
0
def main():
    parser = argparse_oe.ArgumentParser(description="devtool stress tester",
                                        epilog="Use %(prog)s <subcommand> --help to get help on a specific command")
    parser.add_argument('-d', '--debug', help='Enable debug output', action='store_true')
    parser.add_argument('-r', '--resume-from', help='Resume from specified recipe', metavar='PN')
    parser.add_argument('-o', '--only', help='Only test specified recipes (comma-separated without spaces, wildcards allowed)', metavar='PNLIST')
    parser.add_argument('-s', '--skip', help='Skip specified recipes (comma-separated without spaces, wildcards allowed)', metavar='PNLIST')
    parser.add_argument('-c', '--skip-classes', help='Skip recipes inheriting specified classes (comma-separated) - default %(default)s', metavar='CLASSLIST', default='native,nativesdk,cross,cross-canadian,image,populate_sdk,meta,packagegroup')
    subparsers = parser.add_subparsers(title='subcommands', metavar='<subcommand>')

    parser_modify = subparsers.add_parser('modify',
                                          help='Run "devtool modify" followed by a build with bitbake on matching recipes',
                                          description='Runs "devtool modify" followed by a build with bitbake on matching recipes')
    parser_modify.set_defaults(func=stress_modify)

    parser_extract = subparsers.add_parser('extract',
                                           help='Run "devtool extract" on matching recipes',
                                           description='Runs "devtool extract" on matching recipes')
    parser_extract.set_defaults(func=stress_extract)

    args = parser.parse_args()

    if args.debug:
        logger.setLevel(logging.DEBUG)

    import scriptpath
    bitbakepath = scriptpath.add_bitbake_lib_path()
    if not bitbakepath:
        logger.error("Unable to find bitbake by searching parent directory of this script or PATH")
        return 1
    logger.debug('Found bitbake path: %s' % bitbakepath)

    ret = args.func(args)
Ejemplo n.º 4
0
def main():
    parser = argparse_oe.ArgumentParser(description="devtool stress tester",
                                        epilog="Use %(prog)s <subcommand> --help to get help on a specific command")
    parser.add_argument('-d', '--debug', help='Enable debug output', action='store_true')
    parser.add_argument('-r', '--resume-from', help='Resume from specified recipe', metavar='PN')
    parser.add_argument('-o', '--only', help='Only test specified recipes (comma-separated without spaces, wildcards allowed)', metavar='PNLIST')
    parser.add_argument('-s', '--skip', help='Skip specified recipes (comma-separated without spaces, wildcards allowed)', metavar='PNLIST')
    parser.add_argument('-c', '--skip-classes', help='Skip recipes inheriting specified classes (comma-separated) - default %(default)s', metavar='CLASSLIST', default='native,nativesdk,cross,cross-canadian,image,populate_sdk,meta,packagegroup')
    subparsers = parser.add_subparsers(title='subcommands', metavar='<subcommand>')
    subparsers.required = True

    parser_modify = subparsers.add_parser('modify',
                                          help='Run "devtool modify" followed by a build with bitbake on matching recipes',
                                          description='Runs "devtool modify" followed by a build with bitbake on matching recipes')
    parser_modify.set_defaults(func=stress_modify)

    parser_extract = subparsers.add_parser('extract',
                                           help='Run "devtool extract" on matching recipes',
                                           description='Runs "devtool extract" on matching recipes')
    parser_extract.set_defaults(func=stress_extract)

    args = parser.parse_args()

    if args.debug:
        logger.setLevel(logging.DEBUG)

    import scriptpath
    bitbakepath = scriptpath.add_bitbake_lib_path()
    if not bitbakepath:
        logger.error("Unable to find bitbake by searching parent directory of this script or PATH")
        return 1
    logger.debug('Found bitbake path: %s' % bitbakepath)

    ret = args.func(args)
Ejemplo n.º 5
0
def main():
    parser = argparse_oe.ArgumentParser(
        description="devtool stress tester", epilog="Use %(prog)s <subcommand> --help to get help on a specific command"
    )
    parser.add_argument("-d", "--debug", help="Enable debug output", action="store_true")
    parser.add_argument("-r", "--resume-from", help="Resume from specified recipe", metavar="PN")
    parser.add_argument(
        "-o",
        "--only",
        help="Only test specified recipes (comma-separated without spaces, wildcards allowed)",
        metavar="PNLIST",
    )
    parser.add_argument(
        "-s",
        "--skip",
        help="Skip specified recipes (comma-separated without spaces, wildcards allowed)",
        metavar="PNLIST",
    )
    parser.add_argument(
        "-c",
        "--skip-classes",
        help="Skip recipes inheriting specified classes (comma-separated) - default %(default)s",
        metavar="CLASSLIST",
        default="native,nativesdk,cross,cross-canadian,image,populate_sdk,meta,packagegroup",
    )
    subparsers = parser.add_subparsers(title="subcommands", metavar="<subcommand>")

    parser_modify = subparsers.add_parser(
        "modify",
        help='Run "devtool modify" followed by a build with bitbake on matching recipes',
        description='Runs "devtool modify" followed by a build with bitbake on matching recipes',
    )
    parser_modify.set_defaults(func=stress_modify)

    parser_extract = subparsers.add_parser(
        "extract",
        help='Run "devtool extract" on matching recipes',
        description='Runs "devtool extract" on matching recipes',
    )
    parser_extract.set_defaults(func=stress_extract)

    args = parser.parse_args()

    if args.debug:
        logger.setLevel(logging.DEBUG)

    import scriptpath

    bitbakepath = scriptpath.add_bitbake_lib_path()
    if not bitbakepath:
        logger.error("Unable to find bitbake by searching parent directory of this script or PATH")
        return 1
    logger.debug("Found bitbake path: %s" % bitbakepath)

    ret = args.func(args)
Ejemplo n.º 6
0
def setup_tinfoil():
    """Initialize tinfoil api from bitbake"""
    import scriptpath
    bitbakepath = scriptpath.add_bitbake_lib_path()
    if not bitbakepath:
        logger.error("Unable to find bitbake by searching parent directory of this script or PATH")
        sys.exit(1)

    import bb.tinfoil
    tinfoil = bb.tinfoil.Tinfoil()
    tinfoil.prepare(False)
    tinfoil.logger.setLevel(logger.getEffectiveLevel())
    return tinfoil
Ejemplo n.º 7
0
def setup_tinfoil():
    import scriptpath
    bitbakepath = scriptpath.add_bitbake_lib_path()
    if not bitbakepath:
        logger.error("Unable to find bitbake by searching parent directory of this script or PATH")
        sys.exit(1)

    import bb.tinfoil
    import logging
    tinfoil = bb.tinfoil.Tinfoil()
    tinfoil.prepare(False)
    tinfoil.logger.setLevel(logging.WARNING)
    return tinfoil
Ejemplo n.º 8
0
    def setup_tinfoil(cls, config_only=False):
        """Initialize tinfoil api from bitbake"""

        # import relevant libraries
        try:
            scripts_path = os.path.join(pti.repodir, 'scripts', 'lib')
            if scripts_path not in sys.path:
                sys.path.insert(0, scripts_path)
            import scriptpath
            scriptpath.add_bitbake_lib_path()
            import bb.tinfoil
        except ImportError:
            raise PatchtestOEError('Could not import tinfoil module')

        orig_cwd = os.path.abspath(os.curdir)

        # Load tinfoil
        tinfoil = None
        try:
            builddir = os.environ.get('BUILDDIR')
            if not builddir:
                logger.warn('Bitbake environment not loaded?')
                return tinfoil
            os.chdir(builddir)
            tinfoil = bb.tinfoil.Tinfoil()
            tinfoil.prepare(config_only=config_only)
        except bb.tinfoil.TinfoilUIException as te:
            if tinfoil:
                tinfoil.shutdown()
            raise PatchtestOEError(
                'Could not prepare properly tinfoil (TinfoilUIException)')
        except Exception as e:
            if tinfoil:
                tinfoil.shutdown()
            raise e
        finally:
            os.chdir(orig_cwd)

        return tinfoil
Ejemplo n.º 9
0
def setup_tinfoil(config_only=False):
    """Initialize tinfoil api from bitbake"""
    import scriptpath
    bitbakepath = scriptpath.add_bitbake_lib_path()
    if not bitbakepath:
        logger.error("Unable to find bitbake by searching parent directory of this script or PATH")
        sys.exit(1)

    import bb.tinfoil
    tinfoil = bb.tinfoil.Tinfoil()
    tinfoil.prepare(config_only)
    tinfoil.logger.setLevel(logger.getEffectiveLevel())
    return tinfoil
Ejemplo n.º 10
0
def setup_tinfoil(config_only=False, basepath=None, tracking=False):
    """Initialize tinfoil api from bitbake"""
    import scriptpath
    orig_cwd = os.path.abspath(os.curdir)
    if basepath:
        os.chdir(basepath)
    bitbakepath = scriptpath.add_bitbake_lib_path()
    if not bitbakepath:
        logger.error("Unable to find bitbake by searching parent directory of this script or PATH")
        sys.exit(1)

    import bb.tinfoil
    tinfoil = bb.tinfoil.Tinfoil(tracking=tracking)
    tinfoil.prepare(config_only)
    tinfoil.logger.setLevel(logger.getEffectiveLevel())
    os.chdir(orig_cwd)
    return tinfoil
Ejemplo n.º 11
0
def setup_tinfoil(config_only=False, basepath=None, tracking=False):
    """Initialize tinfoil api from bitbake"""
    import scriptpath
    orig_cwd = os.path.abspath(os.curdir)
    if basepath:
        os.chdir(basepath)
    bitbakepath = scriptpath.add_bitbake_lib_path()
    if not bitbakepath:
        logger.error(
            "Unable to find bitbake by searching parent directory of this script or PATH"
        )
        sys.exit(1)

    import bb.tinfoil
    tinfoil = bb.tinfoil.Tinfoil(tracking=tracking)
    tinfoil.prepare(config_only)
    tinfoil.logger.setLevel(logger.getEffectiveLevel())
    os.chdir(orig_cwd)
    return tinfoil
Ejemplo n.º 12
0
import os
import sys
import argparse
import logging
import time
import signal
import shutil
import collections

scripts_path = os.path.dirname(os.path.realpath(__file__))
lib_path = scripts_path + '/lib'
sys.path = sys.path + [lib_path]
import scriptutils
import scriptpath
scriptpath.add_oe_lib_path()
scriptpath.add_bitbake_lib_path()

from compatlayer import LayerType, detect_layers, add_layer, get_signatures
from oeqa.utils.commands import get_bb_vars

PROGNAME = 'yocto-compat-layer'
CASES_PATHS = [
    os.path.join(os.path.abspath(os.path.dirname(__file__)), 'lib',
                 'compatlayer', 'cases')
]
logger = scriptutils.logger_create(PROGNAME, stream=sys.stdout)


def test_layer_compatibility(td, layer):
    from compatlayer.context import CompatLayerTestContext
    logger.info("Starting to analyze: %s" % layer['name'])
Ejemplo n.º 13
0
import sys
import os
import subprocess
import urllib.request


# Allow importing scripts/lib modules
scripts_path = os.path.abspath(os.path.dirname(os.path.realpath(__file__)) + '/..')
lib_path = scripts_path + '/lib'
sys.path = sys.path + [lib_path]
import scriptpath
import scriptutils

# Allow importing bitbake modules
bitbakepath = scriptpath.add_bitbake_lib_path()

import bb.tinfoil

logger = scriptutils.logger_create('verify_homepage')

def wgetHomepage(pn, homepage):
    result = subprocess.call('wget ' + '-q -T 5 -t 1 --spider ' + homepage, shell = True)
    if result:
        logger.warning("%s: failed to verify HOMEPAGE: %s " % (pn, homepage))
        return 1
    else:
        return 0

def verifyHomepage(bbhandler):
    pkg_pn = bbhandler.cooker.recipecaches[''].pkg_pn
Ejemplo n.º 14
0
def cmd_in_path(cmd, path):
    import scriptpath

    scriptpath.add_bitbake_lib_path()

    return bb.utils.which(path, cmd) != "" or False
Ejemplo n.º 15
0
def cmd_in_path(cmd, path):
    import scriptpath

    scriptpath.add_bitbake_lib_path()

    return bb.utils.which(path, cmd) != "" or False