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

Python common.run_command函数代码示例

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

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



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

示例1: _setup_test_specfile

    def _setup_test_specfile(self):
        if self.test and not self.ran_setup_test_specfile:
            # If making a test rpm we need to get a little crazy with the spec
            # file we're building off. (note that this is a temp copy of the
            # spec) Swap out the actual release for one that includes the git
            # SHA1 we're building for our test package:
            sha = self.git_commit_id[:7]
            fullname = "{0}-{1}".format(self.project_name, self.display_version)
            munge_specfile(self.spec_file, sha, self.commit_count, fullname, self.tgz_filename)
            # Custom Openshift v3 stuff follows, everything above is the standard
            # builder
            cmd = ". ./hack/common.sh ; echo $(os::build::ldflags)"
            ldflags = run_command("bash -c '{0}'".format(cmd))
            print("LDFLAGS::{0}".format(ldflags))
            update_ldflags = "sed -i 's|^%global ldflags .*$|%global ldflags {0}|' {1}".format(
                " ".join([ldflag.strip() for ldflag in ldflags.split()]), self.spec_file
            )
            # FIXME - output is never used
            output = run_command(update_ldflags)

            # Add bundled deps for Fedora Guidelines as per:
            # https://fedoraproject.org/wiki/Packaging:Guidelines#Bundling_and_Duplication_of_system_libraries
            provides_list = []
            with open("./Godeps/Godeps.json") as godeps:
                depdict = json.load(godeps)
                for bdep in [(dep[u"ImportPath"], dep[u"Rev"]) for dep in depdict[u"Deps"]]:
                    provides_list.append("Provides: bundled(golang({0})) = {1}".format(bdep[0], bdep[1]))
            update_provides_list = "sed -i 's|^### AUTO-BUNDLED-GEN-ENTRY-POINT|{0}|' {1}".format(
                "\\n".join(provides_list), self.spec_file
            )
            print(run_command(update_provides_list))

            self.build_version += ".git." + str(self.commit_count) + "." + str(self.git_commit_id[:7])
            self.ran_setup_test_specfile = True
开发者ID:RomainVabre,项目名称:origin,代码行数:34,代码来源:__init__.py


示例2: _clear_package_metadata

    def _clear_package_metadata(self):
        """
        Remove all rel-eng/packages/ files that have a relative path
        matching the package we're tagging a new version of. Normally
        this just removes the previous package file but if we were
        renaming oldpackage to newpackage, this would git rm
        rel-eng/packages/oldpackage and add
        rel-eng/packages/spacewalk-newpackage.
        """
        metadata_dir = os.path.join(self.rel_eng_dir, "packages")
        for filename in os.listdir(metadata_dir):
            metadata_file = os.path.join(metadata_dir, filename)  # full path

            if os.path.isdir(metadata_file) or filename.startswith("."):
                continue

            temp_file = open(metadata_file, 'r')
            (version, relative_dir) = temp_file.readline().split(" ")
            relative_dir = relative_dir.strip()  # sometimes has a newline

            if relative_dir == self.relative_project_dir:
                debug("Found metadata for our prefix: %s" %
                        metadata_file)
                debug("   version: %s" % version)
                debug("   dir: %s" % relative_dir)
                if filename == self.project_name:
                    debug("Updating %s with new version." %
                            metadata_file)
                else:
                    print("WARNING: %s also references %s" % (filename,
                            self.relative_project_dir))
                    print("Assuming package has been renamed and removing it.")
                    run_command("git rm %s" % metadata_file)
开发者ID:aronparsons,项目名称:tito,代码行数:33,代码来源:tagger.py


示例3: setUp

    def setUp(self):
        TitoGitTestFixture.setUp(self)

        # Guess based on python version.
        # Do not use anything based on uname in case we are in container.
        # Do not use `lsb_release` to avoid dependencies.
        if sys.version[0:3] == '2.4':
            raise SkipTest('git-annex is not available in epel-5')

        status, ga_version = getstatusoutput('rpm -q git-annex')
        if status != 0:
            raise SkipTest("git-annex is missing")

        # Setup test config:
        self.config = RawConfigParser()
        self.config.add_section("buildconfig")
        self.config.set("buildconfig", "builder",
                "tito.builder.GitAnnexBuilder")
        self.config.set("buildconfig", "offline",
                "true")

        os.chdir(self.repo_dir)
        spec = join(os.path.dirname(__file__), "specs/extsrc.spec")
        self.create_project_from_spec(PKG_NAME, self.config,
                spec=spec)
        self.source_filename = 'extsrc-0.0.2.tar.gz'

        # Make a fake source file, do we need something more real?
        run_command('touch %s' % self.source_filename)
        print(run_command('git-annex init'))

        self.output_dir = tempfile.mkdtemp("-titotestoutput")
开发者ID:Conan-Kudo,项目名称:tito,代码行数:32,代码来源:build_gitannex_tests.py


示例4: _update_setup_py_in_dir

    def _update_setup_py_in_dir(self, new_version, package_dir=None):
        """
        If this subdir has a setup.py, attempt to update it's version.
        (This is a very minor tweak to the original _update_setup_py method from VersionTagger
        """

        if package_dir is not None:
            full_package_dir = os.path.join(self.full_project_dir, package_dir)
        else:
            full_package_dir = self.full_project_dir

        setup_file = os.path.join(full_package_dir, "setup.py")
        if not os.path.exists(setup_file):
            return

        debug("Found setup.py in {}, attempting to update version.".format(package_dir))

        # We probably don't want version-release in setup.py as release is
        # an rpm concept. Hopefully this assumption on
        py_new_version = new_version.split('-')[0]

        f = open(setup_file, 'r')
        buf = six.StringIO()
        for line in f.readlines():
            buf.write(replace_version(line, py_new_version))
        f.close()

        # Write out the new setup.py file contents:
        f = open(setup_file, 'w')
        f.write(buf.getvalue())
        f.close()
        buf.close()

        run_command("git add %s" % setup_file)
开发者ID:Lorquas,项目名称:subscription-manager,代码行数:34,代码来源:rhsmtagger.py


示例5: _tag_release

    def _tag_release(self):
        """
        Tag a new release of the package, add specfile global named commit.
        (ie: x.y.z-r+1) and ldflags from hack/common.sh os::build::ldflags
        """
        self._make_changelog()
        new_version = self._bump_version()
        new_version = re.sub(r"-.*", "", new_version)
        git_hash = get_latest_commit()
        update_commit = \
            "sed -i 's/^%global commit .*$/%global commit {0}/' {1}".format(
                git_hash,
                self.spec_file
            )
        output = run_command(update_commit)

        cmd = '. ./hack/common.sh ; echo $(os::build::ldflags)'
        ldflags = run_command('bash -c \'{0}\''.format(cmd))
        # hack/common.sh will tell us that the tree is dirty because tito has
        # already mucked with things, but lets not consider the tree to be
        # dirty
        ldflags = ldflags.replace('-dirty', '')
        update_ldflags = \
            "sed -i 's|^%global ldflags .*$|%global ldflags {0}|' {1}".format(
                ldflags,
                self.spec_file
            )
        # FIXME - this output is never used
        output = run_command(update_ldflags)

        self._check_tag_does_not_exist(self._get_new_tag(new_version))
        self._update_changelog(new_version)
        self._update_package_metadata(new_version)
开发者ID:3quanfeng,项目名称:origin,代码行数:33,代码来源:__init__.py


示例6: _git_sync_files

    def _git_sync_files(self, project_checkout):
        """
        Copy files from our git into each git build branch and add them.

        A list of safe files is used to protect critical files both from
        being overwritten by a git file of the same name, as well as being
        deleted after.
        """

        # Build the list of all files we will copy:
        debug("Searching for files to copy to build system git:")
        files_to_copy = self._list_files_to_copy()

        os.chdir(project_checkout)

        new, copied, old =  \
                self._sync_files(files_to_copy, project_checkout)

        os.chdir(project_checkout)

        # Git add everything:
        for add_file in (new + copied):
            run_command("git add %s" % add_file)

        # Cleanup obsolete files:
        for cleanup_file in old:
            # Can't delete via full path, must not chdir:
            run_command("git rm %s" % cleanup_file)
开发者ID:Conan-Kudo,项目名称:tito,代码行数:28,代码来源:distgit.py


示例7: setUp

    def setUp(self):
        self.repo_dir = tempfile.mkdtemp("-titocargotest")
        print("Testing in: %s" % self.repo_dir)
        os.chdir(self.repo_dir)

        self.full_pkg_dir = os.path.join(self.repo_dir, "hello_tito")
        run_command('mkdir -p %s' % self.full_pkg_dir)

        # Initialize the repo:
        os.chdir(self.full_pkg_dir)
        run_command('git init')

        # Next we tito init:
        tito("init")
        run_command('echo "offline = true" >> .tito/tito.props')
        run_command('git add .tito/tito.props')
        run_command("git commit -m 'set offline in tito.props'")

        # Init cargo project
        self.create_cargo_project()

        # Init RPM package
        self.create_rpm_package()

        # Run tito tag
        tito("tag --accept-auto-changelog")
