| 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" |
| 11 OUTFILE="$2" | 11 OUTFILE="$2" |
| 12 CHROMEDIR=$(readlink -f $(dirname "$0")/../../../) | 12 CHROMEDIR=$(readlink -f $(dirname "$0")/../../../) |
| 13 | 13 |
| 14 # Load version digits as environment variables. | 14 # Load version digits as environment variables. |
| 15 . "$CHROMEDIR/VERSION" | 15 . "$CHROMEDIR/VERSION" |
| 16 | 16 |
| 17 # Load branding strings as environment variables | 17 # Load branding strings as environment variables |
| 18 DISTRIBUTION="chromium" | 18 DISTRIBUTION="chromium" |
| 19 if [ "$CHROMIUM_BUILD" = "_google_chrome" ]; then | 19 if [ "$CHROMIUM_BUILD" = "_google_chrome" ]; then |
| 20 DISTRIBUTION="google_chrome" | 20 DISTRIBUTION="google_chrome" |
| 21 fi | 21 fi |
| 22 # Make sure the string values are quoted. | 22 # Make sure the string values are quoted. |
| 23 eval $(sed -e 's/\([^=]*\)=\(.*\)/\1="\2"/' \ | 23 eval $(sed -e 's/\([^=]*\)=\(.*\)/\1="\2"/' \ |
| 24 "$CHROMEDIR/app/theme/$DISTRIBUTION/BRANDING") | 24 "$CHROMEDIR/app/theme/$DISTRIBUTION/BRANDING") |
| 25 | 25 |
| 26 # Determine the current repository revision number. | 26 # Determine the current repository revision number. |
| 27 LASTCHANGE=$(svn info 2>/dev/null | grep "Revision:" | cut -d" " -f2-) | 27 LASTCHANGE=$(svn info 2>/dev/null | grep "Revision:" | cut -d" " -f2-) |
| 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 log | perl -lnwe 'if (s/^\s*git-svn-id:\s+.*\@(\d+)\s[a-f\d\-
]+$/$1/) {print; exit; }') |
| 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 | 38 # Write to a temp file and only overwrite the target if it changes, to avoid |
| 39 # unnecessary compiles due to timestamp changes. | 39 # unnecessary compiles due to timestamp changes. |
| 40 TMPFILE=$(mktemp -q -t chromiumver-XXXXXX) | 40 TMPFILE=$(mktemp -q -t chromiumver-XXXXXX) |
| (...skipping 15 matching lines...) Expand all Loading... |
| 56 -e "s/@COPYRIGHT@/$COPYRIGHT/" \ | 56 -e "s/@COPYRIGHT@/$COPYRIGHT/" \ |
| 57 -e "s/@OFFICIAL_BUILD@/$OFFICIAL_BUILD/" \ | 57 -e "s/@OFFICIAL_BUILD@/$OFFICIAL_BUILD/" \ |
| 58 -e "s/@LASTCHANGE@/$LASTCHANGE/" "$TMPL" > "$TMPFILE" | 58 -e "s/@LASTCHANGE@/$LASTCHANGE/" "$TMPL" > "$TMPFILE" |
| 59 | 59 |
| 60 diff -q "$TMPFILE" "$OUTFILE" >/dev/null 2>&1 | 60 diff -q "$TMPFILE" "$OUTFILE" >/dev/null 2>&1 |
| 61 if [ $? -ne 0 ]; then | 61 if [ $? -ne 0 ]; then |
| 62 mv -f "$TMPFILE" "$OUTFILE" | 62 mv -f "$TMPFILE" "$OUTFILE" |
| 63 else | 63 else |
| 64 rm "$TMPFILE" | 64 rm "$TMPFILE" |
| 65 fi | 65 fi |
| OLD | NEW |