[PATCH] [swugenerator] generator: Set decompressed-size

26 views
Skip to first unread message

Ernestas Kulik

unread,
Aug 6, 2025, 5:49:40 AM8/6/25
to swup...@googlegroups.com, Ernestas Kulik
Compressed images require this property to be set.

Signed-off-by: Ernestas Kulik <ernes...@iconn-networks.com>
---
swugenerator/generator.py | 3 +++
1 file changed, 3 insertions(+)

diff --git a/swugenerator/generator.py b/swugenerator/generator.py
index 1721aef..f238b1f 100644
--- a/swugenerator/generator.py
+++ b/swugenerator/generator.py
@@ -125,6 +125,9 @@ class SWUGenerator:
sys.exit(1)

new.fullfilename = new_path
+
+ entry.setdefault("properties", {}) \
+ .update({ "decompressed-size": str(new.getsize()) })
# compression cannot be used with delta, because it has own compressor
elif ("type" in entry) and entry["type"] == "delta":
cmd = [
--
2.47.2

Stefano Babic

unread,
Aug 6, 2025, 6:07:40 AM8/6/25
to Ernestas Kulik, swup...@googlegroups.com
Hi Ernestas,
Ehm....and what is the difference with the commit 3d6f2ac, that I
already merged ?

https://github.com/sbabic/swugenerator/commit/3d6f2acc6056a2be3fcf5a6b79419683f634b142

Best regards,
Stefano Babic

Ernestas Kulik

unread,
Aug 6, 2025, 6:10:23 AM8/6/25
to Stefano Babic, swup...@googlegroups.com
On Wed, 2025-08-06 at 12:07 +0200, Stefano Babic wrote:
> Hi Ernestas,

Hey, Stefano,
That commit is for _decrypted_ size, while this patch is for
_decompressed_ size. :)

https://github.com/sbabic/swugenerator/pull/5

Stefano Babic

unread,
Aug 6, 2025, 6:13:13 AM8/6/25
to Ernestas Kulik, swup...@googlegroups.com
Ah ok, my fault. I will merge it. It is really required just for UBI
volumes, but it should not hurt if it is always set.

Regards,
Stefano

> https://github.com/sbabic/swugenerator/pull/5

Ernestas Kulik

unread,
Aug 6, 2025, 6:16:17 AM8/6/25
to Stefano Babic, swup...@googlegroups.com
On Wed, 2025-08-06 at 12:13 +0200, Stefano Babic wrote:
>
> Ah ok, my fault. I will merge it. It is really required just for UBI
> volumes, but it should not hurt if it is always set.

Ah, I see, UBI volumes was exactly my use case, so I didn’t investigate
further.

Stefano Babic

unread,
Aug 6, 2025, 7:02:33 AM8/6/25
to Ernestas Kulik, swup...@googlegroups.com
Maybe for compatibility reason (the property is added just in this
case), you should first check if the type is UBI, and add it just in
that case.

Best regards,
Stefano

Ernestas Kulik

unread,
Aug 6, 2025, 9:32:20 AM8/6/25
to swup...@googlegroups.com, stefan...@swupdate.org, Ernestas Kulik
Compressed images require this property to be set.

Signed-off-by: Ernestas Kulik <ernes...@iconn-networks.com>
---
swugenerator/generator.py | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/swugenerator/generator.py b/swugenerator/generator.py
index 1721aef..dc0af31 100644
--- a/swugenerator/generator.py
+++ b/swugenerator/generator.py
@@ -125,6 +125,10 @@ class SWUGenerator:
sys.exit(1)

new.fullfilename = new_path
+
+ if entry.get("type") == "ubivol":
+ entry.setdefault("properties", {}) \
+ .update({ "decompressed-size": str(new.getsize()) })
# compression cannot be used with delta, because it has own compressor
elif ("type" in entry) and entry["type"] == "delta":
cmd = [
--
2.47.2

Reply all
Reply to author
Forward
0 new messages