当前位置: 首页>>代码示例>>Python>>正文


Python build_pack_utils.BuildPack类代码示例

本文整理汇总了Python中build_pack_utils.BuildPack的典型用法代码示例。如果您正苦于以下问题:Python BuildPack类的具体用法?Python BuildPack怎么用?Python BuildPack使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了BuildPack类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_compile

 def test_compile(self):
     bp = BuildPack({
         'BUILD_DIR': self.build_dir,
         'CACHE_DIR': self.cache_dir
     }, '.')
     self.copy_build_pack(bp.bp_dir)
     try:
         output = ''
         output = bp._compile()
         self.assert_exists(self.build_dir, 'META-INF')
         self.assert_exists(self.build_dir, 'WEB-INF')
         self.assert_exists(self.build_dir, '.bp')
         self.assert_exists(self.build_dir, '.profile.d/bp_env_vars.sh')
         self.assert_exists(self.build_dir, '.procs')
         self.assert_exists(self.build_dir, '.java-buildpack')
         self.assert_exists(self.build_dir, '.java-buildpack.log')
         self.assert_exists(self.build_dir, 'start.sh')
         # check release command
         with open(os.path.join(self.build_dir, '.procs')) as fp:
             procs = [l.strip() for l in fp.readlines()]
         eq_(1, len(procs))
         eq_(True, procs[0].startswith('web:'))
         eq_(True, procs[0].find('http.port=$PORT') >= 0)
         eq_(True, procs[0].find('MetaspaceSize=64M') >= 0)
         eq_(True, procs[0].find('OnOutOfMemoryError') >= 0)
     except Exception, e:
         print str(e)
         if hasattr(e, 'output'):
             print e.output
         if output:
             print output
         raise
开发者ID:dmikusa-pivotal,项目名称:cf-download-build-pack,代码行数:32,代码来源:test_compile.py

示例2: test_detect_with_asp_net_app

 def test_detect_with_asp_net_app(self):
     shutil.copytree('tests/data/app-asp-net', self.build_dir)
     bp = BuildPack({
         'BUILD_DIR': self.build_dir,
         'CACHE_DIR': self.cache_dir,
         'WEBDIR': 'htdocs'
     }, '.')
     # simulate clone, makes debugging easier
     os.rmdir(bp.bp_dir)
     shutil.copytree('.', bp.bp_dir,
                     ignore=shutil.ignore_patterns("binaries",
                                                   "env",
                                                   "tests"))
     try:
         bp._detect().strip()
     except Exception, e:
         print e.output
         assert re.match('no', e.output)
开发者ID:GitFabIOT,项目名称:php-buildpack,代码行数:18,代码来源:test_detect.py

示例3: test_detect_static

 def test_detect_static(self):
     shutil.copytree('tests/data/app-3', self.build_dir)
     bp = BuildPack({
         'BUILD_DIR': self.build_dir,
         'CACHE_DIR': self.cache_dir,
         'WEBDIR': 'htdocs'
     }, '.')
     # simulate clone, makes debugging easier
     os.rmdir(bp.bp_dir)
     shutil.copytree('.', bp.bp_dir,
                     ignore=shutil.ignore_patterns("binaries",
                                                   "env",
                                                   "tests"))
     try:
         output = bp._detect().strip()
         assert re.match('php*', output)
     except Exception, e:
         print str(e)
         if hasattr(e, 'output'):
             print e.output
         raise
开发者ID:4Queen,项目名称:php-buildpack,代码行数:21,代码来源:test_detect.py

示例4: test_detect_php

 def test_detect_php(self):
     shutil.copytree('tests/data/app-2', self.build_dir)
     bp = BuildPack({
         'BUILD_DIR': self.build_dir,
         'CACHE_DIR': self.cache_dir
     }, '.')
     # simulate clone, makes debugging easier
     os.rmdir(bp.bp_dir)
     shutil.copytree('.', bp.bp_dir,
                     ignore=shutil.ignore_patterns("binaries",
                                                   "env",
                                                   "tests"))
     try:
         output = bp._detect().strip()
         eq_('PHP', output)
     except Exception, e:
         print str(e)
         if hasattr(e, 'output'):
             print e.output
         if output:
             print output
         raise
开发者ID:Jampire,项目名称:cf-php-build-pack,代码行数:22,代码来源:test_detect.py

示例5: compile

def compile(install):
    ctx = install.builder._ctx
    # setup logs director for bp
    os.makedirs(os.path.join(ctx['BUILD_DIR'], 'logs'))
    # read links file
    with open(os.path.join(ctx['BUILD_DIR'], 'download-list.txt')) as fp:
        links = [line.strip() for line in fp.readlines()]
    log.info("Loaded %d downloads.", len(links))
    # download links
    for link in links:
        log.debug("Preparing to download [%s]", link)
        if link.startswith('http'):
            download(install, link)
        else:
            print 'Not sure how to handle [%s], skipping.' % link
    log.info("All downloads complete.")
    # read build pack
    with open(os.path.join(ctx['BUILD_DIR'], 'build-pack.txt')) as fp:
        bp_link = fp.read().strip()
    log.info("Running build pack [%s]", bp_link)
    if bp_link.find('#') >= 0:
        (bp_link, bp_ver) = bp_link.split('#')
        bp = BuildPack(ctx, bp_link, bp_ver)
    else:
        bp = BuildPack(ctx, bp_link)
    # run build pack
    log.info("Cloning build pack")
    bp._clone()
    log.info("Compiling build pack")
    bp._compile()
    # save output from release
    log.info("Running release script")
    release_path = os.path.join(tempfile.gettempdir(), 'release.out')
    with open(release_path, 'wt') as fp:
        result = bp._release()
        log.debug("Build pack release returned [%s]", result)
        fp.write(result)
    log.debug("Compile done.")
    return 0
开发者ID:dmikusa-pivotal,项目名称:cf-download-build-pack,代码行数:39,代码来源:extension.py

示例6: test_compile_httpd

 def test_compile_httpd(self):
     bp = BuildPack({
         'BUILD_DIR': self.build_dir,
         'CACHE_DIR': self.cache_dir
     }, '.')
     # simulate clone, makes debugging easier
     os.rmdir(bp.bp_dir)
     shutil.copytree('.', bp.bp_dir,
                     ignore=shutil.ignore_patterns("binaries",
                                                   "env",
                                                   "tests"))
     # set web server
     self.set_web_server(os.path.join(bp.bp_dir,
                                       'defaults',
                                       'options.json'),
                          'httpd')
     try:
         output = ''
         output = bp._compile()
         outputLines = output.split('\n')
         eq_(21, len([l for l in outputLines if l.startswith('Downloaded')]))
         eq_(2, len([l for l in outputLines if l.startswith('Installing')]))
         eq_(True, outputLines[-1].startswith('Finished:'))
         # Test scripts and config
         self.assert_exists(self.build_dir, 'start.sh')
         with open(os.path.join(self.build_dir, 'start.sh')) as start:
             lines = [line.strip() for line in start.readlines()]
             eq_(5, len(lines))
             eq_('export PYTHONPATH=$HOME/.bp/lib', lines[0])
             eq_('$HOME/.bp/bin/rewrite "$HOME/httpd/conf"', lines[1])
             eq_('$HOME/.bp/bin/rewrite "$HOME/php/etc"', lines[2])
             eq_('$HOME/.bp/bin/rewrite "$HOME/.env"', lines[3])
             eq_('$HOME/.bp/bin/start', lines[4])
         # Check scripts and bp are installed
         self.assert_exists(self.build_dir, '.bp', 'bin', 'rewrite')
         self.assert_exists(self.build_dir, '.bp', 'lib')
         bpu_path = os.path.join(self.build_dir, '.bp', 'lib',
                                 'build_pack_utils')
         eq_(22, len(os.listdir(bpu_path)))
         self.assert_exists(bpu_path, 'utils.py')
         self.assert_exists(bpu_path, 'process.py')
         # Check env and procs files
         self.assert_exists(self.build_dir, '.env')
         self.assert_exists(self.build_dir, '.procs')
         with open(os.path.join(self.build_dir, '.env')) as env:
             lines = [line.strip() for line in env.readlines()]
             eq_(2, len(lines))
             eq_('[email protected]', lines[0])
             eq_('[email protected]_LIBRARY_PATH:@HOME/php/lib',
                 lines[1])
         with open(os.path.join(self.build_dir, '.procs')) as procs:
             lines = [line.strip() for line in procs.readlines()]
             eq_(3, len(lines))
             eq_('httpd: $HOME/httpd/bin/apachectl -f '
                 '"$HOME/httpd/conf/httpd.conf" -k start -DFOREGROUND',
                 lines[0])
             eq_('php-fpm: $HOME/php/sbin/php-fpm -p "$HOME/php/etc" -y '
                 '"$HOME/php/etc/php-fpm.conf"', lines[1])
             eq_('php-fpm-logs: tail -F $HOME/../logs/php-fpm.log',
                 lines[2])
         # Check htdocs and config
         self.assert_exists(self.build_dir, 'htdocs')
         self.assert_exists(self.build_dir, '.bp-config')
         self.assert_exists(self.build_dir, '.bp-config', 'options.json')
         # Test HTTPD
         self.assert_exists(self.build_dir)
         self.assert_exists(self.build_dir, 'httpd')
         self.assert_exists(self.build_dir, 'httpd', 'conf')
         self.assert_exists(self.build_dir, 'httpd', 'conf', 'httpd.conf')
         self.assert_exists(self.build_dir, 'httpd', 'conf', 'extra')
         self.assert_exists(self.build_dir, 'httpd', 'conf',
                            'extra', 'httpd-modules.conf')
         self.assert_exists(self.build_dir, 'httpd', 'conf',
                            'extra', 'httpd-remoteip.conf')
         self.assert_exists(self.build_dir, 'httpd', 'modules',
                            'mod_authz_core.so')
         self.assert_exists(self.build_dir, 'httpd', 'modules',
                            'mod_authz_host.so')
         self.assert_exists(self.build_dir, 'httpd', 'modules',
                            'mod_dir.so')
         self.assert_exists(self.build_dir, 'httpd', 'modules',
                            'mod_env.so')
         self.assert_exists(self.build_dir, 'httpd', 'modules',
                            'mod_log_config.so')
         self.assert_exists(self.build_dir, 'httpd', 'modules',
                            'mod_mime.so')
         self.assert_exists(self.build_dir, 'httpd', 'modules',
                            'mod_mpm_event.so')
         self.assert_exists(self.build_dir, 'httpd', 'modules',
                            'mod_proxy.so')
         self.assert_exists(self.build_dir, 'httpd', 'modules',
                            'mod_proxy_fcgi.so')
         self.assert_exists(self.build_dir, 'httpd', 'modules',
                            'mod_reqtimeout.so')
         self.assert_exists(self.build_dir, 'httpd', 'modules',
                            'mod_unixd.so')
         self.assert_exists(self.build_dir, 'httpd', 'modules',
                            'mod_remoteip.so')
         self.assert_exists(self.build_dir, 'httpd', 'modules',
                            'mod_rewrite.so')
