Title: [105472] trunk/Tools
Revision
105472
Author
[email protected]
Date
2012-01-19 18:45:15 -0800 (Thu, 19 Jan 2012)

Log Message

[GTK] ensure the jhbuild used by webkit is as up-to-date as needed
https://bugs.webkit.org/show_bug.cgi?id=76585

Reviewed by Martin Robinson.

This allows us to specify a minimum version of jhbuild required,
while also providing stability against changes done to the master
branch, by letting us choose what is the exact version that will
be used.

* gtk/run-with-jhbuild: refactored for more hackability and easier
reading
(jhbuild_installed): checks whether jhbuild is installed
(jhbuild_cloned): checks whether jhbuild has been cloned
(jhbuild_at_expected_revision): checks whether jhbuild is at the
expected revision
(update_jhbuild): brings jhbuild to the expected revision
(clone_jhbuild): clones jhbuild
(install_jhbuild): build and installs jhbuild
(update_webkitgtk_libs): runs update-webkitgtk-libs
(ensure_jhbuild): high-level logic to decide whether and which of
the steps above are executed

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (105471 => 105472)


--- trunk/Tools/ChangeLog	2012-01-20 02:41:06 UTC (rev 105471)
+++ trunk/Tools/ChangeLog	2012-01-20 02:45:15 UTC (rev 105472)
@@ -1,3 +1,28 @@
+2012-01-19  Gustavo Noronha Silva  <[email protected]>
+
+        [GTK] ensure the jhbuild used by webkit is as up-to-date as needed
+        https://bugs.webkit.org/show_bug.cgi?id=76585
+
+        Reviewed by Martin Robinson.
+
+        This allows us to specify a minimum version of jhbuild required,
+        while also providing stability against changes done to the master
+        branch, by letting us choose what is the exact version that will
+        be used.
+
+        * gtk/run-with-jhbuild: refactored for more hackability and easier
+        reading
+        (jhbuild_installed): checks whether jhbuild is installed
+        (jhbuild_cloned): checks whether jhbuild has been cloned
+        (jhbuild_at_expected_revision): checks whether jhbuild is at the
+        expected revision
+        (update_jhbuild): brings jhbuild to the expected revision
+        (clone_jhbuild): clones jhbuild
+        (install_jhbuild): build and installs jhbuild
+        (update_webkitgtk_libs): runs update-webkitgtk-libs
+        (ensure_jhbuild): high-level logic to decide whether and which of
+        the steps above are executed
+
 2012-01-19  Alexey Proskuryakov  <[email protected]>
 
         [WK2] DumpRenderTree converts "file:///" to a path differently

Modified: trunk/Tools/gtk/run-with-jhbuild (105471 => 105472)


--- trunk/Tools/gtk/run-with-jhbuild	2012-01-20 02:41:06 UTC (rev 105471)
+++ trunk/Tools/gtk/run-with-jhbuild	2012-01-20 02:45:15 UTC (rev 105472)
@@ -1,5 +1,6 @@
 #!/usr/bin/env python
 # Copyright (C) 2011 Igalia S.L.
+# Copyright (C) 2012 Gustavo Noronha Silva <[email protected]>
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
@@ -20,22 +21,59 @@
 import subprocess
 import sys
 
-def install_and_run_jhbuild():
-    installation_prefix = os.path.abspath(common.top_level_path('WebKitBuild', 'Dependencies', 'Root'))
-    source_path = os.path.abspath(common.top_level_path('WebKitBuild', 'Dependencies', 'Source'))
-    jhbuild_source_path = os.path.join(source_path, 'jhbuild')
 
+jhbuild_revision = '1eedc423f75c605224b430579e4c303292199507'
+
+installation_prefix = os.path.abspath(common.top_level_path('WebKitBuild', 'Dependencies', 'Root'))
+source_path = os.path.abspath(common.top_level_path('WebKitBuild', 'Dependencies', 'Source'))
+jhbuild_source_path = os.path.join(source_path, 'jhbuild')
+jhbuild_path = common.top_level_path('WebKitBuild', 'Dependencies', 'Root', 'bin', 'jhbuild')
+
+
+def jhbuild_installed():
+    return os.path.exists(jhbuild_path)
+
+
+def jhbuild_cloned():
+    return os.path.exists(jhbuild_source_path)
+
+
+def jhbuild_at_expected_revision():
+    process = subprocess.Popen(['git', 'rev-list', 'HEAD^..'], cwd=jhbuild_source_path,
+                               stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+    output, err = process.communicate()
+    if process.returncode != 0:
+        raise Exception('failed to find jhbuild revision: %s' % err)
+
+    return output.strip() == jhbuild_revision
+
+
+def update_jhbuild():
+    process = subprocess.Popen(['git', 'remote', 'update', 'origin'], cwd=source_path)
+    process.wait()
+    if process.returncode != 0:
+        raise Exception('jhbuild remote update origin failed with return code: %i' % process.returncode)
+
+    process = subprocess.Popen(['git', 'checkout', '%s' % jhbuild_revision],
+                               cwd=jhbuild_source_path)
+    process.wait()
+    if process.returncode != 0:
+        raise Exception('failed to checkout treeish %s: %i' % (jhbuild_revision, process.returncode))
+
+
+def clone_jhbuild():
     if not os.path.exists(source_path):
         os.makedirs(source_path)
     if not os.path.exists(installation_prefix):
         os.makedirs(installation_prefix)
 
-    if not os.path.exists(jhbuild_source_path):
-        process = subprocess.Popen(['git', 'clone', 'git://git.gnome.org/jhbuild'], cwd=source_path)
-        process.wait()
-        if process.returncode != 0:
-            raise Exception('jhbuild git clone failed with return code: %i' % process.returncode)
+    process = subprocess.Popen(['git', 'clone', 'git://git.gnome.org/jhbuild'], cwd=source_path)
+    process.wait()
+    if process.returncode != 0:
+        raise Exception('jhbuild git clone failed with return code: %i' % process.returncode)
 
+
+def install_jhbuild():
     # jhbuild is really unhappy about having MAKE defined to something like 'make -j4'
     # so we just undefine it here.
     env_without_make = dict(os.environ)
@@ -53,15 +91,29 @@
     if process.returncode != 0:
         raise Exception('jhbuild configure failed with return code: %i' % process.returncode)
 
+
+def update_webkitgtk_libs():
     process = subprocess.Popen(common.top_level_path('Tools', 'Scripts', 'update-webkitgtk-libs'))
     process.wait()
     if process.returncode != 0:
         raise Exception('jhbuild configure failed with return code: %i' % process.returncode)
 
-jhbuild_path = common.top_level_path('WebKitBuild', 'Dependencies', 'Root', 'bin', 'jhbuild')
-if not os.path.exists(jhbuild_path):
-    install_and_run_jhbuild()
 
+def ensure_jhbuild():
+    if not jhbuild_cloned():
+        clone_jhbuild()
+        update_jhbuild()
+        install_jhbuild()
+        update_webkitgtk_libs()
+    elif not jhbuild_installed() \
+            or not jhbuild_at_expected_revision():
+        update_jhbuild()
+        install_jhbuild()
+
+
+ensure_jhbuild()
+
+
 process = subprocess.Popen([jhbuild_path, '--no-interact', '-f', common.top_level_path('Tools', 'gtk', 'jhbuildrc'), 'run'] + sys.argv[1:])
 process.wait()
 sys.exit(process.returncode)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to