diff options
author | Konstantin Ryabitsev <konstantin@linuxfoundation.org> | 2020-09-09 15:25:02 -0400 |
---|---|---|
committer | Konstantin Ryabitsev <konstantin@linuxfoundation.org> | 2020-09-09 15:25:02 -0400 |
commit | 25bb755f319c6d9c45d316dd0777ebbbfa4a60d9 (patch) | |
tree | 7fe462e768e4314311314e61910625551f775832 /b4/diff.py | |
parent | 9b097b359aa82c4279c99291ab41abb9f5f47881 (diff) | |
download | b4-25bb755f319c6d9c45d316dd0777ebbbfa4a60d9.tar.gz |
Use shorter cache file names
Use shorter cache filenames to avoid running into OSError.
Reported-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
Diffstat (limited to 'b4/diff.py')
-rw-r--r-- | b4/diff.py | 11 |
1 files changed, 5 insertions, 6 deletions
@@ -11,7 +11,6 @@ import b4 import b4.mbox import mailbox import shutil -import urllib.parse from tempfile import mkstemp @@ -29,13 +28,13 @@ def diff_same_thread_series(cmdargs): # start by grabbing the mbox provided savefile = mkstemp('b4-diff-to')[1] # Do we have a cache of this lookup? - cachedir = b4.get_cache_dir() - cachebase = urllib.parse.quote_plus(msgid) + identifier = msgid if wantvers: - cachebase += '-' + '-'.join([str(x) for x in wantvers]) + identifier += '-' + '-'.join([str(x) for x in wantvers]) if cmdargs.useproject: - cachebase += '-' + cmdargs.useproject - cachefile = os.path.join(cachedir, '%s.diff.mbx' % cachebase) + identifier += '-' + cmdargs.useproject + + cachefile = b4.get_cache_file(identifier, suffix='diff.mbx') if os.path.exists(cachefile) and not cmdargs.nocache: logger.info('Using cached copy of the lookup') shutil.copyfile(cachefile, savefile) |