public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: vijaikumar.kanagarajan@gmail.com
To: isar-users@googlegroups.com, jan.kiszka@siemens.com,
	henning.schild@siemens.com
Cc: Vijai Kumar K <Vijaikumar_Kanagarajan@mentor.com>
Subject: [PATCH v3 1/2] meta: Add support for FILESEXTRAPATHS
Date: Thu, 17 Oct 2019 14:58:55 +0530	[thread overview]
Message-ID: <20191017092856.27064-2-Vijaikumar_Kangarajan@mentor.com> (raw)
In-Reply-To: <20191017092856.27064-1-Vijaikumar_Kangarajan@mentor.com>

From: Vijai Kumar K <Vijaikumar_Kanagarajan@mentor.com>

OE-core provides FILESEXTRAPATHS to extend the search path for
files and patches. This is particularly useful when you want to
add more files or replace existing files using bbappend.

Bring in support for FILESEXTRAPATHS from OE-core.

Signed-off-by: Vijai Kumar K <Vijaikumar_Kanagarajan@mentor.com>
---
 RECIPE-API-CHANGELOG.md   | 10 ++++++++++
 doc/user_manual.md        |  2 ++
 meta/classes/base.bbclass | 19 +++++++++++++++++++
 meta/conf/bitbake.conf    |  3 ++-
 4 files changed, 33 insertions(+), 1 deletion(-)

