diff options
author | maruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-19 20:31:50 +0000 |
---|---|---|
committer | maruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-19 20:31:50 +0000 |
commit | 29793d41959c3b820ba63d7ecdd6e6eb0de068fe (patch) | |
tree | fe8ff845e0cca81cbde727869bbe2779d4f6ebaf /tools | |
parent | e86317b1a65b369f06413bfcccd8e5503156b05b (diff) | |
download | chromium_src-29793d41959c3b820ba63d7ecdd6e6eb0de068fe.zip chromium_src-29793d41959c3b820ba63d7ecdd6e6eb0de068fe.tar.gz chromium_src-29793d41959c3b820ba63d7ecdd6e6eb0de068fe.tar.bz2 |
isolate: Get rid of 'mode' on Windows, it is not used.
R=nsylvain@chromium.org
BUG=98834
TEST=
Review URL: http://codereview.chromium.org/10079007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@133050 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/isolate/isolate.py | 24 | ||||
-rwxr-xr-x | tools/isolate/isolate_smoke_test.py | 17 | ||||
-rwxr-xr-x | tools/isolate/run_test_from_archive.py | 4 |
3 files changed, 23 insertions, 22 deletions
diff --git a/tools/isolate/isolate.py b/tools/isolate/isolate.py index c6a4b20..c01b50b 100755 --- a/tools/isolate/isolate.py +++ b/tools/isolate/isolate.py @@ -157,7 +157,8 @@ def process_inputs(prevdict, indir, infiles, level, read_only): sha-1 of the file's content. The file mode is manipulated if read_only is True. In practice, we only save - one of 4 modes: 0755 (rwx), 0644 (rw), 0555 (rx), 0444 (r). + one of 4 modes: 0755 (rwx), 0644 (rw), 0555 (rx), 0444 (r). On windows, mode + is not set since all files are 'executable' by default. """ assert level in (NO_INFO, STATS_ONLY, WITH_HASH) outdict = {} @@ -166,16 +167,17 @@ def process_inputs(prevdict, indir, infiles, level, read_only): outdict[infile] = {} if level >= STATS_ONLY: filestats = os.stat(filepath) - filemode = stat.S_IMODE(filestats.st_mode) - # Remove write access for non-owner. - filemode &= ~(stat.S_IWGRP | stat.S_IWOTH) - if read_only: - filemode &= ~stat.S_IWUSR - if filemode & stat.S_IXUSR: - filemode |= (stat.S_IXGRP | stat.S_IXOTH) - else: - filemode &= ~(stat.S_IXGRP | stat.S_IXOTH) - outdict[infile]['mode'] = filemode + if trace_inputs.get_flavor() != 'win': + filemode = stat.S_IMODE(filestats.st_mode) + # Remove write access for non-owner. + filemode &= ~(stat.S_IWGRP | stat.S_IWOTH) + if read_only: + filemode &= ~stat.S_IWUSR + if filemode & stat.S_IXUSR: + filemode |= (stat.S_IXGRP | stat.S_IXOTH) + else: + filemode &= ~(stat.S_IXGRP | stat.S_IXOTH) + outdict[infile]['mode'] = filemode outdict[infile]['size'] = filestats.st_size # Used to skip recalculating the hash. Use the most recent update time. outdict[infile]['timestamp'] = int(round(filestats.st_mtime)) diff --git a/tools/isolate/isolate_smoke_test.py b/tools/isolate/isolate_smoke_test.py index 1da347c..178ef61 100755 --- a/tools/isolate/isolate_smoke_test.py +++ b/tools/isolate/isolate_smoke_test.py @@ -88,15 +88,11 @@ class IsolateBase(unittest.TestCase): @staticmethod def _fix_file_mode(filename, read_only): - if sys.platform == 'win32': - # Deterministic file mode for a deterministic OS. - return 420 - else: - # 4 modes are supported, 0755 (rwx), 0644 (rw), 0555 (rx), 0444 (r) - min_mode = 0444 - if not read_only: - min_mode |= 0200 - return (min_mode | 0111) if filename.endswith('.py') else min_mode + """4 modes are supported, 0755 (rwx), 0644 (rw), 0555 (rx), 0444 (r).""" + min_mode = 0444 + if not read_only: + min_mode |= 0200 + return (min_mode | 0111) if filename.endswith('.py') else min_mode def _gen_files(self, read_only): root_dir = ROOT_DIR @@ -107,7 +103,8 @@ class IsolateBase(unittest.TestCase): if self.LEVEL >= isolate.STATS_ONLY: for k, v in files.iteritems(): - v[u'mode'] = self._fix_file_mode(k, read_only) + if isolate.trace_inputs.get_flavor() != 'win': + v[u'mode'] = self._fix_file_mode(k, read_only) filestats = os.stat(os.path.join(root_dir, k)) v[u'size'] = filestats.st_size # Used the skip recalculating the hash. Use the most recent update diff --git a/tools/isolate/run_test_from_archive.py b/tools/isolate/run_test_from_archive.py index 074f721..2c56bc8 100755 --- a/tools/isolate/run_test_from_archive.py +++ b/tools/isolate/run_test_from_archive.py @@ -238,7 +238,9 @@ def run_tha_test(manifest, cache_dir, remote, max_cache_size, min_free_space): if not os.path.isdir(outfiledir): os.makedirs(outfiledir) link_file(outfile, cache.path(infile), HARDLINK) - os.chmod(outfile, properties['mode']) + if 'mode' in properties: + # It's not set on Windows. + os.chmod(outfile, properties['mode']) cwd = os.path.join(outdir, manifest['relative_cwd']) if not os.path.isdir(cwd): |