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

Unified Diff: tools/check_ecs_deps/check_ecs_deps.py

Issue 95903002: Enhance check_ecs_deps to allow locally built libraries. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Fixed pylint warnings Created 7 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/check_ecs_deps/check_ecs_deps.py
===================================================================
--- tools/check_ecs_deps/check_ecs_deps.py (revision 237842)
+++ tools/check_ecs_deps/check_ecs_deps.py (working copy)
@@ -6,7 +6,6 @@
''' Verifies that builds of the embedded content_shell do not included
unnecessary dependencies.'''
-import getopt
import os
import re
import string
@@ -50,7 +49,7 @@
binary_target = 'content_shell'
-def stdmsg(final, errors):
+def stdmsg(_final, errors):
if errors:
for message in errors:
print message
@@ -70,6 +69,7 @@
'warn': lambda x: stdmsg('WARNING', x),
'abend': lambda x: stdmsg('FAILED', x),
'ok': lambda x: stdmsg('SUCCESS', x),
+ 'verbose': lambda x: None,
}
parser = optparse.OptionParser(
@@ -80,8 +80,13 @@
parser.add_option("-b", "--build-dir",
help="the location of the compiler output")
parser.add_option("--target", help="Debug or Release")
+ parser.add_option('-v', '--verbose', default=False, action='store_true')
options, args = parser.parse_args()
+ if args:
+ parser.usage()
+ return -1
+
# Bake target into build_dir.
if options.target and options.build_dir:
assert (options.target !=
@@ -90,24 +95,32 @@
options.target)
if options.build_dir != None:
- target = os.path.join(options.build_dir, binary_target)
+ target = os.path.join(options.build_dir, binary_target)
else:
target = binary_target
if options.annotate:
- output = {
+ output.update({
'message': lambda x: bbmsg(None, x),
'fail': lambda x: bbmsg('FAILURE', x),
'warn': lambda x: bbmsg('WARNINGS', x),
'abend': lambda x: bbmsg('EXCEPTIONS', x),
'ok': lambda x: bbmsg(None, x),
- }
+ })
+ if options.verbose:
+ output['verbose'] = lambda x: stdmsg(None, x)
+
forbidden_regexp = re.compile(string.join(map(re.escape,
kUndesiredLibraryList), '|'))
- mapping_regexp = re.compile(r"\s*([^/]*) => ")
+ mapping_regexp = re.compile(r"\s*([^/]*) => (.*)")
blessed_regexp = re.compile(r"(%s)[-0-9.]*\.so" % string.join(map(re.escape,
kAllowedLibraryList), '|'))
+ if options.build_dir != None:
+ built_regexp = re.compile(re.escape(options.build_dir))
+ else:
+ built_regexp = re.compile(re.escape('lib'))
+
success = 0
warning = 0
@@ -131,15 +144,20 @@
success = 1
deps = string.split(out, '\n')
for d in deps:
- libmatch = mapping_regexp.match(d)
- if libmatch:
- lib = libmatch.group(1)
- if forbidden_regexp.search(lib):
- success = 0
- output['message'](['Forbidden library: ' + lib])
- if not blessed_regexp.match(lib):
- warning = 1
- output['message'](['Unexpected library: ' + lib])
+ libmatch = mapping_regexp.match(d)
+ if libmatch:
+ lib = libmatch.group(1)
+ source = libmatch.group(2)
+ if forbidden_regexp.search(lib):
+ success = 0
+ output['message'](['Forbidden library: ' + lib])
+ elif built_regexp.match(source):
+ output['verbose'](['Built library: ' + lib])
+ elif blessed_regexp.match(lib):
+ output['verbose'](['Blessed library: ' + lib])
+ else:
+ warning = 1
+ output['message'](['Unexpected library: ' + lib])
if success == 1:
if warning == 1:
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698