All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: robert_henz@jabil.com
Cc: "openembedded-core@lists.openembedded.org"
	<openembedded-core@lists.openembedded.org>
Subject: Re: [OE-core] PR to fix WantedBy parsing of systemctl
Date: Tue, 20 Sep 2022 23:19:47 +0200	[thread overview]
Message-ID: <Yyouc28ZITHHQlcp@mail.local> (raw)
In-Reply-To: <b5c12365825c4ccf862a0d58029b0939DM5PR02MB221823F6928D9018544ECA3B834C9@DM5PR02MB2218.namprd02.prod.outlook.com>

Hello,

On 20/09/2022 17:55:42+0000, Robert Henz via lists.openembedded.org wrote:
> Hi everyone,
> 
> I have a PR to fix the WantedBy parsing of the systemctl script. I
> tried to follow the process described in your wiki
> (https://www.openembedded.org/wiki/How_to_submit_a_patch_to_OpenEmbedded),
> but ran into some problems I wasn't able to figure out. I will attach
> the patch file for my suggested change to this email but I also went
> ahead and created a fork and generated a GitHub PR in case that is
> ok/easier?

This is not easier to me. However, I'm interested to know more about the
issues you couldn't solve as this is a recurring topic.


> From 6cdb207ed99bc82324fb7b85126425ac8d439070 Mon Sep 17 00:00:00 2001
> From: Bob Henz <robert_henz@jabil.com>
> Date: Mon, 19 Sep 2022 22:02:58 -0400
> Subject: [PATCH] Fix WantedBy processing
> 
> An empty string assignment to WantedBy should clear all prior WantedBy
> settings. This matches behavior of the current systemd implementation.

Your SoB is missing here and this is mandatory.

> ---
>  meta/recipes-core/systemd/systemd-systemctl/systemctl | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/meta/recipes-core/systemd/systemd-systemctl/systemctl b/meta/recipes-core/systemd/systemd-systemctl/systemctl
> index 6d19666d82..cddae75a06 100755
> --- a/meta/recipes-core/systemd/systemd-systemctl/systemctl
> +++ b/meta/recipes-core/systemd/systemd-systemctl/systemctl
> @@ -26,6 +26,9 @@ locations = list()
>  
>  class SystemdFile():
>      """Class representing a single systemd configuration file"""
> +
> +    _clearable_keys = ['WantedBy']
> +
>      def __init__(self, root, path, instance_unit_name):
>          self.sections = dict()
>          self._parse(root, path)
> @@ -80,6 +83,14 @@ class SystemdFile():
>                  v = m.group('value')
>                  if k not in section:
>                      section[k] = list()
> +
> +                # If we come across a "key=" line for a "clearable key", then
> +                # forget all preceding assignments. This works because we are
> +                # processing files in correct parse order.
> +                if k in self._clearable_keys and not v:
> +                    del section[k]
> +                    continue
> +
>                  section[k].extend(v.split())
>  
>      def get(self, section, prop):
> -- 
> 2.34.1
> 

> 
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#170905): https://lists.openembedded.org/g/openembedded-core/message/170905
> Mute This Topic: https://lists.openembedded.org/mt/93809846/3617179
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alexandre.belloni@bootlin.com]
> -=-=-=-=-=-=-=-=-=-=-=-
> 


-- 
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


  reply	other threads:[~2022-09-20 21:19 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-20 17:55 PR to fix WantedBy parsing of systemctl Robert Henz
2022-09-20 21:19 ` Alexandre Belloni [this message]
2022-09-26 15:49   ` Robert Henz
2022-09-26 17:52     ` [OE-core] " Martin Jansa
2022-09-26 19:50       ` Robert Henz
2022-09-26 20:24         ` [PATCH] create-pull-request: don't switch the git remote protocol to git:// Martin Jansa
2022-09-26 20:31         ` [OE-core] PR to fix WantedBy parsing of systemctl Martin Jansa
2022-09-27  1:30           ` Robert Henz
2022-09-27  2:50             ` [OE-core] " Martin Jansa
2022-09-27 10:13         ` Ross Burton
2022-09-27 13:33           ` Robert Henz
2022-09-27 13:46             ` Robert Henz
2022-10-28 11:46               ` [OE-core] " Ross Burton
2022-09-27  9:50     ` Alexandre Belloni

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=Yyouc28ZITHHQlcp@mail.local \
    --to=alexandre.belloni@bootlin.com \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=robert_henz@jabil.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.