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

Side by Side Diff: third_party/sqlite/split.pl

Issue 1636873003: Try for backport (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@zzsql_import3_10_2_websql_backport
Patch Set: Created 4 years, 10 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 | « third_party/sqlite/amalgamation/sqlite3.07.c ('k') | third_party/sqlite/sqlite.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/usr/bin/perl -w
2
3 # The sqlite3.c file is too large for the trybot system to handle. Given a
4 # branch name, pull over the file in chunks that are included into an uber-file
5 # to make things work.
6
7 use strict;
8
9 my $branch = shift || "zzsql_import";
10
11 sub patch {
12 my $file = shift;
13 my $basename = pop @{[split('/', $file)]};
14 system("git checkout -- $file") == 0 || die("Reverting $basename: $?");
15 system("git diff origin/master..$branch -- $file | patch -p1") == 0 || die(" Patching $basename: $?");
16 system("git add $file") == 0 || die("Adding $basename: $?");
17 }
18
19 patch("third_party/sqlite/BUILD.gn");
20 patch("third_party/sqlite/sqlite.gyp");
21 patch("third_party/sqlite/amalgamation/sqlite3.h");
22
23 print "Deleting old split files\n";
24 foreach my $o (glob "third_party/sqlite/amalgamation/sqlite3.??.c") {
25 system("git rm -f $o") == 0 || die("Deleting $o: $?");
26 }
27
28 my $depth = 0;
29 my $acc = "";
30 my $size = 0;
31 my $max = 880000;
32 my $ii = 0;
33 my $o = sprintf("third_party/sqlite/amalgamation/sqlite3.%02d.c", $ii);
34
35 print "Creating $o\n";
36 open(O, ">$o") || die("Writing $o: $!");
37 open(S, "git show $branch:third_party/sqlite/amalgamation/sqlite3.c|") || die("R eading sqlite3.c: $!");
38 while(<S>) {
39 $acc .= $_;
40 if (m|^/[*]+ Begin file [^ ]+ [*]+/$|) {
41 $depth++;
42 } elsif (m|^/[*]+ End of [^ ]+ [*]+/$|) {
43 $depth--;
44 if (!$depth) {
45 if ($size + length($acc) > $max) {
46 my $was = $o;
47 ++$ii;
48 $o = sprintf("third_party/sqlite/amalgamation/sqlite3.%02d.c", $ ii);
49 my $basename = pop @{[split('/', $o)]};
50 print O "\n";
51 print O "/* Chain include. */ \n";
52 print O "#include \"$basename\"\n";
53 close(O) || die("Closing $was: $!");
54 system("git add $was") == 0 || die("Adding $was: $?");
55
56 print "Creating $o\n";
57 open(O, ">$o") || die("Writing $o: $!");
58 $size = 0;
59 }
60 print O $acc;
61 $size += length($acc);
62 $acc = "";
63 }
64 }
65 }
66 close(S) || die("Reading sqlite3.c: $!");
67 close(O) || die("Closing $o: $!");
68 system("git add $o") == 0 || die("Adding $o: $?");
69
70 open(P, "|patch -p1") || die("Applying patch: $?");
71 print P <<EOF;
72 diff --git a/third_party/sqlite/BUILD.gn b/third_party/sqlite/BUILD.gn
73 index 6c90139..67dd6e9 100644
74 --- a/third_party/sqlite/BUILD.gn
75 +++ b/third_party/sqlite/BUILD.gn
76 @@ -37,7 +37,7 @@ if (!use_system_sqlite) {
77
78 sources = [
79 "amalgamation/config.h",
80 - "amalgamation/sqlite3.c",
81 + "amalgamation/sqlite3.00.c",
82 "amalgamation/sqlite3.h",
83 ]
84
85 diff --git a/third_party/sqlite/sqlite.gyp b/third_party/sqlite/sqlite.gyp
86 index 3eef43e..ffa1531 100644
87 --- a/third_party/sqlite/sqlite.gyp
88 +++ b/third_party/sqlite/sqlite.gyp
89 @@ -125,7 +125,7 @@
90 'sources': [
91 'amalgamation/config.h',
92 'amalgamation/sqlite3.h',
93 - 'amalgamation/sqlite3.c',
94 + 'amalgamation/sqlite3.00.c',
95 ],
96 'variables': {
97 'clang_warning_flags': [
98 EOF
99 close(P) || die("Applying patch: $?");
100 system("git add third_party/sqlite/sqlite.gyp") == 0 || die("Adding sqlite.gyp: $?");
101 system("git add third_party/sqlite/BUILD.gn") == 0 || die("Adding BUILD.gn: $?") ;
OLDNEW
« no previous file with comments | « third_party/sqlite/amalgamation/sqlite3.07.c ('k') | third_party/sqlite/sqlite.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698