public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: "'Jan Kiszka' via isar-users" <isar-users@googlegroups.com>
To: Kasturi Shekar <kasturi.shekar@siemens.com>, isar-users@googlegroups.com
Subject: Re: [PATCH v3] bmap-tools: Fix --psplash functionality with bmap-tools 3.6 (bookworm)
Date: Thu, 13 Mar 2025 10:58:31 +0100	[thread overview]
Message-ID: <1c9611b3-7e67-4079-86b6-543d3125b17f@siemens.com> (raw)
In-Reply-To: <20250312090753.566643-1-kasturi.shekar@siemens.com>

On 12.03.25 10:07, '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.
> 
> Debian is not going to fix it in bookworm, Reference:
> https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1034290
> https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1100092
> 
> Signed-off-by: Kasturi Shekar <kasturi.shekar@siemens.com>
> ---
>  .../bmap-tools/bmap-tools.bb                  | 21 +++++
>  ...er-passing-error-of-set_psplash_pipe.patch | 28 +++++++
>  ...e-part-was-skipped-when-_progress_fi.patch | 78 +++++++++++++++++++
>  .../deploy-image/deploy-image_0.1.bb          |  1 +
>  4 files changed, 128 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..a45bcbc4
> --- /dev/null
> +++ b/meta-isar/recipes-installer/bmap-tools/files/0001-Fix-path-parameter-passing-error-of-set_psplash_pipe.patch
> @@ -0,0 +1,28 @@
> +From 06fa51d0270f84d9553c044bd7391f01459a70e8 Mon Sep 17 00:00:00 2001
> +From: Jason <zxcv1884@gmail.com>
> +Date: Wed, 26 Jan 2022 16:26:47 +0800
> +Subject: [PATCH] Fix path parameter passing error of set_psplash_pipe function
> +
> +---
> + 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 @@ def set_psplash_pipe(self, path):
> +         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):
> +         """
> 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..bf17a7d1
> --- /dev/null
> +++ b/meta-isar/recipes-installer/bmap-tools/files/0002-Fix-_psplash_pipe-part-was-skipped-when-_progress_fi.patch
> @@ -0,0 +1,78 @@
> +From 163a49259d025e220e9de4fc2a6296c2c3053500 Mon Sep 17 00:00:00 2001
> +From: Jason <zxcv1884@gmail.com>
> +Date: Mon, 7 Feb 2022 17:55:16 +0800
> +Subject: [PATCH] Fix _psplash_pipe part was skipped when _progress_file is
> + null
> +
> +---
> + 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 @@ def _update_progress(self, blocks_written):
> +         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
> 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"

Missed that so far: This should be limited to Debian versions what it is
needed and where it fits. Definitely excludes anything > bookworm. Best
would be opt-in here.

Jan

>  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 \

-- 
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/1c9611b3-7e67-4079-86b6-543d3125b17f%40siemens.com.

  reply	other threads:[~2025-03-13  9:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <rBT7pjX7j20>
2025-03-12  6:50 ` [PATCH v2] " 'Kasturi Shekar' via isar-users
2025-03-12  6:51   ` 'Shekar, Kasturi' via isar-users
2025-03-12  7:35     ` 'Jan Kiszka' via isar-users
2025-03-12  9:07 ` [PATCH v3] " 'Kasturi Shekar' via isar-users
2025-03-13  9:58   ` 'Jan Kiszka' via isar-users [this message]
2025-03-14  6:58     ` 'Shekar, Kasturi' via isar-users
2025-03-14  7:01       ` 'Jan Kiszka' via isar-users
2025-03-27 10:32   ` Uladzimir Bely

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=1c9611b3-7e67-4079-86b6-543d3125b17f@siemens.com \
    --to=isar-users@googlegroups.com \
    --cc=jan.kiszka@siemens.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