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

Python commands.run_cmd函数代码示例

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

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



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

示例1: check_buildbot

def check_buildbot():
    """check if buildbot command works"""
    try:
        run_cmd(["buildbot", "--version"])
    except CalledProcessError:
        log.error("FAIL: buildbot command doesn't work", exc_info=True)
        raise
开发者ID:subsevenx2001,项目名称:gecko-dev,代码行数:7,代码来源:sanity.py


示例2: testGitShare

    def testGitShare(self):
        shareBase = os.path.join(self.tmpdir, 'git-repos')
        rev = git.git(self.repodir, self.wc, shareBase=shareBase)
        shareDir = os.path.join(shareBase, git.get_repo_name(self.repodir))
        self.assertEquals(rev, self.revisions[-1])

        # We should see all the revisions
        revs = getRevisions(
            self.wc, branches=['origin/master', 'origin/branch2'])
        shared_revs = getRevisions(
            shareDir, branches=['origin/master', 'origin/branch2'])

        self.assertEquals(revs, shared_revs)
        self.assertEquals(revs, self.revisions)

        # Update to a different rev
        rev = git.git(self.repodir, self.wc,
                      revision=self.revisions[0], shareBase=shareBase)
        self.assertEquals(rev, self.revisions[0])
        self.assertFalse(os.path.exists(os.path.join(self.wc, 'newfile')))

        # Add a commit to the original repo
        newfile = os.path.join(self.repodir, 'newfile')
        touch(newfile)
        run_cmd(['git', 'add', 'newfile'], cwd=self.repodir)
        run_cmd(['git', 'commit', '-q', '-m', 'add newfile'], cwd=self.repodir)
        new_rev = getRevisions(self.repodir)[-1]

        # Update to the new rev
        rev = git.git(
            self.repodir, self.wc, revision=new_rev, shareBase=shareBase)
        self.assertEquals(rev, new_rev)
        self.assertTrue(os.path.exists(os.path.join(self.wc, 'newfile')))
开发者ID:Callek,项目名称:build-tools,代码行数:33,代码来源:test_util_git.py


示例3: rsyncFilesByPattern

def rsyncFilesByPattern(server, userName, sshKey, source_dir, target_dir,
                        pattern):
    cmd = ['rsync', '-e',
           'ssh -l %s -oIdentityFile=%s' % (userName, sshKey),
           '-av', '--include=%s' % pattern, '--include=*/', '--exclude=*',
           '%s:%s' % (server, source_dir), target_dir]
    run_cmd(cmd)
开发者ID:B-Rich,项目名称:build-tools,代码行数:7,代码来源:download.py


示例4: testOutofSyncMirrorFailingMaster

    def testOutofSyncMirrorFailingMaster(self):
        # First create the mirror
        mirror = os.path.join(self.tmpdir, "repo2")
        clone(self.repodir, mirror)

        shareBase = os.path.join(self.tmpdir, "share")
        os.mkdir(shareBase)
        mercurial(self.repodir, self.wc, shareBase=shareBase, mirrors=[mirror])

        # Create a bundle
        bundle = os.path.join(self.tmpdir, "bundle")
        run_cmd(["hg", "bundle", "-a", bundle], cwd=self.repodir)

        # Move our repodir out of the way so that pulling/cloning from it fails
        os.rename(self.repodir, self.repodir + "-bad")

        # Try and update to a non-existent revision using our mirror and
        # bundle, with the master failing. We should fail
        self.assertRaises(
            subprocess.CalledProcessError,
            mercurial,
            self.repodir,
            self.wc,
            shareBase=shareBase,
            mirrors=[mirror],
            bundles=[bundle],
            revision="1234567890",
        )
开发者ID:B-Rich,项目名称:build-tools,代码行数:28,代码来源:test_util_hg.py


示例5: getPreviousBuildID

def getPreviousBuildID(download_base_url, download_subdir):
    """Figure out what the previous buildid is"""
    if os.path.exists('previous.apk'):
        os.remove('previous.apk')
    run_cmd(['wget', '-O', 'previous.apk',
         '%s/nightly/latest-%s/gecko-unsigned-unaligned.apk' % (download_base_url, download_subdir)])
    return parseApk('previous.apk')[0]
