コード例 #1
0
ファイル: __init__.py プロジェクト: neki06/origin
    def _get_build_version(self):
        """
      Figure out the git tag and version-release we're building.
      """
        # Determine which package version we should build:
        build_version = None
        if self.build_tag:
            build_version = self.build_tag[len(self.project_name + "-"):]
        else:
            build_version = get_latest_tagged_version(self.project_name)
            if build_version is None:
                if not self.test:
                    error_out([
                        "Unable to lookup latest package info.",
                        "Perhaps you need to tag first?"
                    ])
                sys.stderr.write("WARNING: unable to lookup latest package "
                                 "tag, building untagged test project\n")
                build_version = get_spec_version_and_release(
                    self.start_dir, find_spec_file(in_dir=self.start_dir))
            self.build_tag = "v%s" % (build_version)

        if not self.test:
            check_tag_exists(self.build_tag, offline=self.offline)
        return build_version
コード例 #2
0
ファイル: main.py プロジェクト: maxamillion/tito
    def _get_build_version(self):
        """
        Figure out the git tag and version-release we're building.
        """
        # Determine which package version we should build:
        build_version = None
        if self.build_tag:
            build_version = self.build_tag[len(self.project_name + "-"):]
        else:
            build_version = get_latest_tagged_version(self.project_name)
            if build_version is None:
                if not self.test:
                    error_out(["Unable to lookup latest package info.",
                            "Perhaps you need to tag first?"])
                warn_out("unable to lookup latest package "
                    "tag, building untagged test project")
                build_version = get_spec_version_and_release(self.start_dir,
                    find_spec_like_file(self.start_dir))
            self.build_tag = "%s-%s" % (self.project_name, build_version)

        self.spec_version = build_version.split('-')[-2]
        self.spec_release = build_version.split('-')[-1]
        if not self.test:
            check_tag_exists(self.build_tag, offline=self.offline)
        return build_version
コード例 #3
0
    def _get_build_version(self):
        """
        Figure out the git tag and version-release we're building.
        """
        # Determine which package version we should build:
        build_version = None
        if self.build_tag:
            build_version = self.build_tag[len(self.project_name + "-"):]
        else:
            build_version = get_latest_tagged_version(self.project_name)
            if build_version is None:
                if not self.test:
                    error_out(["Unable to lookup latest package info.",
                            "Perhaps you need to tag first?"])
                warn_out("unable to lookup latest package "
                    "tag, building untagged test project")
                build_version = get_spec_version_and_release(self.start_dir,
                    find_spec_like_file(self.start_dir))
            self.build_tag = "%s-%s" % (self.project_name, build_version)

        self.spec_version = build_version.split('-')[-2]
        self.spec_release = build_version.split('-')[-1]
        if not self.test:
            check_tag_exists(self.build_tag, offline=self.offline)
        return build_version
コード例 #4
0
    def test_tag_with_changelog_multiple(self):
        tito("tag --accept-auto-changelog --use-version 9.0.0 --changelog=Test --changelog=Fake")
        check_tag_exists("%s-9.0.0-1" % PKG_NAME, offline=True)

        changelog = getoutput("cat *.spec")
        self.assertTrue('- Test' in changelog)
        self.assertTrue('- Fake' in changelog)
コード例 #5
0
ファイル: cli.py プロジェクト: jsabo/tito
    def main(self):
        BaseCliModule.main(self)

        build_dir = os.path.normpath(os.path.abspath(self.options.output_dir))
        package_name = get_project_name(tag=self.options.tag)

        build_tag = None
        build_version = None
        # Determine which package version we should build:
        if self.options.tag:
            build_tag = self.options.tag
            build_version = build_tag[len(package_name + "-"):]
        else:
            build_version = get_latest_tagged_version(package_name)
            if build_version == None:
                error_out(["Unable to lookup latest package info.",
                        "Perhaps you need to tag first?"])
            build_tag = "%s-%s" % (package_name, build_version)

        if not self.options.test:
            check_tag_exists(build_tag, offline=self.options.offline)

        self.pkg_config = self._read_project_config(package_name, build_dir,
                self.options.tag, self.options.no_cleanup)

        builder = self._create_builder(package_name, build_tag,
                build_version, self.options, self.pkg_config,
                build_dir)
        builder.run(self.options)
