Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH v4 1/3] image.bbclass: add prohibited-paths QA test
@ 2017-11-16 15:05 Martyn Welch
  2017-11-16 15:05 ` [PATCH v4 2/3] core-image.bbclass: add default IMAGE_QA_PROHIBIT_PATHS variable Martyn Welch
                   ` (5 more replies)
  0 siblings, 6 replies; 11+ messages in thread
From: Martyn Welch @ 2017-11-16 15:05 UTC (permalink / raw)
  To: yocto, openembedded-core

Sometimes we wish to ensure that files or directories are not installed
somewhere that may prove detrimental to the operation of the system. For
example, this may be the case if files are placed in a directory that is
utilised as a mount point at run time, thus making them inaccessible once
when the mount point is being utilised.

Implement the prohibited paths QA test, which enables such locations to be
specified in a "IMAGE_QA_PROHIBITED_PATHS" variable. This implementation
allows for a colon separated list of paths to be provided. Shell style
wildcards can be used.

Signed-off-by: Fabien Lahoudere <fabien.lahoudere@collabora.co.uk>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
---
Changes since v1:
 - Correcting author and SOB.

Changes since v2:
 - Reimplemented as image rather than package level QA test.
 - Changed variable from PROHIBITED_PATH to PROHIBITED_PATHS to better
   reflect its use.

Changes since v3:
 - Rename variable to IMAGE_QA_PROHIBITED_PATHS.
 - Use str.startswith().
 - Simplify if statement.

 meta/classes/image.bbclass | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index d93de02..9053ce3 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -296,6 +296,26 @@ python do_image_complete_setscene () {
 }
 addtask do_image_complete_setscene
 
+python image_check_prohibited_paths () {
+    import glob
+    from oe.utils import ImageQAFailed
+
+    rootfs = d.getVar('IMAGE_ROOTFS')
+
+    path = (d.getVar('IMAGE_QA_PROHIBITED_PATHS') or "")
+    if path != "":
+        for p in path.split(':'):
+            if not p.startswith('/'):
+                raise ImageQAFailed("IMAGE_QA_PROHIBITED_PATHS \"%s\" must be an absolute path" % p, image_check_prohibited_paths)
+
+            match = glob.glob("%s%s" % (rootfs, p))
+            if match:
+                loc = ", ".join(item.replace(rootfs, '') for item in match)
+                raise ImageQAFailed("Match(es) for IMAGE_QA_PROHIBITED_PATHS \"%s\": %s" % (p, loc), image_check_prohibited_paths)
+}
+
+IMAGE_QA_COMMANDS += "image_check_prohibited_paths"
+
 # Add image-level QA/sanity checks to IMAGE_QA_COMMANDS
 #
 # IMAGE_QA_COMMANDS += " \
-- 
2.1.4



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v4 2/3] core-image.bbclass: add default IMAGE_QA_PROHIBIT_PATHS variable
  2017-11-16 15:05 [PATCH v4 1/3] image.bbclass: add prohibited-paths QA test Martyn Welch
@ 2017-11-16 15:05 ` Martyn Welch
  2017-11-16 15:05 ` [PATCH v4 3/3] ref-manual: Add documentation for prohibited-path QA test Martyn Welch
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 11+ messages in thread
From: Martyn Welch @ 2017-11-16 15:05 UTC (permalink / raw)
  To: yocto, openembedded-core

Add a default IMAGE_QA_PROHIBIT_PATHS variable containing paths known to
be mounted in the default fstab, which are known mount points or
directories which should be populated at runtime.

Suggested-by: Alexander Kanavin <alexander.kanavin@linux.intel.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
---

Changes since v3:
 - This patch added.

 meta/classes/core-image.bbclass | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/meta/classes/core-image.bbclass b/meta/classes/core-image.bbclass