开发者ID:EkkiD,项目名称:build-tools,代码行数:7,代码来源:android_snippet.py


示例6: bump_and_tag

    def bump_and_tag(repo, attempt, config, relbranch, revision, tags,
                     defaultBranch):
        relbranchChangesets = len(tags)
        defaultBranchChangesets = 0

        if relbranch in get_branches(reponame):
            update(reponame, revision=relbranch)
        else:
            update(reponame, revision=revision)
            run_cmd(['hg', 'branch', relbranch], cwd=reponame)

        if len(bumpFiles) > 0:
            # Bump files on the relbranch, if necessary
            bump(reponame, bumpFiles, 'version')
            run_cmd(['hg', 'diff'], cwd=repo)
            try:
                get_output(['hg', 'commit', '-u', config['hgUsername'],
                            '-m', getBumpCommitMessage(config['productName'], config['version'])],
                           cwd=reponame)
                relbranchChangesets += 1
                revision = get_revision(reponame)
            except subprocess.CalledProcessError, e:
                # We only want to ignore exceptions caused by having nothing to
                # commit, which are OK. We still want to raise exceptions caused
                # by any other thing.
                if e.returncode != 1 or "nothing changed" not in e.output:
                    raise
开发者ID:EkkiD,项目名称:build-tools,代码行数:27,代码来源:tag-release.py


示例7: recreate_repos

def recreate_repos(repoSetupConfig):
    hgHost = repoSetupConfig['hgHost']
    repoPath = repoSetupConfig['repoPath']
    hgUserName = repoSetupConfig['hgUserName']
    hgSshKey = path.join(path.expanduser("~"), ".ssh",
                         repoSetupConfig['hgSshKey'])

    for repo in repoSetupConfig['reposToClone'].keys():
        maybe_delete_repo(hgHost, hgUserName, hgSshKey, repo, repoPath)
        clone_repo(hgHost, hgUserName, hgSshKey, repo)

    run_cmd(['sleep', '600'])
    allTags = []

    for repo in repoSetupConfig['reposToClone'].keys():
        if repoSetupConfig['reposToClone'][repo].get('overrides'):
            tags = bump_configs(
                hgHost, hgUserName, hgSshKey, repo, repoPath,
                repoSetupConfig['reposToClone'][repo]['overrides'],
                repoSetupConfig['reposToClone'][repo].get('nobump_overrides', []))
            allTags.extend(tags)
    log.info('Tagging using %s' % ' '. join(allTags))

    for repo in repoSetupConfig['reposToClone'].keys():
        if repoSetupConfig['reposToClone'][repo].get('doTag'):
            tag_repo(hgHost, hgUserName, hgSshKey, repo, repoPath, allTags)
开发者ID:EkkiD,项目名称:build-tools,代码行数:26,代码来源:repo_setup.py


示例8: cleanOutgoingRevs

def cleanOutgoingRevs(reponame, remote, username, sshKey):
    outgoingRevs = retry(out, kwargs=dict(src=reponame, remote=remote,
                                          ssh_username=username,
                                          ssh_key=sshKey))
    for r in reversed(outgoingRevs):
        run_cmd(['hg', '--config', 'extensions.mq=', 'strip', '-n',
                 r[REVISION]], cwd=reponame)
开发者ID:70599,项目名称:Waterfox,代码行数:7,代码来源:hg.py


示例9: check_buildbot

def check_buildbot():
    """check if buildbot command works"""
    try:
        run_cmd(['buildbot', '--version'])
    except CalledProcessError:
        print "FAIL: buildbot command doesn't work"
        raise
开发者ID:mjessome,项目名称:tools,代码行数:7,代码来源:release_sanity.py