#.........这里部分代码省略.........
开发者ID:NobleNoob,项目名称:buildpack,代码行数:101,代码来源:test_compile.py

示例7: test_compile_stand_alone

 def test_compile_stand_alone(self):
     bp = BuildPack({
         'BUILD_DIR': self.build_dir,
         'CACHE_DIR': self.cache_dir
     }, '.')
     # simulate clone, makes debugging easier
     os.rmdir(bp.bp_dir)
     shutil.copytree('.', bp.bp_dir,
                     ignore=shutil.ignore_patterns("binaries",
                                                   "env",
                                                   "tests"))
     # set web server & php version
     optsFile = os.path.join(bp.bp_dir, 'defaults', 'options.json')
     self.set_web_server(optsFile, 'none')
     self.set_php_version(optsFile, '5.4.26-dev')
     try:
         output = ''
         output = bp._compile()
         # Test Output
         outputLines = output.split('\n')
         eq_(6, len([l for l in outputLines if l.startswith('Downloaded')]))
         eq_(1, len([l for l in outputLines if l.startswith('No Web')]))
         eq_(1, len([l for l in outputLines if l.startswith('Installing PHP')]))
         eq_(1, len([l for l in outputLines if l.find('php-cli') >= 0]))
         eq_(True, outputLines[-1].startswith('Finished:'))
         # Test scripts and config
         self.assert_exists(self.build_dir, 'start.sh')
         with open(os.path.join(self.build_dir, 'start.sh')) as start:
             lines = [line.strip() for line in start.readlines()]
             eq_(4, len(lines))
             eq_('export PYTHONPATH=$HOME/.bp/lib', lines[0])
             eq_('$HOME/.bp/bin/rewrite "$HOME/php/etc"', lines[1])
             eq_('$HOME/.bp/bin/rewrite "$HOME/.env"', lines[2])
             eq_('$HOME/.bp/bin/start', lines[3])
         # Check scripts and bp are installed
         self.assert_exists(self.build_dir, '.bp', 'bin', 'rewrite')
         self.assert_exists(self.build_dir, '.bp', 'lib')
         bpu_path = os.path.join(self.build_dir, '.bp', 'lib',
                                 'build_pack_utils')
         eq_(22, len(os.listdir(bpu_path)))
         self.assert_exists(bpu_path, 'utils.py')
         self.assert_exists(bpu_path, 'process.py')
         # Check env and procs files
         self.assert_exists(self.build_dir, '.env')
         self.assert_exists(self.build_dir, '.procs')
         with open(os.path.join(self.build_dir, '.env')) as env:
             lines = [line.strip() for line in env.readlines()]
             eq_(1, len(lines))
             eq_('[email protected]_LIBRARY_PATH:@HOME/php/lib',
                 lines[0])
         with open(os.path.join(self.build_dir, '.procs')) as procs:
             lines = [line.strip() for line in procs.readlines()]
             eq_(1, len(lines))
             eq_('php-app: $HOME/php/bin/php -c "$HOME/php/etc" '
                 'app.php', lines[0])
         # Test PHP
         self.assert_exists(self.build_dir, 'php')
         self.assert_exists(self.build_dir, 'php', 'etc')
         self.assert_exists(self.build_dir, 'php', 'etc', 'php.ini')
         self.assert_exists(self.build_dir, 'php', 'bin')
         self.assert_exists(self.build_dir, 'php', 'bin', 'php')
         self.assert_exists(self.build_dir, 'php', 'bin', 'phar.phar')
         self.assert_exists(self.build_dir, 'php', 'lib', 'php',
                            'extensions', 'no-debug-non-zts-20100525',
                            'bz2.so')
         self.assert_exists(self.build_dir, 'php', 'lib', 'php',
                            'extensions', 'no-debug-non-zts-20100525',
                            'zlib.so')
         self.assert_exists(self.build_dir, 'php', 'lib', 'php',
                            'extensions', 'no-debug-non-zts-20100525',
                            'curl.so')
         self.assert_exists(self.build_dir, 'php', 'lib', 'php',
                            'extensions', 'no-debug-non-zts-20100525',
                            'mcrypt.so')
     except Exception, e:
         print str(e)
         if hasattr(e, 'output'):
             print e.output
         if output:
             print output
         raise