index a9a2cec..8d5fb97 100644
--- a/meta/classes/core-image.bbclass
+++ b/meta/classes/core-image.bbclass
@@ -56,6 +56,11 @@ IMAGE_FEATURES_REPLACES_ssh-server-openssh = "ssh-server-dropbear"
 # IMAGE_FEATURES_CONFLICTS_foo = 'bar1 bar2'
 # An error exception would be raised if both image features foo and bar1(or bar2) are included
 
+# IMAGE_QA_PROHIBITED_PATHS
+# Ensure images aren't including files in places that will be used as mount points or that are
+# reserved for runtime data.
+IMAGE_QA_PROHIBITED_PATHS ?= "/dev/pts/*:/media/*:/mnt/*:/proc/*:/run/*:/tmp/*:/var/run/*:/var/tmp/*:/var/volatile/*"
+
 MACHINE_HWCODECS ??= ""
 
 CORE_IMAGE_BASE_INSTALL = '\
-- 
2.1.4



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v4 3/3] ref-manual: Add documentation for prohibited-path QA test
  2017-11-16 15:05 [PATCH v4 1/3] image.bbclass: add prohibited-paths QA test Martyn Welch
  2017-11-16 15:05 ` [PATCH v4 2/3] core-image.bbclass: add default IMAGE_QA_PROHIBIT_PATHS variable Martyn Welch
@ 2017-11-16 15:05 ` Martyn Welch
  2017-11-16 17:58 ` [PATCH v4 1/3] image.bbclass: add prohibited-paths " Otavio Salvador
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 11+ messages in thread
From: Martyn Welch @ 2017-11-16 15:05 UTC (permalink / raw)
  To: yocto, openembedded-core

Add documentation for the IMAGE_QA_PROHIBITED_PATHS variable and
associated prohibited-path QA test

Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
---
Changes since v1:
 - Correcting author and SOB.

Changes since v2:
 - Reimplemented as image rather than package level QA test, altering
   documentation to suit.
 - Changed variable from PROHIBITED_PATH to PROHIBITED_PATHS to better
   reflect its use.

Changes since v3:
 - Variable changed from PROHIBITED_PATHS to IMAGE_QA_PROHIBITED_PATHS.

 documentation/ref-manual/ref-variables.xml | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/documentation/ref-manual/ref-variables.xml b/documentation/ref-manual/ref-variables.xml
index e31aa21..57f969f 100644
--- a/documentation/ref-manual/ref-variables.xml
+++ b/documentation/ref-manual/ref-variables.xml
@@ -6162,6 +6162,30 @@
             </glossdef>
         </glossentry>
 
+        <glossentry id='var-IMAGE_QA_PROHIBITED_PATHS'><glossterm>IMAGE_QA_PROHIBITED_PATHS</glossterm>
+            <info>
+                IMAGE_QA_PROHIBITED_PATHS[doc] = "A colon separated list of paths in which recipes are prohibited from installing."
+            </info>
+            <glossdef>
+                <para role="glossdeffirst">
+<!--                <para role="glossdeffirst"><imagedata fileref="figures/define-generic.png" /> -->
+                    A colon separated list of paths in which recipes are
+                    prohibited from installing.
+                    Shell-style wildcards can be used in paths. All paths need
+                    to be absolute paths.
+                </para>
+
+                <para>
+                    For example, the following
+                    <filename>IMAGE_QA_PROHIBITED_PATHS</filename> ensures
+                    nothing is installed under <filename>/mnt</filename>:
+                    <literallayout class='monospaced'>
+     IMAGE_QA_PROHIBITED_PATHS += "/mnt/*"
+                    </literallayout>
+                </para>
+            </glossdef>
+        </glossentry>
+
         <glossentry id='var-IMAGE_ROOTFS'><glossterm>IMAGE_ROOTFS</glossterm>
             <info>
                 IMAGE_ROOTFS[doc] = "The location of the root filesystem while it is under construction (i.e. during do_rootfs)."
-- 
2.1.4



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH v4 1/3] image.bbclass: add prohibited-paths QA test
  2017-11-16 15:05 [PATCH v4 1/3] image.bbclass: add prohibited-paths QA test Martyn Welch
  2017-11-16 15:05 ` [PATCH v4 2/3] core-image.bbclass: add default IMAGE_QA_PROHIBIT_PATHS variable Martyn Welch
  2017-11-16 15:05 ` [PATCH v4 3/3] ref-manual: Add documentation for prohibited-path QA test Martyn Welch
@ 2017-11-16 17:58 ` Otavio Salvador
  2017-11-17 10:02   ` Martyn Welch
  2017-11-16 23:21 ` [yocto] " Leonardo Sandoval
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 11+ messages in thread
From: Otavio Salvador @ 2017-11-16 17:58 UTC (permalink / raw)
  To: Martyn Welch; +Cc: yocto, Patches and discussions about the oe-core layer

