Uploaded image for project: 'Code Tools'
  1. Code Tools
  2. CODETOOLS-7902987

Git build should record the actual tag, not the latest one

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • P4
    • Resolution: Fixed
    • None
    • None
    • tools
    • None

    Description

      Try to build older jtreg5.1-b01 from the current workspace, like this:

      $ git checkout jtreg5.1-b01
      $ rm -rf build; sh make/build-all.sh ~/Install/jdk8u252-ea/
      ...

      $ build/images/jtreg/bin/jtreg -version
      jtreg, version jtreg6 dev jtreg6

      $ cat build/images/jtreg/release
      JTREG_VERSION=jtreg6 jtreg6
      BUILD_DATE=June 28, 2021

      Note it reports jtreg6! This would then fail when JDK tries to poll the JTReg version for internal checks.

      This happens because the build polls last Git tag, regardless of whether the current HEAD is at previous changeset. I think we are better off using "git describe".

      diff --git a/make/build-all.sh b/make/build-all.sh
      index 150e58d..46c4ace 100644
      --- a/make/build-all.sh
      +++ b/make/build-all.sh
      @@ -84,7 +84,7 @@ get_root() {
       get_tag_info() {
          case $SCM_TYPE in
              HG) hg tags | grep jtreg | head -1 ;;
      - GIT) git tag | grep jtreg | tail -1 ;;
      + GIT) git describe ;;
              *) echo "Error: unknown SCM" >&2 ; exit 1 ;;
          esac
       }

      After this:

      $ cat build/images/jtreg/release
      JTREG_VERSION=5.1 b01
      BUILD_DATE=June 28, 2021

      $ build/images/jtreg/bin/jtreg -version
      jtreg, version 5.1 dev b01

      While this patch would not help building the older JTRegs without rewriting the repository history, it would be good to get in fixed for future JTRegs. This patch can be used separately to build older JTRegs.

      Attachments

        Issue Links

          Activity

            People

              shade Aleksey Shipilev
              shade Aleksey Shipilev
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: