Adding a general script to fetch values from the BRANDING files.

Update the scripts to fetch values from the BRANDING files instead of hardcoding the values.
Review URL: http://codereview.chromium.org/113555

git-svn-id: http://src.chromium.org/svn/trunk/src/build@16372 4ff67af0-8c30-449e-8e8b-ad334ec8d88c
This commit is contained in:
thomasvl@chromium.org 2009-05-19 14:10:09 +00:00
Родитель 36d748e055
Коммит 0c7b4e0e5a
4 изменённых файлов: 66 добавлений и 40 удалений

51
branding_value.sh Executable file
Просмотреть файл

@ -0,0 +1,51 @@
#!/bin/sh
# Copyright (c) 2008 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# This is a wrapper for fetching values from the BRANDING files. Pass the
# value of GYP's branding variable followed by the key you want and the right
# file is checked.
#
# branding_value.sh Chromium COPYRIGHT
# branding_value.sh Chromium PRODUCT_FULLNAME
#
set -e
if [ $# -ne 2 ] ; then
echo "error: expect two arguments, branding and key" >&2
exit 1
fi
BUILD_BRANDING=$1
THE_KEY=$2
pushd $(dirname "${0}") > /dev/null
BUILD_DIR=$(pwd)
popd > /dev/null
TOP="${BUILD_DIR}/.."
case ${BUILD_BRANDING} in
Chromium)
BRANDING_FILE="${TOP}/chrome/app/theme/chromium/BRANDING"
;;
Chrome)
BRANDING_FILE="${TOP}/chrome/app/theme/google_chrome/BRANDING"
;;
*)
echo "error: unknown branding: ${BUILD_BRANDING}" >&2
exit 1
;;
esac
BRANDING_VALUE=$(sed -n -e "s/^${THE_KEY}=\(.*\)\$/\1/p" "${BRANDING_FILE}")
if [ -z "${BRANDING_VALUE}" ] ; then
echo "error: failed to find key '${THE_KEY}'" >&2
exit 1
fi
echo "${BRANDING_VALUE}"

Просмотреть файл

@ -20,26 +20,20 @@ set -e
TOP="${SRCROOT}/.."
PKG_DMG="${TOP}/build/mac/pkg-dmg"
BRAND_SCRIPT="${TOP}/build/branding_value.sh"
BUILD_BRANDING=$1
if [ "${BUILD_BRANDING}" == "Chromium" ]; then
APP_NAME="Chromium"
DMG_NAME="Chromium.dmg"
elif [ "${BUILD_BRANDING}" == "Chrome" ]; then
APP_NAME="Google Chrome"
DMG_NAME="GoogleChrome.dmg"
else
echo "error: unknown branding: ${BUILD_BRANDING}" >&2
exit 1
fi
# show things as we run them
set -x
APP_NAME=$("${BRAND_SCRIPT}" "${BUILD_BRANDING}" PRODUCT_FULLNAME)
DMG_NAME=$(echo "${APP_NAME}" | sed "s/ //g")
SRC_APP_PATH="${BUILT_PRODUCTS_DIR}/${APP_NAME}.app"
VOL_NAME="${APP_NAME}"
DST_DMG_PATH="${BUILT_PRODUCTS_DIR}/${DMG_NAME}"
# show things as we run them
set -x
# Call the real working
"${PKG_DMG}" --source /var/empty \
--target "${DST_DMG_PATH}" \

Просмотреть файл

@ -19,15 +19,9 @@ fi
TOP="${SRCROOT}/.."
BUILD_BRANDING=$1
if [ "${BUILD_BRANDING}" == "Chromium" ]; then
SRC_APP_NAME="Chromium"
elif [ "${BUILD_BRANDING}" == "Chrome" ]; then
SRC_APP_NAME="Google Chrome"
else
echo "error: unknown branding: ${BUILD_BRANDING}" >&2
exit 1
fi
BRAND_SCRIPT="${TOP}/build/branding_value.sh"
SRC_APP_NAME=$("${BRAND_SCRIPT}" "${BUILD_BRANDING}" PRODUCT_FULLNAME)
. "${TOP}/chrome/VERSION"
BREAKPAD_DUMP_SYMS="${BUILT_PRODUCTS_DIR}/dump_syms"

Просмотреть файл

@ -54,18 +54,13 @@ fi
TOP="${SRCROOT}/.."
BUILD_BRANDING=$1
if [ "${BUILD_BRANDING}" == "Chromium" ]; then
APP_NAME="Chromium"
elif [ "${BUILD_BRANDING}" == "Chrome" ]; then
APP_NAME="Google Chrome"
else
echo "error: unknown branding: ${BUILD_BRANDING}" >&2
exit 1
fi
SRC_APP_PATH="${BUILT_PRODUCTS_DIR}/${APP_NAME}.app"
BRAND_SCRIPT="${TOP}/build/branding_value.sh"
set -x
APP_NAME=$("${BRAND_SCRIPT}" "${BUILD_BRANDING}" PRODUCT_FULLNAME)
SRC_APP_PATH="${BUILT_PRODUCTS_DIR}/${APP_NAME}.app"
# Figure out what version this build corresponds to. Just use the svn revision
# for now. Warning: my svnversion returns 10495:10552M. But that's ok since
# it is just for reference.
@ -79,16 +74,8 @@ fi
FULL_VERSION="${MAJOR}.${MINOR}.${BUILD}.${PATCH}"
SHORT_VERSION="${MAJOR}.${MINOR}.${BUILD}"
# Load the branding file
if [ "${BUILD_BRANDING}" == "Chromium" ]; then
BRANDING_FILE="${TOP}/chrome/app/theme/chromium/BRANDING"
elif [ "${BUILD_BRANDING}" == "Chrome" ]; then
BRANDING_FILE="${TOP}/chrome/app/theme/google_chrome/BRANDING"
else
echo "error: unknown branding: ${BUILD_BRANDING}" >&2
exit 1
fi
COPYRIGHT_STRING=$(sed -n -e 's/^COPYRIGHT=\(.*\)$/\1/p' "${BRANDING_FILE}")
# Fetch the copyright
COPYRIGHT_STRING=$("${BRAND_SCRIPT}" "${BUILD_BRANDING}" COPYRIGHT)
# Map (c) or (C) to the copyright sign
COPYRIGHT_STRING=$(echo "${COPYRIGHT_STRING}" | sed -e $'s/([cC])/\302\251/g')