diff options
| author | Mark Hatle <mark.hatle@kernel.crashing.org> | 2023-03-09 16:52:21 -0600 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-03-11 20:49:22 +0000 |
| commit | f29a1c29662f61c9dd26ef2c6c96b8fbb2eb7bd9 (patch) | |
| tree | ac6ace64a084efcd7f3bdb26b5abb30def6830fd | |
| parent | f9b422152bdb40ed49e3310983faf7f5fe58b10d (diff) | |
| download | poky-f29a1c29662f61c9dd26ef2c6c96b8fbb2eb7bd9.tar.gz | |
bitbake: wget.py: Combine urlopener exceptions
No reason to have three identical exception handles, refactor to catch any
of the exceptions with the same block of code.
(Bitbake rev: b29f6e04091b6bfe697dc41c76880de466736fc3)
Signed-off-by: Mark Hatle <mark.hatle@kernel.crashing.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -rw-r--r-- | bitbake/lib/bb/fetch2/wget.py | 18 |
1 files changed, 1 insertions, 17 deletions
diff --git a/bitbake/lib/bb/fetch2/wget.py b/bitbake/lib/bb/fetch2/wget.py index 927487a0b6..dc88317610 100644 --- a/bitbake/lib/bb/fetch2/wget.py +++ b/bitbake/lib/bb/fetch2/wget.py | |||
| @@ -369,7 +369,7 @@ class Wget(FetchMethod): | |||
| 369 | 369 | ||
| 370 | with opener.open(r, timeout=30) as response: | 370 | with opener.open(r, timeout=30) as response: |
| 371 | pass | 371 | pass |
| 372 | except urllib.error.URLError as e: | 372 | except (urllib.error.URLError, ConnectionResetError, TimeoutError) as e: |
| 373 | if try_again: | 373 | if try_again: |
| 374 | logger.debug2("checkstatus: trying again") | 374 | logger.debug2("checkstatus: trying again") |
| 375 | return self.checkstatus(fetch, ud, d, False) | 375 | return self.checkstatus(fetch, ud, d, False) |
| @@ -377,22 +377,6 @@ class Wget(FetchMethod): | |||
| 377 | # debug for now to avoid spamming the logs in e.g. remote sstate searches | 377 | # debug for now to avoid spamming the logs in e.g. remote sstate searches |
| 378 | logger.debug2("checkstatus() urlopen failed: %s" % e) | 378 | logger.debug2("checkstatus() urlopen failed: %s" % e) |
| 379 | return False | 379 | return False |
| 380 | except ConnectionResetError as e: | ||
| 381 | if try_again: | ||
| 382 | logger.debug2("checkstatus: trying again") | ||
| 383 | return self.checkstatus(fetch, ud, d, False) | ||
| 384 | else: | ||
| 385 | # debug for now to avoid spamming the logs in e.g. remote sstate searches | ||
| 386 | logger.debug2("checkstatus() urlopen failed: %s" % e) | ||
| 387 | return False | ||
| 388 | except TimeoutError as e: | ||
| 389 | if try_again: | ||
| 390 | logger.debug2("checkstatus: trying again") | ||
| 391 | return self.checkstatus(fetch, ud, d, False) | ||
| 392 | else: | ||
| 393 | # debug for now to avoid spamming the logs in e.g. remote sstate searches | ||
| 394 | logger.debug2("checkstatus() urlopen TimeoutError: %s" % e) | ||
| 395 | return False | ||
| 396 | 380 | ||
| 397 | return True | 381 | return True |
| 398 | 382 | ||
