diff mbox series

[4/6] weston-init: fix the mixed indentation

Message ID 20230610011339.3716428-5-rs@ti.com
State New
Headers show
Series weston-init: add extra config for weston global socket | expand

Commit Message

Randolph Sapp June 10, 2023, 1:13 a.m. UTC
From: Randolph Sapp <rs@ti.com>

I know my text editor is going to get angry at me if this continues.

Signed-off-by: Randolph Sapp <rs@ti.com>
---
 meta/recipes-graphics/wayland/weston-init.bb | 76 ++++++++++----------
 1 file changed, 38 insertions(+), 38 deletions(-)

Comments

Peter Kjellerstedt June 11, 2023, 9:25 p.m. UTC | #1
> -----Original Message-----
> From: openembedded-core@lists.openembedded.org <openembedded-core@lists.openembedded.org> On Behalf Of Randolph Sapp via lists.openembedded.org
> Sent: den 10 juni 2023 03:14
> To: richard.purdie@linuxfoundation.org; reatmon@ti.com; denis@denix.org; alexandre.belloni@bootlin.com
> Cc: openembedded-core@lists.openembedded.org; Randolph Sapp <rs@ti.com>
> Subject: [OE-core][PATCH 4/6] weston-init: fix the mixed indentation

AFAIK, the official standard for OE-Core is to use tabs for indentation 
of shell code, and four spaces for Python code and bitbake variables.
(But beware, other layers may use different standards, e.g., 
meta-openembedded uses four spaces for everything.)

> 
> From: Randolph Sapp <rs@ti.com>
> 
> I know my text editor is going to get angry at me if this continues.

Get a better editor. ;) At least for Emacs there is a bitbake-mode that 
supports the different ways of indenting shell and Python code in the 
same recipe.

> 
> Signed-off-by: Randolph Sapp <rs@ti.com>
> ---
>  meta/recipes-graphics/wayland/weston-init.bb | 76 ++++++++++----------
>  1 file changed, 38 insertions(+), 38 deletions(-)
> 
> diff --git a/meta/recipes-graphics/wayland/weston-init.bb b/meta/recipes-
> graphics/wayland/weston-init.bb
> index 4fa302c833..01abd4ce78 100644
> --- a/meta/recipes-graphics/wayland/weston-init.bb
> +++ b/meta/recipes-graphics/wayland/weston-init.bb
> @@ -26,44 +26,44 @@ DEFAULTBACKEND ??= ""
>  DEFAULTBACKEND:qemuall ?= "drm"
> 
>  do_install() {
> -        if [ "${VIRTUAL-RUNTIME_init_manager}" != "systemd" ]; then
> -		install -Dm755 ${WORKDIR}/init ${D}/${sysconfdir}/init.d/weston
> -		sed -i 's#ROOTHOME#${ROOT_HOME}#' ${D}/${sysconfdir}/init.d/weston
> -        fi
> -	install -D -p -m0644 ${WORKDIR}/weston.ini ${D}${sysconfdir}/xdg/weston/weston.ini
> -	install -Dm644 ${WORKDIR}/weston.env ${D}${sysconfdir}/default/weston
> -
> -	# Install Weston systemd service and accompanying udev rule
> -	install -D -p -m0644 ${WORKDIR}/weston.service ${D}${systemd_system_unitdir}/weston.service
> -	install -D -p -m0644 ${WORKDIR}/weston.socket ${D}${systemd_system_unitdir}/weston.socket
> -        if [ "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)}" ]; then
> -		install -D -p -m0644 ${WORKDIR}/weston-autologin ${D}${sysconfdir}/pam.d/weston-autologin
> -        fi
> -	sed -i -e s:/etc:${sysconfdir}:g \
> -		-e s:/usr/bin:${bindir}:g \
> -		-e s:/var:${localstatedir}:g \
> -		${D}${systemd_system_unitdir}/weston.service
> -	# Install weston-start script
> -	install -Dm755 ${WORKDIR}/weston-start ${D}${bindir}/weston-start
> -	sed -i 's,@DATADIR@,${datadir},g' ${D}${bindir}/weston-start
> -	sed -i 's,@LOCALSTATEDIR@,${localstatedir},g' ${D}${bindir}/weston-start
> -        if [ -n "${DEFAULTBACKEND}" ]; then
> -		sed -i -e "/^\[core\]/a backend=${DEFAULTBACKEND}-backend.so" ${D}${sysconfdir}/xdg/weston/weston.ini
> -	fi
> -
> -	if [ "${@bb.utils.contains('PACKAGECONFIG', 'xwayland', 'yes', 'no', d)}" = "yes" ]; then
> -		sed -i -e "/^\[core\]/a xwayland=true" ${D}${sysconfdir}/xdg/weston/weston.ini
> -	fi
> -
> -	if [ "${@bb.utils.contains('PACKAGECONFIG', 'no-idle-timeout', 'yes', 'no', d)}" = "yes" ]; then
> -		sed -i -e "/^\[core\]/a idle-time=0" ${D}${sysconfdir}/xdg/weston/weston.ini
> -	fi
> -
> -	if [ "${@bb.utils.contains('PACKAGECONFIG', 'use-pixman', 'yes', 'no', d)}" = "yes" ]; then
> -		sed -i -e "/^\[core\]/a use-pixman=true" ${D}${sysconfdir}/xdg/weston/weston.ini
> -	fi
> -
> -	install -dm 755 -o weston -g weston ${D}/home/weston
> +    if [ "${VIRTUAL-RUNTIME_init_manager}" != "systemd" ]; then
> +        install -Dm755 ${WORKDIR}/init ${D}/${sysconfdir}/init.d/weston
> +        sed -i 's#ROOTHOME#${ROOT_HOME}#' ${D}/${sysconfdir}/init.d/weston
> +    fi
> +    install -D -p -m0644 ${WORKDIR}/weston.ini ${D}${sysconfdir}/xdg/weston/weston.ini
> +    install -Dm644 ${WORKDIR}/weston.env ${D}${sysconfdir}/default/weston
> +
> +    # Install Weston systemd service and accompanying udev rule
> +    install -D -p -m0644 ${WORKDIR}/weston.service ${D}${systemd_system_unitdir}/weston.service
> +    install -D -p -m0644 ${WORKDIR}/weston.socket ${D}${systemd_system_unitdir}/weston.socket
> +    if [ "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)}" ]; then
> +        install -D -p -m0644 ${WORKDIR}/weston-autologin ${D}${sysconfdir}/pam.d/weston-autologin
> +    fi
> +    sed -i -e s:/etc:${sysconfdir}:g \
> +        -e s:/usr/bin:${bindir}:g \
> +        -e s:/var:${localstatedir}:g \
> +        ${D}${systemd_system_unitdir}/weston.service
> +    # Install weston-start script
> +    install -Dm755 ${WORKDIR}/weston-start ${D}${bindir}/weston-start
> +    sed -i 's,@DATADIR@,${datadir},g' ${D}${bindir}/weston-start
> +    sed -i 's,@LOCALSTATEDIR@,${localstatedir},g' ${D}${bindir}/weston-start
> +    if [ -n "${DEFAULTBACKEND}" ]; then
> +        sed -i -e "/^\[core\]/a backend=${DEFAULTBACKEND}-backend.so" ${D}${sysconfdir}/xdg/weston/weston.ini
> +    fi
> +
> +    if [ "${@bb.utils.contains('PACKAGECONFIG', 'xwayland', 'yes', 'no', d)}" = "yes" ]; then
> +        sed -i -e "/^\[core\]/a xwayland=true" ${D}${sysconfdir}/xdg/weston/weston.ini
> +    fi
> +
> +    if [ "${@bb.utils.contains('PACKAGECONFIG', 'no-idle-timeout', 'yes', 'no', d)}" = "yes" ]; then
> +        sed -i -e "/^\[core\]/a idle-time=0" ${D}${sysconfdir}/xdg/weston/weston.ini
> +    fi
> +
> +    if [ "${@bb.utils.contains('PACKAGECONFIG', 'use-pixman', 'yes', 'no', d)}" = "yes" ]; then
> +        sed -i -e "/^\[core\]/a use-pixman=true" ${D}${sysconfdir}/xdg/weston/weston.ini
> +    fi
> +
> +    install -dm 755 -o weston -g weston ${D}/home/weston
>  }
> 
>  INHIBIT_UPDATERCD_BBCLASS = "${@oe.utils.conditional('VIRTUAL-RUNTIME_init_manager', 'systemd', '1', '', d)}"
> --
> 2.41.0

//Peter
Alexander Kanavin June 12, 2023, 9:19 a.m. UTC | #2
On Sun, 11 Jun 2023 at 23:25, Peter Kjellerstedt
<peter.kjellerstedt@axis.com> wrote:
> > I know my text editor is going to get angry at me if this continues.
>
> Get a better editor. ;) At least for Emacs there is a bitbake-mode that
> supports the different ways of indenting shell and Python code in the
> same recipe.

Or we can stop caring about indentation, as long as it's consistent
with what is already there, and doesn't get in the way of reviewing
patches. That's my preferred option, and has been for the past 25
years.

Alex
Peter Kjellerstedt June 12, 2023, 9:58 a.m. UTC | #3
> -----Original Message-----
> From: Alexander Kanavin <alex.kanavin@gmail.com>
> Sent: den 12 juni 2023 11:19
> To: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
> Cc: rs@ti.com; richard.purdie@linuxfoundation.org; reatmon@ti.com;
> denis@denix.org; alexandre.belloni@bootlin.com; openembedded-
> core@lists.openembedded.org
> Subject: Re: [OE-core][PATCH 4/6] weston-init: fix the mixed indentation
> 
> On Sun, 11 Jun 2023 at 23:25, Peter Kjellerstedt
> <peter.kjellerstedt@axis.com> wrote:
> > > I know my text editor is going to get angry at me if this continues.
> >
> > Get a better editor. ;) At least for Emacs there is a bitbake-mode that
> > supports the different ways of indenting shell and Python code in the
> > same recipe.
> 
> Or we can stop caring about indentation, as long as it's consistent
> with what is already there, and doesn't get in the way of reviewing
> patches. That's my preferred option, and has been for the past 25
> years.
> 
> Alex

Well that is of course an option, but then it may get messy if different 
people have different preferences and start changing the indentation back 
and forth...

//Peter
Alexander Kanavin June 12, 2023, 10:05 a.m. UTC | #4
On Mon, 12 Jun 2023 at 11:58, Peter Kjellerstedt
<peter.kjellerstedt@axis.com> wrote:
> Well that is of course an option, but then it may get messy if different
> people have different preferences and start changing the indentation back
> and forth...

I suppose changing indentation needs to be justified by for example
achieving consistency in the same code block (as it does here, which
is fine), and it never should be mixed in with functional changes.
What I don't want is lots of empty code churn that doesn't actually
make things more readable than they already were, and is more or less
an exercise in pedantic neat freakery.

Alex
Randolph Sapp June 12, 2023, 7:46 p.m. UTC | #5
On 6/12/23 05:05, Alexander Kanavin wrote:
> On Mon, 12 Jun 2023 at 11:58, Peter Kjellerstedt
> <peter.kjellerstedt@axis.com> wrote:
>> Well that is of course an option, but then it may get messy if different
>> people have different preferences and start changing the indentation back
>> and forth...
> 
> I suppose changing indentation needs to be justified by for example
> achieving consistency in the same code block (as it does here, which
> is fine), and it never should be mixed in with functional changes.
> What I don't want is lots of empty code churn that doesn't actually
> make things more readable than they already were, and is more or less
> an exercise in pedantic neat freakery.
> 
> Alex

I frankly don't like the concept of mixed indentation in the same file, 
let alone the same code block. The only thing really driving me to 
change it here was the lack of git attributes to define the project 
standard, nvim is attempting to enforce the 4 space standard from python 
over the entirety of bitbake recipes (which I think is fairly sane), and 
the variance of standard in this code block.

I have no preference. So long as there is a standard, I will bow to it.

Randolph
Randolph Sapp June 14, 2023, 1:16 a.m. UTC | #6
On 6/12/23 14:46, Randolph Sapp via lists.openembedded.org wrote:
> On 6/12/23 05:05, Alexander Kanavin wrote:
>> On Mon, 12 Jun 2023 at 11:58, Peter Kjellerstedt
>> <peter.kjellerstedt@axis.com> wrote:
>>> Well that is of course an option, but then it may get messy if different
>>> people have different preferences and start changing the indentation 
>>> back
>>> and forth...
>>
>> I suppose changing indentation needs to be justified by for example
>> achieving consistency in the same code block (as it does here, which
>> is fine), and it never should be mixed in with functional changes.
>> What I don't want is lots of empty code churn that doesn't actually
>> make things more readable than they already were, and is more or less
>> an exercise in pedantic neat freakery.
>>
>> Alex
> 
> I frankly don't like the concept of mixed indentation in the same file, 
> let alone the same code block. The only thing really driving me to 
> change it here was the lack of git attributes to define the project 
> standard, nvim is attempting to enforce the 4 space standard from python 
> over the entirety of bitbake recipes (which I think is fairly sane), and 
> the variance of standard in this code block.
> 
> I have no preference. So long as there is a standard, I will bow to it.
> 
> Randolph
> 

I noticed master didn't pick up any patches past this one. I take it you 
want me to reformat this to the current tab shell block standard?
Alexander Kanavin June 14, 2023, 5:57 a.m. UTC | #7
On Wed, 14 Jun 2023 at 03:16, Randolph Sapp <rs@ti.com> wrote:

> I noticed master didn't pick up any patches past this one. I take it you
> want me to reformat this to the current tab shell block standard?

The remaining patches are still in the staging branch:
https://git.yoctoproject.org/poky-contrib/log/?h=abelloni/master-next

If they're dropped from it, there'll be a separate email explaining what to do.

Alex
Richard Purdie June 14, 2023, 8:08 a.m. UTC | #8
On Tue, 2023-06-13 at 20:16 -0500, Randolph Sapp wrote:
> On 6/12/23 14:46, Randolph Sapp via lists.openembedded.org wrote:
> > On 6/12/23 05:05, Alexander Kanavin wrote:
> > > On Mon, 12 Jun 2023 at 11:58, Peter Kjellerstedt
> > > <peter.kjellerstedt@axis.com> wrote:
> > > > Well that is of course an option, but then it may get messy if different
> > > > people have different preferences and start changing the indentation 
> > > > back
> > > > and forth...
> > > 
> > > I suppose changing indentation needs to be justified by for example
> > > achieving consistency in the same code block (as it does here, which
> > > is fine), and it never should be mixed in with functional changes.
> > > What I don't want is lots of empty code churn that doesn't actually
> > > make things more readable than they already were, and is more or less
> > > an exercise in pedantic neat freakery.
> > > 
> > > Alex
> > 
> > I frankly don't like the concept of mixed indentation in the same file, 
> > let alone the same code block. The only thing really driving me to 
> > change it here was the lack of git attributes to define the project 
> > standard, nvim is attempting to enforce the 4 space standard from python 
> > over the entirety of bitbake recipes (which I think is fairly sane), and 
> > the variance of standard in this code block.
> > 
> > I have no preference. So long as there is a standard, I will bow to it.
> > 
> > Randolph
> > 
> 
> I noticed master didn't pick up any patches past this one. I take it you 
> want me to reformat this to the current tab shell block standard?

Yes please. I stopped there since at least at a quick glance it looked
mostly tab indented and this changed it to space which breaks the code
standard for oe-core. Whether we want to change that isn't something I
have the time/energy to get into right now. If I take it, I'm opening
the gates to many more such changes. There are views on both sides and
people get upset about various aspects of it, me included.

Cheers,

Richard
Randolph Sapp June 14, 2023, 3:11 p.m. UTC | #9
On 6/14/23 03:08, Richard Purdie wrote:
> On Tue, 2023-06-13 at 20:16 -0500, Randolph Sapp wrote:
>> On 6/12/23 14:46, Randolph Sapp via lists.openembedded.org wrote:
>>> On 6/12/23 05:05, Alexander Kanavin wrote:
>>>> On Mon, 12 Jun 2023 at 11:58, Peter Kjellerstedt
>>>> <peter.kjellerstedt@axis.com> wrote:
>>>>> Well that is of course an option, but then it may get messy if different
>>>>> people have different preferences and start changing the indentation
>>>>> back
>>>>> and forth...
>>>>
>>>> I suppose changing indentation needs to be justified by for example
>>>> achieving consistency in the same code block (as it does here, which
>>>> is fine), and it never should be mixed in with functional changes.
>>>> What I don't want is lots of empty code churn that doesn't actually
>>>> make things more readable than they already were, and is more or less
>>>> an exercise in pedantic neat freakery.
>>>>
>>>> Alex
>>>
>>> I frankly don't like the concept of mixed indentation in the same file,
>>> let alone the same code block. The only thing really driving me to
>>> change it here was the lack of git attributes to define the project
>>> standard, nvim is attempting to enforce the 4 space standard from python
>>> over the entirety of bitbake recipes (which I think is fairly sane), and
>>> the variance of standard in this code block.
>>>
>>> I have no preference. So long as there is a standard, I will bow to it.
>>>
>>> Randolph
>>>
>>
>> I noticed master didn't pick up any patches past this one. I take it you
>> want me to reformat this to the current tab shell block standard?
> 
> Yes please. I stopped there since at least at a quick glance it looked
> mostly tab indented and this changed it to space which breaks the code
> standard for oe-core. Whether we want to change that isn't something I
> have the time/energy to get into right now. If I take it, I'm opening
> the gates to many more such changes. There are views on both sides and
> people get upset about various aspects of it, me included.
> 
> Cheers,
> 
> Richard
> 

Alright. I'll fix this up and resubmit.
diff mbox series

Patch

diff --git a/meta/recipes-graphics/wayland/weston-init.bb b/meta/recipes-graphics/wayland/weston-init.bb
index 4fa302c833..01abd4ce78 100644
--- a/meta/recipes-graphics/wayland/weston-init.bb
+++ b/meta/recipes-graphics/wayland/weston-init.bb
@@ -26,44 +26,44 @@  DEFAULTBACKEND ??= ""
 DEFAULTBACKEND:qemuall ?= "drm"
 
 do_install() {
-        if [ "${VIRTUAL-RUNTIME_init_manager}" != "systemd" ]; then
-		install -Dm755 ${WORKDIR}/init ${D}/${sysconfdir}/init.d/weston
-		sed -i 's#ROOTHOME#${ROOT_HOME}#' ${D}/${sysconfdir}/init.d/weston
-        fi
-	install -D -p -m0644 ${WORKDIR}/weston.ini ${D}${sysconfdir}/xdg/weston/weston.ini
-	install -Dm644 ${WORKDIR}/weston.env ${D}${sysconfdir}/default/weston
-
-	# Install Weston systemd service and accompanying udev rule
-	install -D -p -m0644 ${WORKDIR}/weston.service ${D}${systemd_system_unitdir}/weston.service
-	install -D -p -m0644 ${WORKDIR}/weston.socket ${D}${systemd_system_unitdir}/weston.socket
-        if [ "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)}" ]; then
-		install -D -p -m0644 ${WORKDIR}/weston-autologin ${D}${sysconfdir}/pam.d/weston-autologin
-        fi
-	sed -i -e s:/etc:${sysconfdir}:g \
-		-e s:/usr/bin:${bindir}:g \
-		-e s:/var:${localstatedir}:g \
-		${D}${systemd_system_unitdir}/weston.service
-	# Install weston-start script
-	install -Dm755 ${WORKDIR}/weston-start ${D}${bindir}/weston-start
-	sed -i 's,@DATADIR@,${datadir},g' ${D}${bindir}/weston-start
-	sed -i 's,@LOCALSTATEDIR@,${localstatedir},g' ${D}${bindir}/weston-start
-        if [ -n "${DEFAULTBACKEND}" ]; then
-		sed -i -e "/^\[core\]/a backend=${DEFAULTBACKEND}-backend.so" ${D}${sysconfdir}/xdg/weston/weston.ini
-	fi
-
-	if [ "${@bb.utils.contains('PACKAGECONFIG', 'xwayland', 'yes', 'no', d)}" = "yes" ]; then
-		sed -i -e "/^\[core\]/a xwayland=true" ${D}${sysconfdir}/xdg/weston/weston.ini
-	fi
-
-	if [ "${@bb.utils.contains('PACKAGECONFIG', 'no-idle-timeout', 'yes', 'no', d)}" = "yes" ]; then
-		sed -i -e "/^\[core\]/a idle-time=0" ${D}${sysconfdir}/xdg/weston/weston.ini
-	fi
-
-	if [ "${@bb.utils.contains('PACKAGECONFIG', 'use-pixman', 'yes', 'no', d)}" = "yes" ]; then
-		sed -i -e "/^\[core\]/a use-pixman=true" ${D}${sysconfdir}/xdg/weston/weston.ini
-	fi
-
-	install -dm 755 -o weston -g weston ${D}/home/weston
+    if [ "${VIRTUAL-RUNTIME_init_manager}" != "systemd" ]; then
+        install -Dm755 ${WORKDIR}/init ${D}/${sysconfdir}/init.d/weston
+        sed -i 's#ROOTHOME#${ROOT_HOME}#' ${D}/${sysconfdir}/init.d/weston
+    fi
+    install -D -p -m0644 ${WORKDIR}/weston.ini ${D}${sysconfdir}/xdg/weston/weston.ini
+    install -Dm644 ${WORKDIR}/weston.env ${D}${sysconfdir}/default/weston
+
+    # Install Weston systemd service and accompanying udev rule
+    install -D -p -m0644 ${WORKDIR}/weston.service ${D}${systemd_system_unitdir}/weston.service
+    install -D -p -m0644 ${WORKDIR}/weston.socket ${D}${systemd_system_unitdir}/weston.socket
+    if [ "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)}" ]; then
+        install -D -p -m0644 ${WORKDIR}/weston-autologin ${D}${sysconfdir}/pam.d/weston-autologin
+    fi
+    sed -i -e s:/etc:${sysconfdir}:g \
+        -e s:/usr/bin:${bindir}:g \
+        -e s:/var:${localstatedir}:g \
+        ${D}${systemd_system_unitdir}/weston.service
+    # Install weston-start script
+    install -Dm755 ${WORKDIR}/weston-start ${D}${bindir}/weston-start
+    sed -i 's,@DATADIR@,${datadir},g' ${D}${bindir}/weston-start
+    sed -i 's,@LOCALSTATEDIR@,${localstatedir},g' ${D}${bindir}/weston-start
+    if [ -n "${DEFAULTBACKEND}" ]; then
+        sed -i -e "/^\[core\]/a backend=${DEFAULTBACKEND}-backend.so" ${D}${sysconfdir}/xdg/weston/weston.ini
+    fi
+
+    if [ "${@bb.utils.contains('PACKAGECONFIG', 'xwayland', 'yes', 'no', d)}" = "yes" ]; then
+        sed -i -e "/^\[core\]/a xwayland=true" ${D}${sysconfdir}/xdg/weston/weston.ini
+    fi
+
+    if [ "${@bb.utils.contains('PACKAGECONFIG', 'no-idle-timeout', 'yes', 'no', d)}" = "yes" ]; then
+        sed -i -e "/^\[core\]/a idle-time=0" ${D}${sysconfdir}/xdg/weston/weston.ini
+    fi
+
+    if [ "${@bb.utils.contains('PACKAGECONFIG', 'use-pixman', 'yes', 'no', d)}" = "yes" ]; then
+        sed -i -e "/^\[core\]/a use-pixman=true" ${D}${sysconfdir}/xdg/weston/weston.ini
+    fi
+
+    install -dm 755 -o weston -g weston ${D}/home/weston
 }
 
 INHIBIT_UPDATERCD_BBCLASS = "${@oe.utils.conditional('VIRTUAL-RUNTIME_init_manager', 'systemd', '1', '', d)}"