public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: chris.larson@siemens.com
To: isar-users@googlegroups.com
Cc: Christopher Larson <chris.larson@siemens.com>
Subject: [PATCH 5/9] isar-sstate: add --excluded-tasks argument
Date: Fri,  5 Apr 2024 16:31:31 +0000	[thread overview]
Message-ID: <20240405163135.2987489-6-chris.larson@siemens.com> (raw)
In-Reply-To: <20240405163135.2987489-1-chris.larson@siemens.com>

From: Christopher Larson <chris.larson@siemens.com>

This allows the user to override the default lists of tasks to ignore
when linting the sstate cache.

Submitted at https://groups.google.com/g/isar-users/c/2NB-PXyswq8/m/Ca1TO65TAQAJ.

Signed-off-by: Christopher Larson <chris.larson@siemens.com>
---
 scripts/isar-sstate | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/scripts/isar-sstate b/scripts/isar-sstate
index d68b8938..a4429b7a 100755
--- a/scripts/isar-sstate
+++ b/scripts/isar-sstate
@@ -128,6 +128,7 @@ apt-get install python3-botocore
 import argparse
 from collections import namedtuple
 import datetime
+from fnmatch import fnmatchcase
 import os
 import re
 import shutil
@@ -154,6 +155,8 @@ try:
 except ModuleNotFoundError:
     s3_supported = False
 
+DEFAULT_IGNORED_TASKS = "rootfs_wicenv,image_wic"
+
 SstateCacheEntry = namedtuple(
         'SstateCacheEntry', 'hash path arch pn task suffix islink age size'.split())
 
@@ -614,6 +617,9 @@ def arguments():
     parser.add_argument(
         '--lint-stamps', default=False, action='store_true',
         help="lint: assume target is a stamps directory (target must be a local path)")
+    parser.add_argument(
+        '--excluded-tasks', type=str, default=DEFAULT_IGNORED_TASKS,
+        help="lint: comma-separated list of tasks to ignore (default: %(default)s)")
 
     args = parser.parse_args()
     if args.command in 'upload analyze'.split() and args.source is None:
@@ -622,6 +628,7 @@ def arguments():
     elif args.command in 'info clean'.split() and args.source is not None:
         print(f"ERROR: '{args.command}' must not have a source (only a target)")
         sys.exit(1)
+    args.excluded_tasks = args.excluded_tasks.split(',')
     return args
 
 
@@ -820,13 +827,14 @@ def sstate_analyze(source, target, **kwargs):
             print('\n'.join(out))
 
 
-def sstate_lint(target, verbose, sources_dir, build_dir, exit_code, pedantic, lint_stamps, **kwargs):
+def sstate_lint(target, verbose, sources_dir, build_dir, exit_code, pedantic, lint_stamps,
+                excluded_tasks, **kwargs):
     ADDITIONAL_IGNORED_VARNAMES = 'PP'.split()
     # only list non-cacheable tasks here
     # note that these still can break caching of other tasks that depend on these.
     # Run in pedantic mode to also look for these issues (e.g. in image-in-image builds)
     # To make a build fully cacheable, avoid absolute paths in BBLAYERS
-    ADDITIONAL_IGNORED_TASKS = list() if pedantic else 'rootfs_wicenv image_wic'.split()
+    ADDITIONAL_IGNORED_TASKS = list() if pedantic else excluded_tasks
     if not target.exists():
         print(f"WARNING: target {target} does not exist. Nothing to analyze.")
         return 0
@@ -840,7 +848,7 @@ def sstate_lint(target, verbose, sources_dir, build_dir, exit_code, pedantic, li
     hits_builddir = 0
     hits_other = 0
     for sig in cache_sigs.values():
-        if sig.task in ADDITIONAL_IGNORED_TASKS:
+        if any(fnmatchcase(sig.task, pattern) for pattern in ADDITIONAL_IGNORED_TASKS):
             continue
 
         sig_file = target.download(sig.path)
-- 
2.39.2


  parent reply	other threads:[~2024-04-05 16:32 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-05 16:31 [PATCHv2 0/9] Add more signature cachability tests to the testsuite chris.larson
2024-04-05 16:31 ` [PATCH 1/9] isar-bootstrap: avoid forced early expansion of key vars chris.larson
2024-04-05 16:33   ` Larson, Chris
2024-04-05 16:31 ` [PATCH 2/9] isar-ci-ssh-setup: avoid abs path in signatures chris.larson
2024-04-05 16:31 ` [PATCH 3/9] isar-sstate: lint: check for absolute paths in SRC_URI chris.larson
2024-04-05 16:31 ` [PATCH 4/9] isar-sstate: lint: add support for checking stamps chris.larson
2024-04-05 16:31 ` chris.larson [this message]
2024-04-05 16:31 ` [PATCH 6/9] isar-sstate: fix failures if a variable is set to just whitespace chris.larson
2024-04-05 16:31 ` [PATCH 7/9] cibuilder.py: add -S support to the bitbake method chris.larson
2024-04-05 16:31 ` [PATCH 8/9] testsuite: add perform_signature_lint method chris.larson
2024-04-05 16:31 ` [PATCH 9/9] testsuite: add signature cachability checks chris.larson
2024-04-11 16:10 ` [PATCHv2 0/9] Add more signature cachability tests to the testsuite Larson, Chris
2024-04-14 12:39 ` MOESSBAUER, Felix
2024-04-15  9:27 ` 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=20240405163135.2987489-6-chris.larson@siemens.com \
    --to=chris.larson@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