From: "'Kasturi Shekar' via isar-users" <isar-users@googlegroups.com>
To: isar-users@googlegroups.com
Cc: Kasturi Shekar <kasturi.shekar@siemens.com>
Subject: [PATCH] bmap-tools: Fix --psplash functionality with bmap-tools 3.6 (bookworm)
Date: Wed, 12 Mar 2025 11:57:12 +0530 [thread overview]
Message-ID: <20250312062712.566301-1-kasturi.shekar@siemens.com> (raw)
- Fixed the issue where the --psplash-pipe flag was not working in
bmap-tools version 3.6 (Bookworm).
- Added a patch to ensure the correct handling of the --psplash-pipe
flag and avoid skipping the _psplash_pipe section when _progress_file
is null.
- With this fix, psplash can now be used with bmap-tools(v3.6) to properly
display progress updates.
Signed-off-by: Kasturi Shekar <kasturi.shekar@siemens.com>
---
.../bmap-tools/bmap-tools.bb | 21 +++++
...er-passing-error-of-set_psplash_pipe.patch | 33 ++++++++
...e-part-was-skipped-when-_progress_fi.patch | 82 +++++++++++++++++++
.../deploy-image/deploy-image_0.1.bb | 1 +
4 files changed, 137 insertions(+)
create mode 100644 meta-isar/recipes-installer/bmap-tools/bmap-tools.bb
create mode 100644 meta-isar/recipes-installer/bmap-tools/files/0001-Fix-path-parameter-passing-error-of-set_psplash_pipe.patch
create mode 100644 meta-isar/recipes-installer/bmap-tools/files/0002-Fix-_psplash_pipe-part-was-skipped-when-_progress_fi.patch
diff --git a/meta-isar/recipes-installer/bmap-tools/bmap-tools.bb b/meta-isar/recipes-installer/bmap-tools/bmap-tools.bb
new file mode 100644
index 00000000..376ab433
--- /dev/null
+++ b/meta-isar/recipes-installer/bmap-tools/bmap-tools.bb
@@ -0,0 +1,21 @@
+# This software is a part of ISAR.
+# Copyright (c) Siemens AG, 2025
+#
+# SPDX-License-Identifier: MIT
+
+inherit dpkg
+
+SRC_URI = "apt://${BPN}"
+PN = "bmap-tools"
+CHANGELOG_V="<orig-version>+isar"
+
+SRC_URI += "file://0001-Fix-path-parameter-passing-error-of-set_psplash_pipe.patch;apply=no \
+ file://0002-Fix-_psplash_pipe-part-was-skipped-when-_progress_fi.patch;apply=no"
+
+do_prepare_build:append() {
+ deb_add_changelog
+
+ cd ${S}
+ quilt import -f ${WORKDIR}/*.patch
+ quilt push -a
+}
diff --git a/meta-isar/recipes-installer/bmap-tools/files/0001-Fix-path-parameter-passing-error-of-set_psplash_pipe.patch b/meta-isar/recipes-installer/bmap-tools/files/0001-Fix-path-parameter-passing-error-of-set_psplash_pipe.patch
new file mode 100644
index 00000000..7d1bfb47
--- /dev/null
+++ b/meta-isar/recipes-installer/bmap-tools/files/0001-Fix-path-parameter-passing-error-of-set_psplash_pipe.patch
@@ -0,0 +1,33 @@
+From ce558782978405da344627f77e06f0292b6ff5b8 Mon Sep 17 00:00:00 2001
+From: Kasturi Shekar <kasturi.shekar@siemens.com>
+Date: Tue, 11 Mar 2025 12:14:47 +0530
+Subject: [PATCH 1/2] Fix path parameter passing error of set_psplash_pipe
+ function
+
+Signed-off-by: Kasturi Shekar <kasturi.shekar@siemens.com>
+---
+ bmaptools/BmapCopy.py | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/bmaptools/BmapCopy.py b/bmaptools/BmapCopy.py
+index c6a2603..dba24a5 100644
+--- a/bmaptools/BmapCopy.py
++++ b/bmaptools/BmapCopy.py
+@@ -228,11 +228,11 @@ class BmapCopy(object):
+ a best effort.
+ """
+
+- if os.path.exists(pipe) and stat.S_ISFIFO(os.stat(pipe).st_mode):
+- self._psplash_pipe = pipe
++ if os.path.exists(path) and stat.S_ISFIFO(os.stat(path).st_mode):
++ self._psplash_pipe = path
+ else:
+ _log.warning("'%s' is not a pipe, so psplash progress will not be "
+- "updated" % pipe)
++ "updated" % path)
+
+ def set_progress_indicator(self, file_obj, format_string):
+ """
+--
+2.39.5
+
diff --git a/meta-isar/recipes-installer/bmap-tools/files/0002-Fix-_psplash_pipe-part-was-skipped-when-_progress_fi.patch b/meta-isar/recipes-installer/bmap-tools/files/0002-Fix-_psplash_pipe-part-was-skipped-when-_progress_fi.patch
new file mode 100644
index 00000000..734b189e
--- /dev/null
+++ b/meta-isar/recipes-installer/bmap-tools/files/0002-Fix-_psplash_pipe-part-was-skipped-when-_progress_fi.patch
@@ -0,0 +1,82 @@
+From e085dfaae160c93db80ef041f6dbe19ed36e8c47 Mon Sep 17 00:00:00 2001
+From: Kasturi Shekar <kasturi.shekar@siemens.com>
+Date: Tue, 11 Mar 2025 12:19:41 +0530
+Subject: [PATCH 2/2] Fix _psplash_pipe part was skipped when _progress_file is
+ null
+
+Signed-off-by: Kasturi Shekar <kasturi.shekar@siemens.com>
+---
+ bmaptools/BmapCopy.py | 56 +++++++++++++++++++++----------------------
+ 1 file changed, 27 insertions(+), 29 deletions(-)
+
+diff --git a/bmaptools/BmapCopy.py b/bmaptools/BmapCopy.py
+index dba24a5..ca22aba 100644
+--- a/bmaptools/BmapCopy.py
++++ b/bmaptools/BmapCopy.py
+@@ -396,36 +396,34 @@ class BmapCopy(object):
+ else:
+ _log.debug("wrote %d blocks" % blocks_written)
+
+- if not self._progress_file:
+- return
+-
+- if self.mapped_cnt:
+- progress = '\r' + self._progress_format % percent + '\n'
+- else:
+- # Do not rotate the wheel too fast
+- now = datetime.datetime.now()
+- min_delta = datetime.timedelta(milliseconds=250)
+- if now - self._progress_time < min_delta:
+- return
+- self._progress_time = now
+-
+- progress_wheel = ('-', '\\', '|', '/')
+- progress = '\r' + progress_wheel[self._progress_index % 4] + '\n'
+- self._progress_index += 1
+-
+- # This is a little trick we do in order to make sure that the next
+- # message will always start from a new line - we switch to the new
+- # line after each progress update and move the cursor up. As an
+- # example, this is useful when the copying is interrupted by an
+- # exception - the error message will start form new line.
+- if self._progress_started:
+- # The "move cursor up" escape sequence
+- self._progress_file.write('\033[1A') # pylint: disable=W1401
+- else:
+- self._progress_started = True
++ if self._progress_file:
++ if self.mapped_cnt:
++ progress = '\r' + self._progress_format % percent + '\n'
++ else:
++ # Do not rotate the wheel too fast
++ now = datetime.datetime.now()
++ min_delta = datetime.timedelta(milliseconds=250)
++ if now - self._progress_time < min_delta:
++ return
++ self._progress_time = now
++
++ progress_wheel = ('-', '\\', '|', '/')
++ progress = '\r' + progress_wheel[self._progress_index % 4] + '\n'
++ self._progress_index += 1
++
++ # This is a little trick we do in order to make sure that the next
++ # message will always start from a new line - we switch to the new
++ # line after each progress update and move the cursor up. As an
++ # example, this is useful when the copying is interrupted by an
++ # exception - the error message will start form new line.
++ if self._progress_started:
++ # The "move cursor up" escape sequence
++ self._progress_file.write('\033[1A') # pylint: disable=W1401
++ else:
++ self._progress_started = True
+
+- self._progress_file.write(progress)
+- self._progress_file.flush()
++ self._progress_file.write(progress)
++ self._progress_file.flush()
+
+ # Update psplash progress when configured. This is using a best effort
+ # strategy to not affect the writing process when psplash breaks, is
+--
+2.39.5
+
diff --git a/meta-isar/recipes-installer/deploy-image/deploy-image_0.1.bb b/meta-isar/recipes-installer/deploy-image/deploy-image_0.1.bb
index 242ca88e..54e521b5 100644
--- a/meta-isar/recipes-installer/deploy-image/deploy-image_0.1.bb
+++ b/meta-isar/recipes-installer/deploy-image/deploy-image_0.1.bb
@@ -10,6 +10,7 @@ inherit dpkg-raw
SRC_URI = "file://usr/bin/deploy-image-wic.sh \
file://usr/lib/deploy-image-wic/handle-config.sh \
"
+DEPENDS:bookworm += "bmap-tools"
DEBIAN_DEPENDS = "bmap-tools, pv, dialog, util-linux, parted, fdisk, gdisk, pigz, xz-utils, pbzip2, zstd"
do_install[cleandirs] = "${D}/usr/bin/ \
${D}/usr/lib/deploy-image-wic \
--
2.39.5
--
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/isar-users/20250312062712.566301-1-kasturi.shekar%40siemens.com.
next reply other threads:[~2025-03-12 6:27 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-12 6:27 'Kasturi Shekar' via isar-users [this message]
2025-03-12 6:32 ` 'Jan Kiszka' via isar-users
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250312062712.566301-1-kasturi.shekar@siemens.com \
--to=isar-users@googlegroups.com \
--cc=kasturi.shekar@siemens.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox