summaryrefslogtreecommitdiff
path: root/include_server/cache_basics.py
diff options
context:
space:
mode:
authorklarlund <klarlund@01de4be4-8c4a-0410-9132-4925637da917>2008-06-02 19:35:26 +0000
committerklarlund <klarlund@01de4be4-8c4a-0410-9132-4925637da917>2008-06-02 19:35:26 +0000
commitef156006e39b1144e96ac121513d6ee7659edca3 (patch)
treec3607b7a85aeb28a0190d1a8d1f8e7563e601d64 /include_server/cache_basics.py
parent1a6d0aba13bf3f365b15e173b363edf893eed879 (diff)
downloaddistcc-ef156006e39b1144e96ac121513d6ee7659edca3.tar.gz
Fix option real_path_warning_re not working.
I renamed the option to path_observation_re. Now by prefixing INCLUDE_SERVER_ARGS='-d1 --path_observation_re="/usr/.*"' to say make include-server-maintainer-check, one gets a message each time the include server finds a path whose realpath name matches the regular expression. That results in messages like: WARNING include server: For translation unit 'src/testtmp.c', lookup of file 'bits/stdio_lim.h' resolved to '/usr/include/bits/stdio_lim.h' whose realpath is '/usr/include/bits/stdio_lim.h'. To make the interpretation of quoted arguments within INCLUDE_SERVER_ARGS correct, I added 'eval' to the command that cranks up the include server. I remembered to put extra quoted quotes inside the parameters that should be considered a token after the double interpretation that eval implies. git-svn-id: http://distcc.googlecode.com/svn/trunk@436 01de4be4-8c4a-0410-9132-4925637da917
Diffstat (limited to 'include_server/cache_basics.py')
-rwxr-xr-xinclude_server/cache_basics.py36
1 files changed, 16 insertions, 20 deletions
diff --git a/include_server/cache_basics.py b/include_server/cache_basics.py
index d7c98c2..c7a936c 100755
--- a/include_server/cache_basics.py
+++ b/include_server/cache_basics.py
@@ -639,7 +639,7 @@ class BuildStatCache(object):
self.includepath_map = includepath_map
self.directory_map = directory_map
self.realpath_map = realpath_map
- self.bad_realpath_tuples = []
+ self.path_observations = []
def _Verify(self, currdir_idx, searchdir_idx, includepath_idx):
"""Verify that the cached result is the same as obtained by stat call.
@@ -669,21 +669,18 @@ class BuildStatCache(object):
really_exists and "exists" or "does not exist",
cache_exists and "existed" or "did not exist"))
- def GetAndClearBadResolutions(self):
- """Return descriptions of resolutions matching realpath warning regexp.
- Returns:
- a list of tuples of the form
- (include_path, resolved_path, real_path)
- where include_path is the argument of an #include (or an initial file),
- resolved_path is the concatenation of the searchdir where the
- include_path is found with this include_path, and real_path is the
- realpath of this location (relative to the current directory).
- The list is reset to [] with this operation. Thus the items returned are
- those that occcurred since the last time this method was invoked.
+ def WarnAboutPathObservations(self, translation_unit):
+ """Print new paths found according to path observation expression option.
+
+ Args:
+ translation_unit: a string embedded in warning
"""
- bad_realpath_tuples = self.bad_realpath_tuples
- self.bad_realpath_tuples = []
- return bad_realpath_tuples
+ for (includepath, relpath, realpath) in self.path_observations:
+ Debug(DEBUG_WARNING,
+ "For translation unit '%s',"
+ " lookup of file '%s' resolved to '%s' whose realpath is '%s'.",
+ translation_unit, includepath, relpath, realpath)
+ self.path_observations = []
def Resolve(self, includepath_idx, currdir_idx, searchdir_idx,
searchlist_idxs):
@@ -786,12 +783,11 @@ class BuildStatCache(object):
realpath_idx = searchdir_realpaths[sl_idx] = (
self.realpath_map.Index(rpath))
# This is the place to catch errant files according to user defined
- # abspath_warning option. See documentation for method
- # GetAndClearBadResolutions.
- if basics.opt_realpath_warning_re:
+ # regular expression path_observation_re.
+ if basics.opt_path_observation_re:
realpath = self.realpath_map.string[realpath_idx]
- if basics.opt_realpath_warning_re.search(realpath):
- self.bad_realpath_tuples.append((includepath, relpath, realpath))
+ if basics.opt_path_observation_re.search(realpath):
+ self.path_observations.append((includepath, relpath, realpath))
return ((sl_idx, includepath_idx), realpath_idx)
else:
searchdir_stats[sl_idx] = False