开发者ID:Conan-Kudo,项目名称:tito,代码行数:26,代码来源:cargo_tag_tests.py


示例8: _setup_sources

    def _setup_sources(self):
        """
        Create a copy of the git source for the project at the point in time
        our build tag was created.

        Created in the temporary rpmbuild SOURCES directory.
        """
        self._create_build_dirs()

        debug("Creating %s from git tag: %s..." % (self.tgz_filename,
            self.git_commit_id))
        create_tgz(self.git_root, self.tgz_dir, self.git_commit_id,
                self.relative_project_dir,
                os.path.join(self.rpmbuild_sourcedir, self.tgz_filename))

        # Extract the source so we can get at the spec file, etc.
        debug("Copying git source to: %s" % self.rpmbuild_gitcopy)
        run_command("cd %s/ && tar xzf %s" % (self.rpmbuild_sourcedir,
            self.tgz_filename))

        # Show contents of the directory structure we just extracted.
        debug('', 'ls -lR %s/' % self.rpmbuild_gitcopy)

        # NOTE: The spec file we actually use is the one exported by git
        # archive into the temp build directory. This is done so we can
        # modify the version/release on the fly when building test rpms
        # that use a git SHA1 for their version.
        self.spec_file_name = os.path.basename(find_spec_like_file(self.rpmbuild_gitcopy))
        self.spec_file = os.path.join(
            self.rpmbuild_gitcopy, self.spec_file_name)
开发者ID:maxamillion,项目名称:tito,代码行数:30,代码来源:main.py


示例9: _setup_test_specfile

  def _setup_test_specfile(self):
      if self.test and not self.ran_setup_test_specfile:
          # If making a test rpm we need to get a little crazy with the spec
          # file we're building off. (note that this is a temp copy of the
          # spec) Swap out the actual release for one that includes the git
          # SHA1 we're building for our test package:
          setup_specfile_script = get_script_path("test-setup-specfile.pl")
          cmd = "%s %s %s %s %s-%s %s" % \
                  (
                      setup_specfile_script,
                      self.spec_file,
                      self.git_commit_id[:7],
                      self.commit_count,
                      self.project_name,
                      self.display_version,
                      self.tgz_filename,
                  )
          run_command(cmd)
          # Custom Openshift v3 stuff follows, everything above is the standard
          # builder
          cmd = '. ./hack/common.sh ; echo $(os::build::ldflags)'
          ldflags = run_command('bash -c \'%s\''  % (cmd) )
          update_ldflags = "sed -i 's|^%%global ldflags .*$|%%global ldflags %s|' %s" % \
            (ldflags, self.spec_file)
          output = run_command(update_ldflags)

          self.build_version += ".git." + str(self.commit_count) + "." + str(self.git_commit_id[:7])
          self.ran_setup_test_specfile = True
开发者ID:jeffhoffman13,项目名称:origin,代码行数:28,代码来源:__init__.py


示例10: _git_upload_sources

    def _git_upload_sources(self, project_checkout):
        chain_file = find_mead_chain_file(self.builder.rpmbuild_gitcopy)
        with open(chain_file, 'r') as f:
            template = Template(f.read())

            ref = self.builder.build_tag
            if self.test:
                ref = self.builder.git_commit_id

            values = {
                'mead_scm': self.mead_scm,
                'git_ref': ref,
                # Each property on its own line with a few leading spaces to indicate
                # that it's a continuation
                'maven_properties': "\n  ".join(self.builder.maven_properties),
                'maven_options': " ".join(self.builder.maven_args),
            }
            rendered_chain = template.safe_substitute(values)

        with chdir(project_checkout):
            with open("mead.chain", "w") as f:
                f.write(rendered_chain)

            cmd = "git add mead.chain"
            if self.dry_run:
                self.print_dry_run_warning(cmd)
                info_out("Chain file contents:\n%s" % rendered_chain)
            else:
                run_command(cmd)
开发者ID:Conan-Kudo,项目名称:tito,代码行数:29,代码来源:distgit.py


示例11: test_template_version_tagger

    def test_template_version_tagger(self):
        """
        Make sure the template is applied and results in the correct file
        being included in the tag.
        """
        pkg_dir = join(self.repo_dir, 'pkg3')
        filename = join(pkg_dir, "tito.props")
        self.write_file(filename, TEMPLATE_TAGGER_TITO_PROPS)
        run_command('mkdir -p %s' % join(self.repo_dir, 'rel-eng/templates'))
        self.write_file(join(self.repo_dir,
            'rel-eng/templates/version.rb'), VERSION_TEMPLATE_FILE)
        index = self.repo.index
        index.add(['pkg3/tito.props'])
        index.commit("Adding tito.props for pkg3.")

        # Create another pkg3 tag and make sure we got a generated
        # template file.
        os.chdir(os.path.join(self.repo_dir, 'pkg3'))
        tito('tag --debug --accept-auto-changelog')
        new_ver = get_latest_tagged_version(TEST_PKG_3)
        self.assertEquals("0.0.2-1", new_ver)

        dest_file = os.path.join(self.repo_dir, 'pkg3', "version.txt")
        self.assertTrue(os.path.exists(dest_file))

        f = open(dest_file, 'r')
        contents = f.read()
        f.close()

        self.assertTrue("VERSION = \"0.0.2-1\"" in contents)
开发者ID:amitsaha,项目名称:tito,代码行数:30,代码来源:multiproject_tests.py


示例12: _update_setup_py

    def _update_setup_py(self, new_version):
        """
        If this project has a setup.py, attempt to update it's version.
        """
        setup_file = os.path.join(self.full_project_dir, "setup.py")
        if not os.path.exists(setup_file):
            return

        debug("Found setup.py, attempting to update version.")

        # We probably don't want version-release in setup.py as release is
        # an rpm concept. Hopefully this assumption on
        py_new_version = new_version.split('-')[0]

        f = open(setup_file, 'r')
        buf = StringIO.StringIO()
        for line in f.readlines():
            buf.write(replace_version(line, py_new_version))
        f.close()

        # Write out the new setup.py file contents:
        f = open(setup_file, 'w')
        f.write(buf.getvalue())
        f.close()
        buf.close()

        run_command("git add %s" % setup_file)
开发者ID:aronparsons,项目名称:tito,代码行数:27,代码来源:tagger.py


示例13: _setup_test_specfile

    def _setup_test_specfile(self):
        if self.test and not self.ran_setup_test_specfile:
            # If making a test rpm we need to get a little crazy with the spec
            # file we're building off. (note that this is a temp copy of the
            # spec) Swap out the actual release for one that includes the git
            # SHA1 we're building for our test package:
            sha = self.git_commit_id[:7]
            fullname = "{0}-{1}".format(self.project_name, self.display_version)
            munge_specfile(
                self.spec_file,
                sha,
                self.commit_count,
                fullname,
                self.tgz_filename,
            )
            # Custom Openshift v3 stuff follows, everything above is the standard
            # builder
            cmd = '. ./hack/common.sh ; echo $(os::build::ldflags)'
            ldflags = run_command("bash -c '{0}'".format(cmd))
            print("LDFLAGS::{0}".format(ldflags))
            update_ldflags = \
                    "sed -i 's|^%%global ldflags .*$|%%global ldflags {0}|' {1}".format(
                        ' '.join([ldflag.strip() for ldflag in ldflags.split()]),
                        self.spec_file
                    )
            # FIXME - output is never used
            output = run_command(update_ldflags)

            self.build_version += ".git." + \
                str(self.commit_count) + \
                "." + \
                str(self.git_commit_id[:7])
            self.ran_setup_test_specfile = True
开发者ID:adietish,项目名称:origin,代码行数:33,代码来源:__init__.py


示例14: patch_upstream

    def patch_upstream(self):
        commits = run_command('git rev-list --reverse %s..%s -- .'
                % (self.upstream_tag, self.git_commit_id))
        patch_filenames = []
        previous_tag = self.upstream_tag
        for commit in commits.splitlines():
            tag = run_command('git describe --tags --match %s-%s\\* --exact-match %s 2>/dev/null || :'
                    % (self.project_name, self.upstream_version, commit))
            if tag and tag not in BAD_TAGS:
                self._generate_patch(previous_tag, tag, '%s.patch' % tag)
                patch_filenames.append('%s.patch' % tag)
                previous_tag = tag
        if self.test:
            # If this is a --test build, there will be some untagged commits at
            # the end which we also need to include.
            self._generate_patch(previous_tag, self.git_commit_id, '%s.patch' % self.display_version)
            patch_filenames.append('%s.patch' % self.display_version)
        else:
            assert previous_tag == self.build_tag or not commits

        (patch_number, patch_insert_index, patch_apply_index, lines) = self._patch_upstream()
        for patch in patch_filenames:
            lines.insert(patch_insert_index, "Patch%s: %s\n" % (patch_number, patch))
            lines.insert(patch_apply_index, "%%patch%s -p1\n" % (patch_number))
            patch_number += 1
            patch_insert_index += 1
            patch_apply_index += 2
        self._write_spec(lines)
