From ed261c51ff1f33f36845a5d8e1addcab3d1f9154 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AD=A6=E4=B8=B9?= Date: Fri, 19 Jul 2024 11:17:59 +0800 Subject: [PATCH 1/5] Add increment size settings --- debian/changelog | 7 +++++++ src/ostree/ot-builtin-commit.c | 22 +++++++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 7f7b64d..2dd1fcd 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +ostree (2024.5-1ok1.11) nile; urgency=medium + + * I9U7AE - 更新包下载实际大小大于总大小,增加增量大小属性设置 + * Add increment size settings + + -- wudan Fri, 19 Jul 2024 11:17:05 +0800 + ostree (2024.5-1ok1.10) nile; urgency=medium * I9TKDM - 历史版本中存在的版本数量多于5个 diff --git a/src/ostree/ot-builtin-commit.c b/src/ostree/ot-builtin-commit.c index 7c6d63e..eba4e22 100644 --- a/src/ostree/ot-builtin-commit.c +++ b/src/ostree/ot-builtin-commit.c @@ -907,7 +907,27 @@ ostree_builtin_commit (int argc, char **argv, OstreeCommandInvocation *invocatio metadata = g_variant_ref_sink (g_variant_dict_end (&newmeta)); } - + if (repo->txn.stats.content_bytes_written >= 0) + { + g_debug("Content Bytes Written: %s", g_format_size(repo->txn.stats.content_bytes_written)); + g_autoptr(GVariant) old_metadata = g_steal_pointer(&metadata); + g_auto(GVariantDict) newmeta; + g_variant_dict_init(&newmeta, old_metadata); + GString *str = g_string_new(NULL); + if (repo->txn.stats.content_bytes_written == 0) + { + g_string_append_printf(str, "10 MB"); + g_variant_dict_insert(&newmeta, "ostree.incrementsize", "s", str->str); + } + else + { + g_autofree char *bytes_written = g_format_size (repo->txn.stats.content_bytes_written); + g_string_append_printf (str, "%s", bytes_written); + g_variant_dict_insert(&newmeta, "ostree.incrementsize", "s", str->str); + } + metadata = g_variant_ref_sink(g_variant_dict_end(&newmeta)); + g_string_free(str, TRUE); + } if (!opt_timestamp) { if (!ostree_repo_write_commit (repo, parent, opt_subject, commit_body, metadata, -- Gitee From 3e7d8b7d4e1fc7976baef3d79c4d21afe44a94e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AD=A6=E4=B8=B9?= Date: Fri, 19 Jul 2024 15:54:58 +0800 Subject: [PATCH 2/5] fix add size to byte --- debian/changelog | 7 ++++++ src/ostree/ot-builtin-commit.c | 39 ++++++++++++++++++++++------------ 2 files changed, 33 insertions(+), 13 deletions(-) diff --git a/debian/changelog b/debian/changelog index 2dd1fcd..4d0428d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +ostree (2024.5-1ok1.12) nile; urgency=medium + + * I9U7AE - 更新包下载实际大小大于总大小,增加增量大小属性设置 + * fix bytes + + -- wudan Fri, 19 Jul 2024 11:17:05 +0800 + ostree (2024.5-1ok1.11) nile; urgency=medium * I9U7AE - 更新包下载实际大小大于总大小,增加增量大小属性设置 diff --git a/src/ostree/ot-builtin-commit.c b/src/ostree/ot-builtin-commit.c index eba4e22..cba4257 100644 --- a/src/ostree/ot-builtin-commit.c +++ b/src/ostree/ot-builtin-commit.c @@ -907,26 +907,39 @@ ostree_builtin_commit (int argc, char **argv, OstreeCommandInvocation *invocatio metadata = g_variant_ref_sink (g_variant_dict_end (&newmeta)); } + // if (repo->txn.stats.content_bytes_written >= 0) + // { + // g_debug("Content Bytes Written: %s", g_format_size(repo->txn.stats.content_bytes_written)); + // g_autoptr(GVariant) old_metadata = g_steal_pointer(&metadata); + // g_auto(GVariantDict) newmeta; + // g_variant_dict_init(&newmeta, old_metadata); + // //GString *str = g_string_new(NULL); + // if (repo->txn.stats.content_bytes_written == 0) + // { + // //g_string_append_printf(str, "10"); + // guint64 content_bytes=10; + // g_variant_dict_insert(&newmeta, "ostree.incrementsize", "t", content_bytes); + // } + // else + // { + // //g_autofree char *bytes_written = g_format_size (repo->txn.stats.content_bytes_written); + // //g_string_append_printf (str, "%s", bytes_written); + // g_variant_dict_insert(&newmeta, "ostree.incrementsize", "t", repo->txn.stats.content_bytes_written); + // } + // metadata = g_variant_ref_sink(g_variant_dict_end(&newmeta)); + // g_string_free(str, TRUE); + // } if (repo->txn.stats.content_bytes_written >= 0) { g_debug("Content Bytes Written: %s", g_format_size(repo->txn.stats.content_bytes_written)); g_autoptr(GVariant) old_metadata = g_steal_pointer(&metadata); g_auto(GVariantDict) newmeta; g_variant_dict_init(&newmeta, old_metadata); - GString *str = g_string_new(NULL); - if (repo->txn.stats.content_bytes_written == 0) - { - g_string_append_printf(str, "10 MB"); - g_variant_dict_insert(&newmeta, "ostree.incrementsize", "s", str->str); - } - else - { - g_autofree char *bytes_written = g_format_size (repo->txn.stats.content_bytes_written); - g_string_append_printf (str, "%s", bytes_written); - g_variant_dict_insert(&newmeta, "ostree.incrementsize", "s", str->str); - } + + guint64 content_bytes = repo->txn.stats.content_bytes_written == 0 ? 10 : repo->txn.stats.content_bytes_written; + g_variant_dict_insert(&newmeta, "ostree.incrementsize", "t",g_variant_new_uint64(content_bytes)); + metadata = g_variant_ref_sink(g_variant_dict_end(&newmeta)); - g_string_free(str, TRUE); } if (!opt_timestamp) { -- Gitee From a183f95737b6453c0860225a8ea1387a62963041 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AD=A6=E4=B8=B9?= Date: Fri, 26 Jul 2024 10:26:07 +0800 Subject: [PATCH 3/5] fix add bytes --- src/ostree/ot-builtin-commit.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ostree/ot-builtin-commit.c b/src/ostree/ot-builtin-commit.c index cba4257..a0f3bf3 100644 --- a/src/ostree/ot-builtin-commit.c +++ b/src/ostree/ot-builtin-commit.c @@ -935,9 +935,10 @@ ostree_builtin_commit (int argc, char **argv, OstreeCommandInvocation *invocatio g_autoptr(GVariant) old_metadata = g_steal_pointer(&metadata); g_auto(GVariantDict) newmeta; g_variant_dict_init(&newmeta, old_metadata); - + GString *str = g_string_new(NULL); guint64 content_bytes = repo->txn.stats.content_bytes_written == 0 ? 10 : repo->txn.stats.content_bytes_written; - g_variant_dict_insert(&newmeta, "ostree.incrementsize", "t",g_variant_new_uint64(content_bytes)); + g_string_append_printf (str, "%" G_GUINT64_FORMAT, content_bytes); + g_variant_dict_insert(&newmeta, "ostree.incrementsize", "s",str->str); metadata = g_variant_ref_sink(g_variant_dict_end(&newmeta)); } -- Gitee From 7f05c6ce93681810947cba8b63796fa525b62e96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AD=A6=E4=B8=B9?= Date: Fri, 26 Jul 2024 10:31:01 +0800 Subject: [PATCH 4/5] fix add bytes --- debian/changelog | 7 ------- 1 file changed, 7 deletions(-) diff --git a/debian/changelog b/debian/changelog index 4d0428d..2dd1fcd 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,10 +1,3 @@ -ostree (2024.5-1ok1.12) nile; urgency=medium - - * I9U7AE - 更新包下载实际大小大于总大小,增加增量大小属性设置 - * fix bytes - - -- wudan Fri, 19 Jul 2024 11:17:05 +0800 - ostree (2024.5-1ok1.11) nile; urgency=medium * I9U7AE - 更新包下载实际大小大于总大小,增加增量大小属性设置 -- Gitee From 14d3be3542ad51e3627cd7a8a0d024d533c991a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AD=A6=E4=B8=B9?= Date: Fri, 26 Jul 2024 16:24:47 +0800 Subject: [PATCH 5/5] fix add bytes --- src/ostree/ot-builtin-commit.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ostree/ot-builtin-commit.c b/src/ostree/ot-builtin-commit.c index a0f3bf3..101f9ad 100644 --- a/src/ostree/ot-builtin-commit.c +++ b/src/ostree/ot-builtin-commit.c @@ -941,6 +941,7 @@ ostree_builtin_commit (int argc, char **argv, OstreeCommandInvocation *invocatio g_variant_dict_insert(&newmeta, "ostree.incrementsize", "s",str->str); metadata = g_variant_ref_sink(g_variant_dict_end(&newmeta)); + g_string_free(str, TRUE); } if (!opt_timestamp) { -- Gitee