コード例 #6
0
ファイル: main.py プロジェクト: maxamillion/tito
    def tgz(self):
        """
        Override parent behavior, we need a tgz from the upstream spacewalk
        project we're based on.
        """
        # TODO: Wasteful step here, all we really need is a way to look for a
        # spec file at the point in time this release was tagged.
        NoTgzBuilder._setup_sources(self)
        # If we knew what it was named at that point in time we could just do:
        # Export a copy of our spec file at the revision to be built:
#        cmd = "git show %s:%s%s > %s" % (self.git_commit_id,
#                self.relative_project_dir, self.spec_file_name,
#                self.spec_file)
#        debug(cmd)
        self._create_build_dirs()

        self.upstream_version = self._get_upstream_version()
        self.upstream_tag = "%s-%s-1" % (self.upstream_name,
                self.upstream_version)

        print("Building upstream tgz for tag [%s]" % (self.upstream_tag))
        if self.upstream_tag != self.build_tag:
            check_tag_exists(self.upstream_tag, offline=self.offline)

        self.spec_file = os.path.join(self.rpmbuild_sourcedir,
                self.spec_file_name)
        command = "cp %s %s" % (os.path.join(self.rpmbuild_gitcopy,
            self.spec_file_name), self.spec_file)
        run_command(command)

        # Create the upstream tgz:
        prefix = "%s-%s" % (self.upstream_name, self.upstream_version)
        tgz_filename = "%s.tar.gz" % prefix
        commit = get_build_commit(tag=self.upstream_tag)
        relative_dir = get_relative_project_dir(
            project_name=self.upstream_name, commit=commit)
        tgz_fullpath = os.path.join(self.rpmbuild_sourcedir, tgz_filename)
        print("Creating %s from git tag: %s..." % (tgz_filename, commit))
        create_tgz(self.git_root, prefix, commit, relative_dir,
                tgz_fullpath)
        self.ran_tgz = True
        self.sources.append(tgz_fullpath)

        # If these are equal then the tag we're building was likely created in
        # Spacewalk and thus we don't need to do any patching.
        if (self.upstream_tag == self.build_tag and not self.test):
            return

        self.patch_upstream()
コード例 #7
0
    def tgz(self):
        """
        Override parent behavior, we need a tgz from the upstream spacewalk
        project we're based on.
        """
        # TODO: Wasteful step here, all we really need is a way to look for a
        # spec file at the point in time this release was tagged.
        NoTgzBuilder._setup_sources(self)
        # If we knew what it was named at that point in time we could just do:
        # Export a copy of our spec file at the revision to be built:
#        cmd = "git show %s:%s%s > %s" % (self.git_commit_id,
#                self.relative_project_dir, self.spec_file_name,
#                self.spec_file)
#        debug(cmd)
        self._create_build_dirs()

        self.upstream_version = self._get_upstream_version()
        self.upstream_tag = "%s-%s-1" % (self.upstream_name,
                self.upstream_version)

        print("Building upstream tgz for tag [%s]" % (self.upstream_tag))
        if self.upstream_tag != self.build_tag:
            check_tag_exists(self.upstream_tag, offline=self.offline)

        self.spec_file = os.path.join(self.rpmbuild_sourcedir,
                self.spec_file_name)
        command = "cp %s %s" % (os.path.join(self.rpmbuild_gitcopy,
            self.spec_file_name), self.spec_file)
        run_command(command)

        # Create the upstream tgz:
        prefix = "%s-%s" % (self.upstream_name, self.upstream_version)
        tgz_filename = "%s.tar.gz" % prefix
        commit = get_build_commit(tag=self.upstream_tag)
        relative_dir = get_relative_project_dir(
            project_name=self.upstream_name, commit=commit)
        tgz_fullpath = os.path.join(self.rpmbuild_sourcedir, tgz_filename)
        print("Creating %s from git tag: %s..." % (tgz_filename, commit))
        create_tgz(self.git_root, prefix, commit, relative_dir,
                tgz_fullpath)
        self.ran_tgz = True
        self.sources.append(tgz_fullpath)

        # If these are equal then the tag we're building was likely created in
        # Spacewalk and thus we don't need to do any patching.
        if (self.upstream_tag == self.build_tag and not self.test):
            return

        self.patch_upstream()
