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

login
register
mail settings
Submitter Hongxu Jia
Date July 23, 2014, 3:33 a.m.
Message ID <d36bfea1e3c7402098ff8913d473900c8b11eb71.1406085105.git.hongxu.jia@windriver.com>
Download mbox | patch
Permalink /patch/76451/
State Accepted
Commit 68bc4eb778764e4fa66dd6296ca2042e7a9ebf67
Headers show

Comments

Hongxu Jia - July 23, 2014, 3:33 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/insane.bbclass | 13 +++++++++++++
 meta/classes/utils.bbclass  |  2 ++
 meta/conf/bitbake.conf      |  2 ++
 3 files changed, 17 insertions(+)
Gary Thomas - July 25, 2014, 5:25 p.m.
On 2014-07-22 21:33, 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/insane.bbclass | 13 +++++++++++++
>   meta/classes/utils.bbclass  |  2 ++
>   meta/conf/bitbake.conf      |  2 ++
>   3 files changed, 17 insertions(+)
>
> diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass
> index b26216e..6b1c9ad 100644
> --- a/meta/classes/insane.bbclass
> +++ b/meta/classes/insane.bbclass
> @@ -1022,6 +1022,19 @@ python () {
>       # Check various variables
>       ###########################################################################
>
> +    # Checking ${FILESEXTRAPATHS}
> +    extrapaths = (d.getVar("FILESEXTRAPATHS", True) or "")
> +    if '__default' not in extrapaths.split(":"):
> +        msg = "FILESEXTRAPATHS-variable, must always use _prepend (or _append)\n"
> +        msg += "type of assignment, and don't forget the colon.\n"
> +        msg += "Please assign it 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\n"
> +        msg += "Your incorrect assignment is:\n"
> +        msg += "%s\n" % extrapaths
> +        bb.fatal(msg)

It sure would have been nice (even polite?) to make this a warning when first
added.  As is, it's going to break a lot of builds and it will be very tedious
to fix since the parser will die on the first one it finds :-(

> +
>       if d.getVar('do_stage', True) is not None:
>           bb.fatal("Legacy staging found for %s as it has a do_stage function. This will need conversion to a do_install or often simply removal to work with OE-core" % d.getVar("FILE", True))
>
> 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.
>
Richard Purdie - July 25, 2014, 6:35 p.m.
On Fri, 2014-07-25 at 11:25 -0600, Gary Thomas wrote:
> On 2014-07-22 21:33, 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/insane.bbclass | 13 +++++++++++++
> >   meta/classes/utils.bbclass  |  2 ++
> >   meta/conf/bitbake.conf      |  2 ++
> >   3 files changed, 17 insertions(+)
> >
> > diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass
> > index b26216e..6b1c9ad 100644
> > --- a/meta/classes/insane.bbclass
> > +++ b/meta/classes/insane.bbclass
> > @@ -1022,6 +1022,19 @@ python () {
> >       # Check various variables
> >       ###########################################################################
> >
> > +    # Checking ${FILESEXTRAPATHS}
> > +    extrapaths = (d.getVar("FILESEXTRAPATHS", True) or "")
> > +    if '__default' not in extrapaths.split(":"):
> > +        msg = "FILESEXTRAPATHS-variable, must always use _prepend (or _append)\n"
> > +        msg += "type of assignment, and don't forget the colon.\n"
> > +        msg += "Please assign it 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\n"
> > +        msg += "Your incorrect assignment is:\n"
> > +        msg += "%s\n" % extrapaths
> > +        bb.fatal(msg)
> 
> It sure would have been nice (even polite?) to make this a warning when first
> added.  As is, it's going to break a lot of builds and it will be very tedious
> to fix since the parser will die on the first one it finds :-(

Agreed, I'll change this to a warning.

Cheers,

Richard
Gary Thomas - July 25, 2014, 7:02 p.m.
On 2014-07-25 12:35, Richard Purdie wrote:
> On Fri, 2014-07-25 at 11:25 -0600, Gary Thomas wrote:
>> On 2014-07-22 21:33, 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/insane.bbclass | 13 +++++++++++++
>>>    meta/classes/utils.bbclass  |  2 ++
>>>    meta/conf/bitbake.conf      |  2 ++
>>>    3 files changed, 17 insertions(+)
>>>
>>> diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass
>>> index b26216e..6b1c9ad 100644
>>> --- a/meta/classes/insane.bbclass
>>> +++ b/meta/classes/insane.bbclass
>>> @@ -1022,6 +1022,19 @@ python () {
>>>        # Check various variables
>>>        ###########################################################################
>>>
>>> +    # Checking ${FILESEXTRAPATHS}
>>> +    extrapaths = (d.getVar("FILESEXTRAPATHS", True) or "")
>>> +    if '__default' not in extrapaths.split(":"):
>>> +        msg = "FILESEXTRAPATHS-variable, must always use _prepend (or _append)\n"
>>> +        msg += "type of assignment, and don't forget the colon.\n"
>>> +        msg += "Please assign it 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\n"
>>> +        msg += "Your incorrect assignment is:\n"
>>> +        msg += "%s\n" % extrapaths
>>> +        bb.fatal(msg)
>>
>> It sure would have been nice (even polite?) to make this a warning when first
>> added.  As is, it's going to break a lot of builds and it will be very tedious
>> to fix since the parser will die on the first one it finds :-(
>
> Agreed, I'll change this to a warning.

Thanks :-)

Patch

diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass
index b26216e..6b1c9ad 100644
--- a/meta/classes/insane.bbclass
+++ b/meta/classes/insane.bbclass
@@ -1022,6 +1022,19 @@  python () {
     # Check various variables
     ###########################################################################
 
+    # Checking ${FILESEXTRAPATHS}
+    extrapaths = (d.getVar("FILESEXTRAPATHS", True) or "")
+    if '__default' not in extrapaths.split(":"):
+        msg = "FILESEXTRAPATHS-variable, must always use _prepend (or _append)\n"
+        msg += "type of assignment, and don't forget the colon.\n"
+        msg += "Please assign it 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\n"
+        msg += "Your incorrect assignment is:\n"
+        msg += "%s\n" % extrapaths
+        bb.fatal(msg)
+
     if d.getVar('do_stage', True) is not None:
         bb.fatal("Legacy staging found for %s as it has a do_stage function. This will need conversion to a do_install or often simply removal to work with OE-core" % d.getVar("FILE", True))
 
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.