Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(320)

Side by Side Diff: src/scripts/common.sh

Issue 595009: Add a warning to users trying to run old build scripts. (Closed)
Patch Set: new2 Created 10 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved. 1 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 # Common constants for build scripts 5 # Common constants for build scripts
6 # This must evaluate properly for both /bin/bash and /bin/sh 6 # This must evaluate properly for both /bin/bash and /bin/sh
7 7
8 # All scripts should die on error unless commands are specifically excepted 8 # All scripts should die on error unless commands are specifically excepted
9 # by prefixing with '!' or surrounded by 'set +e' / 'set -e'. 9 # by prefixing with '!' or surrounded by 'set +e' / 'set -e'.
10 # TODO: Re-enable this once shflags is less prone to dying. 10 # TODO: Re-enable this once shflags is less prone to dying.
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 if [ -e /etc/debian_chroot ] 101 if [ -e /etc/debian_chroot ]
102 then 102 then
103 INSIDE_CHROOT=1 103 INSIDE_CHROOT=1
104 else 104 else
105 INSIDE_CHROOT=0 105 INSIDE_CHROOT=0
106 fi 106 fi
107 107
108 # Directory locations inside the dev chroot 108 # Directory locations inside the dev chroot
109 CHROOT_TRUNK_DIR="/home/$USER/trunk" 109 CHROOT_TRUNK_DIR="/home/$USER/trunk"
110 110
111 # Check to ensure not running old scripts
112 V_REVERSE=''
113 V_VIDOFF=''
114 case "$(basename $0)" in
115 build_image.sh|build_platform_packages.sh|customize_rootfs.sh|make_chroot.sh)
116 echo
117 echo "$V_REVERSE============================================================"
118 echo "=========================== WARNING ======================"
119 echo "============================================================$V_VIDOFF"
120 echo
121 echo "RUNNING OLD BUILD SYSTEM SCRIPTS. RUN THE PORTAGE-BASED BUILD HERE:"
122 echo "http://www.chromium.org/chromium-os/building-chromium-os/portage-based-b uild"
123 echo
124 if [ "$USER" != "chrome-bot" ]
125 then
126 read -n1 -p "Press any key to continue using the OLD build system..."
127 echo
128 echo
129 fi
130 ;;
131 esac
132
111 # ----------------------------------------------------------------------------- 133 # -----------------------------------------------------------------------------
112 # Functions 134 # Functions
113 135
114 # Make a package 136 # Make a package
115 function make_pkg_common { 137 function make_pkg_common {
116 # Positional parameters from calling script. :? means "fail if unset". 138 # Positional parameters from calling script. :? means "fail if unset".
117 set -e 139 set -e
118 PKG_BASE=${1:?} 140 PKG_BASE=${1:?}
119 shift 141 shift
120 set +e 142 set +e
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 then 208 then
187 echo "Can't find $PKG_NAME; attempting to install it." 209 echo "Can't find $PKG_NAME; attempting to install it."
188 sudo apt-get --yes --force-yes install $PKG_NAME 210 sudo apt-get --yes --force-yes install $PKG_NAME
189 fi 211 fi
190 } 212 }
191 213
192 # Returns true if the input file is whitelisted. 214 # Returns true if the input file is whitelisted.
193 # 215 #
194 # $1 - The file to check 216 # $1 - The file to check
195 is_whitelisted() { 217 is_whitelisted() {
196 local file=$1 218 local file=$1
197 local whitelist="$FLAGS_whitelist" 219 local whitelist="$FLAGS_whitelist"
198 test -f "$whitelist" || (echo "Whitelist file missing ($whitelist)" && exit 1) 220 test -f "$whitelist" || (echo "Whitelist file missing ($whitelist)" && exit 1)
199 221
200 local checksum=$(md5sum "$file" | awk '{ print $1 }') 222 local checksum=$(md5sum "$file" | awk '{ print $1 }')
201 local count=$(sed -e "s/#.*$//" "${whitelist}" | grep -c "$checksum" \ 223 local count=$(sed -e "s/#.*$//" "${whitelist}" | grep -c "$checksum" \
202 || /bin/true) 224 || /bin/true)
203 test $count -ne 0 225 test $count -ne 0
204 } 226 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698