• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python utils.e函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: main

def main():
    user = sh_str('id -un')
    if user == 'root':
        user = 'jkh'

    # sh('ssh ${user}@${DOWNLOAD_HOST} rm -rf ${DOWNLOAD_TARGETDIR}')
    # sh('ssh ${user}@${DOWNLOAD_HOST} mkdir -p ${DOWNLOAD_TARGETDIR}')
    # sh('scp -pr ${RELEASE_STAGEDIR}/* ${user}@${DOWNLOAD_HOST}:${DOWNLOAD_TARGETDIR}/')
    ref_date = 0
    rel_dir = ''
    dirstring = e('${BE_ROOT}/release/${PRODUCT}')
    for x in glob.glob("{0}*".format(dirstring)):
        if e('${BUILD_ARCH_SHORT}') not in os.listdir(x):
            continue

        if os.lstat(x).st_ctime > ref_date:
            ref_date = os.lstat(x).st_ctime
            rel_dir = x

    if not rel_dir:
        error('Release not found')

    if e('${BUILD_TYPE}').lower() in ["master", "stable"]:
        buildtimestamp = os.path.basename(rel_dir).split("-")[-1]
        downloadtargetdir = e('${DOWNLOAD_BASEDIR}/${MILESTONE}/${buildtimestamp}')
    else:
        downloadtargetdir = e('${DOWNLOAD_TARGETDIR}')
    sh('ssh ${user}@${DOWNLOAD_HOST} rm -rf ${downloadtargetdir}')
    sh('ssh ${user}@${DOWNLOAD_HOST} mkdir -p ${downloadtargetdir}')
    sh('scp -pr ${rel_dir}/* ${user}@${DOWNLOAD_HOST}:${downloadtargetdir}/')
    info('Synchronizing download server to CDN')
    sh('ssh ${user}@${DOWNLOAD_HOST} /usr/local/sbin/rsync-mirror.sh')
开发者ID:github188,项目名称:freenas-build,代码行数:32,代码来源:post-to-download.py


示例2: check_port

def check_port(name, port):
    debug('Checking for "{0}" command', name)
    for i in e('${PATH}').split(':'):
        if os.path.exists(e('${i}/${name}')):
            return

    error('Command {0} not found. Please run "pkg install {1}" or install from ports', name, port)
开发者ID:DeepikaDhiman,项目名称:freenas-build,代码行数:7,代码来源:check-host.py


示例3: setup_rootfs

def setup_rootfs():
    buildkernel(e('${KERNCONF}-DEBUG'), ['mach'], buildkernellog)
    installworld('${OBJDIR}/test-root', installworldlog, distributionlog, conf="run")
    installkernel(e('${KERNCONF}'), '${OBJDIR}/test-root', installkernellog, modules=['mach'], conf="run")
    info('Installing overlay files')
    sh('rsync -ah ${TESTS_ROOT}/trueos/overlay/ ${OBJDIR}/test-root')
    sh('makefs -M ${IMAGE_SIZE} ${OBJDIR}/test-root.ufs ${OBJDIR}/test-root')
开发者ID:abwaters,项目名称:freenas-build,代码行数:7,代码来源:run-trueos-tests.py


示例4: setup_vm

def setup_vm():
    global vm_proc, termserv_proc

    info('Starting up VM')
    sh('bhyveload -m ${RAM_SIZE} -d ${OBJDIR}/test-root.ufs ${VM_NAME}')
    vm_proc = sh_spawn(
        'bhyve -m ${RAM_SIZE} -A -H -P',
        '-s 0:0,hostbridge',
        '-s 1:0,virtio-net,${tapdev}',
        '-s 2:0,ahci-hd,${OBJDIR}/test-root.ufs',
        '-s 3:0,ahci-hd,${OBJDIR}/test-swap.bin',
        '-s 31,lpc -l com1,${CONSOLE_MASTER}',
        '${VM_NAME}'
    )

    pid = vm_proc.pid
    logfile = objdir(e('logs/bhyve.${pid}.log'))

    info('Starting telnet server on port {0}', e('${TELNET_PORT}'))
    info('Console log file is {0}', logfile)
    termserv_proc = sh_spawn(
        'python',
        '${BUILD_TOOLS}/terminal-server.py',
        '-l ${logfile}',
        '-c ${CONSOLE_SLAVE}',
        '-p ${TELNET_PORT}'
    )

    on_abort(shutdown_vm)