开发者ID:NobleNoob,项目名称:buildpack,代码行数:81,代码来源:test_compile.py

示例8: test_compile_nginx

 def test_compile_nginx(self):
     bp = BuildPack({
         'BUILD_DIR': self.build_dir,
         'CACHE_DIR': self.cache_dir
     }, '.')
     # simulate clone, makes debugging easier
     os.rmdir(bp.bp_dir)
     shutil.copytree('.', bp.bp_dir,
                     ignore=shutil.ignore_patterns("binaries",
                                                   "env",
                                                   "tests"))
     # set web server
     self.set_web_server(os.path.join(bp.bp_dir,
                                       'defaults',
                                       'options.json'),
                          'nginx')
     try:
         output = ''
         output = bp._compile()
         # Test Output
         outputLines = output.split('\n')
         eq_(7, len([l for l in outputLines if l.startswith('Downloaded')]))
         eq_(2, len([l for l in outputLines if l.startswith('Installing')]))
         eq_(True, outputLines[-1].startswith('Finished:'))
         # Test scripts and config
         self.assert_exists(self.build_dir, 'start.sh')
         with open(os.path.join(self.build_dir, 'start.sh')) as start:
             lines = [line.strip() for line in start.readlines()]
             eq_(5, len(lines))
             eq_('export PYTHONPATH=$HOME/.bp/lib', lines[0])
             eq_('$HOME/.bp/bin/rewrite "$HOME/nginx/conf"', lines[1])
             eq_('$HOME/.bp/bin/rewrite "$HOME/php/etc"', lines[2])
             eq_('$HOME/.bp/bin/rewrite "$HOME/.env"', lines[3])
             eq_('$HOME/.bp/bin/start', lines[4])
         # Check scripts and bp are installed
         self.assert_exists(self.build_dir, '.bp', 'bin', 'rewrite')
         self.assert_exists(self.build_dir, '.bp', 'lib')
         bpu_path = os.path.join(self.build_dir, '.bp', 'lib',
                                 'build_pack_utils')
         eq_(22, len(os.listdir(bpu_path)))
         self.assert_exists(bpu_path, 'utils.py')
         self.assert_exists(bpu_path, 'process.py')
         # Check env and procs files
         self.assert_exists(self.build_dir, '.env')
         self.assert_exists(self.build_dir, '.procs')
         with open(os.path.join(self.build_dir, '.env')) as env:
             lines = [line.strip() for line in env.readlines()]
             eq_(1, len(lines))
             eq_('[email protected]_LIBRARY_PATH:@HOME/php/lib',
                 lines[0])
         with open(os.path.join(self.build_dir, '.procs')) as procs:
             lines = [line.strip() for line in procs.readlines()]
             eq_(3, len(lines))
             eq_('nginx: $HOME/nginx/sbin/nginx -c '
                 '"$HOME/nginx/conf/nginx.conf"', lines[0])
             eq_('php-fpm: $HOME/php/sbin/php-fpm -p "$HOME/php/etc" -y '
                 '"$HOME/php/etc/php-fpm.conf"', lines[1])
             eq_('php-fpm-logs: tail -F $HOME/../logs/php-fpm.log',
                 lines[2])
         # Test htdocs & config
         self.assert_exists(self.build_dir, 'htdocs')
         self.assert_exists(self.build_dir, '.bp-config')
         self.assert_exists(self.build_dir, '.bp-config', 'options.json')
         # Test NGINX
         self.assert_exists(self.build_dir)
         self.assert_exists(self.build_dir, 'nginx')
         self.assert_exists(self.build_dir, 'nginx', 'conf')
         self.assert_exists(self.build_dir, 'nginx', 'conf', 'fastcgi_params')
         self.assert_exists(self.build_dir, 'nginx', 'conf', 'http-logging.conf')
         self.assert_exists(self.build_dir, 'nginx', 'conf', 'http-defaults.conf')
         self.assert_exists(self.build_dir, 'nginx', 'conf', 'http-php.conf')
         self.assert_exists(self.build_dir, 'nginx', 'conf', 'mime.types')
         self.assert_exists(self.build_dir, 'nginx', 'conf', 'nginx-defaults.conf')
         self.assert_exists(self.build_dir, 'nginx', 'conf', 'nginx-workers.conf')
         self.assert_exists(self.build_dir, 'nginx', 'conf', 'nginx.conf')
         self.assert_exists(self.build_dir, 'nginx', 'conf', 'server-defaults.conf')
         self.assert_exists(self.build_dir, 'nginx', 'conf', 'server-locations.conf')
         self.assert_exists(self.build_dir, 'nginx', 'logs')
         self.assert_exists(self.build_dir, 'nginx', 'sbin')
         self.assert_exists(self.build_dir, 'nginx', 'sbin', 'nginx')
         with open(os.path.join(self.build_dir,
                                'nginx',
                                'conf',
                                'http-php.conf')) as fin:
             data = fin.read()
             eq_(-1, data.find('#{PHP_FPM_LISTEN}'))
             eq_(-1, data.find('{TMPDIR}'))
         # Test PHP
         self.assert_exists(self.build_dir, 'php')
         self.assert_exists(self.build_dir, 'php', 'etc')
         self.assert_exists(self.build_dir, 'php', 'etc', 'php-fpm.conf')
         self.assert_exists(self.build_dir, 'php', 'etc', 'php.ini')
         self.assert_exists(self.build_dir, 'php', 'sbin', 'php-fpm')
         self.assert_exists(self.build_dir, 'php', 'bin')
         self.assert_exists(self.build_dir, 'php', 'bin', 'php-cgi')
         self.assert_exists(self.build_dir, 'php', 'lib', 'php',
                            'extensions', 'no-debug-non-zts-20100525',
                            'bz2.so')
         self.assert_exists(self.build_dir, 'php', 'lib', 'php',
                            'extensions', 'no-debug-non-zts-20100525',
#.........这里部分代码省略.........
开发者ID:NobleNoob,项目名称:buildpack,代码行数:101,代码来源:test_compile.py

示例9: test_compile_httpd_with_newrelic

    def test_compile_httpd_with_newrelic(self):
        os.environ['NEWRELIC_LICENSE'] = 'JUNK_LICENSE'
        os.environ['VCAP_APPLICATION'] = json.dumps({
            'name': 'app-name-1'
        })
        bp = BuildPack({
            'BUILD_DIR': self.build_dir,
            'CACHE_DIR': self.cache_dir,
        }, '.')
        # simulate clone, makes debugging easier
        os.rmdir(bp.bp_dir)
        shutil.copytree('.', bp.bp_dir,
                        ignore=shutil.ignore_patterns("binaries",
                                                      "env",
                                                      "tests"))
        # set php & web server
        optsFile = os.path.join(bp.bp_dir, 'defaults', 'options.json')
        self._set_php(optsFile, 'hhvm')
        self._set_web_server(optsFile, 'httpd')

        try:
            output = ''
            output = bp._compile()
            outputLines = output.split('\n')
            eq_(16, len([l for l in outputLines
                         if l.startswith('Downloaded')]))
            eq_(2, len([l for l in outputLines if l.startswith('Installing')]))
            eq_(True, outputLines[-1].startswith('Finished:'))
            # Test scripts and config
            self.assert_exists(self.build_dir, 'start.sh')
            with open(os.path.join(self.build_dir, 'start.sh')) as start:
                lines = [line.strip() for line in start.readlines()]
                eq_(5, len(lines))
                eq_('export PYTHONPATH=$HOME/.bp/lib', lines[0])
                eq_('$HOME/.bp/bin/rewrite "$HOME/httpd/conf"', lines[1])
                eq_('$HOME/.bp/bin/rewrite "$HOME/.env"', lines[2])
                eq_('$HOME/.bp/bin/rewrite "$HOME/hhvm/etc"', lines[3])
                eq_('$HOME/.bp/bin/start', lines[4])
            # Check scripts and bp are installed
            self.assert_exists(self.build_dir, '.bp', 'bin', 'rewrite')
            self.assert_exists(self.build_dir, '.bp', 'lib')
            bpu_path = os.path.join(self.build_dir, '.bp', 'lib',
                                    'build_pack_utils')
            eq_(22, len(os.listdir(bpu_path)))
            self.assert_exists(bpu_path, 'utils.py')
            self.assert_exists(bpu_path, 'process.py')
            # Check env and procs files
            self.assert_exists(self.build_dir, '.env')
            self.assert_exists(self.build_dir, '.procs')
            with open(os.path.join(self.build_dir, '.env')) as env:
                lines = [line.strip() for line in env.readlines()]
                eq_(2, len(lines))
                eq_('[email protected]', lines[0])
                eq_('[email protected]_LIBRARY_PATH:@HOME/hhvm',
                    lines[1])
            with open(os.path.join(self.build_dir, '.procs')) as procs:
                lines = [line.strip() for line in procs.readlines()]
                eq_(2, len(lines))
                eq_('httpd: $HOME/httpd/bin/apachectl -f '
                    '"$HOME/httpd/conf/httpd.conf" -k start -DFOREGROUND',
                    lines[0])
                eq_('hhvm: $HOME/hhvm/hhvm --mode server -c '
                    '$HOME/hhvm/etc/config.hdf', lines[1])

            # Check htdocs and config
            self.assert_exists(self.build_dir, 'htdocs')
            self.assert_exists(self.build_dir, '.bp-config')
            self.assert_exists(self.build_dir, '.bp-config', 'options.json')
            # Test HTTPD
            self.assert_exists(self.build_dir)
            self.assert_exists(self.build_dir, 'httpd')
            self.assert_exists(self.build_dir, 'httpd', 'conf')
            self.assert_exists(self.build_dir, 'httpd', 'conf', 'httpd.conf')
            self.assert_exists(self.build_dir, 'httpd', 'conf', 'extra')
            self.assert_exists(self.build_dir, 'httpd', 'conf',
                               'extra', 'httpd-modules.conf')
            self.assert_exists(self.build_dir, 'httpd', 'conf',
                               'extra', 'httpd-remoteip.conf')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_authz_core.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_authz_host.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_dir.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_env.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_log_config.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_mime.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_mpm_event.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_proxy.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_proxy_fcgi.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_reqtimeout.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_unixd.so')
#.........这里部分代码省略.........
开发者ID:Salakar,项目名称:cf-php-build-pack,代码行数:101,代码来源:test_newrelic.py

示例10: test_compile_php_with_codizy

    def test_compile_php_with_codizy(self):
        #os.environ['BP_DEBUG'] = 'True'
        os.environ['CODIZY_INSTALL'] = 'True'
        bp = BuildPack({
            'BUILD_DIR': self.build_dir,
            'CACHE_DIR': self.cache_dir,
        }, '.')
        self.copy_build_pack(bp.bp_dir)
        # set php & web server
        optsFile = os.path.join(bp.bp_dir, 'defaults', 'options.json')
        self._set_php(optsFile, 'php')
        self._set_web_server(optsFile, 'httpd')
        try:
            output = ''
            output = bp._compile()
            outputLines = output.split('\n')
            eq_(28, len([l for l in outputLines
                         if l.startswith('Downloaded')]))
            eq_(2, len([l for l in outputLines if l.startswith('Installing')]))
            eq_(True, outputLines[-1].startswith('Finished:'))
            # Test scripts and config
            self.assert_exists(self.build_dir, 'start.sh')
            with open(os.path.join(self.build_dir, 'start.sh')) as start:
                lines = [line.strip() for line in start.readlines()]
                eq_(5, len(lines))
                eq_('export PYTHONPATH=$HOME/.bp/lib', lines[0])
                eq_('$HOME/.bp/bin/rewrite "$HOME/httpd/conf"', lines[1])
                eq_('$HOME/.bp/bin/rewrite "$HOME/php/etc"', lines[2])
                eq_('$HOME/.bp/bin/rewrite "$HOME/.env"', lines[3])
                eq_('$HOME/.bp/bin/start', lines[4])
            # Check scripts and bp are installed
            self.assert_exists(self.build_dir, '.bp', 'bin', 'rewrite')
            self.assert_exists(self.build_dir, '.bp', 'lib')
            bpu_path = os.path.join(self.build_dir, '.bp', 'lib',
                                    'build_pack_utils')
            eq_(22, len(os.listdir(bpu_path)))
            self.assert_exists(bpu_path, 'utils.py')
            self.assert_exists(bpu_path, 'process.py')
            # Check env and procs files
            self.assert_exists(self.build_dir, '.env')
            self.assert_exists(self.build_dir, '.procs')
            with open(os.path.join(self.build_dir, '.env')) as env:
                lines = [line.strip() for line in env.readlines()]
                eq_(2, len(lines))
                eq_('[email protected]', lines[0])
                eq_('[email protected]_LIBRARY_PATH:@HOME/php/lib',
                    lines[1])
            with open(os.path.join(self.build_dir, '.procs')) as procs:
                lines = [line.strip() for line in procs.readlines()]
                eq_(3, len(lines))
                eq_('httpd: $HOME/httpd/bin/apachectl -f '
                    '"$HOME/httpd/conf/httpd.conf" -k start -DFOREGROUND',
                    lines[0])
                eq_('php-fpm: $HOME/php/sbin/php-fpm -p "$HOME/php/etc" -y '
                    '"$HOME/php/etc/php-fpm.conf" -c "$HOME/php/etc"',
                    lines[1])
                eq_('php-fpm-logs: tail -F $HOME/logs/php-fpm.log',
                    lines[2])

            # Check htdocs and config
            self.assert_exists(self.build_dir, 'htdocs')
            self.assert_exists(self.build_dir, '.bp-config')
            self.assert_exists(self.build_dir, '.bp-config', 'options.json')
            # Test HTTPD
            self.assert_exists(self.build_dir)
            self.assert_exists(self.build_dir, 'httpd')
            self.assert_exists(self.build_dir, 'httpd', 'conf')
            self.assert_exists(self.build_dir, 'httpd', 'conf', 'httpd.conf')
            self.assert_exists(self.build_dir, 'httpd', 'conf', 'extra')
            self.assert_exists(self.build_dir, 'httpd', 'conf',
                               'extra', 'httpd-modules.conf')
            self.assert_exists(self.build_dir, 'httpd', 'conf',
                               'extra', 'httpd-remoteip.conf')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_authz_core.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_authz_host.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_dir.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_env.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_log_config.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_mime.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_mpm_event.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_proxy.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_proxy_fcgi.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_reqtimeout.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_unixd.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_remoteip.so')
            # Test PHP
            self.assert_exists(self.build_dir, 'php')
            self.assert_exists(self.build_dir, 'php', 'etc')
#.........这里部分代码省略.........
开发者ID:StephenOTT,项目名称:cf-php-build-pack,代码行数:101,代码来源:test_codizy.py

示例11: test_compile_httpd_with_newrelic

    def test_compile_httpd_with_newrelic(self):
        os.environ['NEWRELIC_LICENSE'] = 'JUNK_LICENSE'
        os.environ['VCAP_APPLICATION'] = json.dumps({
            'name': 'app-name-1'
        })
        bp = BuildPack({
            'BUILD_DIR': self.build_dir,
            'CACHE_DIR': self.cache_dir,
        }, '.')
        self.copy_build_pack(bp.bp_dir)
        # set php & web server
        optsFile = os.path.join(bp.bp_dir, 'defaults', 'options.json')
        self._set_php(optsFile, 'php')
        self._set_web_server(optsFile, 'httpd')

        try:
            output = ''
            output = bp._compile()
            outputLines = output.split('\n')
            eq_(22, len([l for l in outputLines
                         if l.startswith('Downloaded')]))
            eq_(2, len([l for l in outputLines if l.startswith('Installing')]))
            eq_(True, outputLines[-1].startswith('Finished:'))
            # Test scripts and config
            self.assert_exists(self.build_dir, 'start.sh')
            with open(os.path.join(self.build_dir, 'start.sh')) as start:
                lines = [line.strip() for line in start.readlines()]
                eq_(5, len(lines))
                eq_('export PYTHONPATH=$HOME/.bp/lib', lines[0])
                eq_('$HOME/.bp/bin/rewrite "$HOME/httpd/conf"', lines[1])
                eq_('$HOME/.bp/bin/rewrite "$HOME/php/etc"', lines[2])
                eq_('$HOME/.bp/bin/rewrite "$HOME/.env"', lines[3])
                eq_('$HOME/.bp/bin/start', lines[4])
            # Check scripts and bp are installed
            self.assert_exists(self.build_dir, '.bp', 'bin', 'rewrite')
            self.assert_exists(self.build_dir, '.bp', 'lib')
            bpu_path = os.path.join(self.build_dir, '.bp', 'lib',
                                    'build_pack_utils')
            eq_(22, len(os.listdir(bpu_path)))
            self.assert_exists(bpu_path, 'utils.py')
            self.assert_exists(bpu_path, 'process.py')
            # Check env and procs files
            self.assert_exists(self.build_dir, '.env')
            self.assert_exists(self.build_dir, '.procs')
            with open(os.path.join(self.build_dir, '.env')) as env:
                lines = [line.strip() for line in env.readlines()]
                eq_(2, len(lines))
                eq_('[email protected]', lines[0])
                eq_('[email protected]_LIBRARY_PATH:@HOME/php/lib',
                    lines[1])
            with open(os.path.join(self.build_dir, '.procs')) as procs:
                lines = [line.strip() for line in procs.readlines()]
                eq_(3, len(lines))
                eq_('httpd: $HOME/httpd/bin/apachectl -f '
                    '"$HOME/httpd/conf/httpd.conf" -k start -DFOREGROUND',
                    lines[0])
                eq_('php-fpm: $HOME/php/sbin/php-fpm -p "$HOME/php/etc" -y '
                    '"$HOME/php/etc/php-fpm.conf" -c "$HOME/php/etc"',
                    lines[1])
                eq_('php-fpm-logs: tail -F $HOME/logs/php-fpm.log',
                    lines[2])

            # Check htdocs and config
            self.assert_exists(self.build_dir, 'htdocs')
            self.assert_exists(self.build_dir, '.bp-config')
            self.assert_exists(self.build_dir, '.bp-config', 'options.json')
            # Test HTTPD
            self.assert_exists(self.build_dir)
            self.assert_exists(self.build_dir, 'httpd')
            self.assert_exists(self.build_dir, 'httpd', 'conf')
            self.assert_exists(self.build_dir, 'httpd', 'conf', 'httpd.conf')
            self.assert_exists(self.build_dir, 'httpd', 'conf', 'extra')
            self.assert_exists(self.build_dir, 'httpd', 'conf',
                               'extra', 'httpd-modules.conf')
            self.assert_exists(self.build_dir, 'httpd', 'conf',
                               'extra', 'httpd-remoteip.conf')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_authz_core.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_authz_host.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_dir.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_env.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_log_config.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_mime.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_mpm_event.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_proxy.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_proxy_fcgi.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_reqtimeout.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_unixd.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_remoteip.so')
#.........这里部分代码省略.........
开发者ID:StephenOTT,项目名称:cf-php-build-pack,代码行数:101,代码来源:test_newrelic.py


注:本文中的build_pack_utils.BuildPack类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。