 Chromium Code Reviews
 Chromium Code Reviews Issue 164091:
  Report apt-get failures in install-build-deps.sh...  (Closed) 
  Base URL: svn://chrome-svn/chrome/trunk/src/
    
  
    Issue 164091:
  Report apt-get failures in install-build-deps.sh...  (Closed) 
  Base URL: svn://chrome-svn/chrome/trunk/src/| OLD | NEW | 
|---|---|
| 1 #!/bin/bash -e | 1 #!/bin/bash -e | 
| 2 | 2 | 
| 3 # Script to install everything needed to build chromium (well, ideally, anyway) | 3 # Script to install everything needed to build chromium (well, ideally, anyway) | 
| 4 # See http://code.google.com/p/chromium/wiki/LinuxBuildInstructions | 4 # See http://code.google.com/p/chromium/wiki/LinuxBuildInstructions | 
| 5 # and http://code.google.com/p/chromium/wiki/LinuxBuild64Bit | 5 # and http://code.google.com/p/chromium/wiki/LinuxBuild64Bit | 
| 6 | 6 | 
| 7 install_gold() { | 7 install_gold() { | 
| 8 # Gold is optional; it's a faster replacement for ld, | 8 # Gold is optional; it's a faster replacement for ld, | 
| 9 # and makes life on 2GB machines much more pleasant. | 9 # and makes life on 2GB machines much more pleasant. | 
| 10 | 10 | 
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 161 dbg_list= | 161 dbg_list= | 
| 162 fi | 162 fi | 
| 163 | 163 | 
| 164 sudo apt-get update | 164 sudo apt-get update | 
| 165 | 165 | 
| 166 # We initially run "apt-get" with the --reinstall option and parse its output. | 166 # We initially run "apt-get" with the --reinstall option and parse its output. | 
| 167 # This way, we can find all the packages that need to be newly installed | 167 # This way, we can find all the packages that need to be newly installed | 
| 168 # without accidentally promoting any packages from "auto" to "manual". | 168 # without accidentally promoting any packages from "auto" to "manual". | 
| 169 # We then re-run "apt-get" with just the list of missing packages. | 169 # We then re-run "apt-get" with just the list of missing packages. | 
| 170 echo "Finding missing packages..." | 170 echo "Finding missing packages..." | 
| 171 new_list="$(yes n | | 171 packages="${dev_list} ${lib_list} ${dbg_list} | 
| 172 LANG=C sudo apt-get install --reinstall \ | 172 $([ "$(uname -m)" = x86_64 ] && echo ${cmp_list})" | 
| 173 ${dev_list} ${lib_list} ${dbg_list} \ | 173 echo "Packages required: $packages" | 
| 174 $([ "$(uname -m)" = x86_64 ] && echo ${cmp_list}) \ | 174 new_list_cmd="sudo apt-get install --reinstall $(echo $packages)" | 
| 175 | | 175 if new_list="$(yes n | LANG=C $new_list_cmd)" | 
| 176 sed -e '1,/The following NEW packages will be installed:/d;s/^ //;t ;d')" | 176 then | 
| 177 echo "No missing packages, and the packages are up-to-date." | |
| 178 elif [ $? -eq 1 ] | |
| 179 then | |
| 180 # We expect apt-get to have exit status of 1. | |
| 181 # This indicates that we canceled the install with "yes n|". | |
| 182 new_list=$(echo $new_list | | |
| 183 sed -e '1,/The following NEW packages will be installed:/d;s/^ //;t;d') | |
| 184 echo "Installing missing packages: $new_list." | |
| 185 sudo apt-get install ${new_list} | |
| 186 else | |
| 187 # An apt-get exit status of 100 indicates that a real error has occurred. | |
| 177 | 188 | 
| 178 echo "Installing missing packages..." | 189 # I am intentionally leaving out the '"'s around new_list_cmd, | 
| 179 sudo apt-get install ${new_list} | 190 # as this makes it easier to cut and paste the output | 
| 191 echo | |
| 192 echo "The following command failed: " ${new_list_cmd} | |
| 193 echo | |
| 194 echo "It produces the following output:" | |
| 195 yes n | $new_list_cmd || true | |
| 196 echo | |
| 197 echo "You will have to install the above packages yourself." | |
| 198 echo | |
| 199 exit 100 | |
| 200 fi | |
| 180 | 201 | 
| 181 # Some operating systems already ship gold | 202 # Some operating systems already ship gold | 
| 182 # (on Debian, you can probably do "apt-get install binutils-gold" to get it), | 203 # (on Debian, you can probably do "apt-get install binutils-gold" to get it), | 
| 183 # but though Ubuntu toyed with shipping it, they haven't yet. | 204 # but though Ubuntu toyed with shipping it, they haven't yet. | 
| 184 # So just install from source if it isn't the default linker. | 205 # So just install from source if it isn't the default linker. | 
| 185 | 206 | 
| 186 case `ld --version` in | 207 case `ld --version` in | 
| 187 *gold*) ;; | 208 *gold*) ;; | 
| 188 * ) | 209 * ) | 
| 189 # FIXME: avoid installing as /usr/bin/ld | 210 # FIXME: avoid installing as /usr/bin/ld | 
| (...skipping 25 matching lines...) Expand all Loading... | |
| 215 echo "Exiting without installing any 32bit libraries." | 236 echo "Exiting without installing any 32bit libraries." | 
| 216 exit 0 | 237 exit 0 | 
| 217 fi | 238 fi | 
| 218 tmp=/tmp/install-32bit.$$ | 239 tmp=/tmp/install-32bit.$$ | 
| 219 trap 'rm -rf "${tmp}"' EXIT INT TERM QUIT | 240 trap 'rm -rf "${tmp}"' EXIT INT TERM QUIT | 
| 220 mkdir -p "${tmp}/apt/lists/partial" "${tmp}/cache" "${tmp}/partial" | 241 mkdir -p "${tmp}/apt/lists/partial" "${tmp}/cache" "${tmp}/partial" | 
| 221 touch "${tmp}/status" | 242 touch "${tmp}/status" | 
| 222 | 243 | 
| 223 [ -r /etc/apt/apt.conf ] && cp /etc/apt/apt.conf "${tmp}/apt/" | 244 [ -r /etc/apt/apt.conf ] && cp /etc/apt/apt.conf "${tmp}/apt/" | 
| 224 cat >>"${tmp}/apt/apt.conf" <<-EOF | 245 cat >>"${tmp}/apt/apt.conf" <<-EOF | 
| 225 » Apt::Architecture "i386"; | 246 Apt::Architecture "i386"; | 
| 226 » Dir::Cache "${tmp}/cache"; | 247 Dir::Cache "${tmp}/cache"; | 
| 227 » Dir::Cache::Archives "${tmp}/"; | 248 Dir::Cache::Archives "${tmp}/"; | 
| 228 » Dir::State::Lists "${tmp}/apt/lists/"; | 249 Dir::State::Lists "${tmp}/apt/lists/"; | 
| 229 » Dir::State::status "${tmp}/status"; | 250 Dir::State::status "${tmp}/status"; | 
| 230 » EOF | 251 EOF | 
| 
Lei Zhang
2009/08/07 20:01:02
Actually that needed to be a tab. When it's 8 spac
 | |
