1#!/bin/sh
2
3# Copyright (c) 2009 The Chromium Authors. All rights reserved.
4# Use of this source code is governed by a BSD-style license that can be
5# found in the LICENSE file.
6
7# A simple shell script for creating necessary zip files for ChromeBot runs
8# from an output directory.
9# Pass the path to the output directory you wish to package.
10
11if [ $# = 0 ]; then
12  echo "usage: make_chromebot_zip.sh path/to/release/dir [output-name]"
13  exit 1
14fi
15
16tools_dir=$(dirname "$0")
17release_dir="$1"
18
19# Create chrome build zip file
20files=$(cat "$tools_dir/FILES")
21test_files=( reliability_tests.exe automated_ui_tests.exe )
22
23output=${2:-chrome-win32}
24rm -fr $output $output.zip
25mkdir $output
26
27# Get the absolute path of the output directory.  We need it when copying
28# files.
29output_abs=`cygpath -a $output`
30
31# Use cp --parents to copy full relative directory.  Since we need the
32# relative directory for the zip, change into the release dir.
33pushd "$release_dir"
34# The file names in FILES may contain whitespace, e.g. 'First Run'.
35# Change IFS setting so we only split words with '\n'
36IFS_Default=$IFS
37IFS=$'\n'
38for f in ${files[@]}; do
39  cp -r --parents "$f" "$output_abs"
40done
41IFS=$IFS_Default
42for f in ${test_files[@]}; do
43  cp -r --parents "$f" "$output_abs"
44done
45popd
46
47zip -r $output.zip $output
48
49# Create chrome symbol zip file
50sym_files=( chrome.dll.pdb chrome.exe.pdb )
51
52sym_output=${2:-chrome-win32-syms}
53rm -fr $sym_output $sym_output.zip
54mkdir $sym_output
55
56# Again, use cp --parents to copy full relative directory.  Since we need the
57# relative directory for the zip, change into the release dir.
58sym_output_abs=`cygpath -a $sym_output`
59pushd "$release_dir"
60for f in ${sym_files[@]}; do
61  cp -r --parents "$f" "$sym_output_abs"
62done
63popd
64
65zip -r $sym_output.zip $sym_output
66