public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: isar-users <isar-users@googlegroups.com>
Subject: [PATCH 04/10] meta: Add bbclass to retrieve selected WKS file
Date: Mon,  8 Oct 2018 13:01:08 +0200	[thread overview]
Message-ID: <9b53505c786d87a28cbe4238d1f0ae97f25e92f2.1538996473.git.jan.kiszka@siemens.com> (raw)
In-Reply-To: <cover.1538996473.git.jan.kiszka@siemens.com>
In-Reply-To: <cover.1538996473.git.jan.kiszka@siemens.com>

From: Jan Kiszka <jan.kiszka@siemens.com>

This implements a lookup service for the target's WKS_FILE. The goal is
to concentrate the search in a single place in order to provide a
consistent logic.

In addition to permitting absolute paths, get_wks_full_path() implements
almost all search paths of OE:

 - <BBPATH>/wic
 - <BBPATH>/scripts/lib/wic/canned-wks
 - <COREBASE>/scripts/lib/wic/canned-wks

It does not support THISDIR for wic-image recipes because that would
restrict the visibility of that file to a single recipe while we would
like to use it freely, also in other recipes such as u-boot-script.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 meta/classes/wks-file.bbclass | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
 create mode 100644 meta/classes/wks-file.bbclass

diff --git a/meta/classes/wks-file.bbclass b/meta/classes/wks-file.bbclass
new file mode 100644
index 0000000..493fea7
--- /dev/null
+++ b/meta/classes/wks-file.bbclass
@@ -0,0 +1,30 @@
+# This software is a part of ISAR.
+# Copyright (C) 2018 Siemens AG
+#
+# SPDX-License-Identifier: MIT
+
+def get_wks_full_path(d):
+    if (d.getVar('IMAGE_TYPE', True) or '') != 'wic-img':
+        return ""
+
+    wks_full_path = None
+
+    wks_file = d.getVar('WKS_FILE', True)
+    if not wks_file.endswith('.wks'):
+        wks_file += '.wks'
+
+    if os.path.isabs(wks_file):
+        if os.path.exists(wks_file):
+            wks_full_path = wks_file
+    else:
+        bbpaths = d.getVar('BBPATH', True).split(':')
+        corebase = d.getVar('COREBASE', True)
+        search_path = ':'.join('%s/wic' % p for p in bbpaths) + ':' + \
+            ':'.join('%s/scripts/lib/wic/canned-wks' % l \
+                     for l in (bbpaths + [corebase]))
+        wks_full_path = bb.utils.which(search_path, wks_file)
+
+    if not wks_full_path:
+        bb.fatal("WKS_FILE '%s' not found" % wks_file)
+
+    return wks_full_path
-- 
2.16.4


  parent reply	other threads:[~2018-10-08 11:01 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-08 11:01 [PATCH 00/10] Pending queue: various fixes, improve rebuilds on dependency changes Jan Kiszka
2018-10-08 11:01 ` [PATCH 01/10] u-boot-custom: Fix parallel build Jan Kiszka
2018-10-08 11:01 ` [PATCH 02/10] u-boot-custom: Fix comment Jan Kiszka
2018-10-08 11:01 ` [PATCH 03/10] u-boot-custom: Allow to extend or replace U-Boot build dependencies Jan Kiszka
2018-10-08 11:01 ` Jan Kiszka [this message]
2018-10-08 11:01 ` [PATCH 05/10] u-boot-script: Switch to wks-file class for WKS_FILE search Jan Kiszka
2018-10-13  6:05   ` chombourger
2018-10-13 13:53     ` Jan Kiszka
2018-10-13 14:49       ` Cedric Hombourger
2018-10-08 11:01 ` [PATCH 06/10] wic-img: Use wks-file class for WKS_FILE lookup Jan Kiszka
2018-10-08 11:01 ` [PATCH 07/10] wic-img: Add WKS_FILE to wic_image task checksum Jan Kiszka
2018-10-08 11:01 ` [PATCH 08/10] base: Improve detection of dependency changes Jan Kiszka
2018-10-08 11:01 ` [PATCH 09/10] linux-custom: Fix typo in KERNEL_NAME_PROVIDED variable Jan Kiszka
2018-10-08 11:01 ` [PATCH 10/10] wic-img: Fix image copy-out in do_wic_image Jan Kiszka
2018-10-10 13:27 ` [PATCH 00/10] Pending queue: various fixes, improve rebuilds on dependency changes Maxim Yu. Osipov

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=9b53505c786d87a28cbe4238d1f0ae97f25e92f2.1538996473.git.jan.kiszka@siemens.com \
    --to=jan.kiszka@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