diff options
Diffstat (limited to 'bitbake/lib/bb/utils.py')
-rw-r--r-- | bitbake/lib/bb/utils.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py index 462eb689b9..2e10fc24dd 100644 --- a/bitbake/lib/bb/utils.py +++ b/bitbake/lib/bb/utils.py | |||
@@ -414,6 +414,10 @@ def lockfile(name, shared=False, retry=True): | |||
414 | return lf | 414 | return lf |
415 | lf.close() | 415 | lf.close() |
416 | except Exception: | 416 | except Exception: |
417 | try: | ||
418 | lf.close() | ||
419 | except Exception: | ||
420 | pass | ||
417 | pass | 421 | pass |
418 | if not retry: | 422 | if not retry: |
419 | return None | 423 | return None |
@@ -443,8 +447,9 @@ def md5_file(filename): | |||
443 | import md5 | 447 | import md5 |
444 | m = md5.new() | 448 | m = md5.new() |
445 | 449 | ||
446 | for line in open(filename): | 450 | with open(filename, "rb") as f: |
447 | m.update(line) | 451 | for line in f: |
452 | m.update(line) | ||
448 | return m.hexdigest() | 453 | return m.hexdigest() |
449 | 454 | ||
450 | def sha256_file(filename): | 455 | def sha256_file(filename): |
@@ -460,8 +465,9 @@ def sha256_file(filename): | |||
460 | return None | 465 | return None |
461 | 466 | ||
462 | s = hashlib.sha256() | 467 | s = hashlib.sha256() |
463 | for line in open(filename): | 468 | with open(filename, "rb") as f: |
464 | s.update(line) | 469 | for line in f: |
470 | s.update(line) | ||
465 | return s.hexdigest() | 471 | return s.hexdigest() |
466 | 472 | ||
467 | def preserved_envvars_exported(): | 473 | def preserved_envvars_exported(): |