Index: Tools/scripts/getpatch
===================================================================
--- Tools/scripts/getpatch
+++ Tools/scripts/getpatch
@@ -134,6 +134,8 @@
URL_BASE = 'https://bugs.freebsd.org/bugzilla/'
URL_SHOW = '{}/show_bug.cgi?id='.format(URL_BASE)
+ REGEX_ATTACHMENTS_TABLE = r'
'
+ REGEX_ATTACHMENT_TR = r'(.*?
)'
REGEX_URL = r'Details'
REGEX = r'([^ ]+) \(text/plain(?:; charset=[-\w]+)?\)'
@@ -147,8 +149,7 @@
return None
return match.group(1)
- def _get_patch_urls(self, data):
- patch_urls = {}
+ def _get_patch_url(self, data):
for url in re.findall(self.REGEX_URL, str(data)):
url = '{}{}'.format(self.URL_BASE, url)
file_name = self._get_patch_name(url)
@@ -158,7 +159,20 @@
self.out(msg.format(url))
continue
download_url = url[:url.find('&')]
- patch_urls[download_url] = file_name
+ return download_url, file_name
+
+ def _get_patch_urls(self, data):
+ patch_urls = {}
+ match = re.search(self.REGEX_ATTACHMENTS_TABLE, str(data), re.DOTALL)
+ if match is None:
+ return patch_urls
+ table = match.group(1)
+ for tr in re.findall(self.REGEX_ATTACHMENT_TR, str(data), re.DOTALL):
+ if (tr.find('bz_tr_obsolete') >= 0):
+ continue
+ download_url, file_name = self._get_patch_url(tr)
+ patch_urls[download_url] = file_name
+
return patch_urls
def fetch(self, *largs, **kwargs):