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

Unified Diff: client/isolated_format.py

Issue 2844063005: Add option to collapse symlinks in isolate.py (Closed)
Patch Set: fix space Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: client/isolated_format.py
diff --git a/client/isolated_format.py b/client/isolated_format.py
index 5c933095b20a09fd944e66904554729ddc34e741..0216a390eb4f6601d249d42afe308b8eb2a2ee9a 100644
--- a/client/isolated_format.py
+++ b/client/isolated_format.py
@@ -309,7 +309,8 @@ def expand_directories_and_symlinks(
@tools.profile
-def file_to_metadata(filepath, prevdict, read_only, algo):
+def file_to_metadata(
+ filepath, prevdict, read_only, algo, collapse_symlinks=False):
M-A Ruel 2017/04/27 17:44:02 no default please
kjlubick 2017/04/27 17:55:37 Done.
"""Processes an input file, a dependency, and return meta data about it.
Behaviors:
@@ -340,7 +341,13 @@ def file_to_metadata(filepath, prevdict, read_only, algo):
# There is the risk of the file's timestamp being reset to its last value
# manually while its content changed. We don't protect against that use case.
try:
- filestats = os.lstat(filepath)
+ filestats = None
M-A Ruel 2017/04/27 17:44:02 not needed
kjlubick 2017/04/27 17:55:37 Done.
+ if collapse_symlinks:
+ # os.stat follows symbolic links
+ filestats = os.stat(filepath)
+ else:
+ # os.lstat does not follow symbolic links, and thus preserves them.
+ filestats = os.lstat(filepath)
except OSError:
# The file is not present.
raise MappingError('%s is missing' % filepath)
« client/isolate.py ('K') | « client/isolate.py ('k') | client/tests/isolate_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698