summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Ryabitsev <konstantin@linuxfoundation.org>2020-03-27 12:06:24 -0400
committerKonstantin Ryabitsev <konstantin@linuxfoundation.org>2020-03-27 12:06:24 -0400
commita5fab3c6c4067e99510ed68e0c7959f60f74345d (patch)
tree8949f0145b8e12b426dd4007d2e2b834dd1c4bdd
parent6de8a6106413068662ca2fa5a98ba2b6aa7f2d7b (diff)
downloadb4-a5fab3c6c4067e99510ed68e0c7959f60f74345d.tar.gz
Make cache locations project-specific
When we use a specific project either via -p or via parsing the full lore URL, don't use the generic lookup cache location. Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
-rw-r--r--b4/__init__.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/b4/__init__.py b/b4/__init__.py
index 8a7cf8b..af8b23c 100644
--- a/b4/__init__.py
+++ b/b4/__init__.py
@@ -1462,7 +1462,10 @@ def get_pi_thread_by_url(t_mbx_url, savefile):
def get_pi_thread_by_msgid(msgid, savefile, useproject=None, nocache=False):
config = get_main_config()
cachedir = get_cache_dir()
- cachefile = os.path.join(cachedir, '%s.pi.mbx' % urllib.parse.quote_plus(msgid))
+ base = msgid
+ if useproject:
+ base = '%s-%s' % (useproject, msgid)
+ cachefile = os.path.join(cachedir, '%s.pi.mbx' % urllib.parse.quote_plus(base))
if os.path.exists(cachefile) and not nocache:
logger.debug('Using cached copy: %s', cachefile)
shutil.copyfile(cachefile, savefile)