[bmap-tools] [PATCH 14/14] BmapCreate: fix and tidy-up bmap file formatting
Artem Bityutskiy
dedekind1 at gmail.com
Tue Jan 21 12:34:35 EST 2014
From: Artem Bityutskiy <artem.bityutskiy at intel.com>
We generated bogus commentary for files with zero mapped block:
<!-- Count of mapped blocks: 0 bytes or 0.0%0.0 -->
<MappedBlocksCount> 0 </MappedBlocksCount>
and this patch fixes it. On top of this, we put too many white-spaces
in the <MappedBlocksCount> because we used wrong variable to calculate
the maximum amount of spaces. Fix this as well.
Change-Id: Icf80b1b8cdba7785755890f066824bb3abb42e0a
Signed-off-by: Artem Bityutskiy <artem.bityutskiy at intel.com>
---
bmaptools/BmapCreate.py | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/bmaptools/BmapCreate.py b/bmaptools/BmapCreate.py
index b70fd73..3df1446 100644
--- a/bmaptools/BmapCreate.py
+++ b/bmaptools/BmapCreate.py
@@ -218,8 +218,6 @@ class BmapCreate(object):
# We do not know the amount of mapped blocks at the moment, so just put
# whitespaces instead of real numbers. Assume the longest possible
# numbers.
- mapped_count = ' ' * len(str(self.image_size))
- mapped_size_human = ' ' * len(self.image_size_human)
xml = _BMAP_START_TEMPLATE \
% (SUPPORTED_BMAP_VERSION, self.image_size_human,
@@ -229,14 +227,14 @@ class BmapCreate(object):
self._f_bmap.write(xml)
self._mapped_count_pos1 = self._f_bmap.tell()
- # Just put white-spaces instead of real information about mapped blocks
- xml = "%s or %.1f -->\n" % (mapped_size_human, 100.0)
+ xml = "%s or %s -->\n" % (' ' * len(self.image_size_human),
+ ' ' * len("100.0%"))
xml += " <MappedBlocksCount> "
self._f_bmap.write(xml)
self._mapped_count_pos2 = self._f_bmap.tell()
- xml = "%s </MappedBlocksCount>\n\n" % mapped_count
+ xml = "%s </MappedBlocksCount>\n\n" % (' ' * len(str(self.blocks_cnt)))
# pylint: disable=C0301
xml += " <!-- Type of checksum used in this file -->\n"
--
1.8.3.1
More information about the Bmap-tools
mailing list