* [PATCH] bmap-tools: Fix --psplash functionality with bmap-tools 3.6 (bookworm)
@ 2025-03-12 6:27 'Kasturi Shekar' via isar-users
2025-03-12 6:32 ` 'Jan Kiszka' via isar-users
0 siblings, 1 reply; 2+ messages in thread
From: 'Kasturi Shekar' via isar-users @ 2025-03-12 6:27 UTC (permalink / raw)
To: isar-users; +Cc: Kasturi Shekar
- 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.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] bmap-tools: Fix --psplash functionality with bmap-tools 3.6 (bookworm)
2025-03-12 6:27 [PATCH] bmap-tools: Fix --psplash functionality with bmap-tools 3.6 (bookworm) 'Kasturi Shekar' via isar-users
@ 2025-03-12 6:32 ` 'Jan Kiszka' via isar-users
0 siblings, 0 replies; 2+ messages in thread
From: 'Jan Kiszka' via isar-users @ 2025-03-12 6:32 UTC (permalink / raw)
To: Kasturi Shekar, isar-users
On 12.03.25 07:27, 'Kasturi Shekar' via isar-users wrote:
> - 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 \
I thought upstream has that fixed? Then backport those patches, rather
than proposing own ones. If upstream is unfixed, go there first.
Jan
--
Siemens AG, Foundational Technologies
Linux Expert Center
--
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/408d00e6-604d-49a1-83fb-2a6097ff2ed2%40siemens.com.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-03-12 6:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-12 6:27 [PATCH] bmap-tools: Fix --psplash functionality with bmap-tools 3.6 (bookworm) 'Kasturi Shekar' via isar-users
2025-03-12 6:32 ` 'Jan Kiszka' via isar-users
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox