Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(172)

Side by Side Diff: scripts/trim_data.sh

Issue 2812943003: Update trim_data to deal with locale fallback failure for unit (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « common/icudtl.dat ('k') | source/data/translit/root_subset.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/bin/bash 1 #!/bin/bash
2 # Copyright (c) 2014 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2014 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 set -e
6 7
7 # Remove entries currently not used in Chromium/V8. 8 # Remove entries currently not used in Chromium/V8.
8 function filter_locale_data { 9 function filter_locale_data {
9 echo Removing unncessary categories in ${localedatapath} 10 echo Removing unncessary categories in ${localedatapath}
10 for langpath in ${localedatapath}/*.txt 11 for langpath in ${localedatapath}/*.txt
11 do 12 do
12 echo Overwriting ${langpath} ... 13 echo Overwriting ${langpath} ...
13 sed -r -i \ 14 sed -r -i \
14 '/^ characterLabel\{$/,/^ \}$/d 15 '/^ characterLabel\{$/,/^ \}$/d
15 /^ AuxExemplarCharacters\{.*\}$/d 16 /^ AuxExemplarCharacters\{.*\}$/d
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 for i in ${dataroot}/unit/*.txt 178 for i in ${dataroot}/unit/*.txt
178 do 179 do
179 echo Overwriting $i ... 180 echo Overwriting $i ...
180 sed -r -i \ 181 sed -r -i \
181 '/^ units(|Narrow|Short)\{$/, /^ \}$/ { 182 '/^ units(|Narrow|Short)\{$/, /^ \}$/ {
182 /^ units(|Narrow|Short)\{$/ p 183 /^ units(|Narrow|Short)\{$/ p
183 /^ (duration|compound)\{$/, /^ \}$/ p 184 /^ (duration|compound)\{$/, /^ \}$/ p
184 /^ \}$/ p 185 /^ \}$/ p
185 d 186 d
186 }' ${i} 187 }' ${i}
188
189 # Delete empty units,units{Narrow|Short} block. Otherwise, locale fallback
190 # fails. See crbug.com/707515.
191 sed -r -i \
192 '/^ units(|Narrow|Short)\{$/ {
193 N
194 /^ units(|Narrow|Short)\{\n \}/ d
Daniel Erat 2017/04/11 21:18:10 sorry, my sed is a bit rusty/nonexistent. i think
jungshik at Google 2017/04/11 21:53:17 unitsNarrow{ } Given an input like the above,
195 }' ${i}
187 done 196 done
188 } 197 }
189 198
190 # big5han and gb2312han collation do not make any sense and nobody uses them. 199 # big5han and gb2312han collation do not make any sense and nobody uses them.
191 function remove_legacy_chinese_codepoint_collation { 200 function remove_legacy_chinese_codepoint_collation {
192 echo "Removing Big5 / GB2312 / UniHan collation data from Chinese locale" 201 echo "Removing Big5 / GB2312 / UniHan collation data from Chinese locale"
193 target="${dataroot}/coll/zh.txt" 202 target="${dataroot}/coll/zh.txt"
194 echo "Overwriting ${target}" 203 echo "Overwriting ${target}"
195 sed -r -i '/^ (uni|big5|gb2312)han\{$/,/^ \}$/ d' ${target} 204 sed -r -i '/^ (uni|big5|gb2312)han\{$/,/^ \}$/ d' ${target}
196 } 205 }
(...skipping 12 matching lines...) Expand all
209 filter_currency_data 218 filter_currency_data
210 filter_region_data 219 filter_region_data
211 remove_legacy_chinese_codepoint_collation 220 remove_legacy_chinese_codepoint_collation
212 filter_unit_data 221 filter_unit_data
213 222
214 # Chromium OS needs exemplar cities for timezones, but not Chromium. 223 # Chromium OS needs exemplar cities for timezones, but not Chromium.
215 # It'll save 400kB (uncompressed), but the size difference in 224 # It'll save 400kB (uncompressed), but the size difference in
216 # 7z compressed installer is <= 100kB. 225 # 7z compressed installer is <= 100kB.
217 # TODO(jshin): Make separate data files for CrOS and Chromium. 226 # TODO(jshin): Make separate data files for CrOS and Chromium.
218 #remove_exemplar_cities 227 #remove_exemplar_cities
OLDNEW
« no previous file with comments | « common/icudtl.dat ('k') | source/data/translit/root_subset.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698