Esempio n. 1
0
def main():
    logging.root.setLevel(logging.INFO)
    args = parseArgs()

    all_criteria = parseCriteriaAndCriterionTypes(args.criteria,
                                                  args.criteriontypes)

    #
    # EDD files (aka ".pfw" files)
    #
    parsed_edds = parseEdd(args.edd_files)

    # We need to modify the toplevel configuration file to account for differences
    # between development setup and target (installation) setup, in particular, the
    # TuningMwith ode must be enforced, regardless of what will be allowed on the target
    fake_toplevel_config = tempfile.NamedTemporaryFile(
        mode='w',
        delete=False,
        suffix=".xml",
        prefix="TMPdomainGeneratorPFConfig_")

    install_path = os.path.dirname(os.path.realpath(args.toplevel_config))
    hostConfig.configure(infile=args.toplevel_config,
                         outfile=fake_toplevel_config,
                         structPath=install_path)
    fake_toplevel_config.close()

    # Create the connector. Pipe its input to us in order to write commands;
    # connect its output to stdout in order to have it dump the domains
    # there; connect its error output to stderr.
    connector = subprocess.Popen([
        "domainGeneratorConnector", fake_toplevel_config.name,
        'verbose' if args.verbose else 'no-verbose',
        'validate' if args.validate else 'no-validate', args.schemas_dir
    ],
                                 stdout=sys.stdout,
                                 stdin=subprocess.PIPE,
                                 stderr=sys.stderr)

    initial_settings = None
    if args.initial_settings:
        initial_settings = os.path.realpath(args.initial_settings)

    for command in generateDomainCommands(logging, all_criteria,
                                          initial_settings,
                                          args.xml_domain_files, parsed_edds):
        connector.stdin.write('\0'.join(command))
        connector.stdin.write("\n")

    # Closing the connector's input triggers the domain generation
    connector.stdin.close()
    connector.wait()
    os.remove(fake_toplevel_config.name)
    return connector.returncode
def main():
    logging.root.setLevel(logging.INFO)
    args = parseArgs()

    all_criteria = parseCriteria(args.criteria)

    #
    # EDD files (aka ".pfw" files)
    #
    parsed_edds = parseEdd(args.edd_files)

    # We need to modify the toplevel configuration file to account for differences
    # between development setup and target (installation) setup, in particular, the
    # TuningMwith ode must be enforced, regardless of what will be allowed on the target
    fake_toplevel_config = tempfile.NamedTemporaryFile(mode='w', delete=False, suffix=".xml",
                                                       prefix="TMPdomainGeneratorPFConfig_")

    install_path = os.path.dirname(os.path.realpath(args.toplevel_config))
    hostConfig.configure(
            infile=args.toplevel_config,
            outfile=fake_toplevel_config,
            structPath=install_path)
    fake_toplevel_config.close()

    # Create the connector. Pipe its input to us in order to write commands;
    # connect its output to stdout in order to have it dump the domains
    # there; connect its error output to stderr.
    connector = subprocess.Popen(["domainGeneratorConnector",
                            fake_toplevel_config.name,
                            'verbose' if args.verbose else 'no-verbose',
                            'validate' if args.validate else 'no-validate',
                            args.schemas_dir],
                           stdout=sys.stdout, stdin=subprocess.PIPE, stderr=sys.stderr)

    initial_settings = None
    if args.initial_settings:
        initial_settings = os.path.realpath(args.initial_settings)

    for command in generateDomainCommands(logging, all_criteria, initial_settings,
                                       args.xml_domain_files, parsed_edds):
        connector.stdin.write('\0'.join(command))
        connector.stdin.write("\n")

    # Closing the connector's input triggers the domain generation
    connector.stdin.close()
    connector.wait()
    os.remove(fake_toplevel_config.name)
    return connector.returncode
        try:
            root.propagate()
        except EddParser.MyPropagationError, ex :
            logging.critical(str(ex))
            logging.info("EXIT ON FAILURE")
            exit(1)

        parsed_edds.append((edd_file.name, root))

    # We need to modify the toplevel configuration file to account for differences
    # between development setup and target (installation) setup, in particular, the
    # TuningMode must be enforced, regardless of what will be allowed on the target
    with tempfile.NamedTemporaryFile(mode='w') as fake_toplevel_config:
        install_path = os.path.dirname(os.path.realpath(args.toplevel_config))
        hostConfig.configure(
                infile=args.toplevel_config,
                outfile=fake_toplevel_config,
                structPath=install_path)
        fake_toplevel_config.flush()

        # Create a new Pfw instance
        pfw = PyPfw.ParameterFramework(fake_toplevel_config.name)

        # create and inject all the criteria
        logging.info("Creating all criteria")
        for criterion in all_criteria:
            criterion_type = pfw.createSelectionCriterionType(criterion['inclusive'])

            for numerical, literal in enumerate(criterion['values']):
                if criterion['inclusive']:
                    # inclusive criteria are "bitfields"
                    numerical = 1 << numerical
Esempio n. 4
0
        try:
            root.propagate()
        except EddParser.MyPropagationError, ex:
            logging.critical(str(ex))
            logging.info("EXIT ON FAILURE")
            exit(1)

        parsed_edds.append((edd_file.name, root))

    # We need to modify the toplevel configuration file to account for differences
    # between development setup and target (installation) setup, in particular, the
    # TuningMode must be enforced, regardless of what will be allowed on the target
    with tempfile.NamedTemporaryFile(mode='w') as fake_toplevel_config:
        install_path = os.path.dirname(os.path.realpath(args.toplevel_config))
        hostConfig.configure(infile=args.toplevel_config,
                             outfile=fake_toplevel_config,
                             structPath=install_path)
        fake_toplevel_config.flush()

        # Create a new Pfw instance
        pfw = PyPfw.ParameterFramework(fake_toplevel_config.name)

        # create and inject all the criteria
        logging.info("Creating all criteria")
        for criterion in all_criteria:
            criterion_type = pfw.createSelectionCriterionType(
                criterion['inclusive'])

            for numerical, literal in enumerate(criterion['values']):
                if criterion['inclusive']:
                    # inclusive criteria are "bitfields"