public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: "'Felix Moessbauer' via isar-users" <isar-users@googlegroups.com>
To: isar-users@googlegroups.com
Cc: adriaan.schmidt@siemens.com,
	Felix Moessbauer <felix.moessbauer@siemens.com>
Subject: [PATCH 1/3] isar-sstate: add helpers to read signature data
Date: Mon, 21 Sep 2026 17:06:32 +0200	[thread overview]
Message-ID: <20260921150634.972641-2-felix.moessbauer@siemens.com> (raw)
In-Reply-To: <20260921150634.972641-1-felix.moessbauer@siemens.com>

The lint command reads and decodes the signature data inline. Upcoming
commands need the same data, so move the reading into a load_sigdata
helper and add get_distro on top of it, which extracts the DISTRO a
signature was generated for.

Next to deduplicating the code, this also releases the downloaded file
in case it cannot be decoded, which previously leaked a temporary file
on the http and s3 backends.

Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
---
 scripts/isar-sstate | 30 ++++++++++++++++++++++--------
 1 file changed, 22 insertions(+), 8 deletions(-)

diff --git a/scripts/isar-sstate b/scripts/isar-sstate
index ada154e2..b5eaabaa 100755
--- a/scripts/isar-sstate
+++ b/scripts/isar-sstate
@@ -592,6 +592,26 @@ def apply_filters(items, pn_filter=None, arch=None):
     return items
 
 
+def load_sigdata(target, path):
+    sig_file = target.download(path)
+    try:
+        with bb.compress.zstd.open(sig_file, "rt", encoding="utf-8", num_threads=1) as f:
+            sigdata = json.load(f, object_hook=bb.siggen.SetDecoder)
+        bb.siggen.handle_renames(sigdata)
+        return sigdata
+    except:
+        # invalid file or format, ignore to continue processing
+        return None
+    finally:
+        target.release(sig_file)
+
+
+def get_distro(target, path):
+    # only tasks that depend on DISTRO carry it in their signature
+    sigdata = load_sigdata(target, path)
+    return sigdata['varvals'].get('DISTRO') if sigdata else None
+
+
 def arguments():
     parser = argparse.ArgumentParser()
     parser.add_argument(
@@ -883,13 +903,8 @@ def sstate_lint(target, verbose, sources_dir, build_dir, exit_code, pedantic, li
         if any(fnmatchcase(sig.task, pattern) for pattern in ADDITIONAL_IGNORED_TASKS):
             continue
 
-        sig_file = target.download(sig.path)
-        try:
-            with bb.compress.zstd.open(sig_file, "rt", encoding="utf-8", num_threads=1) as f:
-                sigdata = json.load(f, object_hook=bb.siggen.SetDecoder)
-            bb.siggen.handle_renames(sigdata)
-        except:
-            # invalid file or format... never mind
+        sigdata = load_sigdata(target, sig.path)
+        if sigdata is None:
             continue
 
         pn_issues = []
@@ -937,7 +952,6 @@ def sstate_lint(target, verbose, sources_dir, build_dir, exit_code, pedantic, li
         if len(pn_issues) > 0:
             print(f"\033[1;33m==== issues found in {sig.arch}:{sig.pn}:{sig.task} ({sig.hash[:8]}) ====\033[0m")
             print('\n'.join(pn_issues))
-        target.release(sig_file)
 
     sum_hits = hits_srcdir + hits_builddir
     if sum_hits == 0:
-- 
2.55.0

-- 
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/20260921150634.972641-2-felix.moessbauer%40siemens.com.

  reply	other threads:[~2026-09-21 15:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-21 15:06 [PATCH 0/3] isar-sstate: improve cache debugging capabilities 'Felix Moessbauer' via isar-users
2026-09-21 15:06 ` 'Felix Moessbauer' via isar-users [this message]
2026-09-21 15:06 ` [PATCH 2/3] isar-sstate: add show command to list all artifacts of a PN 'Felix Moessbauer' via isar-users
2026-09-21 15:06 ` [PATCH 3/3] isar-sstate: add delta command to compare artifact with others 'Felix Moessbauer' via isar-users
2026-09-24  6:55 ` [PATCH 0/3] isar-sstate: improve cache debugging capabilities Zhihang Wei

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=20260921150634.972641-2-felix.moessbauer@siemens.com \
    --to=isar-users@googlegroups.com \
    --cc=adriaan.schmidt@siemens.com \
    --cc=felix.moessbauer@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