From 2c4e5ad1a9263ca8cbf69b5b3d33699d12b9ce7f Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Wed, 19 Jun 2013 16:05:18 +0200 Subject: [PATCH] make_unicode: Cache files under their full path name to avoid conflicts. --- tools/make_unicode | 48 ++++++++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/tools/make_unicode b/tools/make_unicode index 9d2d8a75750..59c75abde3b 100755 --- a/tools/make_unicode +++ b/tools/make_unicode @@ -24,12 +24,14 @@ use strict; # base URLs for www.unicode.org files my $MAPPINGS = "http://www.unicode.org/Public/MAPPINGS"; my $UNIDATA = "http://www.unicode.org/Public/6.0.0/ucd"; +my $REPORTS = "http://www.unicode.org/reports"; +my $RFCS = "http://www.rfc-editor.org/rfc"; # Sort keys file -my $SORTKEYS = "http://www.unicode.org/reports/tr10/allkeys.txt"; +my $SORTKEYS = "tr10/allkeys.txt"; # RFC3454 (stringprep data) -my $STRINGPREP = "http://www.rfc-editor.org/rfc/rfc3454.txt"; +my $STRINGPREP = "rfc3454.txt"; # Defaults mapping my $DEFAULTS = "tools/unicode-defaults"; @@ -319,16 +321,16 @@ my %joining_forms = ################################################################ # fetch a unicode.org file and open it -sub open_data_file($) +sub open_data_file($$) { - my $url = shift; - (my $name = $url) =~ s/^.*\///; + my ($base, $name) = @_; + (my $dir = "data/$name") =~ s/\/[^\/]+$//; local *FILE; unless (-f "data/$name") { - print "Fetching $url...\n"; - mkdir "data"; - !system "wget", "-q", "-O", "data/$name", $url or die "cannot fetch $url"; + print "Fetching $base/$name...\n"; + system "mkdir", "-p", $dir; + !system "wget", "-q", "-O", "data/$name", "$base/$name" or die "cannot fetch $base/$name"; } open FILE, ") { # Decode the fields ... @@ -497,7 +499,7 @@ sub READ_DEFAULTS($) sub READ_FILE($) { my $name = shift; - my $INPUT = open_data_file $name; + my $INPUT = open_data_file( $MAPPINGS, $name ); while (<$INPUT>) { @@ -623,7 +625,7 @@ sub READ_JIS0208_FILE($) $cp2uni[0xa1c0] = 0xff3c; $uni2cp[0xff3c] = 0xa1c0; - my $INPUT = open_data_file $name; + my $INPUT = open_data_file( $MAPPINGS, $name ); while (<$INPUT>) { next if /^\#/; # skip comments @@ -650,7 +652,7 @@ sub READ_SORTKEYS_FILE() my @sortkeys = (); for (my $i = 0; $i < 65536; $i++) { $sortkeys[$i] = [ -1, 0, 0, 0, 0 ] }; - my $INPUT = open_data_file $SORTKEYS; + my $INPUT = open_data_file( $REPORTS, $SORTKEYS ); while (<$INPUT>) { next if /^\#/; # skip comments @@ -757,7 +759,7 @@ sub DUMP_SORTKEYS($@) open OUTPUT,">$filename.new" or die "Cannot create $filename"; printf "Building $filename\n"; printf OUTPUT "/* Unicode collation element table */\n"; - printf OUTPUT "/* generated from %s */\n", $SORTKEYS; + printf OUTPUT "/* generated from %s */\n", "$REPORTS/$SORTKEYS"; printf OUTPUT "/* DO NOT EDIT!! */\n\n"; printf OUTPUT "const unsigned int collation_table[%d] =\n{\n", $ranges*256; @@ -1062,7 +1064,7 @@ sub dump_indic($) my $filename = shift; my @indic_table = ($indic_types{'Other'}) x 65536;; - my $INPUT = open_data_file "$UNIDATA/IndicSyllabicCategory.txt"; + my $INPUT = open_data_file( $UNIDATA, "IndicSyllabicCategory.txt" ); while (<$INPUT>) { next if /^\#/; # skip comments @@ -1095,7 +1097,7 @@ sub dump_indic($) } close $INPUT; - $INPUT = open_data_file "$UNIDATA/IndicMatraCategory.txt"; + $INPUT = open_data_file( $UNIDATA, "IndicMatraCategory.txt" ); while (<$INPUT>) { next if /^\#/; # skip comments @@ -1144,7 +1146,7 @@ sub dump_linebreak($) my @break_table = ($break_types{'XX'}) x 65536;; my $next_group = 0; - my $INPUT = open_data_file "$UNIDATA/LineBreak.txt"; + my $INPUT = open_data_file( $UNIDATA, "LineBreak.txt" ); while (<$INPUT>) { next if /^\#/; # skip comments @@ -1192,7 +1194,7 @@ sub dump_mirroring($) my $filename = shift; my @mirror_table = (); - my $INPUT = open_data_file "$UNIDATA/BidiMirroring.txt"; + my $INPUT = open_data_file( $UNIDATA, "BidiMirroring.txt" ); while (<$INPUT>) { next if /^\#/; # skip comments @@ -1229,7 +1231,7 @@ sub dump_shaping($) $groups{"No_Joining_Group"} = $next_group++; - my $INPUT = open_data_file "$UNIDATA/ArabicShaping.txt"; + my $INPUT = open_data_file( $UNIDATA, "ArabicShaping.txt" ); while (<$INPUT>) { next if /^\#/; # skip comments @@ -1572,7 +1574,7 @@ sub dump_nameprep($) my @mapping_table = (); my @flags_table = (0) x 65536; - my $INPUT = open_data_file $STRINGPREP; + my $INPUT = open_data_file( $RFCS, $STRINGPREP ); while (<$INPUT>) { next unless /Start\sTable/; @@ -1598,7 +1600,7 @@ sub dump_nameprep($) open OUTPUT,">$filename.new" or die "Cannot create $filename"; print "Building $filename\n"; print OUTPUT "/* Nameprep algorithm related data */\n"; - print OUTPUT "/* generated from $STRINGPREP */\n"; + print OUTPUT "/* generated from $RFCS/$STRINGPREP */\n"; print OUTPUT "/* DO NOT EDIT!! */\n\n"; print OUTPUT "#include \"wine/unicode.h\"\n\n"; @@ -1857,7 +1859,7 @@ sub handle_bestfit_file($$$) my ($lb_cur, $lb_end); my @lb_ranges = (); - my $INPUT = open_data_file "$MAPPINGS/$filename" or die "Cannot open $filename"; + my $INPUT = open_data_file( $MAPPINGS, $filename ) or die "Cannot open $filename"; while (<$INPUT>) { @@ -1961,14 +1963,14 @@ sub HANDLE_FILE(@) @uni2cp = (); # symbol codepage file is special - if ($codepage == 20932) { READ_JIS0208_FILE "$MAPPINGS/$filename"; } + if ($codepage == 20932) { READ_JIS0208_FILE( $filename ); } elsif ($codepage == 20127) { fill_20127_codepage(); } elsif ($filename =~ /\/bestfit/) { handle_bestfit_file( $filename, $has_glyphs, $comment ); return; } - else { READ_FILE "$MAPPINGS/$filename"; } + else { READ_FILE( $filename ); } ADD_DEFAULT_MAPPINGS();