* [PATCH] image.py: make sure ROOTFS_SIZE is an integer
@ 2015-09-17 3:55 Jonathan Liu
2015-09-17 7:01 ` Mike Looijmans
0 siblings, 1 reply; 2+ messages in thread
From: Jonathan Liu @ 2015-09-17 3:55 UTC (permalink / raw)
To: openembedded-core
_get_rootfs_size was returning a float in some cases (e.g. 12288.0).
Signed-off-by: Jonathan Liu <net147@gmail.com>
---
meta/lib/oe/image.py | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/meta/lib/oe/image.py b/meta/lib/oe/image.py
index 2361955..f8aa88b 100644
--- a/meta/lib/oe/image.py
+++ b/meta/lib/oe/image.py
@@ -1,6 +1,7 @@
from oe.utils import execute_pre_post_process
import os
import subprocess
+import math
import multiprocessing
@@ -169,10 +170,7 @@ class Image(ImageDepGraph):
base_size = size_kb * overhead_factor
base_size = (base_size, rootfs_req_size)[base_size < rootfs_req_size] + \
rootfs_extra_space
-
- if base_size != int(base_size):
- base_size = int(base_size + 1)
-
+ base_size = int(math.ceil(base_size))
base_size += rootfs_alignment - 1
base_size -= base_size % rootfs_alignment
--
2.5.0
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] image.py: make sure ROOTFS_SIZE is an integer
2015-09-17 3:55 [PATCH] image.py: make sure ROOTFS_SIZE is an integer Jonathan Liu
@ 2015-09-17 7:01 ` Mike Looijmans
0 siblings, 0 replies; 2+ messages in thread
From: Mike Looijmans @ 2015-09-17 7:01 UTC (permalink / raw)
To: openembedded-core
Suggestion: Why bother so much about that last bit? If floats are being used
(I suspect because "overhead_factor" is float), any bit-perfect accuracy has
been thrown out the window anyway.
I suggest just saying "base_size = int(size_kb * overhead_factor)", and be
done with it. If someone specifies "overhead_factor=1.2" or something, he
really is not going to care about that last bit being rounded upwards. If
everything is integer anyway, it will still be bit-perfect.
On 17-09-15 05:55, Jonathan Liu wrote:
> _get_rootfs_size was returning a float in some cases (e.g. 12288.0).
>
> Signed-off-by: Jonathan Liu <net147@gmail.com>
> ---
> meta/lib/oe/image.py | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/meta/lib/oe/image.py b/meta/lib/oe/image.py
> index 2361955..f8aa88b 100644
> --- a/meta/lib/oe/image.py
> +++ b/meta/lib/oe/image.py
> @@ -1,6 +1,7 @@
> from oe.utils import execute_pre_post_process
> import os
> import subprocess
> +import math
> import multiprocessing
>
>
> @@ -169,10 +170,7 @@ class Image(ImageDepGraph):
> base_size = size_kb * overhead_factor
> base_size = (base_size, rootfs_req_size)[base_size < rootfs_req_size] + \
> rootfs_extra_space
> -
> - if base_size != int(base_size):
> - base_size = int(base_size + 1)
> -
> + base_size = int(math.ceil(base_size))
> base_size += rootfs_alignment - 1
> base_size -= base_size % rootfs_alignment
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-09-17 7:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-17 3:55 [PATCH] image.py: make sure ROOTFS_SIZE is an integer Jonathan Liu
2015-09-17 7:01 ` Mike Looijmans
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox