Re: [OE-core] [PATCH v4 1/2] qemu: split out qemu-guest-agent, add startup scripts

2023-03-08 Thread Clément Péron
On Wed, 8 Mar 2023 at 22:15, Richard Purdie
 wrote:
>
> On Wed, 2023-03-08 at 21:22 +0100, Clément Péron wrote:
> > Hi Richard,
> >
> > On Wed, 8 Mar 2023 at 18:31, Richard Purdie
> >  wrote:
> > >
> > > On Wed, 2023-03-08 at 18:14 +0100, Clément Péron wrote:
> > > > Split out the QEMU guest agent into a separate package. The agent is
> > > > intended to be installed within a QEMU VM guest where a user is likely
> > > > to not want to have the rest of the QEMU installation within it.
> > > >
> > > > Additionally, an initscript, udev rules file, and systemd unit file are
> > > > added to the package so that the guest agent can start automatically;
> > > > the former two come from Debian's packaging for qemu-guest-agent.
> > > >
> > > > Signed-off-by: Brenda Streiff 
> > > > Signed-off-by: Clément Péron 
> > > > ---
> > > >
> > > > Changes since v3:
> > > >  - fix missing comma in udev rule
> > > >
> > > > Changes since v2:
> > > >  - Add missing files
> > > >  - rebase on top of master
> > > >
> > > > Changes since v1:
> > > >  - Fix systemd-service using PN where it should not
> > > >
> > > >  meta/recipes-devtools/qemu/qemu.inc   | 35 +++-
> > > >  .../qemu/qemu/qemu-guest-agent.init   | 84 +++
> > > >  .../qemu/qemu/qemu-guest-agent.udev   |  2 +
> > > >  3 files changed, 120 insertions(+), 1 deletion(-)
> > > >  create mode 100644 
> > > > meta/recipes-devtools/qemu/qemu/qemu-guest-agent.init
> > > >  create mode 100644 
> > > > meta/recipes-devtools/qemu/qemu/qemu-guest-agent.udev
> > > >
> > > > diff --git a/meta/recipes-devtools/qemu/qemu.inc 
> > > > b/meta/recipes-devtools/qemu/qemu.inc
> > > > index 1e768b560d..b41055fe5d 100644
> > > > --- a/meta/recipes-devtools/qemu/qemu.inc
> > > > +++ b/meta/recipes-devtools/qemu/qemu.inc
> > > > @@ -9,7 +9,7 @@ LICENSE = "GPL-2.0-only & LGPL-2.1-only"
> > > >  RDEPENDS:${PN}-ptest = "bash"
> > > >
> > > >  require qemu-targets.inc
> > > > -inherit pkgconfig ptest
> > > > +inherit pkgconfig ptest update-rc.d systemd
> > > >
> > > >  LIC_FILES_CHKSUM = 
> > > > "file://COPYING;md5=441c28d2cf86e15a37fa47e15a72fbac \
> > > >  
> > > > file://COPYING.LIB;endline=24;md5=8c5efda6cf1e1b03dcfd0e6c0d271c7f"
> > > > @@ -32,6 +32,8 @@ SRC_URI = 
> > > > "https://download.qemu.org/${BPN}-${PV}.tar.xz \
> > > > 
> > > > file://0001-configure-Fix-check-tcg-not-executing-any-tests.patch \
> > > > 
> > > > file://0001-Revert-linux-user-add-more-compat-ioctl-definitions.patch \
> > > > 
> > > > file://0002-Revert-linux-user-fix-compat-with-glibc-2.36-sys-mou.patch \
> > > > +   file://qemu-guest-agent.init \
> > > > +   file://qemu-guest-agent.udev \
> > > > "
> > > >  UPSTREAM_CHECK_REGEX = "qemu-(?P\d+(\.\d+)+)\.tar"
> > > >
> > > > @@ -132,6 +134,20 @@ do_configure[cleandirs] += "${B}"
> > > >  do_install () {
> > > >   export STRIP=""
> > > >   oe_runmake 'DESTDIR=${D}' install
> > > > +
> > > > + # If we built the guest agent, also install startup/udev rules
> > > > + if [ -e "${D}${bindir}/qemu-ga" ]; then
> > > > + install -d ${D}${sysconfdir}/init.d/
> > > > + install -m 0755 ${WORKDIR}/qemu-guest-agent.init 
> > > > ${D}${sysconfdir}/init.d/qemu-guest-agent
> > > > + sed -i 's:@bindir@:${bindir}:' 
> > > > ${D}${sysconfdir}/init.d/qemu-guest-agent
> > > > +
> > > > + install -d ${D}${sysconfdir}/udev/rules.d/
> > > > + install -m 0644 ${WORKDIR}/qemu-guest-agent.udev 
> > > > ${D}${sysconfdir}/udev/rules.d/60-qemu-guest-agent.rules
> > > > +
> > > > + install -d ${D}${systemd_unitdir}/system/
> > > > + install -m 0644 
> > > > ${S}/contrib/systemd/qemu-guest-agent.service 
> > > > ${D}${systemd_unitdir}/system
> > > > + sed -i -e 's,-/usr/bin/,-${bindir}/,g' 
> > > > ${D}${systemd_unitdir}/system/qemu-guest-agent.service
> > > > + fi
> > > >  }
> > > >
> > > >  # The following fragment will create a wrapper for qemu-mips user 
> > > > emulation
> > > > @@ -210,3 +226,20 @@ PACKAGECONFIG[jack] = 
> > > > "--enable-jack,--disable-jack,jack,"
> > > >  INSANE_SKIP:${PN} = "arch"
> > > >
> > > >  FILES:${PN} += "${datadir}/icons"
> > > > +
> > > > +# Put the guest agent in a separate package
> > > > +PACKAGES =+ "${PN}-guest-agent"
> > > > +SUMMARY:${PN}-guest-agent = "QEMU guest agent"
> > > > +FILES:${PN}-guest-agent += " \
> > > > +${bindir}/qemu-ga \
> > > > +${sysconfdir}/udev/rules.d/60-qemu-guest-agent.rules \
> > > > +${sysconfdir}/init.d/qemu-guest-agent \
> > > > +${systemd_unitdir}/system/qemu-guest-agent.service \
> > > > +"
> > > > +
> > > > +INITSCRIPT_PACKAGES = "${PN}-guest-agent"
> > > > +INITSCRIPT_NAME:${PN}-guest-agent = "qemu-guest-agent"
> > > > +INITSCRIPT_PARAMS:${PN}-guest-agent = "defaults"
> > > > +
> > > > +SYSTEMD_PACKAGES = "${PN}-guest-agent"
> > > > +SYSTEMD_SERVICE:${PN}-guest-agent 

