Exemplo n.º 1
0
def utils(buildsystem, conf_file):
    # utils linking, the first should be redundant.

    symlink(name=os.path.join(buildsystem, 'bin', 'utils'),
            target=os.path.join(os.path.abspath(buildsystem), 'utils'))

    symlink(name=os.path.join(buildsystem, 'makecloth', 'utils'),
            target=os.path.join(os.path.abspath(buildsystem), 'utils'))

    logger.info('initialized utils/ directory.')
Exemplo n.º 2
0
def utils(buildsystem, conf_file):
    # utils linking, the first should be redundant.

    symlink(name=os.path.join(buildsystem, 'bin', 'utils'),
            target=os.path.join(os.path.abspath(buildsystem), 'utils'))

    symlink(name=os.path.join(buildsystem, 'makecloth', 'utils'),
            target=os.path.join(os.path.abspath(buildsystem), 'utils'))

    logger.info('initialized utils/ directory.')
Exemplo n.º 3
0
def fabric(buildsystem, conf_file):
    fab_dir = 'fabfile'

    if os.path.islink(fab_dir):
        os.remove(fab_dir)
    elif os.path.isdir(fab_dir):
        rmtree(fab_dir)

    symlink(name='fabfile', target=os.path.join(buildsystem, 'fabsrc'))

    symlink(name=os.path.join(buildsystem, 'fabsrc', 'utils'),
            target=os.path.join(os.path.abspath(buildsystem), 'utils'))

    logger.info('initialized fabric/ directory.')
Exemplo n.º 4
0
def fabric(buildsystem, conf_file):
    fab_dir = 'fabfile'

    if os.path.islink(fab_dir):
        os.remove(fab_dir)
    elif os.path.isdir(fab_dir):
        rmtree(fab_dir)

    symlink(name='fabfile',
            target=os.path.join(buildsystem, 'fabsrc'))

    symlink(name=os.path.join(buildsystem, 'fabsrc', 'utils'),
            target=os.path.join(os.path.abspath(buildsystem), 'utils'))

    logger.info('initialized fabric/ directory.')
Exemplo n.º 5
0
def config(buildsystem, conf_file):
    # config file injection
    meta_link = os.path.join(buildsystem, 'bin', 'docs_meta.yaml')

    if os.path.exists(meta_link):
        os.remove(meta_link)

    symlink(name=meta_link, target=os.path.join(os.getcwd(), conf_file))

    # config directory
    conf_dir_link = os.path.join(buildsystem, 'config')

    if os.path.exists(conf_dir_link):
        os.remove(conf_dir_link)

    symlink(name=conf_dir_link, target=os.path.dirname(conf_file))

    logger.info('initialized config/ directory.')
Exemplo n.º 6
0
def config(buildsystem, conf_file):
    # config file injection
    meta_link = os.path.join(buildsystem, 'bin', 'docs_meta.yaml')

    if os.path.exists(meta_link):
        os.remove(meta_link)

    symlink(name=meta_link, target=os.path.join(os.getcwd(), conf_file))

    # config directory
    conf_dir_link = os.path.join(buildsystem, 'config')

    if os.path.exists(conf_dir_link):
        os.remove(conf_dir_link)

    symlink(name=conf_dir_link, target=os.path.dirname(conf_file))

    print('[bootstrap]: initialized config/ directory.')
Exemplo n.º 7
0
def utils(buildsystem, conf_file):
    # utils linking, the first should be redundant.

    symlink(name=os.path.join(buildsystem, 'bin', 'utils'),
            target=os.path.join(os.path.abspath(buildsystem), 'utils'))

    symlink(name=os.path.join(buildsystem, 'makecloth', 'utils'),
            target=os.path.join(os.path.abspath(buildsystem), 'utils'))

    symlink(name=os.path.join(buildsystem, 'utils', 'docs_meta.py'),
            target=os.path.join(os.path.abspath(buildsystem), 'bin', 'docs_meta.py'))

    print('[bootstrap]: initialized utils/ directory.')
Exemplo n.º 8
0
def utils(buildsystem, conf_file):
    # utils linking, the first should be redundant.

    symlink(name=os.path.join(buildsystem, 'bin', 'utils'),
            target=os.path.join(os.path.abspath(buildsystem), 'utils'))

    symlink(name=os.path.join(buildsystem, 'makecloth', 'utils'),
            target=os.path.join(os.path.abspath(buildsystem), 'utils'))

    symlink(name=os.path.join(buildsystem, 'utils', 'docs_meta.py'),
            target=os.path.join(os.path.abspath(buildsystem), 'bin',
                                'docs_meta.py'))

    print('[bootstrap]: initialized utils/ directory.')
Exemplo n.º 9
0
def fabric(buildsystem, conf_file):
    fab_dir = 'fabfile'

    if os.path.islink(fab_dir):
        os.remove(fab_dir)
    elif os.path.isdir(fab_dir):
        rmtree(fab_dir)

    symlink(name='fabfile',
            target=os.path.join(buildsystem, 'fabsrc'))

    symlink(name=os.path.join(buildsystem, 'fabsrc', 'utils'),
            target=os.path.join(os.path.abspath(buildsystem), 'utils'))

    symlink(name=os.path.join(buildsystem, 'fabsrc', 'docs_meta.py'),
            target=os.path.join(os.path.abspath(buildsystem), 'bin', 'docs_meta.py'))

    print('[bootstrap]: initialized fabric/ directory.')