On Thu, Nov 16, 2017 at 1:05 PM, Martyn Welch
<martyn.welch@collabora.co.uk> wrote:
> Sometimes we wish to ensure that files or directories are not installed
> somewhere that may prove detrimental to the operation of the system. For
> example, this may be the case if files are placed in a directory that is
> utilised as a mount point at run time, thus making them inaccessible once
> when the mount point is being utilised.
>
> Implement the prohibited paths QA test, which enables such locations to be
> specified in a "IMAGE_QA_PROHIBITED_PATHS" variable. This implementation
> allows for a colon separated list of paths to be provided. Shell style
> wildcards can be used.
>
> Signed-off-by: Fabien Lahoudere <fabien.lahoudere@collabora.co.uk>
> Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
> ---
> Changes since v1:
>  - Correcting author and SOB.
>
> Changes since v2:
>  - Reimplemented as image rather than package level QA test.
>  - Changed variable from PROHIBITED_PATH to PROHIBITED_PATHS to better
>    reflect its use.
>
> Changes since v3:
>  - Rename variable to IMAGE_QA_PROHIBITED_PATHS.
>  - Use str.startswith().
>  - Simplify if statement.
>
>  meta/classes/image.bbclass | 20 ++++++++++++++++++++
>  1 file changed, 20 insertions(+)
>
> diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
> index d93de02..9053ce3 100644
> --- a/meta/classes/image.bbclass
> +++ b/meta/classes/image.bbclass
> @@ -296,6 +296,26 @@ python do_image_complete_setscene () {
>  }
>  addtask do_image_complete_setscene
>
> +python image_check_prohibited_paths () {
> +    import glob
> +    from oe.utils import ImageQAFailed
> +
> +    rootfs = d.getVar('IMAGE_ROOTFS')
> +
> +    path = (d.getVar('IMAGE_QA_PROHIBITED_PATHS') or "")
> +    if path != "":
> +        for p in path.split(':'):
> +            if not p.startswith('/'):
> +                raise ImageQAFailed("IMAGE_QA_PROHIBITED_PATHS \"%s\" must be an absolute path" % p, image_check_prohibited_paths)
> +
> +            match = glob.glob("%s%s" % (rootfs, p))
> +            if match:
> +                loc = ", ".join(item.replace(rootfs, '') for item in match)
> +                raise ImageQAFailed("Match(es) for IMAGE_QA_PROHIBITED_PATHS \"%s\": %s" % (p, loc), image_check_prohibited_paths)
> +}


        for p in path.split(':'):
            if not p.startswith('/'):

so you can drop the if path != "".

An empty list won't go inside the for. Each item needs to be tested.

> +IMAGE_QA_COMMANDS += "image_check_prohibited_paths"
> +
>  # Add image-level QA/sanity checks to IMAGE_QA_COMMANDS
>  #
>  # IMAGE_QA_COMMANDS += " \
> --
> 2.1.4
>
> --
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core



-- 
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [yocto] [PATCH v4 1/3] image.bbclass: add prohibited-paths QA test
  2017-11-16 15:05 [PATCH v4 1/3] image.bbclass: add prohibited-paths QA test Martyn Welch
                   ` (2 preceding siblings ...)
  2017-11-16 17:58 ` [PATCH v4 1/3] image.bbclass: add prohibited-paths " Otavio Salvador