Re: [OE-core] [PATCH v4 1/2] qemu: split out qemu-guest-agent, add startup scripts

2023-03-08 Thread Richard Purdie
On Wed, 2023-03-08 at 21:22 +0100, Clément Péron wrote:
> Hi Richard,
> 
> On Wed, 8 Mar 2023 at 18:31, Richard Purdie
>  wrote:
> > 
> > On Wed, 2023-03-08 at 18:14 +0100, Clément Péron wrote:
> > > Split out the QEMU guest agent into a separate package. The agent is
> > > intended to be installed within a QEMU VM guest where a user is likely
> > > to not want to have the rest of the QEMU installation within it.
> > > 
> > > Additionally, an initscript, udev rules file, and systemd unit file are
> > > added to the package so that the guest agent can start automatically;
> > > the former two come from Debian's packaging for qemu-guest-agent.
> > > 
> > > Signed-off-by: Brenda Streiff 
> > > Signed-off-by: Clément Péron 
> > > ---
> > > 
> > > Changes since v3:
> > >  - fix missing comma in udev rule
> > > 
> > > Changes since v2:
> > >  - Add missing files
> > >  - rebase on top of master
> > > 
> > > Changes since v1:
> > >  - Fix systemd-service using PN where it should not
> > > 
> > >  meta/recipes-devtools/qemu/qemu.inc   | 35 +++-
> > >  .../qemu/qemu/qemu-guest-agent.init   | 84 +++
> > >  .../qemu/qemu/qemu-guest-agent.udev   |  2 +
> > >  3 files changed, 120 insertions(+), 1 deletion(-)
> > >  create mode 100644 meta/recipes-devtools/qemu/qemu/qemu-guest-agent.init
> > >  create mode 100644 meta/recipes-devtools/qemu/qemu/qemu-guest-agent.udev
> > > 
> > > diff --git a/meta/recipes-devtools/qemu/qemu.inc 
> > > b/meta/recipes-devtools/qemu/qemu.inc
> > > index 1e768b560d..b41055fe5d 100644
> > > --- a/meta/recipes-devtools/qemu/qemu.inc
> > > +++ b/meta/recipes-devtools/qemu/qemu.inc
> > > @@ -9,7 +9,7 @@ LICENSE = "GPL-2.0-only & LGPL-2.1-only"
> > >  RDEPENDS:${PN}-ptest = "bash"
> > > 
> > >  require qemu-targets.inc
> > > -inherit pkgconfig ptest
> > > +inherit pkgconfig ptest update-rc.d systemd
> > > 
> > >  LIC_FILES_CHKSUM = "file://COPYING;md5=441c28d2cf86e15a37fa47e15a72fbac \
> > >  
> > > file://COPYING.LIB;endline=24;md5=8c5efda6cf1e1b03dcfd0e6c0d271c7f"
> > > @@ -32,6 +32,8 @@ SRC_URI = 
> > > "https://download.qemu.org/${BPN}-${PV}.tar.xz \
> > > 
> > > file://0001-configure-Fix-check-tcg-not-executing-any-tests.patch \
> > > 
> > > file://0001-Revert-linux-user-add-more-compat-ioctl-definitions.patch \
> > > 
> > > file://0002-Revert-linux-user-fix-compat-with-glibc-2.36-sys-mou.patch \
> > > +   file://qemu-guest-agent.init \
> > > +   file://qemu-guest-agent.udev \
> > > "
> > >  UPSTREAM_CHECK_REGEX = "qemu-(?P\d+(\.\d+)+)\.tar"
> > > 
> > > @@ -132,6 +134,20 @@ do_configure[cleandirs] += "${B}"
> > >  do_install () {
> > >   export STRIP=""
> > >   oe_runmake 'DESTDIR=${D}' install
> > > +
> > > + # If we built the guest agent, also install startup/udev rules
> > > + if [ -e "${D}${bindir}/qemu-ga" ]; then
> > > + install -d ${D}${sysconfdir}/init.d/
> > > + install -m 0755 ${WORKDIR}/qemu-guest-agent.init 
> > > ${D}${sysconfdir}/init.d/qemu-guest-agent
> > > + sed -i 's:@bindir@:${bindir}:' 
> > > ${D}${sysconfdir}/init.d/qemu-guest-agent
> > > +
> > > + install -d ${D}${sysconfdir}/udev/rules.d/
> > > + install -m 0644 ${WORKDIR}/qemu-guest-agent.udev 
> > > ${D}${sysconfdir}/udev/rules.d/60-qemu-guest-agent.rules
> > > +
> > > + install -d ${D}${systemd_unitdir}/system/
> > > + install -m 0644 
> > > ${S}/contrib/systemd/qemu-guest-agent.service 
> > > ${D}${systemd_unitdir}/system
> > > + sed -i -e 's,-/usr/bin/,-${bindir}/,g' 
> > > ${D}${systemd_unitdir}/system/qemu-guest-agent.service
> > > + fi
> > >  }
> > > 
> > >  # The following fragment will create a wrapper for qemu-mips user 
> > > emulation
> > > @@ -210,3 +226,20 @@ PACKAGECONFIG[jack] = 
> > > "--enable-jack,--disable-jack,jack,"
> > >  INSANE_SKIP:${PN} = "arch"
> > > 
> > >  FILES:${PN} += "${datadir}/icons"
> > > +
> > > +# Put the guest agent in a separate package
> > > +PACKAGES =+ "${PN}-guest-agent"
> > > +SUMMARY:${PN}-guest-agent = "QEMU guest agent"
> > > +FILES:${PN}-guest-agent += " \
> > > +${bindir}/qemu-ga \
> > > +${sysconfdir}/udev/rules.d/60-qemu-guest-agent.rules \
> > > +${sysconfdir}/init.d/qemu-guest-agent \
> > > +${systemd_unitdir}/system/qemu-guest-agent.service \
> > > +"
> > > +
> > > +INITSCRIPT_PACKAGES = "${PN}-guest-agent"
> > > +INITSCRIPT_NAME:${PN}-guest-agent = "qemu-guest-agent"
> > > +INITSCRIPT_PARAMS:${PN}-guest-agent = "defaults"
> > > +
> > > +SYSTEMD_PACKAGES = "${PN}-guest-agent"
> > > +SYSTEMD_SERVICE:${PN}-guest-agent = "qemu-guest-agent.service"
> > > diff --git a/meta/recipes-devtools/qemu/qemu/qemu-guest-agent.init 
> > > b/meta/recipes-devtools/qemu/qemu/qemu-guest-agent.init
> > > new file mode 100644
> > > index 00..493da0ef1a
> > > --- /dev/null
> > > +++ 

Re: [OE-core] [PATCH v4 1/2] qemu: split out qemu-guest-agent, add startup scripts

2023-03-08 Thread Clément Péron
Hi Richard,

On Wed, 8 Mar 2023 at 18:31, Richard Purdie
 wrote:
>
> On Wed, 2023-03-08 at 18:14 +0100, Clément Péron wrote:
> > Split out the QEMU guest agent into a separate package. The agent is
> > intended to be installed within a QEMU VM guest where a user is likely
> > to not want to have the rest of the QEMU installation within it.
> >
> > Additionally, an initscript, udev rules file, and systemd unit file are
> > added to the package so that the guest agent can start automatically;
> > the former two come from Debian's packaging for qemu-guest-agent.
> >
> > Signed-off-by: Brenda Streiff 
> > Signed-off-by: Clément Péron 
> > ---
> >
> > Changes since v3:
> >  - fix missing comma in udev rule
> >
> > Changes since v2:
> >  - Add missing files
> >  - rebase on top of master
> >
> > Changes since v1:
> >  - Fix systemd-service using PN where it should not
> >
> >  meta/recipes-devtools/qemu/qemu.inc   | 35 +++-
> >  .../qemu/qemu/qemu-guest-agent.init   | 84 +++
> >  .../qemu/qemu/qemu-guest-agent.udev   |  2 +
> >  3 files changed, 120 insertions(+), 1 deletion(-)
> >  create mode 100644 meta/recipes-devtools/qemu/qemu/qemu-guest-agent.init
> >  create mode 100644 meta/recipes-devtools/qemu/qemu/qemu-guest-agent.udev
> >
> > diff --git a/meta/recipes-devtools/qemu/qemu.inc 
> > b/meta/recipes-devtools/qemu/qemu.inc
> > index 1e768b560d..b41055fe5d 100644
> > --- a/meta/recipes-devtools/qemu/qemu.inc
> > +++ b/meta/recipes-devtools/qemu/qemu.inc
> > @@ -9,7 +9,7 @@ LICENSE = "GPL-2.0-only & LGPL-2.1-only"
> >  RDEPENDS:${PN}-ptest = "bash"
> >
> >  require qemu-targets.inc
> > -inherit pkgconfig ptest
> > +inherit pkgconfig ptest update-rc.d systemd
> >
> >  LIC_FILES_CHKSUM = "file://COPYING;md5=441c28d2cf86e15a37fa47e15a72fbac \
> >  
> > file://COPYING.LIB;endline=24;md5=8c5efda6cf1e1b03dcfd0e6c0d271c7f"
> > @@ -32,6 +32,8 @@ SRC_URI = "https://download.qemu.org/${BPN}-${PV}.tar.xz \
> > 
> > file://0001-configure-Fix-check-tcg-not-executing-any-tests.patch \
> > 
> > file://0001-Revert-linux-user-add-more-compat-ioctl-definitions.patch \
> > 
> > file://0002-Revert-linux-user-fix-compat-with-glibc-2.36-sys-mou.patch \
> > +   file://qemu-guest-agent.init \
> > +   file://qemu-guest-agent.udev \
> > "
> >  UPSTREAM_CHECK_REGEX = "qemu-(?P\d+(\.\d+)+)\.tar"
> >
> > @@ -132,6 +134,20 @@ do_configure[cleandirs] += "${B}"
> >  do_install () {
> >   export STRIP=""
> >   oe_runmake 'DESTDIR=${D}' install
> > +
> > + # If we built the guest agent, also install startup/udev rules
> > + if [ -e "${D}${bindir}/qemu-ga" ]; then
> > + install -d ${D}${sysconfdir}/init.d/
> > + install -m 0755 ${WORKDIR}/qemu-guest-agent.init 
> > ${D}${sysconfdir}/init.d/qemu-guest-agent
> > + sed -i 's:@bindir@:${bindir}:' 
> > ${D}${sysconfdir}/init.d/qemu-guest-agent
> > +
> > + install -d ${D}${sysconfdir}/udev/rules.d/
> > + install -m 0644 ${WORKDIR}/qemu-guest-agent.udev 
> > ${D}${sysconfdir}/udev/rules.d/60-qemu-guest-agent.rules
> > +
> > + install -d ${D}${systemd_unitdir}/system/
> > + install -m 0644 ${S}/contrib/systemd/qemu-guest-agent.service 
> > ${D}${systemd_unitdir}/system
> > + sed -i -e 's,-/usr/bin/,-${bindir}/,g' 
> > ${D}${systemd_unitdir}/system/qemu-guest-agent.service
> > + fi
> >  }
> >
> >  # The following fragment will create a wrapper for qemu-mips user emulation
> > @@ -210,3 +226,20 @@ PACKAGECONFIG[jack] = 
> > "--enable-jack,--disable-jack,jack,"
> >  INSANE_SKIP:${PN} = "arch"
> >
> >  FILES:${PN} += "${datadir}/icons"
> > +
> > +# Put the guest agent in a separate package
> > +PACKAGES =+ "${PN}-guest-agent"
> > +SUMMARY:${PN}-guest-agent = "QEMU guest agent"
> > +FILES:${PN}-guest-agent += " \
> > +${bindir}/qemu-ga \
> > +${sysconfdir}/udev/rules.d/60-qemu-guest-agent.rules \
> > +${sysconfdir}/init.d/qemu-guest-agent \
> > +${systemd_unitdir}/system/qemu-guest-agent.service \
> > +"
> > +
> > +INITSCRIPT_PACKAGES = "${PN}-guest-agent"
> > +INITSCRIPT_NAME:${PN}-guest-agent = "qemu-guest-agent"
> > +INITSCRIPT_PARAMS:${PN}-guest-agent = "defaults"
> > +
> > +SYSTEMD_PACKAGES = "${PN}-guest-agent"
> > +SYSTEMD_SERVICE:${PN}-guest-agent = "qemu-guest-agent.service"
> > diff --git a/meta/recipes-devtools/qemu/qemu/qemu-guest-agent.init 
> > b/meta/recipes-devtools/qemu/qemu/qemu-guest-agent.init
> > new file mode 100644
> > index 00..493da0ef1a
> > --- /dev/null
> > +++ b/meta/recipes-devtools/qemu/qemu/qemu-guest-agent.init
> > @@ -0,0 +1,84 @@
> > +#!/bin/sh
> > +### BEGIN INIT INFO
> > +# Provides:  qemu-guest-agent
> > +# Required-Start:$remote_fs $syslog
> > +# Required-Stop: $remote_fs $syslog
> > +# Default-Start: 2 3 4 5
> > +# Default-Stop:  0 1 6
> > +# Short-Description: QEMU Guest 

Re: [OE-core] [PATCH v4 1/2] qemu: split out qemu-guest-agent, add startup scripts

2023-03-08 Thread Clément Péron
Hi Michael,

On Wed, 8 Mar 2023 at 18:55, Michael Tokarev  wrote:
>
> 08.03.2023 20:28, Clément Péron пишет:
> ...
> >>   meta/recipes-devtools/qemu/qemu.inc   | 35 +++-
> >>   .../qemu/qemu/qemu-guest-agent.init   | 84 +++
> >>   .../qemu/qemu/qemu-guest-agent.udev   |  2 +
> >
> > In this patch,
> >
> > qemu-guest-agent.init and qemu-guest-agent.udev come from the Debian
> > source repo.
> >
> > Could you confirm that these files use the same license as the repo?
> > Or are they following another one?
>
> I wrote those files. It's not much. The license is the same as whole QEMU,
> which basically means GPL2.

Thanks for the confirmation

Best,
Clement

>
> /mjt

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



Re: [OE-core] [PATCH v4 1/2] qemu: split out qemu-guest-agent, add startup scripts

2023-03-08 Thread Richard Purdie
On Wed, 2023-03-08 at 18:14 +0100, Clément Péron wrote:
> Split out the QEMU guest agent into a separate package. The agent is
> intended to be installed within a QEMU VM guest where a user is likely
> to not want to have the rest of the QEMU installation within it.
> 
> Additionally, an initscript, udev rules file, and systemd unit file are
> added to the package so that the guest agent can start automatically;
> the former two come from Debian's packaging for qemu-guest-agent.
> 
> Signed-off-by: Brenda Streiff 
> Signed-off-by: Clément Péron 
> ---
> 
> Changes since v3:
>  - fix missing comma in udev rule
> 
> Changes since v2:
>  - Add missing files
>  - rebase on top of master
> 
> Changes since v1:
>  - Fix systemd-service using PN where it should not
> 
>  meta/recipes-devtools/qemu/qemu.inc   | 35 +++-
>  .../qemu/qemu/qemu-guest-agent.init   | 84 +++
>  .../qemu/qemu/qemu-guest-agent.udev   |  2 +
>  3 files changed, 120 insertions(+), 1 deletion(-)
>  create mode 100644 meta/recipes-devtools/qemu/qemu/qemu-guest-agent.init
>  create mode 100644 meta/recipes-devtools/qemu/qemu/qemu-guest-agent.udev
> 
> diff --git a/meta/recipes-devtools/qemu/qemu.inc 
> b/meta/recipes-devtools/qemu/qemu.inc
> index 1e768b560d..b41055fe5d 100644
> --- a/meta/recipes-devtools/qemu/qemu.inc
> +++ b/meta/recipes-devtools/qemu/qemu.inc
> @@ -9,7 +9,7 @@ LICENSE = "GPL-2.0-only & LGPL-2.1-only"
>  RDEPENDS:${PN}-ptest = "bash"
>  
>  require qemu-targets.inc
> -inherit pkgconfig ptest
> +inherit pkgconfig ptest update-rc.d systemd
>  
>  LIC_FILES_CHKSUM = "file://COPYING;md5=441c28d2cf86e15a37fa47e15a72fbac \
>  
> file://COPYING.LIB;endline=24;md5=8c5efda6cf1e1b03dcfd0e6c0d271c7f"
> @@ -32,6 +32,8 @@ SRC_URI = "https://download.qemu.org/${BPN}-${PV}.tar.xz \
> file://0001-configure-Fix-check-tcg-not-executing-any-tests.patch 
> \
> 
> file://0001-Revert-linux-user-add-more-compat-ioctl-definitions.patch \
> 
> file://0002-Revert-linux-user-fix-compat-with-glibc-2.36-sys-mou.patch \
> +   file://qemu-guest-agent.init \
> +   file://qemu-guest-agent.udev \
> "
>  UPSTREAM_CHECK_REGEX = "qemu-(?P\d+(\.\d+)+)\.tar"
>  
> @@ -132,6 +134,20 @@ do_configure[cleandirs] += "${B}"
>  do_install () {
>   export STRIP=""
>   oe_runmake 'DESTDIR=${D}' install
> +
> + # If we built the guest agent, also install startup/udev rules
> + if [ -e "${D}${bindir}/qemu-ga" ]; then
> + install -d ${D}${sysconfdir}/init.d/
> + install -m 0755 ${WORKDIR}/qemu-guest-agent.init 
> ${D}${sysconfdir}/init.d/qemu-guest-agent
> + sed -i 's:@bindir@:${bindir}:' 
> ${D}${sysconfdir}/init.d/qemu-guest-agent
> +
> + install -d ${D}${sysconfdir}/udev/rules.d/
> + install -m 0644 ${WORKDIR}/qemu-guest-agent.udev 
> ${D}${sysconfdir}/udev/rules.d/60-qemu-guest-agent.rules
> +
> + install -d ${D}${systemd_unitdir}/system/
> + install -m 0644 ${S}/contrib/systemd/qemu-guest-agent.service 
> ${D}${systemd_unitdir}/system
> + sed -i -e 's,-/usr/bin/,-${bindir}/,g' 
> ${D}${systemd_unitdir}/system/qemu-guest-agent.service
> + fi
>  }
>  
>  # The following fragment will create a wrapper for qemu-mips user emulation
> @@ -210,3 +226,20 @@ PACKAGECONFIG[jack] = 
> "--enable-jack,--disable-jack,jack,"
>  INSANE_SKIP:${PN} = "arch"
>  
>  FILES:${PN} += "${datadir}/icons"
> +
> +# Put the guest agent in a separate package
> +PACKAGES =+ "${PN}-guest-agent"
> +SUMMARY:${PN}-guest-agent = "QEMU guest agent"
> +FILES:${PN}-guest-agent += " \
> +${bindir}/qemu-ga \
> +${sysconfdir}/udev/rules.d/60-qemu-guest-agent.rules \
> +${sysconfdir}/init.d/qemu-guest-agent \
> +${systemd_unitdir}/system/qemu-guest-agent.service \
> +"
> +
> +INITSCRIPT_PACKAGES = "${PN}-guest-agent"
> +INITSCRIPT_NAME:${PN}-guest-agent = "qemu-guest-agent"
> +INITSCRIPT_PARAMS:${PN}-guest-agent = "defaults"
> +
> +SYSTEMD_PACKAGES = "${PN}-guest-agent"
> +SYSTEMD_SERVICE:${PN}-guest-agent = "qemu-guest-agent.service"
> diff --git a/meta/recipes-devtools/qemu/qemu/qemu-guest-agent.init 
> b/meta/recipes-devtools/qemu/qemu/qemu-guest-agent.init
> new file mode 100644
> index 00..493da0ef1a
> --- /dev/null
> +++ b/meta/recipes-devtools/qemu/qemu/qemu-guest-agent.init
> @@ -0,0 +1,84 @@
> +#!/bin/sh
> +### BEGIN INIT INFO
> +# Provides:  qemu-guest-agent
> +# Required-Start:$remote_fs $syslog
> +# Required-Stop: $remote_fs $syslog
> +# Default-Start: 2 3 4 5
> +# Default-Stop:  0 1 6
> +# Short-Description: QEMU Guest Agent
> +### END INIT INFO
> +#
> +# Do not configure this file. Edit /etc/default/qemu-guest-agent
> +#

Do we install a /etc/default/qemu-guest-agent? The whole comment block
above can probably be dropped including the INIT INFO as it isn't
applicable for us?

Do we need to mention 

Re: [OE-core] [PATCH v4 1/2] qemu: split out qemu-guest-agent, add startup scripts

2023-03-08 Thread Clément Péron
Hi Michael,

On Wed, 8 Mar 2023 at 18:14, Clément Péron via lists.openembedded.org
 wrote:
>
> Split out the QEMU guest agent into a separate package. The agent is
> intended to be installed within a QEMU VM guest where a user is likely
> to not want to have the rest of the QEMU installation within it.
>
> Additionally, an initscript, udev rules file, and systemd unit file are
> added to the package so that the guest agent can start automatically;
> the former two come from Debian's packaging for qemu-guest-agent.
>
> Signed-off-by: Brenda Streiff 
> Signed-off-by: Clément Péron 
> ---
>
> Changes since v3:
>  - fix missing comma in udev rule
>
> Changes since v2:
>  - Add missing files
>  - rebase on top of master
>
> Changes since v1:
>  - Fix systemd-service using PN where it should not
>
>  meta/recipes-devtools/qemu/qemu.inc   | 35 +++-
>  .../qemu/qemu/qemu-guest-agent.init   | 84 +++
>  .../qemu/qemu/qemu-guest-agent.udev   |  2 +

In this patch,

qemu-guest-agent.init and qemu-guest-agent.udev come from the Debian
source repo.

Could you confirm that these files use the same license as the repo?
Or are they following another one?


Thanks for your help,
Regards
Clement



>  3 files changed, 120 insertions(+), 1 deletion(-)
>  create mode 100644 meta/recipes-devtools/qemu/qemu/qemu-guest-agent.init
>  create mode 100644 meta/recipes-devtools/qemu/qemu/qemu-guest-agent.udev
>
> diff --git a/meta/recipes-devtools/qemu/qemu.inc 
> b/meta/recipes-devtools/qemu/qemu.inc
> index 1e768b560d..b41055fe5d 100644
> --- a/meta/recipes-devtools/qemu/qemu.inc
> +++ b/meta/recipes-devtools/qemu/qemu.inc
> @@ -9,7 +9,7 @@ LICENSE = "GPL-2.0-only & LGPL-2.1-only"
>  RDEPENDS:${PN}-ptest = "bash"
>
>  require qemu-targets.inc
> -inherit pkgconfig ptest
> +inherit pkgconfig ptest update-rc.d systemd
>
>  LIC_FILES_CHKSUM = "file://COPYING;md5=441c28d2cf86e15a37fa47e15a72fbac \
>  
> file://COPYING.LIB;endline=24;md5=8c5efda6cf1e1b03dcfd0e6c0d271c7f"
> @@ -32,6 +32,8 @@ SRC_URI = "https://download.qemu.org/${BPN}-${PV}.tar.xz \
> file://0001-configure-Fix-check-tcg-not-executing-any-tests.patch 
> \
> 
> file://0001-Revert-linux-user-add-more-compat-ioctl-definitions.patch \
> 
> file://0002-Revert-linux-user-fix-compat-with-glibc-2.36-sys-mou.patch \
> +   file://qemu-guest-agent.init \
> +   file://qemu-guest-agent.udev \
> "
>  UPSTREAM_CHECK_REGEX = "qemu-(?P\d+(\.\d+)+)\.tar"
>
> @@ -132,6 +134,20 @@ do_configure[cleandirs] += "${B}"
>  do_install () {
> export STRIP=""
> oe_runmake 'DESTDIR=${D}' install
> +
> +   # If we built the guest agent, also install startup/udev rules
> +   if [ -e "${D}${bindir}/qemu-ga" ]; then
> +   install -d ${D}${sysconfdir}/init.d/
> +   install -m 0755 ${WORKDIR}/qemu-guest-agent.init 
> ${D}${sysconfdir}/init.d/qemu-guest-agent
> +   sed -i 's:@bindir@:${bindir}:' 
> ${D}${sysconfdir}/init.d/qemu-guest-agent
> +
> +   install -d ${D}${sysconfdir}/udev/rules.d/
> +   install -m 0644 ${WORKDIR}/qemu-guest-agent.udev 
> ${D}${sysconfdir}/udev/rules.d/60-qemu-guest-agent.rules
> +
> +   install -d ${D}${systemd_unitdir}/system/
> +   install -m 0644 ${S}/contrib/systemd/qemu-guest-agent.service 
> ${D}${systemd_unitdir}/system
> +   sed -i -e 's,-/usr/bin/,-${bindir}/,g' 
> ${D}${systemd_unitdir}/system/qemu-guest-agent.service
> +   fi
>  }
>
>  # The following fragment will create a wrapper for qemu-mips user emulation
> @@ -210,3 +226,20 @@ PACKAGECONFIG[jack] = 
> "--enable-jack,--disable-jack,jack,"
>  INSANE_SKIP:${PN} = "arch"
>
>  FILES:${PN} += "${datadir}/icons"
> +
> +# Put the guest agent in a separate package
> +PACKAGES =+ "${PN}-guest-agent"
> +SUMMARY:${PN}-guest-agent = "QEMU guest agent"
> +FILES:${PN}-guest-agent += " \
> +${bindir}/qemu-ga \
> +${sysconfdir}/udev/rules.d/60-qemu-guest-agent.rules \
> +${sysconfdir}/init.d/qemu-guest-agent \
> +${systemd_unitdir}/system/qemu-guest-agent.service \
> +"
> +
> +INITSCRIPT_PACKAGES = "${PN}-guest-agent"
> +INITSCRIPT_NAME:${PN}-guest-agent = "qemu-guest-agent"
> +INITSCRIPT_PARAMS:${PN}-guest-agent = "defaults"
> +
> +SYSTEMD_PACKAGES = "${PN}-guest-agent"
> +SYSTEMD_SERVICE:${PN}-guest-agent = "qemu-guest-agent.service"
> diff --git a/meta/recipes-devtools/qemu/qemu/qemu-guest-agent.init 
> b/meta/recipes-devtools/qemu/qemu/qemu-guest-agent.init
> new file mode 100644
> index 00..493da0ef1a
> --- /dev/null
> +++ b/meta/recipes-devtools/qemu/qemu/qemu-guest-agent.init
> @@ -0,0 +1,84 @@
> +#!/bin/sh
> +### BEGIN INIT INFO
> +# Provides:qemu-guest-agent
> +# Required-Start:  $remote_fs $syslog
> +# Required-Stop:   $remote_fs $syslog
> +# Default-Start:   2 3 4 5
> +# Default-Stop:0 1 6
> +# 

