Patchwork [1/1] add checking to standardize how .bbappend files do FILESEXTRAPATHS

login
register
mail settings
Submitter Hongxu Jia
Date July 21, 2014, 5:34 a.m.
Message ID <24a0f777e3517a0365315cc1d311ba9d686c80a2.1405917574.git.hongxu.jia@windriver.com>
Download mbox | patch
Permalink /patch/76157/
State New
Headers show

Comments

Hongxu Jia - July 21, 2014, 5:34 a.m.
When adding patches or config files from bbappend files, it requires
the use of FILESEXTRAPATHS, which has been an issue and failure point
for people starting to work with bitbake and oe-core.

We add checking to standardize how to use FILESEXTRAPATHS. Only the
format of:
  FILESEXTRAPATHS_append := ${THISDIR}/Your_Files_Path or
  FILESEXTRAPATHS_prepend := ${THISDIR}/Your_Files_Path
is acceptable.

[YOCTO #5412]

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
---
 meta/classes/base.bbclass                  |  1 +
 meta/classes/filesextrapaths_check.bbclass | 10 ++++++++++
 meta/classes/utils.bbclass                 |  2 ++
 meta/conf/bitbake.conf                     |  2 ++
 4 files changed, 15 insertions(+)
 create mode 100644 meta/classes/filesextrapaths_check.bbclass
Hongxu Jia - July 21, 2014, 6:03 a.m.
I think it is more reasonable to move the checking to insance.bbclass
  rather than create a new bbclass.

Please drop this, V2 incoming.

//Hongxu


On 07/21/2014 01:34 PM, Hongxu Jia wrote:
> When adding patches or config files from bbappend files, it requires
> the use of FILESEXTRAPATHS, which has been an issue and failure point
> for people starting to work with bitbake and oe-core.
>
> We add checking to standardize how to use FILESEXTRAPATHS. Only the
> format of:
>    FILESEXTRAPATHS_append := ${THISDIR}/Your_Files_Path or
>    FILESEXTRAPATHS_prepend := ${THISDIR}/Your_Files_Path
> is acceptable.
>
> [YOCTO #5412]
>
> Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
> ---
>   meta/classes/base.bbclass                  |  1 +
>   meta/classes/filesextrapaths_check.bbclass | 10 ++++++++++
>   meta/classes/utils.bbclass                 |  2 ++
>   meta/conf/bitbake.conf                     |  2 ++
>   4 files changed, 15 insertions(+)
>   create mode 100644 meta/classes/filesextrapaths_check.bbclass
>
> diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
> index 8114cf6..be8400a 100644
> --- a/meta/classes/base.bbclass
> +++ b/meta/classes/base.bbclass
> @@ -9,6 +9,7 @@ inherit utils
>   inherit utility-tasks
>   inherit metadata_scm
>   inherit logging
> +inherit filesextrapaths_check
>   
>   OE_IMPORTS += "os sys time oe.path oe.utils oe.data oe.package oe.packagegroup oe.sstatesig oe.lsb oe.cachedpath"
>   OE_IMPORTS[type] = "list"
> diff --git a/meta/classes/filesextrapaths_check.bbclass b/meta/classes/filesextrapaths_check.bbclass
> new file mode 100644
> index 0000000..6863e0c
> --- /dev/null
> +++ b/meta/classes/filesextrapaths_check.bbclass
> @@ -0,0 +1,10 @@
> +python __anonymous() {
> +    # Checking ${FILESEXTRAPATHS}
> +    extrapaths = (d.getVar("FILESEXTRAPATHS", True) or "")
> +    if '__default' not in extrapaths.split(":"):
> +        msg =  "Please assign FILESEXTRAPATHS with the format of:\n"
> +        msg += "  FILESEXTRAPATHS_append := ${THISDIR}/Your_Files_Path or\n"
> +        msg += "  FILESEXTRAPATHS_prepend := ${THISDIR}/Your_Files_Path\n"
> +        msg += "in your bbappend file\n"
> +        bb.fatal(msg)
> +}
> diff --git a/meta/classes/utils.bbclass b/meta/classes/utils.bbclass
> index 0ee13e0..0f2a484 100644
> --- a/meta/classes/utils.bbclass
> +++ b/meta/classes/utils.bbclass
> @@ -312,6 +312,8 @@ def explode_deps(s):
>   def base_set_filespath(path, d):
>       filespath = []
>       extrapaths = (d.getVar("FILESEXTRAPATHS", True) 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
> diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
> index f4870d5..6a0cf7a 100644
> --- a/meta/conf/bitbake.conf
> +++ b/meta/conf/bitbake.conf
> @@ -311,6 +311,8 @@ FILES_${PN}-locale = "${datadir}/locale"
>   FILE_DIRNAME = "${@os.path.dirname(d.getVar('FILE'))}"
>   # FILESPATH is set in base.bbclass
>   #FILESPATH = "${FILE_DIRNAME}/${PF}:${FILE_DIRNAME}/${P}:${FILE_DIRNAME}/${PN}:${FILE_DIRNAME}/${BP}:${FILE_DIRNAME}/${BPN}:${FILE_DIRNAME}/files:${FILE_DIRNAME}"
> +# This default was only used for checking
> +FILESEXTRAPATHS ?= "__default:"
>   
>   ##################################################################
>   # General work and output directories for the build system.

Patch

diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
index 8114cf6..be8400a 100644
--- a/meta/classes/base.bbclass
+++ b/meta/classes/base.bbclass
@@ -9,6 +9,7 @@  inherit utils
 inherit utility-tasks
 inherit metadata_scm
 inherit logging
+inherit filesextrapaths_check
 
 OE_IMPORTS += "os sys time oe.path oe.utils oe.data oe.package oe.packagegroup oe.sstatesig oe.lsb oe.cachedpath"
 OE_IMPORTS[type] = "list"
diff --git a/meta/classes/filesextrapaths_check.bbclass b/meta/classes/filesextrapaths_check.bbclass
new file mode 100644
index 0000000..6863e0c
--- /dev/null
+++ b/meta/classes/filesextrapaths_check.bbclass
@@ -0,0 +1,10 @@ 
+python __anonymous() {
+    # Checking ${FILESEXTRAPATHS}
+    extrapaths = (d.getVar("FILESEXTRAPATHS", True) or "")
+    if '__default' not in extrapaths.split(":"):
+        msg =  "Please assign FILESEXTRAPATHS with the format of:\n"
+        msg += "  FILESEXTRAPATHS_append := ${THISDIR}/Your_Files_Path or\n"
+        msg += "  FILESEXTRAPATHS_prepend := ${THISDIR}/Your_Files_Path\n"
+        msg += "in your bbappend file\n"
+        bb.fatal(msg)
+}
diff --git a/meta/classes/utils.bbclass b/meta/classes/utils.bbclass
index 0ee13e0..0f2a484 100644
--- a/meta/classes/utils.bbclass
+++ b/meta/classes/utils.bbclass
@@ -312,6 +312,8 @@  def explode_deps(s):
 def base_set_filespath(path, d):
     filespath = []
     extrapaths = (d.getVar("FILESEXTRAPATHS", True) 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
diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
index f4870d5..6a0cf7a 100644
--- a/meta/conf/bitbake.conf
+++ b/meta/conf/bitbake.conf
@@ -311,6 +311,8 @@  FILES_${PN}-locale = "${datadir}/locale"
 FILE_DIRNAME = "${@os.path.dirname(d.getVar('FILE'))}"
 # FILESPATH is set in base.bbclass
 #FILESPATH = "${FILE_DIRNAME}/${PF}:${FILE_DIRNAME}/${P}:${FILE_DIRNAME}/${PN}:${FILE_DIRNAME}/${BP}:${FILE_DIRNAME}/${BPN}:${FILE_DIRNAME}/files:${FILE_DIRNAME}"
+# This default was only used for checking
+FILESEXTRAPATHS ?= "__default:"
 
 ##################################################################
 # General work and output directories for the build system.