@ 2017-11-16 23:21 ` Leonardo Sandoval
  2017-11-17  7:15   ` Alexander Kanavin
  2017-11-17 10:06   ` Martyn Welch
  2017-11-17 22:53 ` ✗ patchtest: failure for "[v4] image.bbclass: add prohib..." and 2 more Patchwork
  2017-11-18  0:11 ` Patchwork
  5 siblings, 2 replies; 11+ messages in thread
From: Leonardo Sandoval @ 2017-11-16 23:21 UTC (permalink / raw)
  To: Martyn Welch; +Cc: yocto, openembedded-core

isn't it this class meta/classes/insane.bbclass for this type of checks?


On Thu, 16 Nov 2017 15:05:56 +0000
Martyn Welch <martyn.welch@collabora.co.uk> wrote:

> Sometimes we wish to ensure that files or directories are not installed
> somewhere that may prove detrimental to the operation of the system. For
> example, this may be the case if files are placed in a directory that is
> utilised as a mount point at run time, thus making them inaccessible once
> when the mount point is being utilised.
> 
> Implement the prohibited paths QA test, which enables such locations to be
> specified in a "IMAGE_QA_PROHIBITED_PATHS" variable. This implementation
> allows for a colon separated list of paths to be provided. Shell style
> wildcards can be used.
> 
> Signed-off-by: Fabien Lahoudere <fabien.lahoudere@collabora.co.uk>
> Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
> ---
> Changes since v1:
>  - Correcting author and SOB.
> 
> Changes since v2:
>  - Reimplemented as image rather than package level QA test.
>  - Changed variable from PROHIBITED_PATH to PROHIBITED_PATHS to better
>    reflect its use.
> 
> Changes since v3:
>  - Rename variable to IMAGE_QA_PROHIBITED_PATHS.
>  - Use str.startswith().
>  - Simplify if statement.
> 
>  meta/classes/image.bbclass | 20 ++++++++++++++++++++
>  1 file changed, 20 insertions(+)
> 
> diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
> index d93de02..9053ce3 100644
> --- a/meta/classes/image.bbclass
> +++ b/meta/classes/image.bbclass
> @@ -296,6 +296,26 @@ python do_image_complete_setscene () {
>  }
>  addtask do_image_complete_setscene
>  
> +python image_check_prohibited_paths () {
> +    import glob
> +    from oe.utils import ImageQAFailed
> +
> +    rootfs = d.getVar('IMAGE_ROOTFS')
> +
> +    path = (d.getVar('IMAGE_QA_PROHIBITED_PATHS') or "")
> +    if path != "":
> +        for p in path.split(':'):
> +            if not p.startswith('/'):
> +                raise ImageQAFailed("IMAGE_QA_PROHIBITED_PATHS \"%s\" must be an absolute path" % p, image_check_prohibited_paths)
> +
> +            match = glob.glob("%s%s" % (rootfs, p))
> +            if match:
> +                loc = ", ".join(item.replace(rootfs, '') for item in match)
> +                raise ImageQAFailed("Match(es) for IMAGE_QA_PROHIBITED_PATHS \"%s\": %s" % (p, loc), image_check_prohibited_paths)
> +}
> +
> +IMAGE_QA_COMMANDS += "image_check_prohibited_paths"
> +
>  # Add image-level QA/sanity checks to IMAGE_QA_COMMANDS
>  #
>  # IMAGE_QA_COMMANDS += " \
> -- 
> 2.1.4
> 
> -- 
> _______________________________________________
> yocto mailing list
> yocto@yoctoproject.org
> https://lists.yoctoproject.org/listinfo/yocto


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [yocto] [PATCH v4 1/3] image.bbclass: add prohibited-paths QA test
  2017-11-16 23:21 ` [yocto] " Leonardo Sandoval