[OE-core] [PATCH v4 1/2] qemu: split out qemu-guest-agent, add startup scripts

2023-03-08 Thread Clément Péron
Split out the QEMU guest agent into a separate package. The agent is
intended to be installed within a QEMU VM guest where a user is likely
to not want to have the rest of the QEMU installation within it.

Additionally, an initscript, udev rules file, and systemd unit file are
added to the package so that the guest agent can start automatically;
the former two come from Debian's packaging for qemu-guest-agent.

Signed-off-by: Brenda Streiff 
Signed-off-by: Clément Péron 
---

Changes since v3:
 - fix missing comma in udev rule

Changes since v2:
 - Add missing files
 - rebase on top of master

Changes since v1:
 - Fix systemd-service using PN where it should not

 meta/recipes-devtools/qemu/qemu.inc   | 35 +++-
 .../qemu/qemu/qemu-guest-agent.init   | 84 +++
 .../qemu/qemu/qemu-guest-agent.udev   |  2 +
 3 files changed, 120 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-devtools/qemu/qemu/qemu-guest-agent.init
 create mode 100644 meta/recipes-devtools/qemu/qemu/qemu-guest-agent.udev

diff --git a/meta/recipes-devtools/qemu/qemu.inc 
b/meta/recipes-devtools/qemu/qemu.inc
index 1e768b560d..b41055fe5d 100644
--- a/meta/recipes-devtools/qemu/qemu.inc
+++ b/meta/recipes-devtools/qemu/qemu.inc
@@ -9,7 +9,7 @@ LICENSE = "GPL-2.0-only & LGPL-2.1-only"
 RDEPENDS:${PN}-ptest = "bash"
 
 require qemu-targets.inc