开发者ID:abwaters,项目名称:freenas-build,代码行数:29,代码来源:run-trueos-tests.py


示例5: stage_upgrade

def stage_upgrade():
    sh('rm -rf ${UPGRADE_STAGEDIR}')
    sh('mkdir -p ${UPGRADE_STAGEDIR}')
    sh('cp -R ${OBJDIR}/packages/Packages ${UPGRADE_STAGEDIR}/')

    # If an update validation script is given, copy that
    if os.path.exists(e('${PROFILE_ROOT}/ValidateUpdate')):
        sh('cp ${PROFILE_ROOT}/ValidateUpdate ${UPGRADE_STAGEDIR}/ValidateUpdate')
    if os.path.exists(e('${PROFILE_ROOT}/ValidateInstall')):
        sh('cp ${PROFILE_ROOT}/ValidateUpdate ${UPGRADE_STAGEDIR}/ValidateInstall')

    # Allow the environment to over-ride it -- /dev/null or empty string means
    # don't have one
    if env('VALIDATE_UPDATE') is not None:
        if env('VALIDATE_UPDATE') not in ("/dev/null", ""):
            sh('cp ${VALIDATE_UPDATE} ${UPGRADE_STAGEDIR}/ValidateUpdate')
        else:
            sh('rm -f ${UPGRADE_STAGEDIR}/ValidateUpdate')
    if env('VALIDATE_INSTALL') is not None:
        if env('VALIDATE_INSTALL') not in ("/dev/null", ""):
            sh('cp ${VALIDATE_INSTALL} ${UPGRADE_STAGEDIR}/ValidateInstall')
        else:
            sh('rm -f ${UPGRADE_STAGEDIR}/ValidateInstall')

    # If RESTART is given, save that
    if env('RESTART'):
       sh('echo ${RESTART} > ${UPGRADE_STAGEDIR}/RESTART')

    # And if REBOOT is given, put that in FORCEREBOOT
    if env('REBOOT'):
       sh('echo ${REBOOT} > ${UPGRADE_STAGEDIR}/FORCEREBOOT')
    sh('rm -f ${BE_ROOT}/release/LATEST')
    sh('ln -sf ${UPGRADE_STAGEDIR} ${BE_ROOT}/release/LATEST')
开发者ID:abwaters,项目名称:freenas-build,代码行数:33,代码来源:create-upgrade-distribution.py


示例6: check_build_sanity

def check_build_sanity():
    if len(e('${BUILD_ROOT}')) > 38:
        error("Current path too long ({0} characters) for nullfs mounts during build",
              len(os.getcwd()))

    if e('${BE_ROOT}') in sh_str('mount'):
        error("You have dangling mounts inside {0}, did last build crash?", e('${BE_ROOT}'))
开发者ID:DeepikaDhiman,项目名称:freenas-build,代码行数:7,代码来源:check-host.py


示例7: check_sandbox

def check_sandbox():
    if not os.path.exists(e('${BE_ROOT}/.pulled')):
        error('Sandbox is not fully checked out')

    for i in config['repos']:
        if not os.path.isdir(os.path.join(e('${BE_ROOT}'), i['path'], '.git')):
            error('Sandbox is not fully checked out, {0} is missing', i['name'])

    info('Sandbox is fully checked out')
开发者ID:github188,项目名称:freenas-build,代码行数:9,代码来源:check-sandbox.py


示例8: get_image_files_desc

