Title: [101404] trunk/Tools
Revision
101404
Author
mrobin...@webkit.org
Date
2011-11-29 12:30:17 -0800 (Tue, 29 Nov 2011)

Log Message

[GTK] Add a method to detect 'make dist' errors without running 'make dist'
https://bugs.webkit.org/show_bug.cgi?id=73216

Reviewed by Philippe Normand.

Add a script that tries to sniff out 'make dist' problems without running
'make dist.' 'make distcheck' takes a very long time to run and this should
reduce the amount of times it needs to be run consecutively.

* gtk/common.py:
(get_build_path.is_valid_build_directory): Guess the source directory
by the existence of the GNUmakefile instead of the .libs directory. This
allows one to run the script after running autogen.sh but before fully
building.
* gtk/find-make-dist-errors: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/Tools/ChangeLog (101403 => 101404)


--- trunk/Tools/ChangeLog	2011-11-29 20:11:48 UTC (rev 101403)
+++ trunk/Tools/ChangeLog	2011-11-29 20:30:17 UTC (rev 101404)
@@ -1,3 +1,21 @@
+2011-11-29  Martin Robinson  <mrobin...@igalia.com>
+
+        [GTK] Add a method to detect 'make dist' errors without running 'make dist'
+        https://bugs.webkit.org/show_bug.cgi?id=73216
+
+        Reviewed by Philippe Normand.
+
+        Add a script that tries to sniff out 'make dist' problems without running
+        'make dist.' 'make distcheck' takes a very long time to run and this should
+        reduce the amount of times it needs to be run consecutively.
+
+        * gtk/common.py:
+        (get_build_path.is_valid_build_directory): Guess the source directory
+        by the existence of the GNUmakefile instead of the .libs directory. This
+        allows one to run the script after running autogen.sh but before fully
+        building.
+        * gtk/find-make-dist-errors: Added.
+
 2011-11-29  Tor Arne Vestbø  <tor.arne.ves...@nokia.com>
 
         [Qt] Remove use of internal headers in the MiniBrowser

Modified: trunk/Tools/gtk/common.py (101403 => 101404)


--- trunk/Tools/gtk/common.py	2011-11-29 20:11:48 UTC (rev 101403)
+++ trunk/Tools/gtk/common.py	2011-11-29 20:30:17 UTC (rev 101404)
@@ -40,7 +40,7 @@
         return build_dir
 
     def is_valid_build_directory(path):
-        return os.path.exists(os.path.join(path, '.libs'))
+        return os.path.exists(os.path.join(path, 'GNUmakefile'))
 
     build_dir = top_level_path('WebKitBuild', 'Release')
     if is_valid_build_directory(build_dir):

Added: trunk/Tools/gtk/find-make-dist-errors (0 => 101404)


--- trunk/Tools/gtk/find-make-dist-errors	                        (rev 0)
+++ trunk/Tools/gtk/find-make-dist-errors	2011-11-29 20:30:17 UTC (rev 101404)
@@ -0,0 +1,108 @@
+#!/usr/bin/python
+# Copyright (C) 2011 Igalia S.L.
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+
+import common
+import os
+import subprocess
+import sys
+
+def is_source_file_listing(line):
+    return line.strip().startswith('Source')
+
+def get_listed_makefile_headers():
+    makefile_text = open(os.path.join(common.build_path('GNUmakefile'))).read()
+
+    # Automake often places separate includes on the same line.
+    makefile_text = makefile_text.replace(' ', '\n')
+
+    headers = []
+    for line in makefile_text.splitlines():
+        # $(srcdir)/ is the same as an empty string in a source file listing.
+        line = line.replace('$(srcdir)/', '')
+
+        # If the line doesn't start with 'Source' it isn't listing for
+        # a source file.
+        if not is_source_file_listing(line):
+            continue
+
+        # Most source listings end with \ indicating that the listing
+        # continues onto the next line.
+        line = line.replace('\\', '')
+
+        # We only care about header files. Source files result in build
+        # breakage, so we will detect them without this script.
+        line = line.strip()
+        if not line.endswith('.h'):
+            continue
+
+        # If the line contains a makefile variable we do not care about it.
+        if line.find('$') != -1:
+            continue
+
+        headers.append(line)
+
+    return headers
+
+def scan_headers_from_dependency_files():
+    process = subprocess.Popen(['find . -name *.Plo | xargs cat | grep .h:$'],
+                               cwd=common.build_path(),
+                               stdout=subprocess.PIPE,
+                               shell=True)
+    sanitized_lines = set()
+    for line in process.communicate()[0].splitlines():
+        # Paths in Plo files are relative to the build directory so they might contain
+        # ../.. if the build directory is something like WebKitBuild/Release.
+        line = line.replace('../../', '')
+        if not is_source_file_listing(line):
+            continue
+
+        # The lines we care about end with ':'.
+        line = line.replace(':', '')
+        line = line.strip()
+        sanitized_lines.add(line)
+    return sanitized_lines
+
+def get_unlisted_headers(listed_makefile_headers):
+    unlisted = set()
+    for header in scan_headers_from_dependency_files():
+        if not header in listed_makefile_headers:
+            unlisted.add(header)
+    return unlisted
+
+def get_missing_headers(listed_makefile_headers):
+    missing = set()
+    for header in listed_makefile_headers:
+        if not os.path.exists(common.top_level_path(header)):
+            missing.add(header)
+    return missing
+
+listed_makefile_headers = get_listed_makefile_headers()
+unlisted_headers = get_unlisted_headers(listed_makefile_headers)
+missing_headers = get_missing_headers(listed_makefile_headers)
+if unlisted_headers:
+    print 'Headers not listed in the GNUmakefiles:'
+    for header in sorted(unlisted_headers):
+        print '\t%s' % header
+    print
+
+if missing_headers:
+    print 'Headers listed in the GNUmakefiles that do not exist:'
+    for header in sorted(missing_headers):
+        print '\t%s' % header
+    print
+
+sys.exit(len(unlisted_headers) + len(missing_headers))
Property changes on: trunk/Tools/gtk/find-make-dist-errors
___________________________________________________________________

Added: svn:executable

_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to