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

Unified Diff: third_party/sqlite/split.pl

Issue 2755803002: NCI: trybot test for sqlite 3.17 import. (Closed)
Patch Set: also clang on Linux i386 Created 3 years, 9 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.09.c ('k') | no next file » | 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..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: $?");
« no previous file with comments | « third_party/sqlite/amalgamation/sqlite3.09.c ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698