Exemplo n.º 10
0
def fabric(buildsystem, conf_file):
    fab_dir = 'fabfile'

    if os.path.islink(fab_dir):
        os.remove(fab_dir)
    elif os.path.isdir(fab_dir):
        rmtree(fab_dir)

    symlink(name='fabfile', target=os.path.join(buildsystem, 'fabsrc'))

    symlink(name=os.path.join(buildsystem, 'fabsrc', 'utils'),
            target=os.path.join(os.path.abspath(buildsystem), 'utils'))

    symlink(name=os.path.join(buildsystem, 'fabsrc', 'docs_meta.py'),
            target=os.path.join(os.path.abspath(buildsystem), 'bin',
                                'docs_meta.py'))

    print('[bootstrap]: initialized fabric/ directory.')
Exemplo n.º 11
0
def primer():
    os.remove(os.path.join(os.getcwd(), 'fabfile'))
    main_build = os.path.abspath(
        os.path.join(os.getcwd(), '..', 'build', 'primer'))
    primer_build = os.path.join(os.getcwd(), 'build')
    primer_conf = os.path.join(os.getcwd(), 'config')

    if not os.path.exists(main_build):
        os.makedirs(main_build)
    elif not os.path.isdir(main_build):
        msg = "{0} is not a directory".format(main_build)
        logger.critical(msg)
        raise Exception(msg)

    if not os.path.islink(primer_build):
        rmtree(primer_build)
    else:
        os.remove(primer_build)

    symlink(name='build', target=main_build)

    symlink(name='fabfile',
            target=os.path.abspath(
                os.path.join(main_build, '..', 'docs-tools', 'fabsrc')))

    symlink(name=os.path.join('build', 'docs-tools'),
            target=os.path.abspath(os.path.join(main_build, '..',
                                                'docs-tools')))

    symlink(name='conf.py',
            target=os.path.abspath(
                os.path.join(main_build, '..', '..', 'conf.py')))

    symlink(name=os.path.join('source', '.static'),
            target=os.path.abspath(
                os.path.join(main_build, '..', '..', 'source', '.static')))

    for conf_fn in ['sphinx.yaml']:
        symlink(name=os.path.join(primer_conf, conf_fn),
                target=os.path.abspath(
                    os.path.join(main_build, '..', '..', 'config', conf_fn)))

    logger.info('initialized "primer" project.')
Exemplo n.º 12
0
def main():
    user = user_input()
    setup_logging(user)

    if user.repo == '[email protected]:mongodb/docs.git' and user.project != 'manual':
        msg = '[test]: project and repo are not correctly matched'
        logger.error(msg)
        exit(1)

    if not os.path.exists('build'):
        os.makedirs('build')
    elif not os.path.isdir('build'):
        logger.warning('build exists but is not a directory. please investigate.')
        os.remove('build')

    root_path = os.path.abspath(os.getcwd())
    build_path = os.path.join('build', user.project)

    command('git remote add origin [email protected]:mongodb/docs-tools.git', ignore=True)
    command('git branch master origin/master', ignore=True)

    if os.path.exists(build_path):
        logger.info('build directory exists. continuing with quasi-incremental build.')
    else:
        logger.info('cloning repository')
        command('git clone {0} {1}'.format(user.repo, build_path))
        logger.info('cloned repository')

    if user.toolchain == 'giza':
        os.chdir('giza')

        try:
            command('python setup.py install')
        except CommandError:
            command('python setup.py install')
        except CommandError:
            command('python setup.py install')
        except CommandError:
            logger.critical('giza installation failed after three attempts. declaring failure.')
            exit(1)

        os.chdir(root_path)
        logger.info('installed giza')

    os.chdir(build_path)
    logger.debug('script working directory is now {0}'.format(os.getcwd()))

    command('git fetch --all')
    logger.debug('git fetched testing repository {0} in {1}'.format(user.project, build_path))

    try:
        command('git checkout {0}'.format(user.branch))
    except CommandError:
        command('git checkout -b {0} origin/{0}'.format(user.branch))
    except CommandError:
        logger.error('branch name {0} does not exist in remote'.format(user.branch))
        exit(1)

    command('git reset --hard HEAD~3')
    logger.debug('re-set testing head 12 commits')
    command('git pull')
    logger.debug('ran "git pull" on testing repo')

    bootstrapped_tools_path = os.path.join('build', 'docs-tools')

    if user.toolchain == 'giza':
        if os.path.exists(bootstrapped_tools_path):
            try:
                os.remove(bootstrapped_tools_path)
            except:
                shutil.rmtree(bootstrapped_tools_path)
    else:
        if not os.path.exists(bootstrapped_tools_path):
            os.makedirs('build')
            logger.debug("{0} does not exist".format(bootstrapped_tools_path))
            symlink(name=bootstrapped_tools_path, target=root_path)
            logger.debug('created tools symlink')
        elif os.path.islink(bootstrapped_tools_path):
            logger.debug("{0} is a link. continuing.".format(bootstrapped_tools_path))
        elif os.path.isdir(bootstrapped_tools_path) and not os.path.islink(bootstrapped_tools_path):
            logger.warning('a tools directory currently exists, removing.')
            shutil.rmtree(bootstrapped_tools_path)
            symlink(name=bootstrapped_tools_path, target=root_path)
            logger.debug('created tools symlink')

    logger.info('bootstrapping.')
    command('python bootstrap.py safe')
    logger.info('moving on to build the publish target.')

    if user.toolchain == 'giza':
        build_task = command('make giza-publish', capture=True, ignore=True)
    elif user.toolchain == 'legacy':
        build_task = command('make publish', capture=True, ignore=True)

    logger.info('completed build task, moving to printing output')

    print_build_output(build_task)

    log_and_propogate_task_return(build_task)
Exemplo n.º 13
0
def main():
    user = user_input()
    setup_logging(user)

    if user.repo == '[email protected]:mongodb/docs.git' and user.project != 'manual':
        msg = '[test]: project and repo are not correctly matched'
        logger.error(msg)
        exit(1)

    if not os.path.exists('build'):
        os.makedirs('build')
    elif not os.path.isdir('build'):
        logger.warning(
            'build exists but is not a directory. please investigate.')
        os.remove('build')

    root_path = os.path.abspath(os.getcwd())
    build_path = os.path.join('build', user.project)

    if os.path.exists(build_path):
        logger.info(
            'build directory exists. continuing with quasi-incremental build.')
    else:
        logger.info('cloning repository')
        command('git clone {0} {1}'.format(user.repo, build_path))
        logger.info('cloned repository')

    os.chdir(build_path)
    logger.debug('script working directory is now {0}'.format(os.getcwd()))

    command('git fetch --all')
    logger.debug('git fetched testing repository {0} in {1}'.format(
        user.project, build_path))

    try:
        command('git checkout {0}'.format(user.branch))
    except CommandError:
        command('git checkout -b {0} origin/{0}'.format(user.branch))
    except CommandError:
        logger.error('branch name {0} does not exist in remote'.format(
            user.branch))
        exit(1)

    command('git reset --hard HEAD~12')
    logger.debug('re-set testing head 12 commits')
    command('git pull')
    logger.debug('ran "git pull" on testing repo')

    bootstrapped_tools_path = os.path.join('build', 'docs-tools')

    if not os.path.exists(bootstrapped_tools_path):
        logger.debug("{0} does not exist".format(bootstrapped_tools_path))
        symlink(name=bootstrapped_tools_path, target=root_path)
        logger.debug('created tools symlink')
    elif os.path.islink(bootstrapped_tools_path):
        logger.debug(
            "{0} is a link. continuing.".format(bootstrapped_tools_path))
    elif os.path.isdir(bootstrapped_tools_path
                       ) and not os.path.islink(bootstrapped_tools_path):
        logger.warning('a tools directory currently exists, removing.')
        shutil.rmtree(bootstrapped_tools_path)
        symlink(name=bootstrapped_tools_path, target=root_path)
        logger.debug('created tools symlink')

    logger.info('bootstrapping.')
    command('python bootstrap.py safe')
    logger.info('moving on to build the publish target.')

    build_task = command('make publish', capture=True, ignore=True)
    logger.info('completed build task, moving to printing output')

    print_build_output(build_task)

    log_and_propogate_task_return(build_task)
Exemplo n.º 14
0
def primer():
    os.remove(os.path.join(os.getcwd(), 'fabfile'))
    main_build = os.path.abspath(os.path.join(os.getcwd(), '..', 'build', 'primer'))
    primer_build = os.path.join(os.getcwd(), 'build')
    primer_conf = os.path.join(os.getcwd(), 'config')

    if not os.path.exists(main_build):
        os.makedirs(main_build)
    elif not os.path.isdir(main_build):
        raise Exception("[ERROR]: {0} is not a directory".format(main_build))

    if not os.path.islink(primer_build):
        rmtree(primer_build)
    else:
        os.remove(primer_build)

    symlink(name='build', target=main_build)

    symlink(name='fabfile',
            target=os.path.abspath(os.path.join(main_build, '..', 'docs-tools', 'fabsrc')))

    symlink(name=os.path.join('build', 'docs-tools'),
            target=os.path.abspath(os.path.join(main_build, '..', 'docs-tools')))

    symlink(name='conf.py',
            target=os.path.abspath(os.path.join(main_build, '..', '..', 'conf.py')))

    symlink(name=os.path.join('source', '.static'),
            target=os.path.abspath(os.path.join(main_build, '..', '..', 'source', '.static')))

    for conf_fn in ['sphinx.yaml']:
        symlink(name=os.path.join(primer_conf, conf_fn),
                target=os.path.abspath(os.path.join(main_build, '..', '..', 'config', conf_fn)))

    print('[bootstrap]: initialized "primer" project.')