示例10: process_configs

 def process_configs(repo, attempt):
     """Helper method that encapsulates all of the things necessary
        to run release runner for all releases."""
     log.info("Bumping %s, attempt #%s" % (repo, attempt))
     for release in rr.new_releases:
         rr.update_status(release, 'Writing configs')
         l10nContents = rr.get_release_l10n(release['name'])
         tags.extend(getTags(
             getBaseTag(release['product'], release['version']),
             release['buildNumber'])
         )
         update(configs_workdir, revision='default')
         cfgFile = getReleaseConfigName(
             release['product'], path.basename(release['branch']),
             release['version'], staging)
         bump_configs(release=release, cfgFile=cfgFile,
                      l10nContents=l10nContents, workdir=configs_workdir,
                      hg_username=hg_username,
                      productionBranch=buildbot_configs_branch)
         rr.update_status(release, 'Running release sanity')
         rs_args = get_release_sanity_args(configs_workdir, release,
                                           cfgFile, masters_json,
                                           buildbot_configs_branch)
         release_sanity_script = "%s/buildbot-helpers/release_sanity.py" % tools_workdir
         run_cmd(['python', release_sanity_script] + rs_args +
                 ['--dry-run'])
         rr.update_status(
             release, 'Waiting for other releases to run release sanity'
         )
开发者ID:magnyld,项目名称:build-tools,代码行数:29,代码来源:release-runner.py


示例11: checkoutSVN

def checkoutSVN(targetSVNDirectory, svnURL):
    """
    Checkout the product details SVN
    """
    if not os.path.isdir(targetSVNDirectory):
        cmd = ["svn", "co", svnURL, targetSVNDirectory]
        run_cmd(cmd)
开发者ID:pocmo,项目名称:build-tools,代码行数:7,代码来源:svn.py


示例12: testCommitWithUser

 def testCommitWithUser(self):
     run_cmd(['touch', 'newfile'], cwd=self.repodir)
     run_cmd(['hg', 'add', 'newfile'], cwd=self.repodir)
     rev = commit(self.repodir, user='unittest', msg='new stuff!')
     info = getRevInfo(self.repodir, rev)
     self.assertEquals(info['user'], 'unittest')
     self.assertEquals(info['msg'], 'new stuff!')
开发者ID:bdacode,项目名称:build-tools,代码行数:7,代码来源:test_util_hg.py


示例13: testMercurialChangeRepo

    def testMercurialChangeRepo(self):
        # Create a new repo
        old_env = os.environ.copy()
        if 'HG_SHARE_BASE_DIR' in os.environ:
            del os.environ['HG_SHARE_BASE_DIR']

        try:
            repo2 = os.path.join(self.tmpdir, 'repo2')
            run_cmd(['%s/init_hgrepo.sh' % os.path.dirname(__file__), repo2])

            self.assertNotEqual(self.revisions, getRevisions(repo2))

            # Clone the original repo
            mercurial(self.repodir, self.wc)
            self.assertEquals(getRevisions(self.wc), self.revisions)
            open(os.path.join(self.wc, 'test.txt'), 'w').write("hello!")

            # Clone the new one
            mercurial(repo2, self.wc)
            self.assertEquals(getRevisions(self.wc), getRevisions(repo2))
            # Make sure our local file went away
            self.failUnless(
                not os.path.exists(os.path.join(self.wc, 'test.txt')))
        finally:
            os.environ.clear()
            os.environ.update(old_env)
开发者ID:bdacode,项目名称:build-tools,代码行数:26,代码来源:test_util_hg.py


