| OLD | NEW |
| 1 #!/bin/sh | 1 #!/bin/sh |
| 2 # | 2 # |
| 3 # Copyright (c) 2009 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 # TODO(mmoss) This is (mostly) just a conversion to sh syntax of | 7 # TODO(mmoss) This is (mostly) just a conversion to sh syntax of |
| 8 # tools/build/win/version.bat. Rewrite both as common python. | 8 # tools/build/win/version.bat. Rewrite both as common python. |
| 9 | 9 |
| 10 TMPL="$1" | 10 TMPL="$1" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 if [ -z "$LASTCHANGE" ]; then | 28 if [ -z "$LASTCHANGE" ]; then |
| 29 # Maybe it's a git client | 29 # Maybe it's a git client |
| 30 LASTCHANGE=$(git-svn info 2>/dev/null | grep "Revision:" | cut -d" " -f2-) | 30 LASTCHANGE=$(git-svn info 2>/dev/null | grep "Revision:" | cut -d" " -f2-) |
| 31 fi | 31 fi |
| 32 | 32 |
| 33 OFFICIAL_BUILD="false" | 33 OFFICIAL_BUILD="false" |
| 34 if [ "$CHROME_BUILD_TYPE" = "_official" ]; then | 34 if [ "$CHROME_BUILD_TYPE" = "_official" ]; then |
| 35 OFFICIAL_BUILD="true" | 35 OFFICIAL_BUILD="true" |
| 36 fi | 36 fi |
| 37 | 37 |
| 38 # Write to a temp file and only overwrite the target if it changes, to avoid |
| 39 # unnecessary compiles due to timestamp changes. |
| 40 TMPFILE=$(mktemp -q -t chromiumver-XXXX) |
| 41 if [ $? -ne 0 ]; then |
| 42 # Oops, just use the target file and suffer possibly unnecessary compile. |
| 43 TMPFILE="$OUTFILE" |
| 44 fi |
| 45 |
| 38 # TODO(mmoss) Make sure no sed special chars in substitutions. | 46 # TODO(mmoss) Make sure no sed special chars in substitutions. |
| 39 sed -e "s/@MAJOR@/$MAJOR/" \ | 47 sed -e "s/@MAJOR@/$MAJOR/" \ |
| 40 -e "s/@MINOR@/$MINOR/" \ | 48 -e "s/@MINOR@/$MINOR/" \ |
| 41 -e "s/@BUILD@/$BUILD/" \ | 49 -e "s/@BUILD@/$BUILD/" \ |
| 42 -e "s/@PATCH@/$PATCH/" \ | 50 -e "s/@PATCH@/$PATCH/" \ |
| 43 -e "s/@COMPANY_FULLNAME@/$COMPANY_FULLNAME/" \ | 51 -e "s/@COMPANY_FULLNAME@/$COMPANY_FULLNAME/" \ |
| 44 -e "s/@COMPANY_SHORTNAME@/$COMPANY_SHORTNAME/" \ | 52 -e "s/@COMPANY_SHORTNAME@/$COMPANY_SHORTNAME/" \ |
| 45 -e "s/@PRODUCT_FULLNAME@/$PRODUCT_FULLNAME/" \ | 53 -e "s/@PRODUCT_FULLNAME@/$PRODUCT_FULLNAME/" \ |
| 46 -e "s/@PRODUCT_SHORTNAME@/$PRODUCT_SHORTNAME/" \ | 54 -e "s/@PRODUCT_SHORTNAME@/$PRODUCT_SHORTNAME/" \ |
| 47 -e "s/@PRODUCT_EXE@/$PRODUCT_EXE/" \ | 55 -e "s/@PRODUCT_EXE@/$PRODUCT_EXE/" \ |
| 48 -e "s/@COPYRIGHT@/$COPYRIGHT/" \ | 56 -e "s/@COPYRIGHT@/$COPYRIGHT/" \ |
| 49 -e "s/@OFFICIAL_BUILD@/$OFFICIAL_BUILD/" \ | 57 -e "s/@OFFICIAL_BUILD@/$OFFICIAL_BUILD/" \ |
| 50 -e "s/@LASTCHANGE@/$LASTCHANGE/" "$TMPL" > "$OUTFILE" | 58 -e "s/@LASTCHANGE@/$LASTCHANGE/" "$TMPL" > "$TMPFILE" |
| 59 |
| 60 diff -q "$TMPFILE" "$OUTFILE" >/dev/null 2>&1 |
| 61 if [ $? -ne 0 ]; then |
| 62 mv -f "$TMPFILE" "$OUTFILE" |
| 63 else |
| 64 rm "$TMPFILE" |
| 65 fi |
| OLD | NEW |