From dafc75b04fb9c1583d61126929134519853d54fd Mon Sep 17 00:00:00 2001 From: piri-p Date: Wed, 8 May 2024 15:13:48 +0200 Subject: [PATCH] Don't retrieve Tinderbox directory listing when timestamp is provided (#679) --- mozdownload/scraper.py | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/mozdownload/scraper.py b/mozdownload/scraper.py index eb0ac595..cb15524a 100755 --- a/mozdownload/scraper.py +++ b/mozdownload/scraper.py @@ -972,41 +972,42 @@ def get_build_info_for_index(self, build_index=None): """Get additional information for the build at the given index.""" url = urljoin(self.base_url, self.build_list_regex) - self.logger.info('Retrieving list of builds from %s' % url) - parser = self._create_directory_parser(url) - parser.entries = parser.filter(r'^\d+$') - if self.timestamp: # If a timestamp is given, retrieve the folder with the timestamp # as name - parser.entries = self.timestamp in parser.entries and \ - [self.timestamp] + entries = [self.timestamp] + else: + self.logger.info('Retrieving list of builds from %s' % url) + parser = self._create_directory_parser(url) + parser.entries = parser.filter(r'^\d+$') - elif self.date: - # If date is given, retrieve the subset of builds on that date - parser.entries = list(filter(self.date_matches, parser.entries)) + if self.date: + # If date is given, retrieve the subset of builds on that date + parser.entries = list(filter(self.date_matches, parser.entries)) - if not parser.entries: - message = 'No builds have been found' - raise errors.NotFoundError(message, url) + if not parser.entries: + message = 'No builds have been found' + raise errors.NotFoundError(message, url) - self.show_matching_builds(parser.entries) + entries = parser.entries + + self.show_matching_builds(entries) # If no index has been given, set it to the last build of the day. if build_index is None: # Find the most recent non-empty entry. - build_index = len(parser.entries) - for build in reversed(parser.entries): + build_index = len(entries) + for build in reversed(entries): build_index -= 1 if not build_index or self.is_build_dir(build): break - if build_index >= len(parser.entries): + if build_index >= len(entries): raise errors.NotFoundError('Specified build number has not been found ', url) - self.logger.info('Selected build: %s' % parser.entries[build_index]) + self.logger.info('Selected build: %s' % entries[build_index]) - return (parser.entries, build_index) + return (entries, build_index) @property def path_regex(self):