On Tue, Sep 20, 2022 at 05:19 PM, Alexandre Belloni wrote:

> 
> 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.

I am following the instructions 
(https://www.openembedded.org/wiki/How_to_submit_a_patch_to_OpenEmbedded#Sending_via_a_pull_request)
 under "Sending via a pull request".
I created a github fork (cloned it, created my commit and pushed it back to a 
branch of my forked repo).

The problem I've run into is this:

```

bobhenz@hound:~/src/openembedded-core$ scripts/create-pull-request -u badger
NOTE: Assuming remote branch 'fix-wantedby-clearing', use -b to override.
NOTE: Assuming local branch HEAD, use -l to override.
fatal: unable to connect to github.com:
github.com[0: 140.82.114.4]: errno=Connection timed out

warn: No match for commit b637a46f58b5adc7dcc76bdef90a7be8c8462df8 found at 
git://github.com/BadgerTechnologies/openembedded-core
warn: Are you sure you pushed 'fix-wantedby-clearing' there?
ERROR: git request-pull reported an error
bobhenz@hound:~/src/openembedded-core$ git log
commit b637a46f58b5adc7dcc76bdef90a7be8c8462df8 (HEAD -> fix-wantedby-clearing, 
badger/fix-wantedby-clearing)
Author: Bob Henz <robert_h...@jabil.com>
Date:   Mon Sep 19 22:02:58 2022 -0400

Fix WantedBy processing

An empty string assignment to WantedBy should clear all prior WantedBy
settings. This matches behavior of the current systemd implementation.

Signed-off-by: Bob Henz <robert_h...@jabil.com>

commit 68b07bb7f0f01925f9da1cb966239ee49d5c84e3 (origin/master, origin/HEAD, 
badger/master, master)
Author: He Zhe <zhe...@windriver.com>
Date:   Mon Sep 26 16:08:07 2022 +0800

lttng-tools: Disable on qemuriscv32

lttng-tools requires SYS_ppoll and SYS_pselect6 which are not supported on
riscv32. This has been confirmed by lttng-tools upstream.
https://github.com/lttng/lttng-tools/pull/162

It's also turned off for riscv32 in meta-riscv.
https://github.com/riscv/meta-riscv/blob/master/conf/layer.conf

Signed-off-by: He Zhe <zhe...@windriver.com>
Signed-off-by: Richard Purdie <richard.pur...@linuxfoundation.org>
```

(As you can see from the git log, that commit was pushed to the remote forked 
repo called "badger".)

> 
> 
>> From 6cdb207ed99bc82324fb7b85126425ac8d439070 Mon Sep 17 00:00:00 2001
>> From: Bob Henz <robert_h...@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.

I will attach a new patch with a SoB. Can you explain the value of having me 
sign off on my own PR? I guess I thought someone with more authority would be 
signing off on the change...

Thanks for your guidance
From b637a46f58b5adc7dcc76bdef90a7be8c8462df8 Mon Sep 17 00:00:00 2001
From: Bob Henz <robert_h...@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.

Signed-off-by: Bob Henz <robert_h...@jabil.com>
---
 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.25.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#171068): 
https://lists.openembedded.org/g/openembedded-core/message/171068
Mute This Topic: https://lists.openembedded.org/mt/93809846/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to