@ 2017-11-17  7:15   ` Alexander Kanavin
  2017-11-17 10:06   ` Martyn Welch
  1 sibling, 0 replies; 11+ messages in thread
From: Alexander Kanavin @ 2017-11-17  7:15 UTC (permalink / raw)
  To: Leonardo Sandoval, Martyn Welch; +Cc: yocto, openembedded-core

On 11/17/2017 01:21 AM, Leonardo Sandoval wrote:
> isn't it this class meta/classes/insane.bbclass for this type of checks?

This was already discussed - the test should be on the image rather than 
package level:
http://lists.openembedded.org/pipermail/openembedded-core/2017-November/144335.html

Alex


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v4 1/3] image.bbclass: add prohibited-paths QA test
  2017-11-16 17:58 ` [PATCH v4 1/3] image.bbclass: add prohibited-paths " Otavio Salvador
@ 2017-11-17 10:02   ` Martyn Welch
  0 siblings, 0 replies; 11+ messages in thread
From: Martyn Welch @ 2017-11-17 10:02 UTC (permalink / raw)
  To: Otavio Salvador; +Cc: yocto, Patches and discussions about the oe-core layer

On Thu, 2017-11-16 at 15:58 -0200, Otavio Salvador wrote:
> On Thu, Nov 16, 2017 at 1:05 PM, Martyn Welch
> <martyn.welch@collabora.co.uk> wrote:
> > Sometimes we wish to ensure that files or directories are not installed
> > somewhere that may prove detrimental to the operation of the system. For
> > example, this may be the case if files are placed in a directory that is
> > utilised as a mount point at run time, thus making them inaccessible once
> > when the mount point is being utilised.
> >
> > Implement the prohibited paths QA test, which enables such locations to be
> > specified in a "IMAGE_QA_PROHIBITED_PATHS" variable. This implementation
> > allows for a colon separated list of paths to be provided. Shell style
> > wildcards can be used.
> >
> > Signed-off-by: Fabien Lahoudere <fabien.lahoudere@collabora.co.uk>
> > Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
> > ---
> > Changes since v1:
> >  - Correcting author and SOB.
> >
> > Changes since v2:
> >  - Reimplemented as image rather than package level QA test.
> >  - Changed variable from PROHIBITED_PATH to PROHIBITED_PATHS to better
> >    reflect its use.
> >
> > Changes since v3:
> >  - Rename variable to IMAGE_QA_PROHIBITED_PATHS.
> >  - Use str.startswith().
> >  - Simplify if statement.
> >
> >  meta/classes/image.bbclass | 20 ++++++++++++++++++++
> >  1 file changed, 20 insertions(+)
> >
> > diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
> > index d93de02..9053ce3 100644
> > --- a/meta/classes/image.bbclass
> > +++ b/meta/classes/image.bbclass
> > @@ -296,6 +296,26 @@ python do_image_complete_setscene () {
> >  }
> >  addtask do_image_complete_setscene
> >
> > +python image_check_prohibited_paths () {
> > +    import glob
> > +    from oe.utils import ImageQAFailed
> > +
> > +    rootfs = d.getVar('IMAGE_ROOTFS')
> > +
> > +    path = (d.getVar('IMAGE_QA_PROHIBITED_PATHS') or "")
> > +    if path != "":
> > +        for p in path.split(':'):
> > +            if not p.startswith('/'):
> > +                raise ImageQAFailed("IMAGE_QA_PROHIBITED_PATHS \"%s\" must be an absolute path" % p, image_check_prohibited_paths)
> > +
> > +            match = glob.glob("%s%s" % (rootfs, p))
> > +            if match:
> > +                loc = ", ".join(item.replace(rootfs, '') for item in match)
> > +                raise ImageQAFailed("Match(es) for IMAGE_QA_PROHIBITED_PATHS \"%s\": %s" % (p, loc), image_check_prohibited_paths)
> > +}
> 
> 
>         for p in path.split(':'):
>             if not p.startswith('/'):
> 
> so you can drop the if path != "".
> 
> An empty list won't go inside the for. Each item needs to be tested.
> 

