From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mail.openembedded.org (Postfix) with ESMTP id 6289E762B4 for ; Mon, 7 Sep 2015 10:01:20 +0000 (UTC) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga102.jf.intel.com with ESMTP; 07 Sep 2015 03:01:21 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,484,1437462000"; d="scan'208";a="556862751" Received: from linux.intel.com ([10.23.219.25]) by FMSMGA003.fm.intel.com with ESMTP; 07 Sep 2015 03:01:21 -0700 Received: from vmed.fi.intel.com (vmed.fi.intel.com [10.237.72.51]) by linux.intel.com (Postfix) with ESMTP id 8E0406A4083; Mon, 7 Sep 2015 03:00:28 -0700 (PDT) From: Ed Bartosh To: openembedded-core@lists.openembedded.org Date: Mon, 7 Sep 2015 13:01:13 +0300 Message-Id: <1441620073-16198-1-git-send-email-ed.bartosh@linux.intel.com> X-Mailer: git-send-email 2.1.4 Subject: [wic][PATCH] wic: round variable before converting to int X-BeenThere: openembedded-core@lists.openembedded.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Patches and discussions about the oe-core layer List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Sep 2015 10:01:21 -0000 Wic uses bitbake variable ROOTFS_SIZE to set correspondent partition size. This variable is a literal representing float value. Wic crashes trying to convert it to int with the error: invalid literal for int() with base 10: '10166.0' Fixed this by converting variable to float and rounding result. This should work for int and float literals. Signed-off-by: Ed Bartosh --- scripts/lib/wic/imager/direct.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/lib/wic/imager/direct.py b/scripts/lib/wic/imager/direct.py index 31c0edc..146a0d1 100644 --- a/scripts/lib/wic/imager/direct.py +++ b/scripts/lib/wic/imager/direct.py @@ -242,7 +242,7 @@ class DirectImageCreator(BaseImageCreator): rsize_bb = get_bitbake_var('ROOTFS_SIZE', image_name) if rsize_bb: # convert from Kb to Mb - part.size = int(rsize_bb) / 1024 + part.size = int(round(float(rsize_bb) / 1024.)) # need to create the filesystems in order to get their # sizes before we can add them and do the layout. # Image.create() actually calls __format_disks() to create -- 2.1.4