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

Side by Side Diff: src/scripts/check_deps

Issue 1986005: Add more exceptions to check_deps to allow usage of icedtea. (Closed) Base URL: ssh://git@chromiumos-git/chromeos
Patch Set: Look in /usr/local Created 10 years, 7 months 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 2
3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. 3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 import os 7 import os
8 import re 8 import re
9 import sys 9 import sys
10 10
(...skipping 10 matching lines...) Expand all
21 Args: 21 Args:
22 root: The sysroot (e.g. "/") 22 root: The sysroot (e.g. "/")
23 verbose: Print helpful messages. 23 verbose: Print helpful messages.
24 """ 24 """
25 25
26 self._root = root 26 self._root = root
27 self._libcache = set() 27 self._libcache = set()
28 self._verbose = verbose 28 self._verbose = verbose
29 29
30 # Insert some default directories into our library cache. 30 # Insert some default directories into our library cache.
31 # The /usr/lib/nss and /usr/lib/nspr directories are 31 libdirs = [
32 # required for understanding old-style Netscape plugins. 32 "%s/lib" % root,
33 self._ReadLibs([ 33 "%s/usr/lib" % root,
34 "%s/lib" % root, 34 "%s/opt/google/o3d/lib" % root,
35 "%s/usr/local/lib" % root, 35 "%s/usr/lib/opengl/xorg-x11/lib" % root,
36 "%s/usr/lib" % root, 36 "%s/usr/local/lib/icedtea6/jre/lib/i386/client" % root,
37 "%s/usr/lib/nss" % root, 37 "%s/usr/local/lib/icedtea6/jre/lib/i386/headless" % root
38 "%s/usr/lib/nspr" % root, 38 ]
39 "%s/opt/google/o3d/lib" % root 39
40 ], self._libcache) 40 # Read more directories from ld.so.conf.
41 ld_so_conf = "%s/etc/ld.so.conf" % root
42 if os.path.exists(ld_so_conf):
43 f = file(ld_so_conf)
44 for line in f:
45 if line.startswith("/"):
46 path = root + line[:-1]
47 if os.path.exists(path):
48 libdirs.append(path)
49 f.close()
50
51 self._ReadLibs(libdirs, self._libcache)
41 52
42 def _ReadLibs(self, paths, libcache): 53 def _ReadLibs(self, paths, libcache):
43 for path in paths: 54 for path in paths:
44 if os.path.exists(path): 55 if os.path.exists(path):
45 for lib in os.listdir(path): 56 for lib in os.listdir(path):
46 libcache.add(lib) 57 libcache.add(lib)
47 58
48 def _ReadDependencies(self, binary): 59 def _ReadDependencies(self, binary):
49 """Run readelf -d on BINARY, returning (deps, rpaths).""" 60 """Run readelf -d on BINARY, returning (deps, rpaths)."""
50 61
51 deps = set() 62 deps = set()
52 rpaths = set() 63 rpaths = set()
53 64
54 # Read list of dynamic libraries, ignoring error messages that occur 65 # Read list of dynamic libraries, ignoring error messages that occur
55 # when we look at files that aren't actually libraries 66 # when we look at files that aren't actually libraries
56 f = os.popen("readelf -d '%s' 2>/dev/null" % binary) 67 f = os.popen("readelf -d '%s' 2>/dev/null" % binary)
57 for line in f: 68 for line in f:
58 69
59 # Grab dependencies 70 # Grab dependencies
60 m = _SHARED_RE.search(line) 71 m = _SHARED_RE.search(line)
61 if m: 72 if m:
62 deps.add(m.group(1)) 73 deps.add(m.group(1))
63 74
64 # Add RPATHs in our search path 75 # Add RPATHs in our search path
65 m = _RPATH_RE.search(line) 76 m = _RPATH_RE.search(line)
66 if m: 77 if m:
67 for path in m.group(1).split(":"): 78 for path in m.group(1).split(":"):
68 rpaths.add(os.path.join(self._root, path[1:])) 79 if path.startswith("$ORIGIN"):
80 rpaths.add(path.replace("$ORIGIN", os.path.dirname(binary)))
81 else:
82 rpaths.add(os.path.join(self._root, path[1:]))
69 f.close() 83 f.close()
70 84
71 return (deps, rpaths) 85 return (deps, rpaths)
72 86
73 def CheckDependencies(self, binary): 87 def CheckDependencies(self, binary):
74 """Check whether the libs for BINARY can be found in our sysroot.""" 88 """Check whether the libs for BINARY can be found in our sysroot."""
75 89
76 good = True 90 good = True
77 91
78 deps, rpaths = self._ReadDependencies(binary) 92 deps, rpaths = self._ReadDependencies(binary)
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 if not checker.CheckDependencies(binary): 133 if not checker.CheckDependencies(binary):
120 errors = True 134 errors = True
121 135
122 if errors: 136 if errors:
123 sys.exit(1) 137 sys.exit(1)
124 else: 138 else:
125 sys.exit(0) 139 sys.exit(0)
126 140
127 if __name__ == "__main__": 141 if __name__ == "__main__":
128 main() 142 main()
OLDNEW
« 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