All of lore.kernel.org
 help / color / mirror / Atom feed
From: Trevor Woerner <twoerner@gmail.com>
To: yocto-patches@lists.yoctoproject.org
Cc: Bruce Ashfield <bruce.ashfield@gmail.com>,
	Mark Hatle <mark.hatle@kernel.crashing.org>
Subject: [wic][PATCH 8/9] ksparser.py: search for *inc files
Date: Fri,  3 Apr 2026 14:36:43 -0400	[thread overview]
Message-ID: <20260403183644.2783267-9-twoerner@gmail.com> (raw)
In-Reply-To: <20260403183644.2783267-1-twoerner@gmail.com>

If a *wks file has an "include" directive, try looking for the include
file at the path where the *wks file was found.

NOTE: this commit does not work as-is, but is being provided in order to
      explicitly show a clean transition from oe-core

AI-Generated: codex/gpt-5.4 (high)
Reviewed-by: Bruce Ashfield <bruce.ashfield@gmail.com>
Reviewed-by: Mark Hatle <mark.hatle@kernel.crashing.org>
Signed-off-by: Trevor Woerner <twoerner@gmail.com>
---
 src/wic/ksparser.py | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/src/wic/ksparser.py b/src/wic/ksparser.py
index 4ccd70dc555a..8e5fbfadd81f 100644
--- a/src/wic/ksparser.py
+++ b/src/wic/ksparser.py
@@ -101,6 +101,15 @@ def overheadtype(arg):
 
     return result
 
+def resolve_canned_path(arg, current_confpath=None):
+    if current_confpath:
+        current_dir = os.path.dirname(os.path.abspath(current_confpath))
+        relative_path = os.path.join(current_dir, arg)
+        if os.path.exists(relative_path):
+            return relative_path
+
+    return None
+
 def cannedpathtype(arg):
     """
     Custom type for ArgumentParser
@@ -202,7 +211,7 @@ class KickStart():
         bootloader.add_argument('--source')
 
         include = subparsers.add_parser('include')
-        include.add_argument('path', type=cannedpathtype)
+        include.add_argument('path')
 
         self._parse(parser, confpath)
         if not self.bootloader:
@@ -289,7 +298,12 @@ class KickStart():
                         self.partnum += 1
                         self.partitions.append(Partition(parsed, self.partnum))
                     elif line.startswith('include'):
-                        self._parse(parser, parsed.path)
+                        include_path = resolve_canned_path(parsed.path, confpath)
+                        if not include_path:
+                            err = "%s:%d: argument path: file not found: %s" % \
+                                  (confpath, lineno, parsed.path)
+                            raise KickStartError(err)
+                        self._parse(parser, include_path)
                     elif line.startswith('bootloader'):
                         if not self.bootloader:
                             self.bootloader = parsed
-- 
2.51.0



  parent reply	other threads:[~2026-04-03 18:37 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-03 18:36 [wic][PATCH 0/9] standalone wic repository Trevor Woerner
2026-04-03 18:36 ` [wic][PATCH 1/9] re-organize for python src layout packaging Trevor Woerner
2026-04-03 18:36 ` [wic][PATCH 2/9] move example *wks files Trevor Woerner
2026-04-03 18:36 ` [wic][PATCH 3/9] create python hatch project Trevor Woerner
2026-04-03 18:36 ` [wic][PATCH 4/9] add oe-core and bitbake helper packages Trevor Woerner
2026-04-03 18:36 ` [wic][PATCH 5/9] bump version: 0.2.0 -> 0.3.0 Trevor Woerner
2026-04-03 18:36 ` [wic][PATCH 6/9] cli.py: remove bitbake coupling Trevor Woerner
2026-04-03 18:36 ` [wic][PATCH 7/9] plugins/source/bootimg_biosplusefi.py: add import os Trevor Woerner
2026-04-03 18:36 ` Trevor Woerner [this message]
2026-04-03 18:36 ` [wic][PATCH 9/9] cli.py: fix main() for standalone mode Trevor Woerner

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=20260403183644.2783267-9-twoerner@gmail.com \
    --to=twoerner@gmail.com \
    --cc=bruce.ashfield@gmail.com \
    --cc=mark.hatle@kernel.crashing.org \
    --cc=yocto-patches@lists.yoctoproject.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.