コード例 #8
0
    def test_undo_tag(self):
        os.chdir(self.repo_dir)
        original_head = getoutput('git show-ref -s refs/heads/master')

        # Create tito tag, which adds a new commit and moves head.
        tito("tag --accept-auto-changelog --debug")
        tag = "%s-0.0.2-1" % PKG_NAME
        check_tag_exists(tag, offline=True)
        new_head = getoutput('git show-ref -s refs/heads/master')
        self.assertNotEqual(original_head, new_head)

        # Undo tito tag, which rewinds one commit to original head.
        tito("tag -u")
        self.assertFalse(tag_exists_locally(tag))
        new_head = getoutput('git show-ref -s refs/heads/master')
        self.assertEqual(original_head, new_head)
コード例 #9
0
ファイル: __init__.py プロジェクト: RomainVabre/origin
    def _get_build_version(self):
        """
        Figure out the git tag and version-release we're building.
        """
        # Determine which package version we should build:
        build_version = None
        if self.build_tag:
            build_version = self.build_tag[len(self.project_name + "-") :]
        else:
            build_version = get_latest_tagged_version(self.project_name)
            if build_version is None:
                if not self.test:
                    error_out(["Unable to lookup latest package info.", "Perhaps you need to tag first?"])
                sys.stderr.write("WARNING: unable to lookup latest package " "tag, building untagged test project\n")
                build_version = get_spec_version_and_release(self.start_dir, find_spec_file(in_dir=self.start_dir))
            self.build_tag = "v{0}".format(build_version)

        if not self.test:
            check_tag_exists(self.build_tag, offline=self.offline)
        return build_version
コード例 #10
0
 def test_tag_with_version(self):
     tito("tag --accept-auto-changelog --debug --use-version 9.0.0")
     check_tag_exists("%s-9.0.0-1" % PKG_NAME, offline=True)
コード例 #11
0
 def test_tag(self):
     tito("tag --accept-auto-changelog --debug")
     check_tag_exists("%s-0.0.2-1" % PKG_NAME, offline=True)
コード例 #12
0
ファイル: singleproject_tests.py プロジェクト: wottop/tito
 def test_tag_with_version_and_release(self):
     tito(
         "tag --accept-auto-changelog --debug --use-version 9.0.0 --use-release dummyvalue"
     )
     check_tag_exists("%s-9.0.0-dummyvalue" % PKG_NAME, offline=True)
コード例 #13
0
 def test_tag_with_version_and_release(self):
     tito("tag --accept-auto-changelog --debug --use-version 9.0.0 --use-release dummyvalue")
     check_tag_exists("%s-9.0.0-dummyvalue" % PKG_NAME, offline=True)
コード例 #14
0
ファイル: functional-tests.py プロジェクト: jsabo/tito
 def test_initial_tag_keep_version(self):
     # Tags were actually created in setup code:
     for pkg_name, pkg_dir in TEST_PKGS:
         check_tag_exists("%s-0.0.1-1" % pkg_name, offline=True)
         self.assertTrue(os.path.exists(os.path.join(MULTI_GIT, 
             "rel-eng/packages", pkg_name)))
コード例 #15
0
ファイル: functional-tests.py プロジェクト: jsabo/tito
 def test_initial_tag(self):
     """ Test creating an initial tag. """
     run_tito("tag --accept-auto-changelog --debug")
     check_tag_exists("%s-0.0.2-1" % TEST_PKG_1, offline=True)
コード例 #16
0
ファイル: functional-tests.py プロジェクト: jsabo/tito
 def test_initial_tag_keep_version(self):
     """ Create an initial package tag with --keep-version. """
     check_tag_exists("%s-0.0.1-1" % TEST_PKG_1, offline=True)
     self.assertTrue(os.path.exists(os.path.join(SINGLE_GIT, 
         "rel-eng/packages", TEST_PKG_1)))