def get_image_files_desc():
    for ext in dsl.formats:
        path = e('${RELEASE_STAGEDIR}/${BUILD_ARCH_SHORT}/${NAME}.${ext}')
        filename = os.path.basename(path)
        if os.path.exists(path):
            yield {
                'filename': filename,
                'type': ext,
                'hash': sh_str("sha256 -q ${path}"),
                'url': e("${url}/${filename}")
            }
开发者ID:DeepikaDhiman,项目名称:freenas-build,代码行数:11,代码来源:create-release-distribution.py


示例9: create_poudriere_config

def create_poudriere_config():
    sh('mkdir -p ${DISTFILES_CACHE}')
    setfile('${POUDRIERE_ROOT}/etc/poudriere.conf', template('${BUILD_CONFIG}/templates/poudriere.conf', {
        'ports_repo': config['repos'].where(name='ports')['path'],
        'ports_branch': config['repos'].where(name='ports')['branch'],
    }))

    tree = e('${POUDRIERE_ROOT}/etc/poudriere.d/ports/p')
    sh('mkdir -p', tree)
    setfile(pathjoin(tree, 'mnt'), e('${PORTS_OVERLAY}'))
    setfile(pathjoin(tree, 'method'), 'git')
开发者ID:abwaters,项目名称:freenas-build,代码行数:11,代码来源:build-ports.py


示例10: main

def main():
    sh('rm -rf ${DEBUG_WORLD}')
    sh('mkdir -p ${DEBUG_WORLD}')

    info('Saving debug information in ${{DEBUG_WORLD}}')

    for root, dirs, files in os.walk(e('${WORLD_DESTDIR}/')):
        for name in files:
            filename = os.path.join(root, name)
            relpath = os.path.relpath(filename, e('${WORLD_DESTDIR}'))
            destpath = os.path.join(e('${DEBUG_WORLD}'), relpath)

            ext = os.path.splitext(name)[1]

            if ext == '.ko':
                continue

            if relpath.startswith(('boot', 'usr/local/lib/grub')):
                continue

            if ext == '.c':
                make_dir(destpath)
                shutil.move(filename, destpath)
                for f in os.listdir(root):
                    if f.endswith('.html'):
                        html_path = os.path.join(root, f)
                        if 'Generated by Cython' in open(html_path).read():
                            relpath = os.path.relpath(html_path, e('${WORLD_DESTDIR}'))
                            destpath = os.path.join(e('${DEBUG_WORLD}'), relpath)
                            shutil.move(html_path, destpath)
                continue

            if ext == '.html':
                continue

            if not is_elf(filename):
                continue

            make_dir(destpath)

            # We need to remove any flags on protected files and restore
            # them after stripping
            flags = os.stat(filename).st_flags
            os.chflags(filename, 0)

            if not relpath.startswith('rescue'):
                sh('objcopy --only-keep-debug ${filename} ${destpath}.debug')
                sh('objcopy --strip-unneeded ${filename}')
                sh('objcopy --add-gnu-debuglink="${destpath}.debug" ${filename}', log='/dev/null', nofail=True)
            else:
                sh('strip ${filename}')

            os.chflags(filename, flags)
开发者ID:DeepikaDhiman,项目名称:freenas-build,代码行数:53,代码来源:build-debug.py


示例11: fetch_binary_packages

def fetch_binary_packages():
    if e('${SKIP_PACKAGES_FETCH}'):
        return

    for i in config.binary_packages:
        _, name = os.path.split(i)

        if os.path.exists(e('${WORLD_DESTDIR}/usr/ports/packages/${name}')):
            continue

        info('Fetching package {0}', name)
        sh('fetch ${i} -o ${WORLD_DESTDIR}/usr/ports/packages/')
开发者ID:DeepikaDhiman,项目名称:freenas-build,代码行数:12,代码来源:install-ports.py


示例12: main

def main():
    info("Available profiles:")
    for i in glob("${BUILD_PROFILES}/*"):
        dsl = load_file(e("${i}/config.pyd"), os.environ)
        if dsl is None:
            continue

        profile = dsl["profile"]
        selected = e("${PROFILE}") == profile["name"]
        info('* {0}{1}', profile["name"], " [selected]" if selected else "")
        info('\tDescription: {0}', profile["description"])
        info('\tOwner: {0}', profile["owner"])
        info('\tStatus: {0}', profile["status"])
