All of lore.kernel.org
 help / color / mirror / Atom feed
* [OE-core][PATCH 0/6] weston-init: add extra config for weston global socket
@ 2023-06-10  1:13 rs
  2023-06-10  1:13 ` [OE-core][PATCH 1/6] weston-init: make sure the render group exists rs
                   ` (5 more replies)
  0 siblings, 6 replies; 16+ messages in thread
From: rs @ 2023-06-10  1:13 UTC (permalink / raw)
  To: richard.purdie, reatmon, denis, alexandre.belloni
  Cc: openembedded-core, Randolph Sapp

From: Randolph Sapp <rs@ti.com>

Cleaning up some parts of weston-init, adding guards to systemd init
scripts, making sure users are in the correct groups for interacting
with graphics devices and finally attempting to help direct users to the
global Wayland socket when they are allowed to interact with it.

The only functional change here is the addition of a profile script that
checks if the user is in the correct group to interact with the global
systemd socket at /run/wayland-0; if they are, then we set
WAYLAND_DISPLAY to point to that socket directly.

Randolph Sapp (6):
  weston-init: make sure the render group exists
  weston-init: add weston user to the render group
  weston-init: add the weston user to the wayland group
  weston-init: fix the mixed indentation
  weston-init: guard against systemd configs
  weston-init: add profile to point users to global socket

 meta/recipes-graphics/wayland/weston-init.bb  | 88 ++++++++++---------
 .../wayland/weston-init/weston-socket.sh      | 20 +++++
 2 files changed, 68 insertions(+), 40 deletions(-)
 create mode 100755 meta/recipes-graphics/wayland/weston-init/weston-socket.sh

-- 
2.41.0



^ permalink raw reply	[flat|nested] 16+ messages in thread

* [OE-core][PATCH 1/6] weston-init: make sure the render group exists
  2023-06-10  1:13 [OE-core][PATCH 0/6] weston-init: add extra config for weston global socket rs
@ 2023-06-10  1:13 ` rs
  2023-06-10  1:13 ` [OE-core][PATCH 2/6] weston-init: add weston user to the render group rs
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 16+ messages in thread
From: rs @ 2023-06-10  1:13 UTC (permalink / raw)
  To: richard.purdie, reatmon, denis, alexandre.belloni
  Cc: openembedded-core, Randolph Sapp

From: Randolph Sapp <rs@ti.com>

Add the render group explicitly here to make sure it exists for the
useradd command.

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

diff --git a/meta/recipes-graphics/wayland/weston-init.bb b/meta/recipes-graphics/wayland/weston-init.bb
index a7adce7fda..b637fa6a4a 100644
--- a/meta/recipes-graphics/wayland/weston-init.bb
+++ b/meta/recipes-graphics/wayland/weston-init.bb
@@ -94,5 +94,5 @@ CONFFILES:${PN} += "${sysconfdir}/xdg/weston/weston.ini ${sysconfdir}/default/we
 
 SYSTEMD_SERVICE:${PN} = "weston.service weston.socket"
 USERADD_PARAM:${PN} = "--home /home/weston --shell /bin/sh --user-group -G video,input weston"
-GROUPADD_PARAM:${PN} = "-r wayland"
+GROUPADD_PARAM:${PN} = "-r wayland; -r render"
 
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [OE-core][PATCH 2/6] weston-init: add weston user to the render group
  2023-06-10  1:13 [OE-core][PATCH 0/6] weston-init: add extra config for weston global socket rs
  2023-06-10  1:13 ` [OE-core][PATCH 1/6] weston-init: make sure the render group exists rs
@ 2023-06-10  1:13 ` rs
  2023-06-10  1:13 ` [OE-core][PATCH 3/6] weston-init: add the weston user to the wayland group rs
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 16+ messages in thread
From: rs @ 2023-06-10  1:13 UTC (permalink / raw)
  To: richard.purdie, reatmon, denis, alexandre.belloni
  Cc: openembedded-core, Randolph Sapp

From: Randolph Sapp <rs@ti.com>

The weston user must be in the render group in order to access render
device nodes for standard user-space graphics.

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

diff --git a/meta/recipes-graphics/wayland/weston-init.bb b/meta/recipes-graphics/wayland/weston-init.bb
index b637fa6a4a..6d62993d7d 100644
--- a/meta/recipes-graphics/wayland/weston-init.bb
+++ b/meta/recipes-graphics/wayland/weston-init.bb
@@ -93,6 +93,6 @@ FILES:${PN} += "\
 CONFFILES:${PN} += "${sysconfdir}/xdg/weston/weston.ini ${sysconfdir}/default/weston"
 
 SYSTEMD_SERVICE:${PN} = "weston.service weston.socket"
-USERADD_PARAM:${PN} = "--home /home/weston --shell /bin/sh --user-group -G video,input weston"
+USERADD_PARAM:${PN} = "--home /home/weston --shell /bin/sh --user-group -G video,input,render weston"
 GROUPADD_PARAM:${PN} = "-r wayland; -r render"
 
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [OE-core][PATCH 3/6] weston-init: add the weston user to the wayland group
  2023-06-10  1:13 [OE-core][PATCH 0/6] weston-init: add extra config for weston global socket rs
  2023-06-10  1:13 ` [OE-core][PATCH 1/6] weston-init: make sure the render group exists rs
  2023-06-10  1:13 ` [OE-core][PATCH 2/6] weston-init: add weston user to the render group rs
@ 2023-06-10  1:13 ` rs
  2023-06-10  1:13 ` [OE-core][PATCH 4/6] weston-init: fix the mixed indentation rs
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 16+ messages in thread
From: rs @ 2023-06-10  1:13 UTC (permalink / raw)
  To: richard.purdie, reatmon, denis, alexandre.belloni
  Cc: openembedded-core, Randolph Sapp

From: Randolph Sapp <rs@ti.com>

Add the weston user to the wayland group so all users accessing the
global weston socket in /run all share a group.

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

diff --git a/meta/recipes-graphics/wayland/weston-init.bb b/meta/recipes-graphics/wayland/weston-init.bb
index 6d62993d7d..4fa302c833 100644
--- a/meta/recipes-graphics/wayland/weston-init.bb
+++ b/meta/recipes-graphics/wayland/weston-init.bb
@@ -93,6 +93,6 @@ FILES:${PN} += "\
 CONFFILES:${PN} += "${sysconfdir}/xdg/weston/weston.ini ${sysconfdir}/default/weston"
 
 SYSTEMD_SERVICE:${PN} = "weston.service weston.socket"
-USERADD_PARAM:${PN} = "--home /home/weston --shell /bin/sh --user-group -G video,input,render weston"
+USERADD_PARAM:${PN} = "--home /home/weston --shell /bin/sh --user-group -G video,input,render,wayland weston"
 GROUPADD_PARAM:${PN} = "-r wayland; -r render"
 
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [OE-core][PATCH 4/6] weston-init: fix the mixed indentation
  2023-06-10  1:13 [OE-core][PATCH 0/6] weston-init: add extra config for weston global socket rs
                   ` (2 preceding siblings ...)
  2023-06-10  1:13 ` [OE-core][PATCH 3/6] weston-init: add the weston user to the wayland group rs
@ 2023-06-10  1:13 ` rs
  2023-06-11 21:25   ` Peter Kjellerstedt
  2023-06-10  1:13 ` [OE-core][PATCH 5/6] weston-init: guard against systemd configs rs
  2023-06-10  1:13 ` [OE-core][PATCH 6/6] weston-init: add profile to point users to global socket rs
  5 siblings, 1 reply; 16+ messages in thread
From: rs @ 2023-06-10  1:13 UTC (permalink / raw)
  To: richard.purdie, reatmon, denis, alexandre.belloni
  Cc: openembedded-core, Randolph Sapp

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(-)

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



^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [OE-core][PATCH 5/6] weston-init: guard against systemd configs
  2023-06-10  1:13 [OE-core][PATCH 0/6] weston-init: add extra config for weston global socket rs
                   ` (3 preceding siblings ...)
  2023-06-10  1:13 ` [OE-core][PATCH 4/6] weston-init: fix the mixed indentation rs
@ 2023-06-10  1:13 ` rs
  2023-06-10  1:13 ` [OE-core][PATCH 6/6] weston-init: add profile to point users to global socket rs
  5 siblings, 0 replies; 16+ messages in thread
From: rs @ 2023-06-10  1:13 UTC (permalink / raw)
  To: richard.purdie, reatmon, denis, alexandre.belloni
  Cc: openembedded-core, Randolph Sapp

From: Randolph Sapp <rs@ti.com>

Just as sysvinit scripts shouldn't be present in a distro using systemd,
systemd scripts shouldn't be present in a system not using systemd.

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

diff --git a/meta/recipes-graphics/wayland/weston-init.bb b/meta/recipes-graphics/wayland/weston-init.bb
index 01abd4ce78..64f613ef8b 100644
--- a/meta/recipes-graphics/wayland/weston-init.bb
+++ b/meta/recipes-graphics/wayland/weston-init.bb
@@ -26,27 +26,32 @@ DEFAULTBACKEND ??= ""
 DEFAULTBACKEND:qemuall ?= "drm"
 
 do_install() {
+    # Install weston-start script
     if [ "${VIRTUAL-RUNTIME_init_manager}" != "systemd" ]; then
+        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
         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.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
+        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
+        sed -i -e s:/etc:${sysconfdir}:g \
+            -e s:/usr/bin:${bindir}:g \
+            -e s:/var:${localstatedir}:g \
+            ${D}${systemd_system_unitdir}/weston.service
+    fi
+
     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
+
+    install -D -p -m0644 ${WORKDIR}/weston.ini ${D}${sysconfdir}/xdg/weston/weston.ini
+    install -Dm644 ${WORKDIR}/weston.env ${D}${sysconfdir}/default/weston
+
     if [ -n "${DEFAULTBACKEND}" ]; then
         sed -i -e "/^\[core\]/a backend=${DEFAULTBACKEND}-backend.so" ${D}${sysconfdir}/xdg/weston/weston.ini
     fi
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [OE-core][PATCH 6/6] weston-init: add profile to point users to global socket
  2023-06-10  1:13 [OE-core][PATCH 0/6] weston-init: add extra config for weston global socket rs
                   ` (4 preceding siblings ...)
  2023-06-10  1:13 ` [OE-core][PATCH 5/6] weston-init: guard against systemd configs rs
@ 2023-06-10  1:13 ` rs
  5 siblings, 0 replies; 16+ messages in thread
From: rs @ 2023-06-10  1:13 UTC (permalink / raw)
  To: richard.purdie, reatmon, denis, alexandre.belloni
  Cc: openembedded-core, Randolph Sapp

From: Randolph Sapp <rs@ti.com>

Add profile script to point users capable of interacting with the global
socket to it by default.

Signed-off-by: Randolph Sapp <rs@ti.com>
---
 meta/recipes-graphics/wayland/weston-init.bb  |  3 +++
 .../wayland/weston-init/weston-socket.sh      | 20 +++++++++++++++++++
 2 files changed, 23 insertions(+)
 create mode 100755 meta/recipes-graphics/wayland/weston-init/weston-socket.sh

diff --git a/meta/recipes-graphics/wayland/weston-init.bb b/meta/recipes-graphics/wayland/weston-init.bb
index 64f613ef8b..2797fea9e1 100644
--- a/meta/recipes-graphics/wayland/weston-init.bb
+++ b/meta/recipes-graphics/wayland/weston-init.bb
@@ -9,6 +9,7 @@ SRC_URI = "file://init \
            file://weston.ini \
            file://weston.service \
            file://weston.socket \
+           file://weston-socket.sh \
            file://weston-autologin \
            file://weston-start"
 
@@ -39,6 +40,7 @@ do_install() {
     if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
         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
+        install -D -p -m0644 ${WORKDIR}/weston-socket.sh ${D}${sysconfdir}/profile.d/weston-socket.sh
         sed -i -e s:/etc:${sysconfdir}:g \
             -e s:/usr/bin:${bindir}:g \
             -e s:/var:${localstatedir}:g \
@@ -88,6 +90,7 @@ INITSCRIPT_PARAMS = "start 9 5 2 . stop 20 0 1 6 ."
 
 FILES:${PN} += "\
     ${sysconfdir}/xdg/weston/weston.ini \
+    ${sysconfdir}/profile.d/weston-socket.sh \
     ${systemd_system_unitdir}/weston.service \
     ${systemd_system_unitdir}/weston.socket \
     ${sysconfdir}/default/weston \
diff --git a/meta/recipes-graphics/wayland/weston-init/weston-socket.sh b/meta/recipes-graphics/wayland/weston-init/weston-socket.sh
new file mode 100755
index 0000000000..86389d63a3
--- /dev/null
+++ b/meta/recipes-graphics/wayland/weston-init/weston-socket.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+# set weston variables for use with global weston socket
+global_socket="/run/wayland-0"
+if [ -e "$global_socket" ]; then
+	weston_group=$(stat -c "%G" "$global_socket")
+	if [ "$(id -u)" = "0" ]; then
+		export WAYLAND_DISPLAY="$global_socket"
+	else
+		case "$(groups "$USER")" in
+			*"$weston_group"*)
+				export WAYLAND_DISPLAY="$global_socket"
+				;;
+			*)
+				;;
+		esac
+	fi
+	unset weston_group
+fi
+unset global_socket
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 16+ messages in thread

* RE: [OE-core][PATCH 4/6] weston-init: fix the mixed indentation
  2023-06-10  1:13 ` [OE-core][PATCH 4/6] weston-init: fix the mixed indentation rs
@ 2023-06-11 21:25   ` Peter Kjellerstedt
  2023-06-12  9:19     ` Alexander Kanavin
  0 siblings, 1 reply; 16+ messages in thread
From: Peter Kjellerstedt @ 2023-06-11 21:25 UTC (permalink / raw)
  To: rs; +Cc: richard.purdie, reatmon, denis, alexandre.belloni, openembedded-core

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



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [OE-core][PATCH 4/6] weston-init: fix the mixed indentation
  2023-06-11 21:25   ` Peter Kjellerstedt
@ 2023-06-12  9:19     ` Alexander Kanavin
  2023-06-12  9:58       ` Peter Kjellerstedt
  0 siblings, 1 reply; 16+ messages in thread
From: Alexander Kanavin @ 2023-06-12  9:19 UTC (permalink / raw)
  To: Peter Kjellerstedt
  Cc: rs, richard.purdie, reatmon, denis, alexandre.belloni, openembedded-core

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


^ permalink raw reply	[flat|nested] 16+ messages in thread

* RE: [OE-core][PATCH 4/6] weston-init: fix the mixed indentation
  2023-06-12  9:19     ` Alexander Kanavin
@ 2023-06-12  9:58       ` Peter Kjellerstedt
  2023-06-12 10:05         ` Alexander Kanavin
  0 siblings, 1 reply; 16+ messages in thread
From: Peter Kjellerstedt @ 2023-06-12  9:58 UTC (permalink / raw)
  To: Alexander Kanavin
  Cc: rs, richard.purdie, reatmon, denis, alexandre.belloni, openembedded-core

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


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [OE-core][PATCH 4/6] weston-init: fix the mixed indentation
  2023-06-12  9:58       ` Peter Kjellerstedt
@ 2023-06-12 10:05         ` Alexander Kanavin
  2023-06-12 19:46           ` [EXTERNAL] " Randolph Sapp
       [not found]           ` <176801038AB94927.4582@lists.openembedded.org>
  0 siblings, 2 replies; 16+ messages in thread
From: Alexander Kanavin @ 2023-06-12 10:05 UTC (permalink / raw)
  To: Peter Kjellerstedt
  Cc: rs, richard.purdie, reatmon, denis, alexandre.belloni, openembedded-core

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


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [EXTERNAL] Re: [OE-core][PATCH 4/6] weston-init: fix the mixed indentation
  2023-06-12 10:05         ` Alexander Kanavin
@ 2023-06-12 19:46           ` Randolph Sapp
       [not found]           ` <176801038AB94927.4582@lists.openembedded.org>
  1 sibling, 0 replies; 16+ messages in thread
From: Randolph Sapp @ 2023-06-12 19:46 UTC (permalink / raw)
  To: Alexander Kanavin, Peter Kjellerstedt
  Cc: richard.purdie, reatmon, denis, alexandre.belloni, openembedded-core

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


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [EXTERNAL] Re: [OE-core][PATCH 4/6] weston-init: fix the mixed indentation
       [not found]           ` <176801038AB94927.4582@lists.openembedded.org>
@ 2023-06-14  1:16             ` Randolph Sapp
  2023-06-14  5:57               ` Alexander Kanavin
  2023-06-14  8:08               ` Richard Purdie
  0 siblings, 2 replies; 16+ messages in thread
From: Randolph Sapp @ 2023-06-14  1:16 UTC (permalink / raw)
  To: Alexander Kanavin, Peter Kjellerstedt
  Cc: richard.purdie, reatmon, denis, alexandre.belloni, openembedded-core

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?


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [EXTERNAL] Re: [OE-core][PATCH 4/6] weston-init: fix the mixed indentation
  2023-06-14  1:16             ` Randolph Sapp
@ 2023-06-14  5:57               ` Alexander Kanavin
  2023-06-14  8:08               ` Richard Purdie
  1 sibling, 0 replies; 16+ messages in thread
From: Alexander Kanavin @ 2023-06-14  5:57 UTC (permalink / raw)
  To: Randolph Sapp
  Cc: Peter Kjellerstedt, richard.purdie, reatmon, denis,
	alexandre.belloni, openembedded-core

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


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [EXTERNAL] Re: [OE-core][PATCH 4/6] weston-init: fix the mixed indentation
  2023-06-14  1:16             ` Randolph Sapp
  2023-06-14  5:57               ` Alexander Kanavin
@ 2023-06-14  8:08               ` Richard Purdie
  2023-06-14 15:11                 ` Randolph Sapp
  1 sibling, 1 reply; 16+ messages in thread
From: Richard Purdie @ 2023-06-14  8:08 UTC (permalink / raw)
  To: Randolph Sapp, Alexander Kanavin, Peter Kjellerstedt
  Cc: reatmon, denis, alexandre.belloni, openembedded-core

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




^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [EXTERNAL] Re: [OE-core][PATCH 4/6] weston-init: fix the mixed indentation
  2023-06-14  8:08               ` Richard Purdie
@ 2023-06-14 15:11                 ` Randolph Sapp
  0 siblings, 0 replies; 16+ messages in thread
From: Randolph Sapp @ 2023-06-14 15:11 UTC (permalink / raw)
  To: Richard Purdie, Alexander Kanavin, Peter Kjellerstedt
  Cc: reatmon, denis, alexandre.belloni, openembedded-core

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.



^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2023-06-14 15:11 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-10  1:13 [OE-core][PATCH 0/6] weston-init: add extra config for weston global socket rs
2023-06-10  1:13 ` [OE-core][PATCH 1/6] weston-init: make sure the render group exists rs
2023-06-10  1:13 ` [OE-core][PATCH 2/6] weston-init: add weston user to the render group rs
2023-06-10  1:13 ` [OE-core][PATCH 3/6] weston-init: add the weston user to the wayland group rs
2023-06-10  1:13 ` [OE-core][PATCH 4/6] weston-init: fix the mixed indentation rs
2023-06-11 21:25   ` Peter Kjellerstedt
2023-06-12  9:19     ` Alexander Kanavin
2023-06-12  9:58       ` Peter Kjellerstedt
2023-06-12 10:05         ` Alexander Kanavin
2023-06-12 19:46           ` [EXTERNAL] " Randolph Sapp
     [not found]           ` <176801038AB94927.4582@lists.openembedded.org>
2023-06-14  1:16             ` Randolph Sapp
2023-06-14  5:57               ` Alexander Kanavin
2023-06-14  8:08               ` Richard Purdie
2023-06-14 15:11                 ` Randolph Sapp
2023-06-10  1:13 ` [OE-core][PATCH 5/6] weston-init: guard against systemd configs rs
2023-06-10  1:13 ` [OE-core][PATCH 6/6] weston-init: add profile to point users to global socket rs

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.