That's what I initially thought...

>>> path = ""
>>> for p in path.split(':'):
...     print "Hello"
... 
Hello
>>> 

> > +IMAGE_QA_COMMANDS += "image_check_prohibited_paths"
> > +
> >  # Add image-level QA/sanity checks to IMAGE_QA_COMMANDS
> >  #
> >  # IMAGE_QA_COMMANDS += " \
> > --
> > 2.1.4
> >
> > --
> > _______________________________________________
> > Openembedded-core mailing list
> > Openembedded-core@lists.openembedded.org
> > http://lists.openembedded.org/mailman/listinfo/openembedded-core
> 
> 
> 




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [yocto] [PATCH v4 1/3] image.bbclass: add prohibited-paths QA test
  2017-11-16 23:21 ` [yocto] " Leonardo Sandoval
  2017-11-17  7:15   ` Alexander Kanavin
@ 2017-11-17 10:06   ` Martyn Welch
  2017-11-17 11:56     ` Otavio Salvador
  1 sibling, 1 reply; 11+ messages in thread
From: Martyn Welch @ 2017-11-17 10:06 UTC (permalink / raw)
  To: Leonardo Sandoval; +Cc: yocto, openembedded-core

On Thu, 2017-11-16 at 17:21 -0600, Leonardo Sandoval wrote:
> isn't it this class meta/classes/insane.bbclass for this type of checks?
> 

I don't know. The logic for IMAGE_QA_COMMAND is in image.bbclass, as far
as I can see the package QA tests are in package.bbclass, so
image.bbclass seemed like a reasonable place to put the image QA test.

If the consensus is that it should be in insane.bbclass, I'm more than
happy to move it though.

> 
> On Thu, 16 Nov 2017 15:05:56 +0000
> Martyn Welch <martyn.welch@collabora.co.uk> wrote:
> 
> > Sometimes we wish to ensure that files or directories are not installed
> > somewhere that may prove detrimental to the operation of the system. For
> > example, this may be the case if files are placed in a directory that is
> > utilised as a mount point at run time, thus making them inaccessible once
> > when the mount point is being utilised.
> > 
> > Implement the prohibited paths QA test, which enables such locations to be
> > specified in a "IMAGE_QA_PROHIBITED_PATHS" variable. This implementation
> > allows for a colon separated list of paths to be provided. Shell style
> > wildcards can be used.
> > 
> > Signed-off-by: Fabien Lahoudere <fabien.lahoudere@collabora.co.uk>
> > Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
> > ---
> > Changes since v1:
> >  - Correcting author and SOB.
> > 
> > Changes since v2:
> >  - Reimplemented as image rather than package level QA test.
> >  - Changed variable from PROHIBITED_PATH to PROHIBITED_PATHS to better
> >    reflect its use.
> > 
> > Changes since v3:
> >  - Rename variable to IMAGE_QA_PROHIBITED_PATHS.
> >  - Use str.startswith().
> >  - Simplify if statement.
> > 
> >  meta/classes/image.bbclass | 20 ++++++++++++++++++++
> >  1 file changed, 20 insertions(+)
> > 
> > diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
> > index d93de02..9053ce3 100644
> > --- a/meta/classes/image.bbclass
> > +++ b/meta/classes/image.bbclass
> > @@ -296,6 +296,26 @@ python do_image_complete_setscene () {
> >  }
> >  addtask do_image_complete_setscene
> >  
> > +python image_check_prohibited_paths () {
> > +    import glob
> > +    from oe.utils import ImageQAFailed
> > +
> > +    rootfs = d.getVar('IMAGE_ROOTFS')
> > +
> > +    path = (d.getVar('IMAGE_QA_PROHIBITED_PATHS') or "")
> > +    if path != "":
> > +        for p in path.split(':'):
> > +            if not p.startswith('/'):
> > +                raise ImageQAFailed("IMAGE_QA_PROHIBITED_PATHS \"%s\" must be an absolute path" % p, image_check_prohibited_paths)
> > +
> > +            match = glob.glob("%s%s" % (rootfs, p))
> > +            if match:
> > +                loc = ", ".join(item.replace(rootfs, '') for item in match)
> > +                raise ImageQAFailed("Match(es) for IMAGE_QA_PROHIBITED_PATHS \"%s\": %s" % (p, loc), image_check_prohibited_paths)
> > +}
> > +
> > +IMAGE_QA_COMMANDS += "image_check_prohibited_paths"
> > +
> >  # Add image-level QA/sanity checks to IMAGE_QA_COMMANDS
> >  #
> >  # IMAGE_QA_COMMANDS += " \
> > -- 
> > 2.1.4
> > 
> > -- 
> > _______________________________________________
> > yocto mailing list
> > yocto@yoctoproject.org
> > https://lists.yoctoproject.org/listinfo/yocto




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [yocto] [PATCH v4 1/3] image.bbclass: add prohibited-paths QA test
  2017-11-17 10:06   ` Martyn Welch
@ 2017-11-17 11:56     ` Otavio Salvador
  0 siblings, 0 replies; 11+ messages in thread