开发者ID:DeepikaDhiman,项目名称:freenas-build,代码行数:13,代码来源:profiles.py


示例13: obtain_jail_name

def obtain_jail_name():
    global jailname
    for i in string.ascii_lowercase:
        user = e('${SUDO_USER}')
        if user:
            i = e('${i}-${user}')

        if sh('jls -q -n -j j${i}-p', log="/dev/null", nofail=True) != 0:
            jailname = e('j${i}')
            setfile(e('${OBJDIR}/jailname'), jailname)
            return

    error('No jail names available')
开发者ID:abwaters,项目名称:freenas-build,代码行数:13,代码来源:build-ports.py


示例14: check_sandbox

def check_sandbox():
    if not os.path.exists(e('${BE_ROOT}/.pulled')):
        error('Sandbox is not fully checked out')

    checkout_only = e('${CHECKOUT_ONLY}')
    if checkout_only:
            checkout_only = checkout_only.split(',')
    for i in config['repos']:
        if checkout_only and i['name'] not in checkout_only:
            continue
        if not os.path.isdir(os.path.join(e('${BE_ROOT}'), i['path'], '.git')):
            error('Sandbox is not fully checked out, {0} is missing', i['name'])

    info('Sandbox is fully checked out')
开发者ID:DeepikaDhiman,项目名称:freenas-build,代码行数:14,代码来源:check-sandbox.py


示例15: read_repo_manifest

def read_repo_manifest():
    global pkgversion
    global sequence

    versions = []
    f = open(e("${BE_ROOT}/repo-manifest"))
    o = open(e("${BE_ROOT}/objs/world/etc/repo-manifest"), "w")

    for i in f:
        versions.append(i.split()[1])
        o.write(i)

    pkgversion = hashlib.md5('-'.join(versions).encode('ascii')).hexdigest()
    sequence = pkgversion
开发者ID:DeepikaDhiman,项目名称:freenas-build,代码行数:14,代码来源:build-packages.py


示例16: main

def main():
    prod = e("${PRODUCTION}")
    if prod and prod.lower() == "yes":
        KEY_PASSWORD = getpass.getpass("Enter Password: ")
        print("Hey Release Engineer this is the password you entered: {0}".format(KEY_PASSWORD))
    else:
        KEY_PASSWORD = ""
    changelog = e('${CHANGELOG}')
    ssh = e('${UPDATE_USER}@${UPDATE_HOST}')
    sshopts = '-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null'
    temp_dest = sh_str("ssh ${ssh} ${sshopts} mktemp -d /tmp/update-${PRODUCT}-XXXXXXXXX")
    temp_changelog = sh_str("ssh ${ssh} ${sshopts} mktemp /tmp/changelog-XXXXXXXXX")

    if not temp_dest or not temp_changelog:
        error('Failed to create temporary directories on {0}', ssh)

    sh('scp ${sshopts} -r ${BE_ROOT}/release/LATEST/. ${ssh}:${temp_dest}')
    if changelog:
        cl_file = None
        if changelog == '-':
            print('Enter changelog, ^D to end:')
            cl_file = tempfile.NamedTemporaryFile(delete=False)
            cl_file.write(bytes(sys.stdin.read(), 'UTF-8'))
            cl_file.close()
            changelog = cl_file.name

        sh('scp ${sshopts} ${changelog} ${ssh}:${temp_changelog}')
        if cl_file is not None:
            os.remove(cl_file.name)

    sh(
        "echo ${KEY_PASSWORD} |",
        "ssh ${sshopts} ${ssh}",
        "/usr/local/bin/freenas-release",
        "-P ${PRODUCT}",
        "-D ${UPDATE_DB}",
        "--archive ${UPDATE_DEST}",
        "-K ${FREENAS_KEYFILE}",
        "-C ${temp_changelog}" if changelog else "",
        "add ${temp_dest}"
    )

    sh("ssh ${sshopts} ${ssh} rm -rf ${temp_dest}")
    sh("ssh ${sshopts} ${ssh} rm -rf ${temp_changelog}")
    # This last line syncs up with the cdn
    # It is only done in the case of public facing update
    if e("${INTERNAL_UPDATE}").lower() == "no":
        sh("ssh ${sshopts} ${ssh} /usr/local/sbin/rsync-mirror.sh")
