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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « third_party/sqlite/amalgamation/sqlite3.09.c ('k') | no next file » | 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 || "zzzzzzsql_update";
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/amalgamation/sqlite3.h");
21
22 print "Deleting old split files\n";
23 foreach my $o (glob "third_party/sqlite/amalgamation/sqlite3.??.c") {
24 system("git rm -f $o") == 0 || die("Deleting $o: $?");
25 }
26
27 my $depth = 0;
28 my $acc = "";
29 my $size = 0;
30 my $max = 880000;
31 my $ii = 0;
32 my $o = sprintf("third_party/sqlite/amalgamation/sqlite3.%02d.c", $ii);
33
34 print "Creating $o\n";
35 open(O, ">$o") || die("Writing $o: $!");
36 open(S, "git show $branch:third_party/sqlite/amalgamation/sqlite3.c|") || die("R eading sqlite3.c: $!");
37 while(<S>) {
38 $acc .= $_;
39 if (m|^/[*]+ Begin file [^ ]+ [*]+/$|) {
40 $depth++;
41 } elsif (m|^/[*]+ End of [^ ]+ [*]+/$|) {
42 $depth--;
43 if (!$depth) {
44 if ($size + length($acc) > $max) {
45 my $was = $o;
46 ++$ii;
47 $o = sprintf("third_party/sqlite/amalgamation/sqlite3.%02d.c", $ ii);
48 my $basename = pop @{[split('/', $o)]};
49 print O "\n";
50 print O "/* Chain include. */ \n";
51 print O "#include \"$basename\"\n";
52 close(O) || die("Closing $was: $!");
53 system("git add $was") == 0 || die("Adding $was: $?");
54
55 print "Creating $o\n";
56 open(O, ">$o") || die("Writing $o: $!");
57 $size = 0;
58 }
59 print O $acc;
60 $size += length($acc);
61 $acc = "";
62 }
63 }
64 }
65 close(S) || die("Reading sqlite3.c: $!");
66 close(O) || die("Closing $o: $!");
67 system("git add $o") == 0 || die("Adding $o: $?");
68
69 open(P, "|patch -p1") || die("Applying patch: $?");
70 print P <<EOF;
71 diff --git a/third_party/sqlite/BUILD.gn b/third_party/sqlite/BUILD.gn
72 index 6c90139..67dd6e9 100644
73 --- a/third_party/sqlite/BUILD.gn
74 +++ b/third_party/sqlite/BUILD.gn
75 @@ -37,7 +37,7 @@ if (!use_system_sqlite) {
76
77 sources = [
78 "amalgamation/config.h",
79 - "amalgamation/sqlite3.c",
80 + "amalgamation/sqlite3.00.c",
81 "amalgamation/sqlite3.h",
82 ]
83
84 EOF
85 close(P) || die("Applying patch: $?");
86 system("git add third_party/sqlite/BUILD.gn") == 0 || die("Adding BUILD.gn: $?") ;
OLDNEW
« 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