[PATCH] sbuild: Replace getpid with task hash

4 views
Skip to first unread message

Anton Mikanovich

unread,
Jun 17, 2024, 10:04:22 AMJun 17
to isar-...@googlegroups.com, Anton Mikanovich, Jan Kiszka
To be sure there are no issues with SBUILD_CHROOT value generation
caused by inline getpid execution use BB_TASKHASH instead.
This variable holds the hash of the task filled by Bitbake and should
have the same level of uniqueness as pid inside one build.

This change may help to fix sporadic sbuild session mismatch issue.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>
Signed-off-by: Anton Mikanovich <ami...@ilbers.de>
---
meta/classes/sbuild.bbclass | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/classes/sbuild.bbclass b/meta/classes/sbuild.bbclass
index f1193c20..3f27a2ef 100644
--- a/meta/classes/sbuild.bbclass
+++ b/meta/classes/sbuild.bbclass
@@ -7,7 +7,7 @@ SCHROOT_MOUNTS ?= ""

inherit crossvars

-SBUILD_CHROOT ?= "${DEBDISTRONAME}-${SCHROOT_USER}-${ISAR_BUILD_UUID}-${@os.getpid()}"
+SBUILD_CHROOT ?= "${DEBDISTRONAME}-${SCHROOT_USER}-${ISAR_BUILD_UUID}-${BB_TASKHASH}"

SBUILD_CONF_DIR ?= "${SCHROOT_CONF}/${SBUILD_CHROOT}"
SCHROOT_CONF_FILE ?= "${SCHROOT_CONF}/chroot.d/${SBUILD_CHROOT}"
--
2.34.1

Jan Kiszka

unread,
Jun 17, 2024, 10:44:40 AMJun 17
to Anton Mikanovich, isar-...@googlegroups.com
On 17.06.24 16:04, Anton Mikanovich wrote:
> To be sure there are no issues with SBUILD_CHROOT value generation
> caused by inline getpid execution use BB_TASKHASH instead.
> This variable holds the hash of the task filled by Bitbake and should
> have the same level of uniqueness as pid inside one build.
>
> This change may help to fix sporadic sbuild session mismatch issue.
>
> Signed-off-by: Jan Kiszka <jan.k...@siemens.com>

Suggested-by? If you rather want me as author, there has to be a "From:
..." line at the top.

> Signed-off-by: Anton Mikanovich <ami...@ilbers.de>
> ---
> meta/classes/sbuild.bbclass | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/meta/classes/sbuild.bbclass b/meta/classes/sbuild.bbclass
> index f1193c20..3f27a2ef 100644
> --- a/meta/classes/sbuild.bbclass
> +++ b/meta/classes/sbuild.bbclass
> @@ -7,7 +7,7 @@ SCHROOT_MOUNTS ?= ""
>
> inherit crossvars
>
> -SBUILD_CHROOT ?= "${DEBDISTRONAME}-${SCHROOT_USER}-${ISAR_BUILD_UUID}-${@os.getpid()}"
> +SBUILD_CHROOT ?= "${DEBDISTRONAME}-${SCHROOT_USER}-${ISAR_BUILD_UUID}-${BB_TASKHASH}"
>
> SBUILD_CONF_DIR ?= "${SCHROOT_CONF}/${SBUILD_CHROOT}"
> SCHROOT_CONF_FILE ?= "${SCHROOT_CONF}/chroot.d/${SBUILD_CHROOT}"

--
Siemens AG, Technology
Linux Expert Center

Anton Mikanovich

unread,
Jun 18, 2024, 3:37:12 AMJun 18
to isar-...@googlegroups.com, Anton Mikanovich, Jan Kiszka
To be sure there are no issues with SBUILD_CHROOT value generation
caused by inline getpid execution use BB_TASKHASH instead.
This variable holds the hash of the task filled by Bitbake and should
have the same level of uniqueness as pid inside one build.

This change may help to fix sporadic sbuild session mismatch issue.

Suggested-by: Jan Kiszka <jan.k...@siemens.com>
Signed-off-by: Anton Mikanovich <ami...@ilbers.de>
---
meta/classes/sbuild.bbclass | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/classes/sbuild.bbclass b/meta/classes/sbuild.bbclass
index f1193c20..3f27a2ef 100644
--- a/meta/classes/sbuild.bbclass
+++ b/meta/classes/sbuild.bbclass
@@ -7,7 +7,7 @@ SCHROOT_MOUNTS ?= ""

inherit crossvars

-SBUILD_CHROOT ?= "${DEBDISTRONAME}-${SCHROOT_USER}-${ISAR_BUILD_UUID}-${@os.getpid()}"
+SBUILD_CHROOT ?= "${DEBDISTRONAME}-${SCHROOT_USER}-${ISAR_BUILD_UUID}-${BB_TASKHASH}"

SBUILD_CONF_DIR ?= "${SCHROOT_CONF}/${SBUILD_CHROOT}"
SCHROOT_CONF_FILE ?= "${SCHROOT_CONF}/chroot.d/${SBUILD_CHROOT}"
--
2.34.1

Reply all
Reply to author
Forward
0 new messages