Esempio n. 1
0
def create_bare_config(logger, use_projects, extra_indexer_options=None):
    """
    Create bare configuration file with a few basic settings.
    """

    logger.info(
        'Creating bare configuration in {}'.format(OPENGROK_CONFIG_FILE))
    indexer_options = [
        '-s', OPENGROK_SRC_ROOT, '-d', OPENGROK_DATA_ROOT, '-c',
        '/usr/local/bin/ctags', '--remote', 'on', '-H', '-S', '-W',
        OPENGROK_CONFIG_FILE, '--noIndex'
    ]

    if extra_indexer_options:
        if type(extra_indexer_options) is not list:
            raise Exception("extra_indexer_options has to be a list")
        indexer_options.extend(extra_indexer_options)
    if use_projects:
        indexer_options.append('-P')
    indexer = Indexer(indexer_options,
                      jar=OPENGROK_JAR,
                      logger=logger,
                      doprint=True)
    indexer.execute()
    ret = indexer.getretcode()
    if ret != SUCCESS_EXITVAL:
        logger.error('Command returned {}'.format(ret))
        logger.error(indexer.geterroutput())
        raise Exception("Failed to create bare configuration")
Esempio n. 2
0
def create_bare_config(logger):
    """
    Create bare configuration file with a few basic settings.
    """

    logger.info(
        'Creating bare configuration in {}'.format(OPENGROK_CONFIG_FILE))
    indexer = Indexer([
        '-s', OPENGROK_SRC_ROOT, '-d', OPENGROK_DATA_ROOT, '-c',
        '/usr/local/bin/ctags', '--remote', 'on', '-P', '-H', '-W',
        OPENGROK_CONFIG_FILE, '--noIndex'
    ],
                      jar=os.path.join(OPENGROK_LIB_DIR, 'opengrok.jar'),
                      logger=logger,
                      doprint=True)
    indexer.execute()
    ret = indexer.getretcode()
    if ret != SUCCESS_EXITVAL:
        logger.error('Command returned {}'.format(ret))
        logger.error(indexer.geterroutput())
        raise Exception("Failed to create bare configuration")