Clean up DEPS and python scripts
authorTaeho Kim <th81.kim@samsung.com>
Fri, 29 May 2015 01:48:11 +0000 (10:48 +0900)
committerYoungsoo Choi <kenshin.choi@samsung.com>
Tue, 10 Jul 2018 06:57:09 +0000 (06:57 +0000)
Modify DEPS files, rename python script suffix from xwalk to efl
to resolve the naming confusion and split xwalk/efl dependency
In addition to that add a DEPS.efl to have separate gclient
configuration file(.gclient-efl)

Bug: http://107.108.218.239/bugzilla/show_bug.cgi?id=13013
Reviewed by: Antonio Gomes, Hyunhak Kim

Change-Id: I7e59424d07d966b50dd2658c8e8f0b4c04a5fe11
Signed-off-by: Taeho Kim <th81.kim@samsung.com>
tizen_src/DEPS
tizen_src/DEPS.efl [moved from tizen_src/scripts/xwalk/DEPS.xwalk with 72% similarity]
tizen_src/scripts/fetch_deps.py [new file with mode: 0755]
tizen_src/scripts/generate_gclient-efl.py [moved from tizen_src/scripts/xwalk/generate_gclient-xwalk.py with 62% similarity]

index 69b984d..ca2545b 100644 (file)
@@ -10,16 +10,16 @@ deps = {
 
 hooks = [
   {
-    # Generate .gclient-xwalk for Crosswalk's dependencies, including
+    # Generate .gclient-efl for chromium-efl's dependencies, including
     # custom chromium and WebKit repositories.
-    "name": "generate-gclient-xwalk",
+    "name": "generate-gclient-efl",
     "pattern": ".",
-    "action": ["python", "src/tizen_src/scripts/xwalk/generate_gclient-xwalk.py"],
+    "action": ["python", "src/tizen_src/scripts/generate_gclient-efl.py"],
   },
   {
     # Fetch Crosswalk dependencies.
     "name": "fetch-deps",
     "pattern": ".",
-    "action": ["python", "src/xwalk/tools/fetch_deps.py", "-v"],
+    "action": ["python", "src/tizen_src/scripts/fetch_deps.py", "-v"],
   },
 ]
similarity index 72%
rename from tizen_src/scripts/xwalk/DEPS.xwalk
rename to tizen_src/DEPS.efl
index 62f7851..56c6aaa 100644 (file)
@@ -1,8 +1,8 @@
-# Source code dependencies required for building Crosswalk.
+# Source code dependencies required for building Chromium-efl.
 #
-# This file is used as a template to generate .gclient-xwalk, which is a
+# This file is used as a template to generate .gclient-efl, which is a
 # regular .gclient file pointing to additional source code repositories that
-# need to be checked out in order to build Crosswalk.
+# need to be checked out in order to build Chromium-efl.
 #
 # These dependencies are not specified in DEPS for historical compatibility
 # reasons and also to allow us to perform some additional manipulation on some
 # variables below.
 
 # -----------------------------------
-# Crosswalk dependencies.
-# Edit these when rolling DEPS.xwalk.
+# Chromium-efl dependencies.
+# Edit these when rolling DEPS.efl.
 # -----------------------------------
 
-chromium_crosswalk_rev = '52d4347d95a66afe54be98677b077fce0b7fd846'
-v8_crosswalk_rev = '35e0d97482e74df63e75088eec0378f19bad24dd'
 ozone_wayland_rev = 'bd769b47008882f3d0fcb78070415a5ef2700032'
 
-# |blink_crosswalk_rev| specifies the SHA1 hash of the blink-crosswalk commit
-# we want to point to, very much like the variables above.
 # |blink_upstream_rev| indicates the revision of the latest upstream commit in
-# the blink-crosswalk repository, so that the devtools code can use it to fetch
+# the s-blink repository, so that the devtools code can use it to fetch
 # assets from Chromium's servers with a revision that exists there. We need an
 # SVN revision while Blink is still in SVN.
-blink_crosswalk_rev = 'a6caf4f53deee46eb41c31d38dc990964615b8e5'
-blink_upstream_rev = '184144'  # FIXME(wang16): Specify a later revision than
-                               # the one we actually have in blink-crosswalk
-                               # because of crbug.com/425155.
-                               # This will not be needed in M40 or M39 past
-                               # Blink r184144.
+blink_upstream_rev = '191638' #TODO(TK) : need to update revision number
 
 efl_integration_branch = 'origin/beta/m42_2311_t'
 ct_git = 'ssh://165.213.202.130:29418/webplatform'
 
-crosswalk_git = 'https://github.com/crosswalk-project'
 ozone_wayland_git = 'https://github.com/01org'
 
 # ------------------------------------------------------
@@ -68,7 +58,7 @@ solutions = [
         'https://cvs.khronos.org/svn/repos/registry/trunk/public/cl/api/1.2@'
            '28150',
 
-      # These directories are not relevant to Crosswalk and can be safely ignored
+      # These directories are not relevant to Chromium-efl and can be safely ignored
       # in a checkout. It avoids creating additional directories outside src/ that
       # are not used and also saves some bandwidth.
       'build': None,
@@ -88,8 +78,8 @@ solutions = [
 
     'custom_hooks': [
       # Disable Chromium's "gyp" hooks, which runs the gyp_chromium script. We
-      # are not interested in running it as we use gyp_xwalk instead (and it is
-      # run at a later stage as a hook in Crosswalk's own DEPS).
+      # are not interested in running it as we use gyp_chromiumefl instead (and it is
+      # run at a later stage as a hook in Chromium-efl's own DEPS).
       {
         'name': 'gyp',
       },
@@ -122,5 +112,5 @@ hooks = [
 ]
 
 # -------------------------------------------------
-# This area is edited by generate_gclient-xwalk.py.
+# This area is edited by generate_gclient-efl.py.
 # -------------------------------------------------
diff --git a/tizen_src/scripts/fetch_deps.py b/tizen_src/scripts/fetch_deps.py
new file mode 100755 (executable)
index 0000000..7c4cb44
--- /dev/null
@@ -0,0 +1,102 @@
+#!/usr/bin/env python
+
+# Copyright 2015 Samsung Electronics. All rights reserved.
+# Copyright (c) 2013 Intel Corporation. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""This script will do:
+  1. Setup src's git initialization.
+  2. Place .gclient file outside of src.
+  3. Call gclient sync outside of src.
+"""
+
+import optparse
+import os
+import sys
+
+def TryAddDepotToolsToPythonPath():
+  depot_tools = FindDepotToolsInPath()
+  if depot_tools:
+    sys.path.append(depot_tools)
+    python_path = os.environ.get('PYTHONPATH')
+    if python_path:
+      os.environ['PYTHONPATH'] = os.path.pathsep.join(
+          python_path.split(os.path.pathsep)+[depot_tools])
+    else:
+      os.environ['PYTHONPATH'] = depot_tools
+
+def FindDepotToolsInPath():
+  paths = os.getenv('PATH').split(os.path.pathsep)
+  for path in paths:
+    if os.path.basename(path) == '':
+      # path is end with os.path.pathsep
+      path = os.path.dirname(path)
+    if os.path.basename(path) == 'depot_tools':
+      return path
+  return None
+
+try:
+  import gclient_utils
+except ImportError:
+  TryAddDepotToolsToPythonPath()
+
+try:
+  import gclient_utils
+  import subprocess2
+except ImportError:
+  sys.stderr.write("Can't find gclient_utils, please add your depot_tools "\
+                   "to PATH or PYTHONPATH\n")
+
+class DepsFetcher(object):
+  def __init__(self, options):
+    self._options = options
+    self._tools_dir = os.path.dirname(os.path.abspath(__file__))
+    self._tizensrc_dir = os.path.dirname(self._tools_dir)
+    # self should be at src/tizen_src/scripts/fetch_deps.py
+    # so src is at self/../../../
+    self._src_dir = os.path.dirname(self._tizensrc_dir)
+    self._root_dir = os.path.dirname(self._src_dir)
+    self._new_gclient_file = os.path.join(self._root_dir,
+                                          '.gclient-efl')
+    if not os.path.isfile(self._new_gclient_file):
+      raise IOError('%s was not found. Run generate_gclient-efl.py.' %
+                    self._new_gclient_file)
+
+  def DoGclientSyncForChromium(self):
+    gclient_cmd = ['gclient', 'sync', '--verbose', '--reset',
+                   '--force', '--with_branch_heads',
+                   '--delete_unversioned_trees']
+    gclient_cmd.append('--gclientfile=%s' %
+                       os.path.basename(self._new_gclient_file))
+    gclient_utils.CheckCallAndFilterAndHeader(gclient_cmd,
+        always=self._options.verbose, cwd=self._root_dir)
+
+
+def main():
+  option_parser = optparse.OptionParser()
+
+  option_parser.add_option('-v', '--verbose', action='count', default=0,
+      help='Produces additional output for diagnostics. Can be '
+           'used up to three times for more logging info.')
+  # pylint: disable=W0612
+  options, args = option_parser.parse_args()
+
+  # Following code copied from gclient_utils.py
+  try:
+    # Make stdout auto-flush so buildbot doesn't kill us during lengthy
+    # operations. Python as a strong tendency to buffer sys.stdout.
+    sys.stdout = gclient_utils.MakeFileAutoFlush(sys.stdout)
+    # Make stdout annotated with the thread ids.
+    sys.stdout = gclient_utils.MakeFileAnnotated(sys.stdout)
+  except (gclient_utils.Error, subprocess2.CalledProcessError), e:
+    print >> sys.stderr, 'Error: %s' % str(e)
+    return 1
+
+  deps_fetcher = DepsFetcher(options)
+  deps_fetcher.DoGclientSyncForChromium()
+
+  return 0
+
+if __name__ == '__main__':
+  sys.exit(main())
similarity index 62%
rename from tizen_src/scripts/xwalk/generate_gclient-xwalk.py
rename to tizen_src/scripts/generate_gclient-efl.py
index 63449fb..a59d888 100755 (executable)
@@ -1,12 +1,13 @@
 #!/usr/bin/env python
 
+# Copyright 2015 Samsung Electronics. All rights reserved.
 # Copyright (c) 2013 Intel Corporation. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
 """
-This script is responsible for generating .gclient-xwalk in the top-level
-source directory from DEPS.xwalk.
+This script is responsible for generating .gclient-efl in the top-level
+source directory from DEPS.efl.
 
 User-configurable values such as |cache_dir| are fetched from .gclient instead.
 """
@@ -17,12 +18,12 @@ import os
 import pprint
 
 
-CROSSWALK_ROOT = os.path.dirname(os.path.abspath(__file__))
-GCLIENT_ROOT = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(CROSSWALK_ROOT))))
+EFL_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
+GCLIENT_ROOT = os.path.dirname(os.path.dirname(EFL_ROOT))
 
 def ParseGClientConfig():
   """
-  Parses the top-level .gclient file (NOT .gclient-xwalk) and returns the
+  Parses the top-level .gclient file (NOT .gclient-efl) and returns the
   values set there as a dictionary.
   """
   with open(os.path.join(GCLIENT_ROOT, '.gclient')) as dot_gclient:
@@ -31,37 +32,31 @@ def ParseGClientConfig():
   return config
 
 
-def GenerateGClientXWalk(options):
-  with open(os.path.join(CROSSWALK_ROOT, 'DEPS.xwalk')) as deps_file:
+def GenerateGClientEFL(options):
+  with open(os.path.join(EFL_ROOT, 'DEPS.efl')) as deps_file:
     deps_contents = deps_file.read()
 
-  if 'XWALK_OS_ANDROID' in os.environ:
-    deps_contents += 'target_os = [\'android\']\n'
-
   gclient_config = ParseGClientConfig()
   if options.cache_dir:
-    logging.warning('--cache_dir is deprecated and will be removed in '
-                    'Crosswalk 8. You should set cache_dir in .gclient '
-                    'instead.')
+    logging.warning('--cache_dir is deprecated and will be removed.'
+                    'You should set cache_dir in .gclient instead.')
     cache_dir = options.cache_dir
   else:
     cache_dir = gclient_config.get('cache_dir')
   deps_contents += 'cache_dir = %s\n' % pprint.pformat(cache_dir)
 
-  with open(os.path.join(GCLIENT_ROOT, '.gclient-xwalk'), 'w') as gclient_file:
+  with open(os.path.join(GCLIENT_ROOT, '.gclient-efl'), 'w') as gclient_file:
     gclient_file.write(deps_contents)
 
-
 def main():
   option_parser = optparse.OptionParser()
   # TODO(rakuco): Remove in Crosswalk 8.
   option_parser.add_option('--cache-dir',
-                           help='DEPRECATED Set "cache_dir" in .gclient-xwalk '
+                           help='DEPRECATED Set "cache_dir" in .gclient-efl '
                                 'to this directory, so that all git '
                                 'repositories are cached there.')
   options, _ = option_parser.parse_args()
-  GenerateGClientXWalk(options)
-
+  GenerateGClientEFL(options)
 
 if __name__ == '__main__':
   main()