diff options
-rw-r--r-- | meta/classes-global/sstate.bbclass | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/meta/classes-global/sstate.bbclass b/meta/classes-global/sstate.bbclass index e3d6373b3f..2fd29d7323 100644 --- a/meta/classes-global/sstate.bbclass +++ b/meta/classes-global/sstate.bbclass | |||
@@ -306,18 +306,17 @@ def sstate_install(ss, d): | |||
306 | sharedfiles.append(ss['fixmedir'] + "/fixmepath") | 306 | sharedfiles.append(ss['fixmedir'] + "/fixmepath") |
307 | 307 | ||
308 | # Write out the manifest | 308 | # Write out the manifest |
309 | f = open(manifest, "w") | 309 | with open(manifest, "w") as f: |
310 | for file in sharedfiles: | 310 | for file in sharedfiles: |
311 | f.write(file + "\n") | 311 | f.write(file + "\n") |
312 | 312 | ||
313 | # We want to ensure that directories appear at the end of the manifest | 313 | # We want to ensure that directories appear at the end of the manifest |
314 | # so that when we test to see if they should be deleted any contents | 314 | # so that when we test to see if they should be deleted any contents |
315 | # added by the task will have been removed first. | 315 | # added by the task will have been removed first. |
316 | dirs = sorted(shareddirs, key=len) | 316 | dirs = sorted(shareddirs, key=len) |
317 | # Must remove children first, which will have a longer path than the parent | 317 | # Must remove children first, which will have a longer path than the parent |
318 | for di in reversed(dirs): | 318 | for di in reversed(dirs): |
319 | f.write(di + "\n") | 319 | f.write(di + "\n") |
320 | f.close() | ||
321 | 320 | ||
322 | # Append to the list of manifests for this PACKAGE_ARCH | 321 | # Append to the list of manifests for this PACKAGE_ARCH |
323 | 322 | ||
@@ -481,9 +480,8 @@ def sstate_clean_cachefiles(d): | |||
481 | def sstate_clean_manifest(manifest, d, canrace=False, prefix=None): | 480 | def sstate_clean_manifest(manifest, d, canrace=False, prefix=None): |
482 | import oe.path | 481 | import oe.path |
483 | 482 | ||
484 | mfile = open(manifest) | 483 | with open(manifest) as mfile: |
485 | entries = mfile.readlines() | 484 | entries = mfile.readlines() |
486 | mfile.close() | ||
487 | 485 | ||
488 | for entry in entries: | 486 | for entry in entries: |
489 | entry = entry.strip() | 487 | entry = entry.strip() |