示例14: testShareExtraFiles

    def testShareExtraFiles(self):
        shareBase = os.path.join(self.tmpdir, 'share')
        backup = os.path.join(self.tmpdir, 'backup')

        # Clone the original repo
        mercurial(self.repodir, self.wc, shareBase=shareBase)

        clone(self.repodir, backup)

        # Make the working repo have a new file. We need it to have an earlier
        # timestamp (yesterday) to trigger the odd behavior in hg
        newfile = os.path.join(self.wc, 'newfile')
        touch(newfile, timestamp=yesterday_timestamp())
        run_cmd(['hg', 'add', 'newfile'], cwd=self.wc)
        run_cmd(['hg', 'commit', '-m', '"add newfile"'], cwd=self.wc)

        # Reset the share base to remove the 'add newfile' commit. We
        # overwrite repodir with the backup that doesn't have the commit,
        # then clone the repodir to a throwaway dir to create the new
        # shareBase. Now self.wc still points to shareBase, but the
        # changeset that self.wc was on is lost.
        shutil.rmtree(self.repodir)
        shutil.rmtree(shareBase)
        clone(backup, self.repodir)
        throwaway = os.path.join(self.tmpdir, 'throwaway')
        mercurial(self.repodir, throwaway, shareBase=shareBase)

        # Try and update our working copy
        mercurial(self.repodir, self.wc, shareBase=shareBase)

        self.assertFalse(os.path.exists(os.path.join(self.wc, 'newfile')))
开发者ID:gerva,项目名称:tools,代码行数:31,代码来源:test_util_hg.py


示例15: testCommit

 def testCommit(self):
     newfile = os.path.join(self.repodir, 'newfile')
     touch(newfile)
     run_cmd(['hg', 'add', 'newfile'], cwd=self.repodir)
     rev = commit(self.repodir, user='unittest', msg='gooooood')
     info = getRevInfo(self.repodir, rev)
     self.assertEquals(info['msg'], 'gooooood')
开发者ID:gerva,项目名称:tools,代码行数:7,代码来源:test_util_hg.py


示例16: testPullDefault

    def testPullDefault(self):
        clone(self.repodir, self.wc)
        run_cmd(["hg", "tag", "-f", "TAG1"], cwd=self.repodir)
        revisions = getRevisions(self.repodir)

        rev = pull(self.repodir, self.wc, revision="default")
        self.assertEquals(rev, revisions[0])
        self.assertEquals(getRevisions(self.wc), revisions)
开发者ID:B-Rich,项目名称:build-tools,代码行数:8,代码来源:test_util_hg.py


示例17: testPushWithForce

 def testPushWithForce(self):
     clone(self.repodir, self.wc, revision=self.revisions[0],
           clone_by_rev=True)
     newfile = os.path.join(self.wc, 'newfile')
     touch(newfile)
     run_cmd(['hg', 'add', 'newfile'], cwd=self.wc)
     run_cmd(['hg', 'commit', '-m', '"re-add newfile"'], cwd=self.wc)
     push(self.repodir, self.wc, push_new_branches=False, force=True)
开发者ID:gerva,项目名称:tools,代码行数:8,代码来源:test_util_hg.py


示例18: _run_hg

 def _run_hg(cls, command, repo=None, want_output=False):
     cmd = [cls.hg, '--config', 'extensions.mq=']
     if repo:
         cmd.extend(["-R", repo])
     if want_output:
         return get_output(cmd + command)
     else:
         run_cmd(cmd + command)
开发者ID:rail,项目名称:build-autoland,代码行数:8,代码来源:mercurial.py


示例19: setUp

    def setUp(self):
        self.tmpdir = tempfile.mkdtemp()
        self.repodir = os.path.join(self.tmpdir, "repo")
        run_cmd(["%s/init_hgrepo.sh" % os.path.dirname(__file__), self.repodir])

        self.revisions = getRevisions(self.repodir)
        self.wc = os.path.join(self.tmpdir, "wc")
        self.pwd = os.getcwd()
开发者ID:B-Rich,项目名称:build-tools,代码行数:8,代码来源:test_util_hg.py


示例20: purge

def purge(dest):
    """Purge the repository of all untracked and ignored files."""
    try:
        run_cmd(['hg', '--config', 'extensions.purge=', 'purge',
                 '-a', '--all', dest], cwd=dest)
    except subprocess.CalledProcessError, e:
        log.debug('purge failed: %s' % e)
        raise
开发者ID:70599,项目名称:Waterfox,代码行数:8,代码来源:hg.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python commands.run_remote_cmd函数代码示例发布时间:2022-05-26
下一篇:
Python commands.get_output函数代码示例发布时间: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