Make the command cache use the directory name as part of the cache key.

Some commands are sensitive to the directory they're executed from. Chrome's
Mojo is trying to use such a command.

This makes GYP about 10% slower on my Mac laptop when running on Chrome, which
is to say that it's not actually noticeably worse, because it was already so
bad.  Out of 2,413 command executions, there were formerly 475 cache misses;
this change adds another 1,596. I looked at the sorts of commands that are now
missing and the majority of them (879) are dir_exists.py followed by a
relative path, and those expansions are very incorrect to look up from the
cache. The next biggest buckets are 252 "echo -n ${HOME}/goma", 220
find_sdk.py, and another 220 plugin_flags.sh with an absolute directory
argument, and none of these are sensitive to the working directory. Finally,
there are 9 version.py invocations that are sensitive to the working
directory. The numbers don't add up because I examined different statistics
during different runs, and parallelism means that caching behavior is slightly
different on successive runs.

Considering that over half of the existing cache hits are dangerous, I'm
inclined to make this change from a correctness perspective over performance
concerns. Meanwhile, we should find a way to limit the time impact of the big
callees here. dir_exists.py, find_sdk.py, plugin_flags.sh, and the goma finder
might all perform better if migrated to pymod_do_main.

BUG=112,418
TEST=gyptest.py test/variables/commands/gyptest-commands-repeated-multidir.py

Review URL: https://codereview.chromium.org/225783006

git-svn-id: http://gyp.googlecode.com/svn/trunk@1913 78cadc50-ecff-11dd-a971-7dbc132099af