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

Unified 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, 11 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..fe37f6dd934d513cd6f5c60912bcf9ed6375200a
--- /dev/null
+++ b/third_party/sqlite/split.pl
@@ -0,0 +1,101 @@
+#!/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 || "zzsql_import";
+
+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/sqlite.gyp");
+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",
+ ]
+
+diff --git a/third_party/sqlite/sqlite.gyp b/third_party/sqlite/sqlite.gyp
+index 3eef43e..ffa1531 100644
+--- a/third_party/sqlite/sqlite.gyp
++++ b/third_party/sqlite/sqlite.gyp
+@@ -125,7 +125,7 @@
+ 'sources': [
+ 'amalgamation/config.h',
+ 'amalgamation/sqlite3.h',
+- 'amalgamation/sqlite3.c',
++ 'amalgamation/sqlite3.00.c',
+ ],
+ 'variables': {
+ 'clang_warning_flags': [
+EOF
+close(P) || die("Applying patch: $?");
+system("git add third_party/sqlite/sqlite.gyp") == 0 || die("Adding sqlite.gyp: $?");
+system("git add third_party/sqlite/BUILD.gn") == 0 || die("Adding BUILD.gn: $?");
« 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