PR to fix WantedBy parsing of systemctl
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?
https://github.com/openembedded/openembedded-core/pull/78
Again, I apologize for not being able to follow your defined procedure, please let me know if there is additional information you need from me.
Thanks,
Bob
From 6cdb207ed99bc82324fb7b85126425ac8d439070 Mon Sep 17 00:00:00 2001
From: Bob Henz <[email protected]>
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.
--- meta/recipes-core/systemd/systemd-systemctl/systemctl | 11 +++++++++++ 1 file changed, 11 insertions(+)
meta/recipes-core/systemd/systemd-systemctl/systemctl +11 -0
@@ -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):
Signature · 1 line
2.34.1
Hello,
Quoted 9 lines · Robert Henz via lists.openembedded.org
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.
Quoted 7 lines
From
6cdb207ed99bc82324fb7b85126425ac8d439070Mon Sep 17 00:00:00 2001
From: Bob Henz <[email protected]>
Date: Mon, 19 Sep 2022 22:02:58 -0400
Subject: [PATCH] Fix WantedBy processingAn 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.
Quoted 46 lines
--- meta/recipes-core/systemd/systemd-systemctl/systemctl | 11 +++++++++++ 1 file changed, 11 insertions(+)meta/recipes-core/systemd/systemd-systemctl/systemctl +11
-0@@ -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):Signature · 11 lines
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: [email protected] Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
Quoted 12 lines · Alexandre Belloni
Hello,
Quoted 6 lines · Robert Henz via lists.openembedded.org
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 ),
Quoted 7 lines
Quoted 4 lines
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 <[email protected]> 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 <[email protected]> commit 68b07bb7f0f01925f9da1cb966239ee49d5c84e3 (origin/master, origin/HEAD, badger/master, master) Author: He Zhe <[email protected]> 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 <[email protected]> Signed-off-by: Richard Purdie <[email protected]> ```
(As you can see from the git log, that commit was pushed to the remote forked repo called "badger".)
Quoted 11 lines
Quoted 9 lines
From
6cdb207ed99bc82324fb7b85126425ac8d439070Mon Sep 17 00:00:00 2001
From: Bob Henz <[email protected]>
Date: Mon, 19 Sep 2022 22:02:58 -0400
Subject: [PATCH] Fix WantedBy processingAn 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 <[email protected]>
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.
--- meta/recipes-core/systemd/systemd-systemctl/systemctl | 11 +++++++++++ 1 file changed, 11 insertions(+)
meta/recipes-core/systemd/systemd-systemctl/systemctl +11 -0
@@ -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):
Signature · 1 line
2.25.1
Looks like your badger remote is still using git:// protocol which isn't supported by github.com anymore, you need to change it to https://.
Quoted 101 lines · Robert Henz via lists.openembedded.org
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 <[email protected]> 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 <[email protected]> commit 68b07bb7f0f01925f9da1cb966239ee49d5c84e3 (origin/master, origin/HEAD, badger/master, master) Author: He Zhe <[email protected]> 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 <[email protected]> Signed-off-by: Richard Purdie <[email protected]> ```(As you can see from the git log, that commit was pushed to the remote forked repo called "badger".)
From
6cdb207ed99bc82324fb7b85126425ac8d439070Mon Sep 17 00:00:00 2001
From: Bob Henz <[email protected]>
Date: Mon, 19 Sep 2022 22:02:58 -0400
Subject: [PATCH] Fix WantedBy processingAn 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
-=-=-=-=-=-=-=-=-=-=-=-
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/3617156
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
I think I'm missing some context. Not really understanding what this script is trying to accomplish I don't know what "remote branch" is vs "local branch". Should "remote branch" be "master" and the local branch be the branch with the change I want to make? Here's that script running with "set -x" turned on 1/2 way through...
bobhenz@hound:~/src/openembedded-core$ scripts/create-pull-request -u badger + USER_RE=[A-Za-z0-9_.@][A-Za-z0-9_.@-]*$\? + PROTO_RE=[a-z][a-z+]*:// + GIT_RE=\(^\([a-z][a-z+]*://\)\?\)\([A-Za-z0-9_.@][A-Za-z0-9_.@-]*$\?@\)\?\([^:/]*\)[:/]\(.*\) + REMOTE_URL=https://github.com/BadgerTechnologies/openembedded-core + echo https://github.com/BadgerTechnologies/openembedded-core + sed s#\(^\([a-z][a-z+]*://\)\?\)\([A-Za-z0-9_.@][A-Za-z0-9_.@-]*$\?@\)\?\([^:/]*\)[:/]\(.*\)#\5# + REMOTE_REPO=BadgerTechnologies/openembedded-core + echo https://github.com/BadgerTechnologies/openembedded-core + sed s#\(^\([a-z][a-z+]*://\)\?\)\([A-Za-z0-9_.@][A-Za-z0-9_.@-]*$\?@\)\?\([^:/]*\)[:/]\(.*\)#git://\4/\5# + REMOTE_URL=git://github.com/BadgerTechnologies/openembedded-core + [ -z ] + git branch + grep -e ^\* + cut -d -f2 + BRANCH=fix-wantedby-clearing + echo NOTE: Assuming remote branch 'fix-wantedby-clearing', use -b to override. NOTE: Assuming remote branch 'fix-wantedby-clearing', use -b to override. + [ -z ] + L_BRANCH=HEAD + echo NOTE: Assuming local branch HEAD, use -l to override. NOTE: Assuming local branch HEAD, use -l to override. + [ 0 -eq 1 ] + WEB_URL= + WEB_URL=https://github.com/BadgerTechnologies/openembedded-core/tree/fix-wantedby-clearing + [ -n https://github.com/BadgerTechnologies/openembedded-core/tree/fix-wantedby-clearing ] + [ = 1 ] + wget --no-check-certificate -q https://github.com/BadgerTechnologies/openembedded-core/tree/fix-wantedby-clearing -O /dev/null + [ 0 -ne 0 ] + [ -e pull-186156 ] + mkdir pull-186156 + [ -n ] + git format-patch -M40 --subject-prefix=PATCH -n -o pull-186156 --thread=shallow --cover-letter master..HEAD + ls -A pull-186156 + [ -z 0000-cover-letter.patch 0001-Fix-WantedBy-processing.patch ] + [ -n ] + echo pull-186156/0000-cover-letter.patch + CL=pull-186156/0000-cover-letter.patch + PM=pull-186156/pull-msg + + trgit -d --version [:alpha:][:space:]. + sed s/\(...\).*/\1/ + git version 2.25.1 + GIT_VERSION=225 + NEWER_GIT_VERSION=210 + [ 225 -lt 210 ] + git request-pull master git://github.com/BadgerTechnologies/openembedded-core HEAD:fix-wantedby-clearing fatal: unable to connect to github.com: github.com[0: 140.82.113.3]: 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?
+ [ 1 -ne 0 ]
+ echo ERROR: git request-pull reported an error
ERROR: git request-pull reported an error
+ rm -rf pull-186156
+ exit 1
PATCH 1/1 create-pull-request: don't switch the git remote protocol to git://
Many git repos prefer https:// nowadays and many removed support for git://.
This breaks the script when using github.com even when selected remote is ssh ([email protected]:openembedded/...), it will re-write it to git://
before calling git pull-request causing:
openembedded-core $ scripts/create-pull-request -u github -b jansa/artifacts -o pull-kernel
NOTE: Assuming local branch HEAD, use -l to override.
fatal: unable to connect to github.com:
github.com[0: 140.82.121.3]: errno=Connection timed out
warn: No match for commit ea003bd026aa24bb4c8b7562f44ed6512e921259 found at git://github.com/shr-distribution/oe-core
warn: Are you sure you pushed 'jansa/artifacts' there?
ERROR: git request-pull reported an error
--- scripts/create-pull-request | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/create-pull-request +1 -1
@@ -128,7 +128,7 @@ PROTO_RE="[a-z][a-z+]*://" GIT_RE="\(^\($PROTO_RE\)\?\)\($USER_RE@\)\?\([^:/]*\)[:/]\(.*\)" REMOTE_URL=${REMOTE_URL%.git} REMOTE_REPO=$(echo $REMOTE_URL | sed "s#$GIT_RE#\5#") -REMOTE_URL=$(echo $REMOTE_URL | sed "s#$GIT_RE#git://\4/\5#") +REMOTE_URL=$(echo $REMOTE_URL | sed "s#$GIT_RE#https://\4/\5#") if [ -z "$BRANCH" ]; then BRANCH=$(git branch | grep -e "^\* " | cut -d' ' -f2)
Signature · 1 line
2.37.3
see the REMOTE_URL changes shown in set -x, relevant context is in:
https://git.openembedded.org/openembedded-core/commit/?id=675e88e6e0bbd5ab2dcd4bdf97b0de59925a1be6
We forgot to update it after:
https://github.blog/2021-09-01-improving-git-protocol-security-github/#no-more-unauthenticated-git
and unfortunately it shows how rarely this script is being used.
I've sent a fix for this, please test it.
Quoted 88 lines · Robert Henz via lists.openembedded.org
I think I'm missing some context. Not really understanding what this script is trying to accomplish I don't know what "remote branch" is vs "local branch". Should "remote branch" be "master" and the local branch be the branch with the change I want to make? Here's that script running with "set -x" turned on 1/2 way through...
bobhenz@hound:~/src/openembedded-core$ scripts/create-pull-request -u badger + USER_RE=[A-Za-z0-9_.@][A-Za-z0-9_.@-]*$\? + PROTO_RE=[a-z][a-z+]*:// + GIT_RE=\(^\([a-z][a-z+]*://\)\?\)\([A-Za-z0-9_.@][A-Za-z0-9_.@ -]*$\?@\)\?\([^:/]*\)[:/]\(.*\) + REMOTE_URL=https://github.com/BadgerTechnologies/openembedded-core + echo https://github.com/BadgerTechnologies/openembedded-core + sed s#\(^\([a-z][a-z+]*://\)\?\)\([A-Za-z0-9_.@][A-Za-z0-9_.@ -]*$\?@\)\?\([^:/]*\)[:/]\(.*\)#\5# + REMOTE_REPO=BadgerTechnologies/openembedded-core + echo https://github.com/BadgerTechnologies/openembedded-core + sed s#\(^\([a-z][a-z+]*://\)\?\)\([A-Za-z0-9_.@][A-Za-z0-9_.@ -]*$\?@\)\?\([^:/]*\)[:/]\(.*\)#git://\4/\5# + REMOTE_URL=git://github.com/BadgerTechnologies/openembedded-core + [ -z ] + git branch + grep -e ^\* + cut -d -f2 + BRANCH=fix-wantedby-clearing + echo NOTE: Assuming remote branch 'fix-wantedby-clearing', use -b to override. NOTE: Assuming remote branch 'fix-wantedby-clearing', use -b to override. + [ -z ] + L_BRANCH=HEAD + echo NOTE: Assuming local branch HEAD, use -l to override. NOTE: Assuming local branch HEAD, use -l to override. + [ 0 -eq 1 ] + WEB_URL= + WEB_URL= https://github.com/BadgerTechnologies/openembedded-core/tree/fix-wantedby-clearing + [ -n https://github.com/BadgerTechnologies/openembedded-core/tree/fix-wantedby-clearing ] + [ = 1 ] + wget --no-check-certificate -q https://github.com/BadgerTechnologies/openembedded-core/tree/fix-wantedby-clearing -O /dev/null + [ 0 -ne 0 ] + [ -e pull-186156 ] + mkdir pull-186156 + [ -n ] + git format-patch -M40 --subject-prefix=PATCH -n -o pull-186156 --thread=shallow --cover-letter master..HEAD + ls -A pull-186156 + [ -z 0000-cover-letter.patch 0001-Fix-WantedBy-processing.patch ] + [ -n ] + echo pull-186156/0000-cover-letter.patch + CL=pull-186156/0000-cover-letter.patch + PM=pull-186156/pull-msg + + trgit -d --version [:alpha:][:space:]. + sed s/\(...\).*/\1/ + git version 2.25.1 + GIT_VERSION=225 + NEWER_GIT_VERSION=210 + [ 225 -lt 210 ] + git request-pull master git:// github.com/BadgerTechnologies/openembedded-core HEAD:fix-wantedby-clearing fatal: unable to connect to github.com: github.com[0: 140.82.113.3]: errno=Connection timed outwarn: No match for commit
b637a46f58b5adc7dcc76bdef90a7be8c8462df8found atgit://github.com/BadgerTechnologies/openembedded-core
warn: Are you sure you pushed 'fix-wantedby-clearing' there?
+ [ 1 -ne 0 ]
+ echo ERROR: git request-pull reported an error
ERROR: git request-pull reported an error
+ rm -rf pull-186156
+ exit 1
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#171073):
https://lists.openembedded.org/g/openembedded-core/message/171073
Mute This Topic: https://lists.openembedded.org/mt/93809846/3617156
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
I have confirmed your patch worked for me. Perhaps the documentation should also be updated to indicate that remotes need to be cloned/added using the https protocol?
I still can't send the resulting two files via git send-email (the final step), as I would have to do a significant amount of configuration in my _personal_ gmail account in order to use git send-email to send the final patch. I will attach the resulting two files here and perhaps that will be sufficient for someone to begin reviewing my actual PR.
Thanks,
Bob
From b637a46f58b5adc7dcc76bdef90a7be8c8462df8 Mon Sep 17 00:00:00 2001
Message-Id: <[email protected]>
From: Bob Henz <[email protected]>
Date: Mon, 26 Sep 2022 20:54:41 -0400
Subject: [PATCH 0/1] Fix WantedBy processing
An empty string assignment to WantedBy should clear all prior WantedBy settings. This matches behavior of the current systemd implementation. When using systemd drop-in files (instead of patching published .service files) this change becomes especially important.
The following changes since commit 68b07bb7f0f01925f9da1cb966239ee49d5c84e3:
lttng-tools: Disable on qemuriscv32 (2022-09-26 15:08:32 +0100)
are available in the Git repository at:
https://github.com/BadgerTechnologies/openembedded-core fix-wantedby-clearing
https://github.com/BadgerTechnologies/openembedded-core/tree/fix-wantedby-clearing
Bob Henz (1):
Fix WantedBy processing
meta/recipes-core/systemd/systemd-systemctl/systemctl | 11 +++++++++++ 1 file changed, 11 insertions(+)
Signature · 1 line
2.25.1
From b637a46f58b5adc7dcc76bdef90a7be8c8462df8 Mon Sep 17 00:00:00 2001
Message-Id: <b637a46f58b5adc7dcc76bdef90a7be8c8462df8.1664240081.git.robert_henz@jabil.com>
In-Reply-To: <[email protected]>
References: <[email protected]>
From: Bob Henz <[email protected]>
Date: Mon, 19 Sep 2022 22:02:58 -0400
Subject: [PATCH 1/1] Fix WantedBy processing
An empty string assignment to WantedBy should clear all prior WantedBy settings. This matches behavior of the current systemd implementation.
--- meta/recipes-core/systemd/systemd-systemctl/systemctl | 11 +++++++++++ 1 file changed, 11 insertions(+)
meta/recipes-core/systemd/systemd-systemctl/systemctl +11 -0
@@ -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):
Signature · 1 line
2.25.1
Quoted 1 line
I still can't send the resulting two files via git send-email (the final
step), as I would have to do a significant amount of configuration in my _personal_ gmail account in order to use git send-email to send the final patch.
FWIW: I'm also using my gmail account and the configuration was quite simple, install msmtp, create app password in google security settings, write it in ~/.msmtprc and git send-email works fine (the only issue is that I'm seeing each sent e-mail twice, once as sent by me and once the same e-mail received through ML).
Regards,
Quoted 24 lines · Robert Henz via lists.openembedded.org
I have confirmed your patch worked for me. Perhaps the documentation should also be updated to indicate that remotes need to be cloned/added using the https protocol?
I still can't send the resulting two files via git send-email (the final step), as I would have to do a significant amount of configuration in my _personal_ gmail account in order to use git send-email to send the final patch. I will attach the resulting two files here and perhaps that will be sufficient for someone to begin reviewing my actual PR.
Thanks,
Bob-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#171081):
https://lists.openembedded.org/g/openembedded-core/message/171081
Mute This Topic: https://lists.openembedded.org/mt/93809846/3617156
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Just use git-send-email directly, for a simple patch you don’t need the overhead of create-pull-request.
Ross
From: [email protected] <[email protected]> on behalf of Robert Henz via lists.openembedded.org <[email protected]>
Date: Tuesday, 27 September 2022 at 10:53
To: [email protected] <[email protected]>
Subject: Re: [OE-core] PR to fix WantedBy parsing of systemctl
I think I'm missing some context. Not really understanding what this script is trying to accomplish I don't know what "remote branch" is vs "local branch". Should "remote branch" be "master" and the local branch be the branch with the change I want to make? Here's that script running with "set -x" turned on 1/2 way through...
bobhenz@hound:~/src/openembedded-core$ scripts/create-pull-request -u badger + USER_RE=[A-Za-z0-9_.@][A-Za-z0-9_.@-]*$\? + PROTO_RE=[a-z][a-z+]*:// + GIT_RE=\(^\([a-z][a-z+]*://\)\?\)\([A-Za-z0-9_.@][A-Za-z0-9_.@-]*$\?@\)\?\([^:/]*\)[:/]\(.*\) + REMOTE_URL=https://github.com/BadgerTechnologies/openembedded-core + echo https://github.com/BadgerTechnologies/openembedded-core + sed s#\(^\([a-z][a-z+]*://\)\?\)\([A-Za-z0-9_.@][A-Za-z0-9_.@-]*$\?@\)\?\([^:/]*\)[:/]\(.*\)#\5# + REMOTE_REPO=BadgerTechnologies/openembedded-core + echo https://github.com/BadgerTechnologies/openembedded-core + sed s#\(^\([a-z][a-z+]*://\)\?\)\([A-Za-z0-9_.@][A-Za-z0-9_.@-]*$\?@\)\?\([^:/]*\)[:/]\(.*\)#git://\4/\5# + REMOTE_URL=git://github.com/BadgerTechnologies/openembedded-core + [ -z ] + git branch + grep -e ^\* + cut -d -f2 + BRANCH=fix-wantedby-clearing + echo NOTE: Assuming remote branch 'fix-wantedby-clearing', use -b to override. NOTE: Assuming remote branch 'fix-wantedby-clearing', use -b to override. + [ -z ] + L_BRANCH=HEAD + echo NOTE: Assuming local branch HEAD, use -l to override. NOTE: Assuming local branch HEAD, use -l to override. + [ 0 -eq 1 ] + WEB_URL= + WEB_URL=https://github.com/BadgerTechnologies/openembedded-core/tree/fix-wantedby-clearing + [ -n https://github.com/BadgerTechnologies/openembedded-core/tree/fix-wantedby-clearing ] + [ = 1 ] + wget --no-check-certificate -q https://github.com/BadgerTechnologies/openembedded-core/tree/fix-wantedby-clearing -O /dev/null + [ 0 -ne 0 ] + [ -e pull-186156 ] + mkdir pull-186156 + [ -n ] + git format-patch -M40 --subject-prefix=PATCH -n -o pull-186156 --thread=shallow --cover-letter master..HEAD + ls -A pull-186156 + [ -z 0000-cover-letter.patch 0001-Fix-WantedBy-processing.patch ] + [ -n ] + echo pull-186156/0000-cover-letter.patch + CL=pull-186156/0000-cover-letter.patch + PM=pull-186156/pull-msg + + trgit -d --version [:alpha:][:space:]. + sed s/\(...\).*/\1/ + git version 2.25.1 + GIT_VERSION=225 + NEWER_GIT_VERSION=210 + [ 225 -lt 210 ] + git request-pull master git://github.com/BadgerTechnologies/openembedded-core HEAD:fix-wantedby-clearing fatal: unable to connect to github.com: github.com[0: 140.82.113.3]: 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?
+ [ 1 -ne 0 ]
+ echo ERROR: git request-pull reported an error
ERROR: git request-pull reported an error
+ rm -rf pull-186156
+ exit 1
Ross,
I was trying to use the Pull Request method because originally I thought it would mean I didn't have to use git send-email. Now, of course, I realize that it's just some helpful wrapper scripts around using git send-email. :-(
I'll make you all a deal. When you all update your documentation ( https://www.openembedded.org/wiki/How_to_submit_a_patch_to_OpenEmbedded ) to include the procedure for setting up my personal gmail account to allow git send-email to work from my work laptop, I'll do it and submit my patch that way.
The accepted answer here seems overly complex but probably (mostly?) correct and a little scathing of this entire process so might not be where you want people trying to help with your project to have to read through: https://stackoverflow.com/questions/68238912/how-to-configure-and-use-git-send-email-to-work-with-gmail-to-email-patches-to
Quoted 2 lines · Robert Henz via lists.openembedded.org
I'll make you all a deal. When you all update your documentation (https://www.openembedded.org/wiki/How_to_submit_a_patch_to_OpenEmbedded) to include the procedure for setting up my personal gmail account to allow git send-email to work from my work laptop, I'll do it and submit my patch that way.
We’re not going to expand the wiki to cover how to setup git-send-email for every email server.
If your MTA (like GMail) needs authenticated SMTP, then you need the password. If your MTA uses 2FA (like GMail) then you typically need an application password. Generating this is step 2 of that SO page you linked to, although the use of git-credentials is overkill as you can just tell git the password the same way you tell it what sever to use.
[sendemail]
from = Ross Burton <[email protected]>
smtpserver = smtp.gmail.com
smtpuser = ...
smtppass = …
Ross
Quoted 7 lines · Robert Henz via lists.openembedded.org
Quoted 4 lines
Quoted 2 lines
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...
You are singing of on the DCO:
https://en.wikipedia.org/wiki/Developer_Certificate_of_Origin
Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com