public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Anton Mikanovich <amikan@ilbers.de>
To: isar-users@googlegroups.com
Cc: adriaan.schmidt@siemens.com, Anton Mikanovich <amikan@ilbers.de>
Subject: [PATCH 2/6] base: Implement bitbake build ID
Date: Sat, 14 May 2022 10:07:32 +0300	[thread overview]
Message-ID: <20220514070736.12997-3-amikan@ilbers.de> (raw)
In-Reply-To: <20220514070736.12997-1-amikan@ilbers.de>

Add internal ID which is unique for any single bitabake run.
BITBAKE_BUILD_ID is calculated as a hash of two variables defined by
bitbake itself at build start:
BUILDNAME - defined as "${DATE}${TIME}" of cooker execution.
TOPDIR - build dir where Isar is building.
Both of them guarantee uniqueness by time and directory.

Signed-off-by: Anton Mikanovich <amikan@ilbers.de>
---
 meta/classes/base.bbclass | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
index 4ec2c81..f6b6a32 100644
--- a/meta/classes/base.bbclass
+++ b/meta/classes/base.bbclass
@@ -278,3 +278,12 @@ def base_set_filespath(path, d):
             if p != "":
                 filespath.append(os.path.join(p, o))
     return ":".join(filespath)
+
+calculate_build_id[vardepsexclude] = "BUILDNAME"
+def calculate_build_id(d):
+    import hashlib
+    build_name = d.getVar("BUILDNAME", True) or ""
+    build_dir = d.getVar("TOPDIR", True) or ""
+    return hashlib.sha1((build_dir + build_name).encode("utf-8")).hexdigest()
+
+BITBAKE_BUILD_ID = "${@ calculate_build_id(d)}"
-- 
2.17.1


  parent reply	other threads:[~2022-05-14  7:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-14  7:07 [PATCH 0/6] Imager schroot migration Anton Mikanovich
2022-05-14  7:07 ` [PATCH 1/6] sbuild: Allow setting custom config paths Anton Mikanovich
2022-05-14  7:07 ` Anton Mikanovich [this message]
2022-05-14  7:07 ` [PATCH 3/6] imager: Migrate from buildchroot to schroot Anton Mikanovich
2022-05-14  7:07 ` [PATCH 4/6] imager: Move image types " Anton Mikanovich
2022-05-14  7:07 ` [PATCH 5/6] events: Cleanup lost schroot sessions if any Anton Mikanovich
2022-05-14  7:07 ` [PATCH 6/6] meta: Remove buildchroot Anton Mikanovich

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=20220514070736.12997-3-amikan@ilbers.de \
    --to=amikan@ilbers.de \
    --cc=adriaan.schmidt@siemens.com \
    --cc=isar-users@googlegroups.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