From: Otavio Salvador @ 2017-11-17 11:56 UTC (permalink / raw)
  To: Martyn Welch; +Cc: yocto, Patches and discussions about the oe-core layer

On Fri, Nov 17, 2017 at 8:06 AM, Martyn Welch
<martyn.welch@collabora.co.uk> wrote:
> On Thu, 2017-11-16 at 17:21 -0600, Leonardo Sandoval wrote:
>> isn't it this class meta/classes/insane.bbclass for this type of checks?
>>
>
> I don't know. The logic for IMAGE_QA_COMMAND is in image.bbclass, as far
> as I can see the package QA tests are in package.bbclass, so
> image.bbclass seemed like a reasonable place to put the image QA test.
>
> If the consensus is that it should be in insane.bbclass, I'm more than
> happy to move it though.

If not in insane.bbclass, a new image-insane.bbclass. I dislike it
being defined in multiple places.

-- 
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750


^ permalink raw reply	[flat|nested] 11+ messages in thread

* ✗ patchtest: failure for "[v4] image.bbclass: add prohib..." and 2 more
  2017-11-16 15:05 [PATCH v4 1/3] image.bbclass: add prohibited-paths QA test Martyn Welch
                   ` (3 preceding siblings ...)
  2017-11-16 23:21 ` [yocto] " Leonardo Sandoval
@ 2017-11-17 22:53 ` Patchwork
  2017-11-18  0:11 ` Patchwork
  5 siblings, 0 replies; 11+ messages in thread
From: Patchwork @ 2017-11-17 22:53 UTC (permalink / raw)
  To: Martyn Welch; +Cc: openembedded-core

== Series Details ==

Series: "[v4] image.bbclass: add prohib..." and 2 more
Revision: 1
URL   : https://patchwork.openembedded.org/series/9830/
State : failure

== Summary ==


Thank you for submitting this patch series to OpenEmbedded Core. This is
an automated response. Several tests have been executed on the proposed
series by patchtest resulting in the following failures:



