Re: [OE-core] [PATCH 2/2] rootfs-post: add sanity check for ROOTFS_POSTCMD

2020-07-08 Thread Richard Purdie
On Wed, 2020-07-08 at 13:09 +0200, Konrad Weihmann wrote:
> It warns about trailing blanks before the delimiter, as otherwise the
> task can't be removed properly
> 
> Signed-off-by: Konrad Weihmann 
> ---
>  meta/classes/rootfs-postcommands.bbclass | 8 
>  1 file changed, 8 insertions(+)
> 
> diff --git a/meta/classes/rootfs-postcommands.bbclass 
> b/meta/classes/rootfs-postcommands.bbclass
> index 984730ebe8..e33715f016 100644
> --- a/meta/classes/rootfs-postcommands.bbclass
> +++ b/meta/classes/rootfs-postcommands.bbclass
> @@ -57,6 +57,14 @@ python () {
>  d.appendVar('ROOTFS_POSTPROCESS_COMMAND', 'rootfs_reproducible;')
>  }
>  
> +addhandler rootfs_postcmd_sanity_eventhandler
> +rootfs_postcmd_sanity_eventhandler[eventmask] = "bb.event.RecipeParsed"
> +python rootfs_postcmd_sanity_eventhandler() {
> +for x in (d.getVar("ROOTFS_POSTPROCESS_COMMAND") or "").split(";"):
> +if x.endswith(" "):
> +bb.warn("'%s' ends with a blank, making the task unremovable" % 
> x.strip())
> +}
> +
>  systemd_create_users () {
>   for conffile in ${IMAGE_ROOTFS}/usr/lib/sysusers.d/systemd.conf 
> ${IMAGE_ROOTFS}/usr/lib/sysusers.d/systemd-remote.conf; do
>   [ -e $conffile ] || continue

I think this belongs with other sanity tests in insane.bbclass. I'd
prefer not to have another event handler in the system just for this
(they're high overhead).

Cheers,

Richard

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.

View/Reply Online (#140419): 
https://lists.openembedded.org/g/openembedded-core/message/140419
Mute This Topic: https://lists.openembedded.org/mt/75374081/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub  
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


[OE-core] [PATCH 2/2] rootfs-post: add sanity check for ROOTFS_POSTCMD

2020-07-08 Thread Konrad Weihmann
It warns about trailing blanks before the delimiter, as otherwise the
task can't be removed properly

Signed-off-by: Konrad Weihmann 
---
 meta/classes/rootfs-postcommands.bbclass | 8 
 1 file changed, 8 insertions(+)

diff --git a/meta/classes/rootfs-postcommands.bbclass 
b/meta/classes/rootfs-postcommands.bbclass
index 984730ebe8..e33715f016 100644
--- a/meta/classes/rootfs-postcommands.bbclass
+++ b/meta/classes/rootfs-postcommands.bbclass
@@ -57,6 +57,14 @@ python () {
 d.appendVar('ROOTFS_POSTPROCESS_COMMAND', 'rootfs_reproducible;')
 }
 
+addhandler rootfs_postcmd_sanity_eventhandler
+rootfs_postcmd_sanity_eventhandler[eventmask] = "bb.event.RecipeParsed"
+python rootfs_postcmd_sanity_eventhandler() {
+for x in (d.getVar("ROOTFS_POSTPROCESS_COMMAND") or "").split(";"):
+if x.endswith(" "):
+bb.warn("'%s' ends with a blank, making the task unremovable" % 
x.strip())
+}
+
 systemd_create_users () {
for conffile in ${IMAGE_ROOTFS}/usr/lib/sysusers.d/systemd.conf 
${IMAGE_ROOTFS}/usr/lib/sysusers.d/systemd-remote.conf; do
[ -e $conffile ] || continue
-- 
2.20.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.

View/Reply Online (#140418): 
https://lists.openembedded.org/g/openembedded-core/message/140418
Mute This Topic: https://lists.openembedded.org/mt/75374081/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub  
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-