From: Artem Bityutskiy Date: Tue, 24 Sep 2013 09:55:07 +0000 (+0300) Subject: bmaptool: fix --nobmap case X-Git-Tag: v3.0~8 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=97362ebee78fa174d2ec8b74547a8f7b96e9dcc7;p=tools%2Fbmap-tools.git bmaptool: fix --nobmap case One of the previous commits introduced the NamedFile class and broke the --nobmap case, because we created a NamedFile object even when f_bmap was None. This patch fixes the problem. Change-Id: I4592e06b1385dcf5d34b42717b0374c68d0c223f Signed-off-by: Artem Bityutskiy --- diff --git a/bmaptool b/bmaptool index 8c92d3c..d375781 100755 --- a/bmaptool +++ b/bmaptool @@ -425,17 +425,18 @@ def copy_command(args, log): bmap_obj.close() bmap_obj = f_obj + if bmap_obj: + bmap_obj = NamedFile(bmap_obj, bmap_path) + try: if dest_is_blkdev: dest_str = "block device '%s'" % args.dest # For block devices, use the specialized class - writer = BmapCopy.BmapBdevCopy(image_obj, dest_obj, - NamedFile(bmap_obj, bmap_path), + writer = BmapCopy.BmapBdevCopy(image_obj, dest_obj, bmap_obj, image_size, logger=log) else: dest_str = "file '%s'" % os.path.basename(args.dest) - writer = BmapCopy.BmapCopy(image_obj, dest_obj, - NamedFile(bmap_obj, bmap_path), + writer = BmapCopy.BmapCopy(image_obj, dest_obj, bmap_obj, image_size, logger=log) except BmapCopy.Error as err: log.error(str(err))