summaryrefslogtreecommitdiffstats
path: root/meta/classes/package_rpm.bbclass
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2013-05-09 17:05:58 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-05-09 22:28:04 +0100
commit566628d8cd674a964d5824391cfd1585a1a22a87 (patch)
tree670366ee1492ff8bb18b9261dfab9d06c06b0a2d /meta/classes/package_rpm.bbclass
parentd2ef952851d9ef16875fdbbbc6ae6eb6cfc10cc0 (diff)
downloadpoky-566628d8cd674a964d5824391cfd1585a1a22a87.tar.gz
class/lib: Fix up various file access methods
There are various bits of cruft that have built up around our file accesses. This patch cleans some of them up, specifically: * Remove pointless "from __builtin__ import file" * Use open(), not file() * Wrap file usage in a with container to ensure files are closed * Add missing .close() calls in some cases (From OE-Core rev: a43e0a8ecd0441131e929daf998c3cd454d9c8f3) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/package_rpm.bbclass')
-rw-r--r--meta/classes/package_rpm.bbclass9
1 files changed, 3 insertions, 6 deletions
diff --git a/meta/classes/package_rpm.bbclass b/meta/classes/package_rpm.bbclass
index 3a2997637b..25b14dd79d 100644
--- a/meta/classes/package_rpm.bbclass
+++ b/meta/classes/package_rpm.bbclass
@@ -504,8 +504,7 @@ def write_rpm_perfiledata(srcname, d):
504 outdepends = workdir + "/" + srcname + ".requires" 504 outdepends = workdir + "/" + srcname + ".requires"
505 505
506 try: 506 try:
507 from __builtin__ import file 507 dependsfile = open(outdepends, 'w')
508 dependsfile = file(outdepends, 'w')
509 except OSError: 508 except OSError:
510 raise bb.build.FuncFailed("unable to open spec file for writing.") 509 raise bb.build.FuncFailed("unable to open spec file for writing.")
511 510
@@ -518,8 +517,7 @@ def write_rpm_perfiledata(srcname, d):
518 outprovides = workdir + "/" + srcname + ".provides" 517 outprovides = workdir + "/" + srcname + ".provides"
519 518
520 try: 519 try:
521 from __builtin__ import file 520 providesfile = open(outprovides, 'w')
522 providesfile = file(outprovides, 'w')
523 except OSError: 521 except OSError:
524 raise bb.build.FuncFailed("unable to open spec file for writing.") 522 raise bb.build.FuncFailed("unable to open spec file for writing.")
525 523
@@ -1005,8 +1003,7 @@ python write_specfile () {
1005 1003
1006 # Write the SPEC file 1004 # Write the SPEC file
1007 try: 1005 try:
1008 from __builtin__ import file 1006 specfile = open(outspecfile, 'w')
1009 specfile = file(outspecfile, 'w')
1010 except OSError: 1007 except OSError:
1011 raise bb.build.FuncFailed("unable to open spec file for writing.") 1008 raise bb.build.FuncFailed("unable to open spec file for writing.")
1012 1009