Beispiel #1
0
    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
Beispiel #2
0
  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
Beispiel #3
0
    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
Beispiel #4
0
 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)
         self.build_version += ".git." + str(self.commit_count) + "." + str(self.git_commit_id[:7])
         self.ran_setup_test_specfile = True
Beispiel #5
0
 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)
         self.build_version += ".git." + str(self.commit_count) + "." + str(
             self.git_commit_id[:7])
         self.ran_setup_test_specfile = True