-inherit pkgconfig ptest
+inherit pkgconfig ptest update-rc.d systemd
 
 LIC_FILES_CHKSUM = "file://COPYING;md5=441c28d2cf86e15a37fa47e15a72fbac \
 
file://COPYING.LIB;endline=24;md5=8c5efda6cf1e1b03dcfd0e6c0d271c7f"
@@ -32,6 +32,8 @@ SRC_URI = "https://download.qemu.org/${BPN}-${PV}.tar.xz \
file://0001-configure-Fix-check-tcg-not-executing-any-tests.patch \

file://0001-Revert-linux-user-add-more-compat-ioctl-definitions.patch \

file://0002-Revert-linux-user-fix-compat-with-glibc-2.36-sys-mou.patch \
+   file://qemu-guest-agent.init \
+   file://qemu-guest-agent.udev \
"
 UPSTREAM_CHECK_REGEX = "qemu-(?P\d+(\.\d+)+)\.tar"
 
@@ -132,6 +134,20 @@ do_configure[cleandirs] += "${B}"
 do_install () {
export STRIP=""
oe_runmake 'DESTDIR=${D}' install
+
+   # If we built the guest agent, also install startup/udev rules
+   if [ -e "${D}${bindir}/qemu-ga" ]; then
+   install -d ${D}${sysconfdir}/init.d/
+   install -m 0755 ${WORKDIR}/qemu-guest-agent.init 
${D}${sysconfdir}/init.d/qemu-guest-agent
+   sed -i 's:@bindir@:${bindir}:' 
${D}${sysconfdir}/init.d/qemu-guest-agent
+
+   install -d ${D}${sysconfdir}/udev/rules.d/
+   install -m 0644 ${WORKDIR}/qemu-guest-agent.udev 
${D}${sysconfdir}/udev/rules.d/60-qemu-guest-agent.rules
+
+   install -d ${D}${systemd_unitdir}/system/
+   install -m 0644 ${S}/contrib/systemd/qemu-guest-agent.service 
${D}${systemd_unitdir}/system
+   sed -i -e 's,-/usr/bin/,-${bindir}/,g' 
${D}${systemd_unitdir}/system/qemu-guest-agent.service
+   fi
 }
 
 # The following fragment will create a wrapper for qemu-mips user emulation
@@ -210,3 +226,20 @@ PACKAGECONFIG[jack] = "--enable-jack,--disable-jack,jack,"
 INSANE_SKIP:${PN} = "arch"
 
 FILES:${PN} += "${datadir}/icons"
+
+# Put the guest agent in a separate package
+PACKAGES =+ "${PN}-guest-agent"
+SUMMARY:${PN}-guest-agent = "QEMU guest agent"
+FILES:${PN}-guest-agent += " \
+${bindir}/qemu-ga \
+${sysconfdir}/udev/rules.d/60-qemu-guest-agent.rules \
+${sysconfdir}/init.d/qemu-guest-agent \
+${systemd_unitdir}/system/qemu-guest-agent.service \
+"
+
+INITSCRIPT_PACKAGES = "${PN}-guest-agent"
+INITSCRIPT_NAME:${PN}-guest-agent = "qemu-guest-agent"
+INITSCRIPT_PARAMS:${PN}-guest-agent = "defaults"
+
+SYSTEMD_PACKAGES = "${PN}-guest-agent"
+SYSTEMD_SERVICE:${PN}-guest-agent = "qemu-guest-agent.service"
diff --git a/meta/recipes-devtools/qemu/qemu/qemu-guest-agent.init 
b/meta/recipes-devtools/qemu/qemu/qemu-guest-agent.init
new file mode 100644
index 00..493da0ef1a
--- /dev/null
+++ b/meta/recipes-devtools/qemu/qemu/qemu-guest-agent.init
@@ -0,0 +1,84 @@
+#!/bin/sh
+### BEGIN INIT INFO
+# Provides:qemu-guest-agent
+# Required-Start:  $remote_fs $syslog
+# Required-Stop:   $remote_fs $syslog
+# Default-Start:   2 3 4 5
+# Default-Stop:0 1 6
+# Short-Description:   QEMU Guest Agent
+### END INIT INFO
+#
+# Do not configure this file. Edit /etc/default/qemu-guest-agent
+#
+
+set -e
+
+. /etc/init.d/functions
+
+PATH=/sbin:/usr/sbin:/bin:/usr/bin
+DESC="QEMU Guest Agent"
+NAME=qemu-ga
+DAEMON=@bindir@/$NAME
+PIDFILE=/var/run/$NAME.pid
+
+# config
+DAEMON_ARGS=""
+# default transport
+TRANSPORT=virtio-serial:/dev/virtio-ports/org.qemu.guest_agent.0
+NO_START=0
+
+test ! -r /etc/default/qemu-guest-agent || . /etc/default/qemu-guest-agent
+test "$NO_START" = "0" || exit 0
+test -x "$DAEMON" || exit 0
+
+#
+# Function