Home | History | Annotate | Download | only in binutils
      1 #!/bin/sh
      2 # Copyright 2014 The Chromium Authors. All rights reserved.
      3 # Use of this source code is governed by a BSD-style license that can be
      4 # found in the LICENSE file.
      5 
      6 # Upload the generated output to Google storage.
      7 
      8 set -e
      9 
     10 if [ ! -d "$1" ]; then
     11   echo "update.sh <output directory from build-all.sh>"
     12   exit 1
     13 fi
     14 
     15 if echo "$PWD" | grep -qE "/src/third_party/binutils$"; then
     16   echo -n
     17 else
     18   echo "update.sh should be run in src/third_party/binutils"
     19   exit 1
     20 fi
     21 
     22 if [ ! -f ~/.boto ]; then
     23   echo "You need to run 'gsutil config' to set up authentication before running this script."
     24   exit 1
     25 fi
     26 
     27 for DIR in $1/*; do
     28   # Skip if not directory
     29   if [ ! -d "$DIR" ]; then
     30     continue
     31   fi
     32 
     33   case "$DIR" in
     34     */i686-pc-linux-gnu)
     35       export ARCH="Linux_ia32"
     36       ;;
     37 
     38     */x86_64-unknown-linux-gnu)
     39       export ARCH="Linux_x64"
     40       ;;
     41 
     42     *)
     43       echo "Unknown architecture directory $DIR"
     44       exit 1
     45       ;;
     46   esac
     47 
     48   if [ ! -d "$ARCH" ]; then
     49     mkdir -p "$ARCH"
     50   fi
     51 
     52   BINUTILS_TAR_BZ2="$ARCH/binutils.tar.bz2"
     53   FULL_BINUTILS_TAR_BZ2="$PWD/$BINUTILS_TAR_BZ2"
     54   if [ -f "${BINUTILS_TAR_BZ2}.sha1" ]; then
     55     rm "${BINUTILS_TAR_BZ2}.sha1"
     56   fi
     57   (cd "$DIR"; tar jcf "$FULL_BINUTILS_TAR_BZ2" .)
     58 
     59   upload_to_google_storage.py --bucket chromium-binutils "$BINUTILS_TAR_BZ2"
     60   git add -f "${BINUTILS_TAR_BZ2}.sha1"
     61 done
     62 
     63 echo "Please commit the new .sha1 to the Chromium repository"
     64 echo ""
     65 echo "# git commit"
     66