diff --git a/RECIPE-API-CHANGELOG.md b/RECIPE-API-CHANGELOG.md
index bbef1a3..e9072d7 100644
--- a/RECIPE-API-CHANGELOG.md
+++ b/RECIPE-API-CHANGELOG.md
@@ -176,3 +176,13 @@ Otherwise set a encrypted root password like this:
 USERS += "root"
 USER_root[password] = "$6$rounds=10000$RXeWrnFmkY$DtuS/OmsAS2cCEDo0BF5qQsizIrq6jPgXnwv3PHqREJeKd1sXdHX/ayQtuQWVDHe0KIO0/sVH8dvQm1KthF0d/"
 ```
+### Use FILESEXTRAPATHS to add custom paths to FILESPATH
+
+Direct modification of FILESPATH variable is discouraged. Use FILESEXTRAPATHS
+instead to add a custom search path for files and patches. This makes overriding
+files and patches using bbappend a lot easier.
+
+For example:
+```
+FILESEXTRAPATHS_prepend := "$THISDIR/files:"
+```
diff --git a/doc/user_manual.md b/doc/user_manual.md
index c2657da..e096c24 100644
--- a/doc/user_manual.md
+++ b/doc/user_manual.md
@@ -321,6 +321,8 @@ Some other variables include:
  - `HOST_DISTRO_BOOTSTRAP_KEYS` - Analogously to DISTRO_BOOTSTRAP_KEYS: List of gpg key URIs used to verify apt bootstrap repo for the host.
  - `DISTRO_APT_PREMIRRORS` - The preferred mirror (append it to the default URI in the format `ftp.debian.org my.preferred.mirror`. This variable is optional.
  - `THIRD_PARTY_APT_KEYS` - List of gpg key URIs used to verify apt repos for apt installation after bootstrapping
+ - `FILESEXTRAPATHS` - The default directories BitBake uses when it processes recipes are initially defined by the FILESPATH variable. You can extend FILESPATH variable by using FILESEXTRAPATHS.
+ - `FILESOVERRIDES` - A subset of OVERRIDES used by the build system for creating FILESPATH. The FILESOVERRIDES variable uses overrides to automatically extend the FILESPATH variable.
 
 ---
 
diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
index 8c7b021..0670430 100644
--- a/meta/classes/base.bbclass
+++ b/meta/classes/base.bbclass
@@ -19,6 +19,7 @@
 # OTHER DEALINGS IN THE SOFTWARE.
 
 THISDIR = "${@os.path.dirname(d.getVar('FILE', True))}"
+FILESPATH = "${@base_set_filespath(["${FILE_DIRNAME}/${PF}","${FILE_DIRNAME}/${P}:${FILE_DIRNAME}/${PN}", "${FILE_DIRNAME}/files","${FILE_DIRNAME}"], d)}"
 
 def get_deb_host_arch():
     import subprocess
@@ -222,3 +223,21 @@ python do_cleanall() {
     except bb.fetch2.BBFetchException as e:
         bb.fatal(str(e))
 }
+
+# Derived from OpenEmbedded Core: meta/classes/utils.bbclass
+def base_set_filespath(path, d):
+    filespath = []
+    extrapaths = (d.getVar("FILESEXTRAPATHS") or "")
+    # Remove default flag which was used for checking
+    extrapaths = extrapaths.replace("__default:", "")
+    # Don't prepend empty strings to the path list
+    if extrapaths != "":
+        path = extrapaths.split(":") + path
+    # The ":" ensures we have an 'empty' override
+    overrides = (":" + (d.getVar("FILESOVERRIDES") or "")).split(":")
+    overrides.reverse()
+    for o in overrides:
+        for p in path:
+            if p != "":
+                filespath.append(os.path.join(p, o))
+    return ":".join(filespath)
diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
index bca1114..1f20c98 100644
--- a/meta/conf/bitbake.conf
+++ b/meta/conf/bitbake.conf
@@ -23,8 +23,8 @@ B = "${S}"
 CVSDIR = "${DL_DIR}/cvs"
 DEPENDS = ""
 DEPLOY_DIR = "${TMPDIR}/deploy"
-FILESPATH = "${FILE_DIRNAME}/${PF}:${FILE_DIRNAME}/${P}:${FILE_DIRNAME}/${PN}:${FILE_DIRNAME}/files:${FILE_DIRNAME}"
 FILE_DIRNAME = "${@os.path.dirname(d.getVar('FILE', False))}"
+FILESEXTRAPATHS ?= "__default:"
 GITDIR = "${DL_DIR}/git"
 P = "${PN}-${PV}"
 PF = "${PN}-${PV}-${PR}"
@@ -58,6 +58,7 @@ SDKCHROOT_DIR = "${DEPLOY_DIR_SDKCHROOT}/${DISTRO}-${DISTRO_ARCH}"
 CACHE = "${TMPDIR}/cache"
 
 OVERRIDES = "${DISTRO_ARCH}:${MACHINE}:${DISTRO}:forcevariable"
+FILESOVERRIDES = "${DISTRO_ARCH}:${MACHINE}"
 
 # Setting default QEMU_ARCH variables for different DISTRO_ARCH:
 QEMU_ARCH_amd64 = "x86_64"
-- 
2.17.1


  reply	other threads:[~2019-10-17  9:29 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <0191015094118.GA15374@lightning>
2019-10-16 14:37 ` [PATCH v2 0/2] FILESEXTRAPATHS vijaikumar.kanagarajan
2019-10-16 14:37   ` [PATCH v2 1/2] meta: Add support for FILESEXTRAPATHS vijaikumar.kanagarajan
2019-10-16 14:37   ` [PATCH v2 2/2] Replace FILESPATH with FILESEXTRAPATHS vijaikumar.kanagarajan
2019-10-16 17:05   ` [PATCH v2 0/2] FILESEXTRAPATHS Henning Schild
2019-10-17  9:17     ` Vijai Kumar K
2019-10-17  9:28     ` [PATCH v3 " vijaikumar.kanagarajan
2019-10-17  9:28       ` vijaikumar.kanagarajan [this message]
2019-10-17  9:28       ` [PATCH v3 2/2] Replace FILESPATH with FILESEXTRAPATHS vijaikumar.kanagarajan
2019-10-25 12:49       ` [PATCH v3 0/2] FILESEXTRAPATHS Baurzhan Ismagulov
2019-10-25 13:22         ` Henning Schild
2019-10-25 14:12           ` Baurzhan Ismagulov
2019-10-25 17:17             ` Jan Kiszka
2019-11-04 19:41               ` Baurzhan Ismagulov
2019-11-04 19:45       ` Baurzhan Ismagulov
2019-11-05 16:08         ` Henning Schild
2019-11-05 16:18           ` vijai kumar
2019-11-05 17:07             ` Jan Kiszka
2019-11-05 17:36               ` vijai kumar

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=20191017092856.27064-2-Vijaikumar_Kangarajan@mentor.com \
    --to=vijaikumar.kanagarajan@gmail.com \
    --cc=Vijaikumar_Kanagarajan@mentor.com \
    --cc=henning.schild@siemens.com \
    --cc=isar-users@googlegroups.com \
    --cc=jan.kiszka@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