diff options
author | Alexander Kanavin <alexander.kanavin@linux.intel.com> | 2015-12-04 13:00:20 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-12-07 17:01:21 +0000 |
commit | 9d19dd9bd709dca655b1eac13deaa49e2b54cd88 (patch) | |
tree | 0f6458c8e0a7ec3794ae025e81a0b5f155184d43 /bitbake/lib | |
parent | 71ede7b689475a09ee14cfb94a0ad6458be87738 (diff) | |
download | poky-9d19dd9bd709dca655b1eac13deaa49e2b54cd88.tar.gz |
bitbake: wget.py: parse only <a> tags
For two reasons:
1) The important one: we hit the following bug when doing upstream version checks
on some webpages:
https://bugs.launchpad.net/beautifulsoup/+bug/1471755
2) Also, documentation for beautifulsoup states that memory usage and
speed is improved that way.
(Bitbake rev: 7546d4aeb3ba8fda9832081b84d93138dc5e58d6)
Signed-off-by: Alexander Kanavin <alexander.kanavin@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib')
-rw-r--r-- | bitbake/lib/bb/fetch2/wget.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/bitbake/lib/bb/fetch2/wget.py b/bitbake/lib/bb/fetch2/wget.py index bd2a8972a7..c185f5b5f4 100644 --- a/bitbake/lib/bb/fetch2/wget.py +++ b/bitbake/lib/bb/fetch2/wget.py | |||
@@ -38,6 +38,7 @@ from bb.fetch2 import FetchError | |||
38 | from bb.fetch2 import logger | 38 | from bb.fetch2 import logger |
39 | from bb.fetch2 import runfetchcmd | 39 | from bb.fetch2 import runfetchcmd |
40 | from bs4 import BeautifulSoup | 40 | from bs4 import BeautifulSoup |
41 | from bs4 import SoupStrainer | ||
41 | 42 | ||
42 | class Wget(FetchMethod): | 43 | class Wget(FetchMethod): |
43 | """Class to fetch urls via 'wget'""" | 44 | """Class to fetch urls via 'wget'""" |
@@ -367,7 +368,7 @@ class Wget(FetchMethod): | |||
367 | version = ['', '', ''] | 368 | version = ['', '', ''] |
368 | 369 | ||
369 | bb.debug(3, "VersionURL: %s" % (url)) | 370 | bb.debug(3, "VersionURL: %s" % (url)) |
370 | soup = BeautifulSoup(self._fetch_index(url, ud, d)) | 371 | soup = BeautifulSoup(self._fetch_index(url, ud, d), "html.parser", parse_only=SoupStrainer("a")) |
371 | if not soup: | 372 | if not soup: |
372 | bb.debug(3, "*** %s NO SOUP" % (url)) | 373 | bb.debug(3, "*** %s NO SOUP" % (url)) |
373 | return "" | 374 | return "" |
@@ -417,7 +418,7 @@ class Wget(FetchMethod): | |||
417 | ud.path.split(dirver)[0], ud.user, ud.pswd, {}]) | 418 | ud.path.split(dirver)[0], ud.user, ud.pswd, {}]) |
418 | bb.debug(3, "DirURL: %s, %s" % (dirs_uri, package)) | 419 | bb.debug(3, "DirURL: %s, %s" % (dirs_uri, package)) |
419 | 420 | ||
420 | soup = BeautifulSoup(self._fetch_index(dirs_uri, ud, d)) | 421 | soup = BeautifulSoup(self._fetch_index(dirs_uri, ud, d), "html.parser", parse_only=SoupStrainer("a")) |
421 | if not soup: | 422 | if not soup: |
422 | return version[1] | 423 | return version[1] |
423 | 424 | ||