diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-05-19 15:16:11 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-05-19 15:19:11 +0100 |
commit | c9867c4624b88fb19deacf70b7a3ff46d4fa4699 (patch) | |
tree | 7ea9ede6f6490f0b06500aa43c70dd8c41775c68 | |
parent | 2970800a09eb440c73ba1ff88467d0292433e424 (diff) | |
download | poky-c9867c4624b88fb19deacf70b7a3ff46d4fa4699.tar.gz |
bitbake: cooker: Improve taskgraph file handling
Use open() instead of file() and close files when finished with them.
(Bitbake rev: 033c5a16ff19781ed793c2d97d285884017a2a4e)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | bitbake/lib/bb/cooker.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py index 219c79ec69..44aa11e531 100644 --- a/bitbake/lib/bb/cooker.py +++ b/bitbake/lib/bb/cooker.py | |||
@@ -894,8 +894,8 @@ class BBCooker: | |||
894 | depgraph = self.generateTaskDepTreeData(pkgs_to_build, task) | 894 | depgraph = self.generateTaskDepTreeData(pkgs_to_build, task) |
895 | 895 | ||
896 | # Prints a flattened form of package-depends below where subpackages of a package are merged into the main pn | 896 | # Prints a flattened form of package-depends below where subpackages of a package are merged into the main pn |
897 | depends_file = file('pn-depends.dot', 'w' ) | 897 | depends_file = open('pn-depends.dot', 'w' ) |
898 | buildlist_file = file('pn-buildlist', 'w' ) | 898 | buildlist_file = open('pn-buildlist', 'w' ) |
899 | print("digraph depends {", file=depends_file) | 899 | print("digraph depends {", file=depends_file) |
900 | for pn in depgraph["pn"]: | 900 | for pn in depgraph["pn"]: |
901 | fn = depgraph["pn"][pn]["filename"] | 901 | fn = depgraph["pn"][pn]["filename"] |
@@ -911,9 +911,10 @@ class BBCooker: | |||
911 | for rdepend in depgraph["rdepends-pn"][pn]: | 911 | for rdepend in depgraph["rdepends-pn"][pn]: |
912 | print('"%s" -> "%s" [style=dashed]' % (pn, rdepend), file=depends_file) | 912 | print('"%s" -> "%s" [style=dashed]' % (pn, rdepend), file=depends_file) |
913 | print("}", file=depends_file) | 913 | print("}", file=depends_file) |
914 | depends_file.close() | ||
914 | logger.info("PN dependencies saved to 'pn-depends.dot'") | 915 | logger.info("PN dependencies saved to 'pn-depends.dot'") |
915 | 916 | ||
916 | depends_file = file('package-depends.dot', 'w' ) | 917 | depends_file = open('package-depends.dot', 'w' ) |
917 | print("digraph depends {", file=depends_file) | 918 | print("digraph depends {", file=depends_file) |
918 | for package in depgraph["packages"]: | 919 | for package in depgraph["packages"]: |
919 | pn = depgraph["packages"][package]["pn"] | 920 | pn = depgraph["packages"][package]["pn"] |
@@ -932,9 +933,10 @@ class BBCooker: | |||
932 | for rdepend in depgraph["rrecs-pkg"][package]: | 933 | for rdepend in depgraph["rrecs-pkg"][package]: |
933 | print('"%s" -> "%s" [style=dotted]' % (package, rdepend), file=depends_file) | 934 | print('"%s" -> "%s" [style=dotted]' % (package, rdepend), file=depends_file) |
934 | print("}", file=depends_file) | 935 | print("}", file=depends_file) |
936 | depends_file.close() | ||
935 | logger.info("Package dependencies saved to 'package-depends.dot'") | 937 | logger.info("Package dependencies saved to 'package-depends.dot'") |
936 | 938 | ||
937 | tdepends_file = file('task-depends.dot', 'w' ) | 939 | tdepends_file = open('task-depends.dot', 'w' ) |
938 | print("digraph depends {", file=tdepends_file) | 940 | print("digraph depends {", file=tdepends_file) |
939 | for task in depgraph["tdepends"]: | 941 | for task in depgraph["tdepends"]: |
940 | (pn, taskname) = task.rsplit(".", 1) | 942 | (pn, taskname) = task.rsplit(".", 1) |
@@ -944,6 +946,7 @@ class BBCooker: | |||
944 | for dep in depgraph["tdepends"][task]: | 946 | for dep in depgraph["tdepends"][task]: |
945 | print('"%s" -> "%s"' % (task, dep), file=tdepends_file) | 947 | print('"%s" -> "%s"' % (task, dep), file=tdepends_file) |
946 | print("}", file=tdepends_file) | 948 | print("}", file=tdepends_file) |
949 | tdepends_file.close() | ||
947 | logger.info("Task dependencies saved to 'task-depends.dot'") | 950 | logger.info("Task dependencies saved to 'task-depends.dot'") |
948 | 951 | ||
949 | def show_appends_with_no_recipes(self): | 952 | def show_appends_with_no_recipes(self): |