| Index: third_party/sqlite/split.pl
|
| diff --git a/third_party/sqlite/split.pl b/third_party/sqlite/split.pl
|
| new file mode 100755
|
| index 0000000000000000000000000000000000000000..36942237c5932e569fdd65bf11437da376d43c5b
|
| --- /dev/null
|
| +++ b/third_party/sqlite/split.pl
|
| @@ -0,0 +1,86 @@
|
| +#!/usr/bin/perl -w
|
| +
|
| +# The sqlite3.c file is too large for the trybot system to handle. Given a
|
| +# branch name, pull over the file in chunks that are included into an uber-file
|
| +# to make things work.
|
| +
|
| +use strict;
|
| +
|
| +my $branch = shift || "zzzzzzsql_update";
|
| +
|
| +sub patch {
|
| + my $file = shift;
|
| + my $basename = pop @{[split('/', $file)]};
|
| + system("git checkout -- $file") == 0 || die("Reverting $basename: $?");
|
| + system("git diff origin/master..$branch -- $file | patch -p1") == 0 || die("Patching $basename: $?");
|
| + system("git add $file") == 0 || die("Adding $basename: $?");
|
| +}
|
| +
|
| +patch("third_party/sqlite/BUILD.gn");
|
| +patch("third_party/sqlite/amalgamation/sqlite3.h");
|
| +
|
| +print "Deleting old split files\n";
|
| +foreach my $o (glob "third_party/sqlite/amalgamation/sqlite3.??.c") {
|
| + system("git rm -f $o") == 0 || die("Deleting $o: $?");
|
| +}
|
| +
|
| +my $depth = 0;
|
| +my $acc = "";
|
| +my $size = 0;
|
| +my $max = 880000;
|
| +my $ii = 0;
|
| +my $o = sprintf("third_party/sqlite/amalgamation/sqlite3.%02d.c", $ii);
|
| +
|
| +print "Creating $o\n";
|
| +open(O, ">$o") || die("Writing $o: $!");
|
| +open(S, "git show $branch:third_party/sqlite/amalgamation/sqlite3.c|") || die("Reading sqlite3.c: $!");
|
| +while(<S>) {
|
| + $acc .= $_;
|
| + if (m|^/[*]+ Begin file [^ ]+ [*]+/$|) {
|
| + $depth++;
|
| + } elsif (m|^/[*]+ End of [^ ]+ [*]+/$|) {
|
| + $depth--;
|
| + if (!$depth) {
|
| + if ($size + length($acc) > $max) {
|
| + my $was = $o;
|
| + ++$ii;
|
| + $o = sprintf("third_party/sqlite/amalgamation/sqlite3.%02d.c", $ii);
|
| + my $basename = pop @{[split('/', $o)]};
|
| + print O "\n";
|
| + print O "/* Chain include. */ \n";
|
| + print O "#include \"$basename\"\n";
|
| + close(O) || die("Closing $was: $!");
|
| + system("git add $was") == 0 || die("Adding $was: $?");
|
| +
|
| + print "Creating $o\n";
|
| + open(O, ">$o") || die("Writing $o: $!");
|
| + $size = 0;
|
| + }
|
| + print O $acc;
|
| + $size += length($acc);
|
| + $acc = "";
|
| + }
|
| + }
|
| +}
|
| +close(S) || die("Reading sqlite3.c: $!");
|
| +close(O) || die("Closing $o: $!");
|
| +system("git add $o") == 0 || die("Adding $o: $?");
|
| +
|
| +open(P, "|patch -p1") || die("Applying patch: $?");
|
| +print P <<EOF;
|
| +diff --git a/third_party/sqlite/BUILD.gn b/third_party/sqlite/BUILD.gn
|
| +index 6c90139..67dd6e9 100644
|
| +--- a/third_party/sqlite/BUILD.gn
|
| ++++ b/third_party/sqlite/BUILD.gn
|
| +@@ -37,7 +37,7 @@ if (!use_system_sqlite) {
|
| +
|
| + sources = [
|
| + "amalgamation/config.h",
|
| +- "amalgamation/sqlite3.c",
|
| ++ "amalgamation/sqlite3.00.c",
|
| + "amalgamation/sqlite3.h",
|
| + ]
|
| +
|
| +EOF
|
| +close(P) || die("Applying patch: $?");
|
| +system("git add third_party/sqlite/BUILD.gn") == 0 || die("Adding BUILD.gn: $?");
|
|
|