开发者ID:sibiaoluo,项目名称:beaker,代码行数:28,代码来源:beakertito.py


示例15: _generate_default_changelog

    def _generate_default_changelog(self, last_tag):
        # Grab all the commits we are interested in
        commits = run_command('git log --pretty=format:%%H --relative %s..HEAD -- .'
                % last_tag)

        changelog = []
        for sha in reversed(commits.split('\n')):
            subject = run_command('git show -s --pretty="format:%s" %s'
                    % (self._changelog_format(), sha))

            # Skip Gerrit merges
            if re.match(r'Merge ".*" into', subject):
                continue

            # Skip Tito version bumps
            if re.match(r'Automatic commit of package \[.*\] release \[.*\]', subject):
                continue

            # Tito's built-in cherry-pick cleaning
            subject = self._changelog_remove_cherrypick(subject)

            # Check for Bug: footer
            body = run_command('git show -s --pretty=format:%%b %s' % sha)
            m = re.search(r'^Bug:\s*(\d+)', body, re.IGNORECASE | re.MULTILINE)
            if m:
                bz_number = m.group(1)
                subject = '%s %s' % (bz_number, subject)

            # Escape rpm macros
            subject = subject.replace('%', '%%')

            changelog.append(subject)
        return '\n'.join(changelog)
开发者ID:sibiaoluo,项目名称:beaker,代码行数:33,代码来源:beakertito.py


示例16: _generate_patch

 def _generate_patch(self, left, right, out):
     # It's nice to publish patches which show the actual commits making up
     # the patch, with authorship, dates, log messages, etc.
     # We can use git log for that. But it will only produce usable patches if
     # left is an ancestor of every commit in left..right.
     # That will normally be true for a series of hotfixes on top of a
     # release. But if we are doing a --test build or if there are divergent
     # tags then this might not be true. In that case the best we can do is
     # git diff left..right.
     if not run_command('git rev-list $(git rev-list --first-parent %s..%s | tail -n1)..%s'
             % (left, right, left)):
         print 'Generating patchset %s..%s' % (left, right)
         run_command('git log -p --reverse --pretty=email '
                 '-m --first-parent '
                 '--no-renames ' # patch can't handle these :-(
                 '--relative %s..%s -- . >%s/%s'
                 % (left, right, self.rpmbuild_gitcopy, out))
     else:
         print 'Generating diff %s..%s' % (left, right)
         run_command('git diff --no-renames '
                 '--relative %s..%s -- . >%s/%s'
                 % (left, right, self.rpmbuild_gitcopy, out))
     shutil.copy('%s/%s' % (self.rpmbuild_gitcopy, out), self.rpmbuild_sourcedir)
     shutil.copy('%s/%s' % (self.rpmbuild_gitcopy, out), self.rpmbuild_basedir)
     print 'Wrote: %s/%s' % (self.rpmbuild_basedir, out)
开发者ID:sibiaoluo,项目名称:beaker,代码行数:25,代码来源:beakertito.py


示例17: patch_upstream

    def patch_upstream(self):
        """ Create one patch per each release """
        ch_dir = self.git_root
        if self.relative_project_dir != "/":
            ch_dir = os.path.join(self.git_root,
                    self.relative_project_dir)
        os.chdir(ch_dir)
        debug("Running /usr/bin/generate-patches.pl -d %s %s %s-1 %s %s"
               % (self.rpmbuild_gitcopy, self.project_name, self.upstream_version, self.build_version, self.git_commit_id))
        output = run_command("/usr/bin/generate-patches.pl -d %s %s %s-1 %s %s"
               % (self.rpmbuild_gitcopy, self.project_name, self.upstream_version, self.build_version, self.git_commit_id))
        self.patch_files = output.split("\n")
        for p_file in self.patch_files:
            (status, output) = getstatusoutput(
                "grep 'Binary files .* differ' %s/%s " % (self.rpmbuild_gitcopy, p_file))
            if status == 0 and output != "":
                error_out("You are doomed. Diff contains binary files. You can not use this builder")

            run_command("cp %s/%s %s" % (self.rpmbuild_gitcopy, p_file, self.rpmbuild_sourcedir))

        (patch_number, patch_insert_index, patch_apply_index, lines) = self._patch_upstream()

        for patch in self.patch_files:
            lines.insert(patch_insert_index, "Patch%s: %s\n" % (patch_number, patch))
            lines.insert(patch_apply_index, "%%patch%s -p1\n" % (patch_number))
            patch_number += 1
            patch_insert_index += 1
            patch_apply_index += 2
        self._write_spec(lines)
