From c8307c102e19c11e2ee8570e6c5a587c46b58dbb Mon Sep 17 00:00:00 2001 From: Kongqun Yang Date: Tue, 18 Mar 2014 15:57:32 -0700 Subject: [PATCH] Update packager to work with gclient Detail changes: 1. Add gclient DEPS (depenencies) 2. Update gyp_packager.py 3. Update .gitignore 4. Update third_party/happyhttp patch path 5. Add a new script in happyhttp to reset the patch before re-sync Change-Id: I30f0beb94a56ae8aff3b25bb16fe76a7b07e3d54 --- .gitignore | 19 +++- DEPS | 120 +++++++++++++++++++++++ gyp_packager.py | 5 +- third_party/happyhttp/git_reset.py | 24 +++++ third_party/happyhttp/patches/_stricmp | 6 +- third_party/happyhttp/patches/server_url | 6 +- 6 files changed, 168 insertions(+), 12 deletions(-) create mode 100644 DEPS create mode 100755 third_party/happyhttp/git_reset.py diff --git a/.gitignore b/.gitignore index 2ac980b264..c63db5085a 100644 --- a/.gitignore +++ b/.gitignore @@ -4,8 +4,23 @@ .pydevproject .repo .settings +/base/ +/build/ /docs/ /out/ -# Ignore llvm-build. This is only when you are using clang. Address Sanitizer -# requires clang. +/testing/ +/third_party/gflags/ +/third_party/gold/ +/third_party/happyhttp/src/ +/third_party/icu/ +/third_party/libevent/ +/third_party/libxml/ /third_party/llvm-build/ +/third_party/modp_b64/ +/third_party/openssl/ +/third_party/protobuf/ +/third_party/zlib/ +/tools/clang/ +/tools/gyp/ +/tools/protoc_wrapper/ +/tools/valgrind/ diff --git a/DEPS b/DEPS new file mode 100644 index 0000000000..cb1c01eb67 --- /dev/null +++ b/DEPS @@ -0,0 +1,120 @@ +# Copyright 2014 Google Inc. All rights reserved. +# +# Use of this source code is governed by a BSD-style +# license that can be found in the LICENSE file or at +# https://developers.google.com/open-source/licenses/bsd +# +# Packager dependencies. + +vars = { + "chromium_svn": "http://src.chromium.org/chrome/trunk", + "chromium_rev": "253526", + + "googlecode_url": "http://%s.googlecode.com/svn", + "gflags_rev": "84", + "gmock_rev": "470", + "gtest_rev": "680", + "gyp_rev": "1876", + "webrtc_rev": "5718", # For gflags. + + "happyhttp_url": "https://github.com/Zintinio/HappyHTTP.git", + "happyhttp_rev": "7306b1606a09063ac38c264afe59f0ad0b441750", +} + +deps = { + "src/base": + Var("chromium_svn") + "/src/base@" + Var("chromium_rev"), + + "src/build": + Var("chromium_svn") + "/src/build@" + Var("chromium_rev"), + + "src/testing": + Var("chromium_svn") + "/src/testing@" + Var("chromium_rev"), + + "src/testing/gmock": + (Var("googlecode_url") % "googlemock") + "/trunk@" + Var("gmock_rev"), + + "src/testing/gtest": + (Var("googlecode_url") % "googletest") + "/trunk@" + Var("gtest_rev"), + + "src/third_party/gflags": + (Var("googlecode_url") % "webrtc")+ "/trunk/third_party/gflags@" + Var("webrtc_rev"), + + "src/third_party/gflags/src": + (Var("googlecode_url") % "gflags") + "/trunk/src@" + Var("gflags_rev"), + + "src/third_party/happyhttp/src": + Var("happyhttp_url") + "@" + Var("happyhttp_rev"), + + # Required by libxml. + "src/third_party/icu": + Var("chromium_svn") + "/deps/third_party/icu46@" + Var("chromium_rev"), + + # Required by base/message_pump_libevent.cc. + "src/third_party/libevent": + Var("chromium_svn") + "/src/third_party/libevent@" + Var("chromium_rev"), + + "src/third_party/libxml": + Var("chromium_svn") + "/src/third_party/libxml@" + Var("chromium_rev"), + + "src/third_party/modp_b64": + Var("chromium_svn") + "/src/third_party/modp_b64@" + Var("chromium_rev"), + + "src/third_party/openssl": + Var("chromium_svn") + "/deps/third_party/openssl@" + Var("chromium_rev"), + + "src/third_party/protobuf": + Var("chromium_svn") + "/src/third_party/protobuf@" + Var("chromium_rev"), + + "src/tools/clang": + Var("chromium_svn") + "/src/tools/clang@" + Var("chromium_rev"), + + "src/tools/gyp": + (Var("googlecode_url") % "gyp") + "/trunk@" + Var("gyp_rev"), + + "src/tools/protoc_wrapper": + Var("chromium_svn") + "/src/tools/protoc_wrapper@" + Var("chromium_rev"), + + "src/tools/valgrind": + Var("chromium_svn") + "/src/tools/valgrind@" + Var("chromium_rev"), +} + +deps_os = { + "unix": { # Linux, actually. + # Linux gold build to build faster. + "src/third_party/gold": + Var("chromium_svn") + "/deps/third_party/gold@" + Var("chromium_rev"), + + # Required by /src/build/linux/system.gyp. + "src/third_party/zlib": + Var("chromium_svn") + "/src/third_party/zlib@" + Var("chromium_rev"), + }, +} + +pre_deps_hooks = [ + { + # Reset happyhttp so the sync could proceed. + # We cannot use "git apply --reverse" here as the source may not have been pulled. + # "git reset" does not work here either as we cannot change working directory. + "pattern": "third_party/happyhttp/src", + "action": ["python", "src/third_party/happyhttp/git_reset.py"], + }, +] + +hooks = [ + { + # Patch happyhttp source. + "pattern": "third_party/happyhttp/src", + "action": ["git", "apply", "src/third_party/happyhttp/patches/_stricmp"], + }, + { + # Patch happyhttp source. + "pattern": "third_party/happyhttp/src", + "action": ["git", "apply", "src/third_party/happyhttp/patches/server_url"], + }, + { + # A change to a .gyp, .gypi, or to GYP itself should run the generator. + "pattern": ".", + "action": ["python", "src/gyp_packager.py"], + }, +] diff --git a/gyp_packager.py b/gyp_packager.py index 89320eba6b..31ab1ebf13 100755 --- a/gyp_packager.py +++ b/gyp_packager.py @@ -54,10 +54,7 @@ if __name__ == '__main__': args.append(os.path.join(src_dir, 'packager.gyp')) # Always include common.gypi. - args.extend(['-I' + os.path.join(src_dir, 'build/common.gypi')]) - - # Gyp should run from current directory. - args.append('--depth=.') + args.extend(['-I' + os.path.join(src_dir, 'build', 'common.gypi')]) # Set these default GYP_DEFINES if user does not set the value explicitly. _DEFAULT_DEFINES = {"test_isolation_mode" : "noop", "use_glib" : 0, diff --git a/third_party/happyhttp/git_reset.py b/third_party/happyhttp/git_reset.py new file mode 100755 index 0000000000..05e30f5c91 --- /dev/null +++ b/third_party/happyhttp/git_reset.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python +# +# Copyright 2014 Google Inc. All rights reserved. +# +# Use of this source code is governed by a BSD-style +# license that can be found in the LICENSE file or at +# https://developers.google.com/open-source/licenses/bsd +# +# Perform 'git reset --hard HEAD' on src directory. + +import os +import subprocess +import sys + +if __name__ == '__main__': + script_dir = os.path.dirname(os.path.realpath(__file__)) + src_dir = os.path.join(script_dir, 'src') + + # No need to perform a reset if the source hasn't been pulled yet. + if not os.path.exists(src_dir): + sys.exit(0) + + sys.exit(subprocess.call(['git', 'reset', '--hard', 'HEAD'], cwd=src_dir)) + diff --git a/third_party/happyhttp/patches/_stricmp b/third_party/happyhttp/patches/_stricmp index 80143f93b6..7251a6a967 100644 --- a/third_party/happyhttp/patches/_stricmp +++ b/third_party/happyhttp/patches/_stricmp @@ -1,7 +1,7 @@ -diff --git a/third_party/happyhttp/src/happyhttp.cpp b/third_party/happyhttp/src/happyhttp.cpp +diff --git a/src/third_party/happyhttp/src/happyhttp.cpp b/src/third_party/happyhttp/src/happyhttp.cpp index 9e56673..8c8548f 100644 ---- a/third_party/happyhttp/src/happyhttp.cpp -+++ b/third_party/happyhttp/src/happyhttp.cpp +--- a/src/third_party/happyhttp/src/happyhttp.cpp ++++ b/src/third_party/happyhttp/src/happyhttp.cpp @@ -49,7 +49,7 @@ #include #include diff --git a/third_party/happyhttp/patches/server_url b/third_party/happyhttp/patches/server_url index ab38e9218b..bbb505de02 100644 --- a/third_party/happyhttp/patches/server_url +++ b/third_party/happyhttp/patches/server_url @@ -1,7 +1,7 @@ -diff --git a/third_party/happyhttp/src/test.cpp b/third_party/happyhttp/src/test.cpp +diff --git a/src/third_party/happyhttp/src/test.cpp b/src/third_party/happyhttp/src/test.cpp index f3d39d1..3ce74b4 100644 ---- a/third_party/happyhttp/src/test.cpp -+++ b/third_party/happyhttp/src/test.cpp +--- a/src/third_party/happyhttp/src/test.cpp ++++ b/src/third_party/happyhttp/src/test.cpp @@ -31,7 +31,7 @@ void Test1() { puts("-----------------Test1------------------------" );