aboutsummaryrefslogtreecommitdiff
path: root/b4/mbox.py
diff options
context:
space:
mode:
authorKonstantin Ryabitsev <konstantin@linuxfoundation.org>2021-05-25 13:51:51 -0400
committerKonstantin Ryabitsev <konstantin@linuxfoundation.org>2021-05-25 13:51:51 -0400
commit036c0f3f4f17d091556dfc26bee5aa3a29f7912a (patch)
tree96bdeedd00cfb8572f86f8290329b661caf168bc /b4/mbox.py
parentf2eacc4dbcb8f976ab12570c0a3c6d53bc3c1c23 (diff)
downloadb4-036c0f3f4f17d091556dfc26bee5aa3a29f7912a.tar.gz
Don't depend on List-Archive lore header
The newer version of public-inbox is not injecting its own List-Archive headers, so stop relying on it for any purpose. Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
Diffstat (limited to 'b4/mbox.py')
-rw-r--r--b4/mbox.py21
1 files changed, 18 insertions, 3 deletions
diff --git a/b4/mbox.py b/b4/mbox.py
index bf1a586..f575f94 100644
--- a/b4/mbox.py
+++ b/b4/mbox.py
@@ -387,7 +387,8 @@ def save_as_quilt(am_msgs, q_dirname):
sfh.write('%s\n' % patch_filename)
-def get_extra_series(msgs: list, direction: int = 1, wantvers: Optional[int] = None, nocache: bool = False) -> list:
+def get_extra_series(msgs: list, direction: int = 1, wantvers: Optional[int] = None, nocache: bool = False,
+ useproject: Optional[str] = None) -> list:
base_msg = None
latest_revision = None
seen_msgids = set()
@@ -427,7 +428,21 @@ def get_extra_series(msgs: list, direction: int = 1, wantvers: Optional[int] = N
logger.debug('Could not find cover of 1st patch in mbox')
return msgs
- listarc = base_msg.get_all('List-Archive')[-1].strip('<>')
+ config = b4.get_main_config()
+ loc = urllib.parse.urlparse(config['midmask'])
+ if not useproject:
+ projects = b4.get_lore_projects_from_msg(base_msg)
+ if not projects:
+ logger.info('Unable to figure out list archive location')
+ return msgs
+ useproject = projects[0]
+
+ listarc = '%s://%s/%s/' % (loc.scheme, loc.netloc, useproject)
+
+ if not listarc:
+ logger.info('Unable to figure out list archive location')
+ return msgs
+
nt_msgs = list()
if len(obsoleted):
for nt_msgid in obsoleted:
@@ -601,7 +616,7 @@ def main(cmdargs):
return
if len(msgs) and cmdargs.checknewer:
- msgs = get_extra_series(msgs, direction=1)
+ msgs = get_extra_series(msgs, direction=1, useproject=cmdargs.useproject)
if cmdargs.subcmd == 'am':
make_am(msgs, cmdargs, msgid)