Bug 460926 A11y hierachy is broken on Ubuntu 8.10 (GNOME 2.24), r=Evan.Yan sr=roc
[wine-gecko.git] / testing / sisyphus / bin / edit-talkback.sh
blobdd0aad7c61aea0e3f10b6ed932ac1a3a95160257
1 #!/bin/bash -e
2 # -*- Mode: Shell-script; tab-width: 4; indent-tabs-mode: nil; -*-
3 # ***** BEGIN LICENSE BLOCK *****
4 # Version: MPL 1.1/GPL 2.0/LGPL 2.1
6 # The contents of this file are subject to the Mozilla Public License Version
7 # 1.1 (the "License"); you may not use this file except in compliance with
8 # the License. You may obtain a copy of the License at
9 # http://www.mozilla.org/MPL/
11 # Software distributed under the License is distributed on an "AS IS" basis,
12 # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 # for the specific language governing rights and limitations under the
14 # License.
16 # The Original Code is mozilla.org code.
18 # The Initial Developer of the Original Code is
19 # Mozilla Corporation.
20 # Portions created by the Initial Developer are Copyright (C) 2006.
21 # the Initial Developer. All Rights Reserved.
23 # Contributor(s):
24 # Bob Clary <bob@bclary.com>
26 # Alternatively, the contents of this file may be used under the terms of
27 # either the GNU General Public License Version 2 or later (the "GPL"), or
28 # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
29 # in which case the provisions of the GPL or the LGPL are applicable instead
30 # of those above. If you wish to allow use of your version of this file only
31 # under the terms of either the GPL or the LGPL, and not to allow others to
32 # use your version of this file under the terms of the MPL, indicate your
33 # decision by deleting the provisions above and replace them with the notice
34 # and other provisions required by the GPL or the LGPL. If you do not delete
35 # the provisions above, a recipient may use your version of this file under
36 # the terms of any one of the MPL, the GPL or the LGPL.
38 # ***** END LICENSE BLOCK *****
40 source $TEST_DIR/bin/library.sh
43 # options processing
45 options="p:b:x:i:d:"
46 function usage()
48 cat <<EOF
49 usage:
50 $SCRIPT -p product -b branch -x executablepath -i talkbackid [-d datafiles]
52 variable description
53 =============== ============================================================
54 -p product required. firefox|thunderbird
55 -b branch required. 1.8.0|1.8.1|1.9.0|1.9.1
56 -x executablepath required. directory-tree containing executable named
57 'product'
58 -i talkbackid required. identifier to add to talkback url
59 -d datafiles optional. one or more filenames of files containing
60 environment variable definitions to be included.
62 note that the environment variables should have the same names as in the
63 "variable" column.
65 EOF
66 exit 1
69 unset product branch executablepath talkbackid datafiles
71 while getopts $options optname ;
72 do
73 case $optname in
74 p) product=$OPTARG;;
75 b) branch=$OPTARG;;
76 x) executablepath=$OPTARG;;
77 i) talkbackid=$OPTARG;;
78 d) datafiles=$OPTARG;;
79 esac
80 done
82 # include environment variables
83 loaddata $datafiles
85 if [[ -z "$product" || -z "$branch" || \
86 -z "$executablepath" || -z "$talkbackid" ]]; then
87 usage
90 executable=`get_executable $product $branch $executablepath`
92 executablepath=`dirname $executable`
94 # escape & in talkback id to prevent replacements
95 talkbackid=`echo $talkbackid | sed 's@&@\\\\&@g'`
98 # edit talkback to automatically submit
100 talkback=1
102 if [[ -e "$executablepath/extensions/talkback@mozilla.org/components/master.ini" ]]; then
103 cd "$executablepath/extensions/talkback@mozilla.org/components/"
104 elif [[ -e "$executablepath/extensions/talkback@mozilla.org/components/talkback/master.ini" ]]; then
105 cd "$executablepath/extensions/talkback@mozilla.org/components/talkback/"
106 elif [[ -e "$executablepath/components/master.ini" ]]; then
107 cd "$executablepath/components"
108 else
109 # talkback not found
110 talkback=0
113 if [[ $talkback -eq 1 ]]; then
114 # edit to automatically send talkback incidents
115 if [[ ! -e master.sed ]]; then
116 #echo "$0: editing talkback master.ini in `pwd`"
117 cp $TEST_DIR/bin/master.sed .
118 sed -f master.sed -i.bak master.ini
121 case $OSID in
123 vendorid=`dos2unix < master.ini | grep '^VendorID = "' | sed 's@VendorID = "\([^"]*\)"@\1@'`
124 productid=`dos2unix < master.ini | grep '^ProductID = "' | sed 's@ProductID = "\([^"]*\)"@\1@'`
125 platformid=`dos2unix < master.ini | grep '^PlatformID = "' | sed 's@PlatformID = "\([^"]*\)"@\1@'`
126 buildid=`dos2unix < master.ini | grep '^BuildID = "' | sed 's@BuildID = "\([^"]*\)"@\1@'`
127 appdata=`cygpath -a -d "$APPDATA"`
128 talkbackdir="`cygpath -a -u $appdata`/Talkback"
130 linux)
131 vendorid=`dos2unix < master.ini | grep '^VendorID = "' | sed 's@VendorID = "\([^"]*\)"@\1@'`
132 productid=`dos2unix < master.ini | grep '^ProductID = "' | sed 's@ProductID = "\([^"]*\)"@\1@'`
133 platformid=`dos2unix < master.ini | grep '^PlatformID = "' | sed 's@PlatformID = "\([^"]*\)"@\1@'`
134 buildid=`dos2unix < master.ini | grep '^BuildID = "' | sed 's@BuildID = "\([^"]*\)"@\1@'`
135 talkbackdir="$HOME/.fullcircle"
137 darwin)
138 # hack around Mac's use of spaces in directory names
139 vendorid=`grep '^VendorID = "' master.ini | sed 's@VendorID = "\([^"]*\)"@\1@'`
140 productid=`grep '^ProductID = "' master.ini | sed 's@ProductID = "\([^"]*\)"@\1@'`
141 platformid=`grep '^PlatformID = "' master.ini | sed 's@PlatformID = "\([^"]*\)"@\1@'`
142 buildid=`grep '^BuildID = "' master.ini | sed 's@BuildID = "\([^"]*\)"@\1@'`
143 talkbackdir="$HOME/Library/Application Support/FullCircle"
144 IFS=:
147 error "unknown os $OSID" $LINENO
149 esac
151 if [[ -z "$talkbackdir" ]]; then
152 error "empty talkback directory" $LINENO
155 mkdir -p "$talkbackdir"
157 case $OSID in
159 talkbackinidir="$talkbackdir/$vendorid/$productid/$platformid/$buildid"
161 linux | darwin )
162 talkbackinidir="$talkbackdir/$vendorid$productid$platformid$buildid"
164 esac
166 if [[ ! -d "$talkbackinidir" ]]; then
167 create-directory.sh -d "$talkbackinidir" -n
170 cd $talkbackinidir
172 cp ${TEST_DIR}/talkback/$OSID/Talkback.ini .
174 case "$OSID" in
176 sed -i.bak "s@URLEdit .*@URLEdit = \"mozqa:$talkbackid\"@" Talkback.ini
178 linux)
179 sed -i.bak "s@URLEditControl .*@URLEditControl = \"mozqa:$talkbackid\"@" Talkback.ini
181 darwin)
182 sed -i.bak "s@URLEditControl .*@URLEditControl = \"mozqa:$talkbackid\"@" Talkback.ini
185 error "unknown os=$OSID" $LINENO
186 esac