开发者ID:CiscoSystems,项目名称:tito,代码行数:29,代码来源:distributionbuilder.py


示例18: _bump_version

    def _bump_version(self, release=False, zstream=False):
        """
        Bump up the package version in the spec file.

        Set release to True to bump the package release instead.

        Checks for the keep version option and if found, won't actually
        bump the version or release.
        """
        old_version = get_latest_tagged_version(self.project_name)
        if old_version == None:
            old_version = "untagged"
        # TODO: Do this here instead of calling out to an external Perl script:
        if not self.keep_version:
            bump_type = "bump-version"
            if release:
                bump_type = "bump-release"
            elif zstream:
                bump_type = "bump-zstream"

            script_path = get_script_path("bump-version.pl")
            cmd = "%s %s --specfile %s" % \
                    (script_path, bump_type, self.spec_file)
            run_command(cmd)

        new_version = self._get_spec_version_and_release()
        if new_version.strip() == "":
            msg = "Error getting bumped package version, try: \n"
            msg = msg + "  'rpm -q --specfile %s'" % self.spec_file
            error_out(msg)
        print("Tagging new version of %s: %s -> %s" % (self.project_name,
            old_version, new_version))
        return new_version
开发者ID:shadowbrain,项目名称:tito,代码行数:33,代码来源:tagger.py


示例19: _build_in_mock

    def _build_in_mock(self):
        if not self.speedup:
            print("Initializing mock...")
            run_command("mock %s -r %s --init" % (self.mock_cmd_args, self.mock_tag))
        else:
            print("Skipping mock --init due to speedup option.")

        print("Installing deps in mock...")
        run_command("mock %s -r %s %s" % (
            self.mock_cmd_args, self.mock_tag, self.srpm_location))
        print("Building RPMs in mock...")
        run_command('mock %s -r %s --rebuild %s' %
                (self.mock_cmd_args, self.mock_tag, self.srpm_location))
        mock_output_dir = os.path.join(self.rpmbuild_dir, "mockoutput")
        run_command("mock %s -r %s --copyout /builddir/build/RPMS/ %s" %
                (self.mock_cmd_args, self.mock_tag, mock_output_dir))

        # Copy everything mock wrote out to /tmp/tito:
        files = os.listdir(mock_output_dir)
        run_command("cp -v %s/*.rpm %s" %
                (mock_output_dir, self.rpmbuild_basedir))
        print
        info_out("Wrote:")
        for rpm in files:
            rpm_path = os.path.join(self.rpmbuild_basedir, rpm)
            print("  %s" % rpm_path)
            self.artifacts.append(rpm_path)
        print
开发者ID:maxamillion,项目名称:tito,代码行数:28,代码来源:main.py


示例20: tag_new_version

    def tag_new_version(project_path, new_version_release):
        """
        Find the line with version number  and change
        it to contain the new version.
        """
        file_name = "Cargo.toml"
        config_file = os.path.join(project_path, file_name)

        if not os.path.exists(config_file):
            debug('Cargo.toml file not found, this is probably not a Rust project')
            return

        debug("Found Cargo.toml file, attempting to update the version.")
        # We probably don't want version-release in config file as
        # release is an RPM concept
        new_version = new_version_release.split('-')[0]
        file_buffer = []

        # Read file line by line and replace version when found
        with open(config_file, 'r') as cfgfile:
            file_buffer = CargoBump.process_cargo_toml(cfgfile, new_version)

        # Write the buffer back into the file
        with open(config_file, 'w') as cfgfile:
            cfgfile.writelines(map(lambda x: x + "\n", file_buffer))

        # Add Cargo.toml into git index
        run_command("git add %s" % file_name)
开发者ID:Conan-Kudo,项目名称:tito,代码行数:28,代码来源:cargobump.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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