开发者ID:DeepikaDhiman,项目名称:freenas-build,代码行数:48,代码来源:post-to-upgrade.py


示例17: main

def main():
    if not e('${SKIP_CHECKOUT}'):
        cwd = os.getcwd()
        for i in dsl['repos']:
            if e('${CHECKOUT_ONLY}'):
                if i['name'] not in e('${CHECKOUT_ONLY}').split(','):
                    continue

            info('Checkout: {0} -> {1}', i['name'], i['path'])
            debug('Repository URL: {0}', i['url'])
            debug('Local branch: {0}', i['branch'])
            checkout_repo(cwd, i)

    generate_manifest()
    setfile('${BE_ROOT}/.pulled', e('${PRODUCT}'))
    return 0
开发者ID:abwaters,项目名称:freenas-build,代码行数:16,代码来源:checkout.py


示例18: prepare_env

def prepare_env():
    for cmd in jailconf.get('copy', []):
        dest = os.path.join(e('${JAIL_DESTDIR}'), cmd['dest'][1:])
        sh('rm -rf ${dest}')
        sh('cp -a', cmd['source'], dest)

    for cmd in jailconf.get('link', []):
        flags = '-o {0}'.format(cmd['flags']) if 'flags' in cmd else ''
        dest = os.path.join(e('${JAIL_DESTDIR}'), cmd['dest'][1:])
        sh('mkdir -p', os.path.dirname(dest))
        sh('mount -t nullfs', flags, cmd['source'], dest)

    osversion = sh_str("awk '/\#define __FreeBSD_version/ { print $3 }' ${JAIL_DESTDIR}/usr/include/sys/param.h")
    login_env = e(',UNAME_r=${FREEBSD_RELEASE_VERSION% *},UNAME_v=FreeBSD ${FREEBSD_RELEASE_VERSION},OSVERSION=${osversion}')
    sh('sed -i "" -e "s/,UNAME_r.*:/:/ ; s/:\(setenv.*\):/:\\1${login_env}:/" ${JAIL_DESTDIR}/etc/login.conf')
    sh('cap_mkdb ${JAIL_DESTDIR}/etc/login.conf');
开发者ID:abwaters,项目名称:freenas-build,代码行数:16,代码来源:build-ports.py


示例19: cleandirs

def cleandirs():
    info('Cleaning previous build products')
    if os.path.isdir(e('${INSTUFS_DESTDIR}')):
        sh('chflags -R 0 ${INSTUFS_DESTDIR}')
        sh('rm -rf ${INSTUFS_DESTDIR}')

    sh('rm -rf ${ISO_DESTDIR}')
    sh('mkdir -p ${ISO_DESTDIR} ${INSTUFS_DESTDIR}')
开发者ID:github188,项目名称:freenas-build,代码行数:8,代码来源:create-iso.py


示例20: merge_port_trees

def merge_port_trees():
    for i in config['port_trees']:
        info(e('Merging ports tree ${i}'))
        for p in glob('${i}/*/*'):
            portpath = '/'.join(p.split('/')[-2:])
            sh('rm -rf ${PORTS_OVERLAY}/${portpath}')
            sh('mkdir -p ${PORTS_OVERLAY}/${portpath}')
            sh('cp -lr ${p}/ ${PORTS_OVERLAY}/${portpath}')
开发者ID:abwaters,项目名称:freenas-build,代码行数:8,代码来源:build-ports.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python utils.enc函数代码示例发布时间:2022-05-26
下一篇:
Python utils.dprint函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap