mbox series

[RFC,0/2] debianize: Use dh_installsystemd

Message ID 20240201130752.3734292-1-Quirin.Gylstorff@siemens.com
Headers show
Series debianize: Use dh_installsystemd | expand

Message

Quirin Gylstorff Feb. 1, 2024, 1:07 p.m. UTC
From: Quirin Gylstorff <quirin.gylstorff@siemens.com>

This series adds the variable DEBIAN_SYSTEMD_SERVICE which defines
a systemd file to automatically be added to the debian folder and
automatically installed by using `dh_installsystemd`.

Quirin Gylstorff (2):
  debianize: use dh_installsystemd to automatically add systemd service
  meta/recipe-support: Use DEBIAN_SYSTEMD_SERVICE variable

 meta/classes/debianize.bbclass                    | 15 +++++++++++++++
 meta/recipes-support/enable-fsck/enable-fsck.bb   |  6 ++----
 meta/recipes-support/enable-fsck/files/postinst   |  3 ---
 .../expand-on-first-boot_1.4.bb                   |  7 ++-----
 .../expand-on-first-boot/files/postinst           |  3 ---
 .../sshd-regen-keys/sshd-regen-keys_0.4.bb        |  1 +
 6 files changed, 20 insertions(+), 15 deletions(-)
 delete mode 100644 meta/recipes-support/enable-fsck/files/postinst
 delete mode 100644 meta/recipes-support/expand-on-first-boot/files/postinst

Comments

MOESSBAUER, Felix Feb. 1, 2024, 3:16 p.m. UTC | #1
On Thu, 2024-02-01 at 14:07 +0100, 'Quirin Gylstorff' via isar-users
wrote:
> From: Quirin Gylstorff <quirin.gylstorff@siemens.com>
> 
> This series adds the variable DEBIAN_SYSTEMD_SERVICE which defines
> a systemd file to automatically be added to the debian folder and
> automatically installed by using `dh_installsystemd`.

Hi, do we really need that interface?

Usually you just copy these files into the debian folder in
do_prepare_build. That's it.

There are also more files which get picked up by the debhelpers.

Best regards,
Felix

> 
> Quirin Gylstorff (2):
>   debianize: use dh_installsystemd to automatically add systemd
> service
>   meta/recipe-support: Use DEBIAN_SYSTEMD_SERVICE variable
> 
>  meta/classes/debianize.bbclass                    | 15
> +++++++++++++++
>  meta/recipes-support/enable-fsck/enable-fsck.bb   |  6 ++----
>  meta/recipes-support/enable-fsck/files/postinst   |  3 ---
>  .../expand-on-first-boot_1.4.bb                   |  7 ++-----
>  .../expand-on-first-boot/files/postinst           |  3 ---
>  .../sshd-regen-keys/sshd-regen-keys_0.4.bb        |  1 +
>  6 files changed, 20 insertions(+), 15 deletions(-)
>  delete mode 100644 meta/recipes-support/enable-fsck/files/postinst
>  delete mode 100644 meta/recipes-support/expand-on-first-
> boot/files/postinst
> 
> -- 
> 2.43.0
>
Quirin Gylstorff Feb. 1, 2024, 3:48 p.m. UTC | #2
On 2/1/24 16:16, Moessbauer, Felix (T CED OES-DE) wrote:
> On Thu, 2024-02-01 at 14:07 +0100, 'Quirin Gylstorff' via isar-users
> wrote:
>> From: Quirin Gylstorff <quirin.gylstorff@siemens.com>
>>
>> This series adds the variable DEBIAN_SYSTEMD_SERVICE which defines
>> a systemd file to automatically be added to the debian folder and
>> automatically installed by using `dh_installsystemd`.
> 
> Hi, do we really need that interface?
> 
> Usually you just copy these files into the debian folder in
> do_prepare_build. That's it.
> 
> There are also more files which get picked up by the debhelpers.

We have multiple location and files where the do_install pattern is
used:
```
     file://postinst"
     "

  do_install() {
     install -d -m 755 ${D}/lib/systemd/system
     install -m 644 ${WORKDIR}/enable-fsck.service ${D}/lib/systemd/system/
```

If the the do_prepare_build pattern is sufficient we can also change all 
service:

```
do_prepare_build:append() {
     install -m 644 ${WORKDIR}/enable-fsck.service ${S}/debian

}
```

Quirin
> 
> Best regards,
> Felix
> 
>>
>> Quirin Gylstorff (2):
>>    debianize: use dh_installsystemd to automatically add systemd
>> service
>>    meta/recipe-support: Use DEBIAN_SYSTEMD_SERVICE variable
>>
>>   meta/classes/debianize.bbclass                    | 15
>> +++++++++++++++
>>   meta/recipes-support/enable-fsck/enable-fsck.bb   |  6 ++----
>>   meta/recipes-support/enable-fsck/files/postinst   |  3 ---
>>   .../expand-on-first-boot_1.4.bb                   |  7 ++-----
>>   .../expand-on-first-boot/files/postinst           |  3 ---
>>   .../sshd-regen-keys/sshd-regen-keys_0.4.bb        |  1 +
>>   6 files changed, 20 insertions(+), 15 deletions(-)
>>   delete mode 100644 meta/recipes-support/enable-fsck/files/postinst
>>   delete mode 100644 meta/recipes-support/expand-on-first-
>> boot/files/postinst
>>
>> -- 
>> 2.43.0
>>
>
Anton Mikanovich Feb. 1, 2024, 3:52 p.m. UTC | #3
01/02/2024 17:48, 'Gylstorff Quirin' via isar-users wrote:
>
> We have multiple location and files where the do_install pattern is
> used:
> ```
>     file://postinst"
>     "
>
>  do_install() {
>     install -d -m 755 ${D}/lib/systemd/system
>     install -m 644 ${WORKDIR}/enable-fsck.service 
> ${D}/lib/systemd/system/
> ```
>
> If the the do_prepare_build pattern is sufficient we can also change 
> all service:
>
> ```
> do_prepare_build:append() {
>     install -m 644 ${WORKDIR}/enable-fsck.service ${S}/debian
>
> }
> ```
>
> Quirin
>
I hope the same can be done by subdir=debian in SRC_URI, not sure about
dpkg-raw recipes.
MOESSBAUER, Felix Feb. 15, 2024, 8:42 a.m. UTC | #4
On Thu, 2024-02-01 at 16:48 +0100, Gylstorff Quirin wrote:
> 
> 
> On 2/1/24 16:16, Moessbauer, Felix (T CED OES-DE) wrote:
> > On Thu, 2024-02-01 at 14:07 +0100, 'Quirin Gylstorff' via isar-
> > users
> > wrote:
> > > From: Quirin Gylstorff <quirin.gylstorff@siemens.com>
> > > 
> > > This series adds the variable DEBIAN_SYSTEMD_SERVICE which
> > > defines
> > > a systemd file to automatically be added to the debian folder and
> > > automatically installed by using `dh_installsystemd`.
> > 
> > Hi, do we really need that interface?
> > 
> > Usually you just copy these files into the debian folder in
> > do_prepare_build. That's it.
> > 
> > There are also more files which get picked up by the debhelpers.
> 
> We have multiple location and files where the do_install pattern is
> used:
> ```
>      file://postinst"
>      "
> 
>   do_install() {
>      install -d -m 755 ${D}/lib/systemd/system
>      install -m 644 ${WORKDIR}/enable-fsck.service
> ${D}/lib/systemd/system/
> ```
> 
> If the the do_prepare_build pattern is sufficient we can also change
> all 
> service:
> 
> ```
> do_prepare_build:append() {
>      install -m 644 ${WORKDIR}/enable-fsck.service ${S}/debian
> 
> }

This in principle is a good pattern, but is prone to rebuild errors as
${S}/debian is not cleaned beforehand. Unfortunately we cannot always
add do_prepare_build[cleandirs] += "${S}/debian", as this runs after
the do_unpack which might already place files there.

Maybe just add this line to the respective recipes?

Felix

> ```
> 
> Quirin
> > 
> > Best regards,
> > Felix
> > 
> > > 
> > > Quirin Gylstorff (2):
> > >    debianize: use dh_installsystemd to automatically add systemd
> > > service
> > >    meta/recipe-support: Use DEBIAN_SYSTEMD_SERVICE variable
> > > 
> > >   meta/classes/debianize.bbclass                    | 15
> > > +++++++++++++++
> > >   meta/recipes-support/enable-fsck/enable-fsck.bb   |  6 ++----
> > >   meta/recipes-support/enable-fsck/files/postinst   |  3 ---
> > >   .../expand-on-first-boot_1.4.bb                   |  7 ++-----
> > >   .../expand-on-first-boot/files/postinst           |  3 ---
> > >   .../sshd-regen-keys/sshd-regen-keys_0.4.bb        |  1 +
> > >   6 files changed, 20 insertions(+), 15 deletions(-)
> > >   delete mode 100644 meta/recipes-support/enable-
> > > fsck/files/postinst
> > >   delete mode 100644 meta/recipes-support/expand-on-first-
> > > boot/files/postinst
> > > 
> > > -- 
> > > 2.43.0
> > > 
> >