* Issue             Series sent to the wrong mailing list or some patches from the series correspond to different mailing lists [test_target_mailing_list] 
  Suggested fix    Send the series again to the correct mailing list (ML)
  Suggested ML     yocto@yoctoproject.org [http://git.yoctoproject.org/cgit/cgit.cgi/yocto-docs/]
  Patch's path:    documentation/ref-manual/ref-variables.xml

* Issue             Series does not apply on top of target branch [test_series_merge_on_head] 
  Suggested fix    Rebase your series on top of targeted branch
  Targeted branch  master (currently at a17f3ec910)



If you believe any of these test results are incorrect, please reply to the
mailing list (openembedded-core@lists.openembedded.org) raising your concerns.
Otherwise we would appreciate you correcting the issues and submitting a new
version of the patchset if applicable. Please ensure you add/increment the
version number when sending the new version (i.e. [PATCH] -> [PATCH v2] ->
[PATCH v3] -> ...).

---
Guidelines:     https://www.openembedded.org/wiki/Commit_Patch_Message_Guidelines
Test framework: http://git.yoctoproject.org/cgit/cgit.cgi/patchtest
Test suite:     http://git.yoctoproject.org/cgit/cgit.cgi/patchtest-oe



^ permalink raw reply	[flat|nested] 11+ messages in thread

* ✗ patchtest: failure for "[v4] image.bbclass: add prohib..." and 2 more
  2017-11-16 15:05 [PATCH v4 1/3] image.bbclass: add prohibited-paths QA test Martyn Welch
                   ` (4 preceding siblings ...)
  2017-11-17 22:53 ` ✗ patchtest: failure for "[v4] image.bbclass: add prohib..." and 2 more Patchwork
@ 2017-11-18  0:11 ` Patchwork
  5 siblings, 0 replies; 11+ messages in thread
From: Patchwork @ 2017-11-18  0:11 UTC (permalink / raw)
  To: Martyn Welch; +Cc: openembedded-core

== Series Details ==

Series: "[v4] image.bbclass: add prohib..." and 2 more
Revision: 1
URL   : https://patchwork.openembedded.org/series/9830/
State : failure

== Summary ==


Thank you for submitting this patch series to OpenEmbedded Core. This is
an automated response. Several tests have been executed on the proposed
series by patchtest resulting in the following failures:



* Issue             Series sent to the wrong mailing list or some patches from the series correspond to different mailing lists [test_target_mailing_list] 
  Suggested fix    Send the series again to the correct mailing list (ML)
  Suggested ML     yocto@yoctoproject.org [http://git.yoctoproject.org/cgit/cgit.cgi/yocto-docs/]
  Patch's path:    documentation/ref-manual/ref-variables.xml

* Issue             Series does not apply on top of target branch [test_series_merge_on_head] 
  Suggested fix    Rebase your series on top of targeted branch
  Targeted branch  master (currently at a17f3ec910)



If you believe any of these test results are incorrect, please reply to the
mailing list (openembedded-core@lists.openembedded.org) raising your concerns.
Otherwise we would appreciate you correcting the issues and submitting a new
version of the patchset if applicable. Please ensure you add/increment the
version number when sending the new version (i.e. [PATCH] -> [PATCH v2] ->
[PATCH v3] -> ...).

---
Guidelines:     https://www.openembedded.org/wiki/Commit_Patch_Message_Guidelines
Test framework: http://git.yoctoproject.org/cgit/cgit.cgi/patchtest
Test suite:     http://git.yoctoproject.org/cgit/cgit.cgi/patchtest-oe



^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2017-11-18  0:11 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-16 15:05 [PATCH v4 1/3] image.bbclass: add prohibited-paths QA test Martyn Welch
2017-11-16 15:05 ` [PATCH v4 2/3] core-image.bbclass: add default IMAGE_QA_PROHIBIT_PATHS variable Martyn Welch
2017-11-16 15:05 ` [PATCH v4 3/3] ref-manual: Add documentation for prohibited-path QA test Martyn Welch
2017-11-16 17:58 ` [PATCH v4 1/3] image.bbclass: add prohibited-paths " Otavio Salvador
2017-11-17 10:02   ` Martyn Welch
2017-11-16 23:21 ` [yocto] " Leonardo Sandoval
2017-11-17  7:15   ` Alexander Kanavin
2017-11-17 10:06   ` Martyn Welch
2017-11-17 11:56     ` Otavio Salvador
2017-11-17 22:53 ` ✗ patchtest: failure for "[v4] image.bbclass: add prohib..." and 2 more Patchwork
2017-11-18  0:11 ` Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox