예제 #1
0
def get_image_path(parameters, name):
    return (
        parameters['//releases:root'] / \
        foreman.get_relpath() /
        name /
        ASSERT.not_none(parameters['%s/version' % name]) /
        shipyard2.IMAGE_DIR_IMAGE_FILENAME
    )
예제 #2
0
def get_output_dir_path(parameters, name, version):
    """Get pod or xar dir path under release repo."""
    return (
        parameters['//releases:root'] / \
        foreman.get_relpath() /
        name /
        version
    )
예제 #3
0
파일: build.py 프로젝트: clchiou/garage
def rule2(parameters):

    relpath = get_relpath()
    if relpath != Path('pkg1/pkg2'):
        raise AssertionError(relpath)

    par2 = parameters['par2']
    if par2 != Path('pkg1/pkg2'):
        raise AssertionError(par2)
예제 #4
0
파일: bases.py 프로젝트: clchiou/garage
 def git_clone(parameters):
     repo_path = parameters['//bases:drydock'] / foreman.get_relpath()
     repo_path /= repo_path.name
     git_dir_path = repo_path / '.git'
     if git_dir_path.is_dir():
         LOG.info('skip: git clone: %s', repo_url)
         return
     LOG.info('git clone: %s', repo_url)
     scripts.git_clone(repo_url, repo_path=repo_path, treeish=treeish)
     ASSERT.predicate(git_dir_path, Path.is_dir)
예제 #5
0
 def build(parameters):
     src_path = find_package(
         parameters,
         foreman.get_relpath(),
         sub_directory_path,
     )
     LOG.info('build first-party package: %s', src_path)
     with scripts.using_cwd(src_path):
         scripts.run(['npm', 'install'])
         scripts.run(['npm', 'run', 'build'])
예제 #6
0
 def setup(parameters):
     src_path = ASSERT.predicate(
         _find_project(parameters, foreman.get_relpath()),
         _is_root_project,
     )
     if (src_path / 'gradlew').exists():
         LOG.info('skip: generate gradle wrapper')
         return
     LOG.info('generate gradle wrapper')
     with scripts.using_cwd(src_path):
         scripts.run(['gradle', 'wrapper'])
예제 #7
0
def _should_mount_image_data(image_data_path, name, rules):
    """True if we should mount image-data directory.

    Check presence of the following directories:
    * <image-data>/images/<image-path>/<image-name>.
    * <image-data>/<rule-path>.
    """
    if (image_data_path / foreman.get_relpath() / name).is_dir():
        return True
    for rule in rules:
        if (image_data_path / rule.path).is_dir():
            return True
    return False
예제 #8
0
def build(parameters):
    src_path = parameters['//bases:drydock'] / foreman.get_relpath()
    src_path /= src_path.name
    if (src_path / 'capnpc-java').exists():
        LOG.info('skip: build capnproto-java')
        return
    LOG.info('build capnproto-java')
    bin_path = _get_var_path('exec_prefix') / 'bin'
    header_path = _get_var_path('includedir') / 'capnp'
    with scripts.using_cwd(src_path):
        scripts.make()
        with scripts.using_sudo():
            scripts.cp('capnpc-java', bin_path)
            scripts.cp('compiler/src/main/schema/capnp/java.capnp',
                       header_path)
예제 #9
0
파일: build.py 프로젝트: clchiou/garage
def build(parameters):
    src_path = parameters['//bases:drydock'] / foreman.get_relpath()
    src_path /= src_path.name
    if (src_path / 'c++/.libs/libcapnp.so').exists():
        LOG.info('skip: build capnproto')
        return
    LOG.info('build capnproto')
    with scripts.using_cwd(src_path / 'c++'):
        scripts.run(['autoreconf', '-i'])
        scripts.run(['./configure'])
        # Skip `make check` for now.
        scripts.make()
        with scripts.using_sudo():
            scripts.make(['install'])
            scripts.run(['ldconfig'])
예제 #10
0
파일: build.py 프로젝트: clchiou/garage
def ops_db_client_build(parameters):
    src_path = ASSERT.predicate(
        shipyard2.rules.pythons\
        .find_package(parameters, foreman.get_relpath()) /
        'scripts' /
        'ops-db-client',
        Path.is_file,
    )
    dst_path = Path('/usr/local/bin/ops-db-client')
    if dst_path.exists():
        LOG.info('skip: install ops-db-client')
        return
    LOG.info('install ops-db-client')
    with scripts.using_sudo():
        scripts.cp(src_path, dst_path)
예제 #11
0
def rule1(parameters):

    relpath = get_relpath()
    if relpath != Path('pkg1'):
        raise AssertionError(relpath)

    par1 = parameters['par1']
    if par1 != Path('pkg1'):
        raise AssertionError(par1)

    par2 = parameters['//pkg1/pkg2:par2']
    if par2 != Path('pkg1/pkg2'):
        raise AssertionError(par2)

    # test_build() will check this
    foreman._test_ran = True
예제 #12
0
 def build(parameters):
     src_path = _find_project(parameters, foreman.get_relpath())
     root_path = _find_root_project(src_path)
     ASSERT.false(src_path.samefile(root_path))
     output_path = src_path / ('build/libs/%s-all.jar' % src_path.name)
     task = ':'.join(src_path.relative_to(root_path).parts)
     task = ':%s:shadowJar' % task
     target_dir_path = parameters[root_project + ':packages']
     if (target_dir_path / output_path.name).exists():
         LOG.info('skip: run task %s', task)
         return
     LOG.info('run task %s', task)
     with scripts.using_cwd(root_path):
         scripts.run(['./gradlew', task])
     with scripts.using_sudo():
         scripts.mkdir(target_dir_path)
         scripts.cp(output_path, target_dir_path)
예제 #13
0
파일: build.py 프로젝트: clchiou/garage
def build(parameters):
    src_path = parameters['//bases:drydock'] / foreman.get_relpath()
    src_path /= src_path.name
    build_dir_path = src_path / 'build'
    if build_dir_path.exists():
        LOG.info('skip: build nng')
        return
    LOG.info('build nng')
    scripts.mkdir(build_dir_path)
    with scripts.using_cwd(build_dir_path):
        scripts.run([
            'cmake',
            *('-D', 'BUILD_SHARED_LIBS:BOOL=ON'),
            *('-G', 'Ninja'),
            '..',
        ])
        scripts.run(['ninja'])
        # Skip `ninja test` for now.
        with scripts.using_sudo():
            scripts.run(['ninja', 'install'])
            scripts.run(['ldconfig'])
예제 #14
0
파일: build.py 프로젝트: clchiou/garage
def _get_src_path(parameters):
    src_parent_path = parameters['//bases:drydock'] / foreman.get_relpath()
    return src_parent_path / src_parent_path.name
예제 #15
0
파일: build.py 프로젝트: clchiou/garage
def build(parameters):
    src_path = parameters['//bases:drydock'] / foreman.get_relpath()
    src_path /= src_path.name
    scripts.export_path('PATH', src_path)
    with scripts.using_cwd(src_path):
        scripts.run(['gclient'])  # This updates depot_tools.
예제 #16
0
파일: bases.py 프로젝트: clchiou/garage
def _archive_get_output_path(parameters, archive):
    return (parameters['//bases:drydock'] / foreman.get_relpath() /
            archive.output)
예제 #17
0
파일: bases.py 프로젝트: clchiou/garage
def _archive_get_archive_path(parameters, archive):
    return (parameters['//bases:drydock'] / foreman.get_relpath() /
            archive.filename)
예제 #18
0
파일: build.py 프로젝트: clchiou/garage
from pathlib import Path

from foreman import define_parameter, rule, get_relpath

if __name__ != 'pkg1.pkg2':
    raise AssertionError(__name__)

if not __file__.endswith(
        'foreman/tests/testdata/test_command/pkg1/pkg2/build.py'):
    raise AssertionError(__file__)

relpath = get_relpath()
if relpath != Path('pkg1/pkg2'):
    raise AssertionError(relpath)

define_parameter('par2').with_derive(lambda ps: get_relpath())


@rule
def rule2(parameters):

    relpath = get_relpath()
    if relpath != Path('pkg1/pkg2'):
        raise AssertionError(relpath)

    par2 = parameters['par2']
    if par2 != Path('pkg1/pkg2'):
        raise AssertionError(par2)
예제 #19
0
def build(parameters):
    scripts.export_path(
        'PATH',
        parameters['//bases:drydock'] / foreman.get_relpath() /
        parameters['archive'].output / 'bin',
    )
예제 #20
0
def get_output_label(name):
    return foreman.Label.parse(
        '//%s:%s' % ('/'.join(foreman.get_relpath().parts[1:]), name))
예제 #21
0
파일: pythons.py 프로젝트: clchiou/garage
 def build(parameters):
     src_path = find_package(parameters, foreman.get_relpath())
     LOG.info('export first-party host package: %s', src_path)
     scripts.export_path('PYTHONPATH', src_path)
예제 #22
0
파일: pythons.py 프로젝트: clchiou/garage
 def build(parameters):
     src_path = find_package(parameters, foreman.get_relpath())
     LOG.info('build first-party package: %s', src_path)
     with scripts.using_cwd(src_path):
         _build(parameters, make_global_options)
예제 #23
0
파일: build.py 프로젝트: clchiou/garage
from foreman import define_parameter, define_rule, get_relpath


if __name__ != 'pkg1.pkg2':
    raise AssertionError('incorrect __name__: %s' % __name__)


if not __file__.endswith('tests/testdata/path1/pkg1/pkg2/build.py'):
    raise AssertionError('incorrect __file__: %s' % __file__)


if str(get_relpath()) != 'pkg1/pkg2':
    raise AssertionError('incorrect relpath: %s' % get_relpath())


COUNT = 0
if COUNT > 0:
    raise AssertionError('load more than once')
COUNT += 1


define_parameter('par_x')


define_rule('rule_x').depend('//pkg1:pkg1')
예제 #24
0
def _get_src_path(parameters):
    return (parameters['//bases:drydock'] / foreman.get_relpath() /
            parameters['archive'].output)
예제 #25
0
파일: build.py 프로젝트: clchiou/garage
def _get_config_path(ps):
    return ps['//bases:drydock'] / foreman.get_relpath() / 'config.json'