Home | History | Annotate | Download | only in cros_pkg
      1 #!/bin/bash -u
      2 #
      3 # Copyright 2015 Google Inc. All Rights Reserved.
      4 #
      5 # This script is intended to be used by binary_search_state.py, as
      6 # part of the binary search triage on ChromeOS packages.  This script
      7 # copies a list of packages from the 'bad' build tree into the working
      8 # build tree, for testing.
      9 #
     10 
     11 source common/common.sh
     12 
     13 pushd ${WORK_BUILD}
     14 
     15 PKG_LIST_FILE=$1
     16 
     17 overall_status=0
     18 
     19 if [[ -f ${PKG_LIST_FILE} ]] ; then
     20 
     21   # Read every line, and handle case where last line has no newline
     22   while read pkg || [[ -n "$pkg" ]];
     23   do
     24     sudo cp ${BAD_BUILD}/packages/$pkg ${WORK_BUILD}/packages/$pkg
     25     status=$?
     26     if [[ ${status} -ne 0 ]] ; then
     27       echo "Failed to copy ${pkg} to work build tree."
     28       overall_status=2
     29     fi
     30   done < ${PKG_LIST_FILE}
     31 else
     32 
     33   for o in "$@"
     34   do
     35     sudo cp ${BAD_BUILD}/packages/$o  ${WORK_BUILD}/packages/$o
     36     status=$?
     37     if [[ ${status} -ne 0 ]] ; then
     38       echo "Failed to copy ${pkg} to work build tree."
     39       overall_status=2
     40     fi
     41   done
     42 fi
     43 
     44 popd
     45 
     46 exit ${overall_status}
     47