| 231 | 252 | 
| 232 # Download 32bit packages | 253 # Download 32bit packages | 
| 233 echo "Computing list of available 32bit packages..." | 254 echo "Computing list of available 32bit packages..." | 
| 234 apt-get -c="${tmp}/apt/apt.conf" update | 255 apt-get -c="${tmp}/apt/apt.conf" update | 
| 235 | 256 | 
| 236 echo "Downloading available 32bit packages..." | 257 echo "Downloading available 32bit packages..." | 
| 237 apt-get -c="${tmp}/apt/apt.conf" \ | 258 apt-get -c="${tmp}/apt/apt.conf" \ | 
| 238 --yes --download-only --force-yes --reinstall install \ | 259 --yes --download-only --force-yes --reinstall install \ | 
| 239 ${lib_list} ${dbg_list} | 260 ${lib_list} ${dbg_list} | 
| 240 | 261 | 
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 326 sed -e 's/[.]so[.][0-9].*/.so/' | | 347 sed -e 's/[.]so[.][0-9].*/.so/' | | 
| 327 sort -u); do | 348 sort -u); do | 
| 328 [ "x${i##*/}" = "xld-linux.so" ] && continue | 349 [ "x${i##*/}" = "xld-linux.so" ] && continue | 
| 329 [ -r "$i" ] && continue | 350 [ -r "$i" ] && continue | 
| 330 j="$(ls "$i."* | sed -e 's/.*[.]so[.]\([^.]*\)$/\1/;t;d' | | 351 j="$(ls "$i."* | sed -e 's/.*[.]so[.]\([^.]*\)$/\1/;t;d' | | 
| 331 sort -n | tail -n 1)" | 352 sort -n | tail -n 1)" | 
| 332 [ -r "$i.$j" ] || continue | 353 [ -r "$i.$j" ] || continue | 
| 333 sudo ln -s "${i##*/}.$j" "$i" | 354 sudo ln -s "${i##*/}.$j" "$i" | 
| 334 done | 355 done | 
| 335 fi | 356 fi | 
| OLD | NEW |