All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCHv2] common-tasks: Add an example of using bbappends to add a file
@ 2021-08-19 15:12 Tom Rini
  2021-08-20  7:59 ` [docs] " Quentin Schulz
  0 siblings, 1 reply; 3+ messages in thread
From: Tom Rini @ 2021-08-19 15:12 UTC (permalink / raw)
  To: docs

Use the xserver-xf86-config_%.bbappend from meta-raspberrypi to provide
an example of having a bbappend file add files to an existing recipe.

Signed-off-by: Tom Rini <trini@konsulko.com>
---
Changes in v2:
- Based on Quentin's feedback, submit a fix upstream to meta-raspberrypi
  for their FILES append usage.  Incorporate that now that the fix is
  merged upstream.
- Incorporate Quentin's syntax suggestions.
- Based on Quentin's feedback in the summary paragraph of the new
  section, reword to be more precise about when things change.
---
 documentation/dev-manual/common-tasks.rst | 61 +++++++++++++++++++++++
 1 file changed, 61 insertions(+)

diff --git a/documentation/dev-manual/common-tasks.rst b/documentation/dev-manual/common-tasks.rst
index 4a5011ea749a..5a0443c8ee5f 100644
--- a/documentation/dev-manual/common-tasks.rst
+++ b/documentation/dev-manual/common-tasks.rst
@@ -554,6 +554,67 @@ The end result of this ``.bbappend`` file is that on a Raspberry Pi, where
 used during :ref:`ref-tasks-fetch` and the test for a non-zero file size in
 :ref:`ref-tasks-install` will return true, and the file will be installed.
 
+Installing Additional Files Using Your Layer
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+As another example, consider the main ``xserver-xf86-config`` recipe and a
+corresponding ``xserver-xf86-config`` append file both from the :term:`Source
+Directory`.  Here is the main ``xserver-xf86-config`` recipe, which is named
+``xserver-xf86-config_0.1.bb`` and located in the "meta" layer at
+``meta/recipes-graphics/xorg-xserver``::
+
+   SUMMARY = "X.Org X server configuration file"
+   HOMEPAGE = "http://www.x.org"
+   SECTION = "x11/base"
+   LICENSE = "MIT-X"
+   LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
+   PR = "r33"
+
+   SRC_URI = "file://xorg.conf"
+
+   S = "${WORKDIR}"
+
+   CONFFILES:${PN} = "${sysconfdir}/X11/xorg.conf"
+
+   PACKAGE_ARCH = "${MACHINE_ARCH}"
+   ALLOW_EMPTY:${PN} = "1"
+
+   do_install () {
+	if test -s ${WORKDIR}/xorg.conf; then
+		install -d ${D}/${sysconfdir}/X11
+		install -m 0644 ${WORKDIR}/xorg.conf ${D}/${sysconfdir}/X11/
+	fi
+   }
+
+Following is the append file, which is named ``xserver-xf86-config_%.bbappend``
+and is from the Raspberry Pi BSP Layer named ``meta-raspberrypi``. The
+file is in the layer at ``recipes-graphics/xorg-xserver``::
+
+   FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
+
+   SRC_URI:append:rpi = " \
+       file://xorg.conf.d/98-pitft.conf \
+       file://xorg.conf.d/99-calibration.conf \
+   "
+   do_install:append:rpi () {
+       PITFT="${@bb.utils.contains("MACHINE_FEATURES", "pitft", "1", "0", d)}"
+       if [ "${PITFT}" = "1" ]; then
+           install -d ${D}/${sysconfdir}/X11/xorg.conf.d/
+           install -m 0644 ${WORKDIR}/xorg.conf.d/98-pitft.conf ${D}/${sysconfdir}/X11/xorg.conf.d/
+           install -m 0644 ${WORKDIR}/xorg.conf.d/99-calibration.conf ${D}/${sysconfdir}/X11/xorg.conf.d/
+       fi
+   }
+
+   FILES:${PN}:append:rpi = " ${sysconfdir}/X11/xorg.conf.d/*"
+
+Building off of the previous example, we once again are setting the
+:term:`FILESEXTRAPATHS` variable.  In this case we are also using
+:term:`SRC_URI` to list additional source files to use when ``rpi`` is found in
+the list of :term:`OVERRIDES`.  The :ref:`ref-tasks-install` task will then perform a
+check for an additional :term:`MACHINE_FEATURES` that if set will cause these
+additional files to be installed.  These additional files are listed in
+:term:`FILES` so that they will be packaged.
+
 Prioritizing Your Layer
 -----------------------
 
-- 
2.17.1


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

* Re: [docs] [PATCHv2] common-tasks: Add an example of using bbappends to add a file
  2021-08-19 15:12 [PATCHv2] common-tasks: Add an example of using bbappends to add a file Tom Rini
@ 2021-08-20  7:59 ` Quentin Schulz
  2021-09-13 15:41   ` Michael Opdenacker
  0 siblings, 1 reply; 3+ messages in thread
From: Quentin Schulz @ 2021-08-20  7:59 UTC (permalink / raw)
  To: Tom Rini; +Cc: docs

Hi Tom,

On Thu, Aug 19, 2021 at 11:12:33AM -0400, Tom Rini wrote:
> Use the xserver-xf86-config_%.bbappend from meta-raspberrypi to provide
> an example of having a bbappend file add files to an existing recipe.
> 
> Signed-off-by: Tom Rini <trini@konsulko.com>

Reviewed-by: Quentin Schulz <foss@0leil.net>

Many thanks!
Quentin

> ---
> Changes in v2:
> - Based on Quentin's feedback, submit a fix upstream to meta-raspberrypi
>   for their FILES append usage.  Incorporate that now that the fix is
>   merged upstream.
> - Incorporate Quentin's syntax suggestions.
> - Based on Quentin's feedback in the summary paragraph of the new
>   section, reword to be more precise about when things change.
> ---
>  documentation/dev-manual/common-tasks.rst | 61 +++++++++++++++++++++++
>  1 file changed, 61 insertions(+)
> 
> diff --git a/documentation/dev-manual/common-tasks.rst b/documentation/dev-manual/common-tasks.rst
> index 4a5011ea749a..5a0443c8ee5f 100644
> --- a/documentation/dev-manual/common-tasks.rst
> +++ b/documentation/dev-manual/common-tasks.rst
> @@ -554,6 +554,67 @@ The end result of this ``.bbappend`` file is that on a Raspberry Pi, where
>  used during :ref:`ref-tasks-fetch` and the test for a non-zero file size in
>  :ref:`ref-tasks-install` will return true, and the file will be installed.
>  
> +Installing Additional Files Using Your Layer
> +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> +
> +As another example, consider the main ``xserver-xf86-config`` recipe and a
> +corresponding ``xserver-xf86-config`` append file both from the :term:`Source
> +Directory`.  Here is the main ``xserver-xf86-config`` recipe, which is named
> +``xserver-xf86-config_0.1.bb`` and located in the "meta" layer at
> +``meta/recipes-graphics/xorg-xserver``::
> +
> +   SUMMARY = "X.Org X server configuration file"
> +   HOMEPAGE = "https://urldefense.proofpoint.com/v2/url?u=http-3A__www.x.org&d=DwIBAg&c=_sEr5x9kUWhuk4_nFwjJtA&r=LYjLexDn7rXIzVmkNPvw5ymA1XTSqHGq8yBP6m6qZZ4njZguQhZhkI_-172IIy1t&m=-29DA_-pdEqHQSyf0kCmWI525NPKUKUY41Sj1r21ZFs&s=_ME7L8fLob_4Mm6mqS2PY-QPwWTcUwliVPk6FqSOXk8&e= "
> +   SECTION = "x11/base"
> +   LICENSE = "MIT-X"
> +   LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
> +   PR = "r33"
> +
> +   SRC_URI = "file://xorg.conf"
> +
> +   S = "${WORKDIR}"
> +
> +   CONFFILES:${PN} = "${sysconfdir}/X11/xorg.conf"
> +
> +   PACKAGE_ARCH = "${MACHINE_ARCH}"
> +   ALLOW_EMPTY:${PN} = "1"
> +
> +   do_install () {
> +	if test -s ${WORKDIR}/xorg.conf; then
> +		install -d ${D}/${sysconfdir}/X11
> +		install -m 0644 ${WORKDIR}/xorg.conf ${D}/${sysconfdir}/X11/
> +	fi
> +   }
> +
> +Following is the append file, which is named ``xserver-xf86-config_%.bbappend``
> +and is from the Raspberry Pi BSP Layer named ``meta-raspberrypi``. The
> +file is in the layer at ``recipes-graphics/xorg-xserver``::
> +
> +   FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
> +
> +   SRC_URI:append:rpi = " \
> +       file://xorg.conf.d/98-pitft.conf \
> +       file://xorg.conf.d/99-calibration.conf \
> +   "
> +   do_install:append:rpi () {
> +       PITFT="${@bb.utils.contains("MACHINE_FEATURES", "pitft", "1", "0", d)}"
> +       if [ "${PITFT}" = "1" ]; then
> +           install -d ${D}/${sysconfdir}/X11/xorg.conf.d/
> +           install -m 0644 ${WORKDIR}/xorg.conf.d/98-pitft.conf ${D}/${sysconfdir}/X11/xorg.conf.d/
> +           install -m 0644 ${WORKDIR}/xorg.conf.d/99-calibration.conf ${D}/${sysconfdir}/X11/xorg.conf.d/
> +       fi
> +   }
> +
> +   FILES:${PN}:append:rpi = " ${sysconfdir}/X11/xorg.conf.d/*"
> +
> +Building off of the previous example, we once again are setting the
> +:term:`FILESEXTRAPATHS` variable.  In this case we are also using
> +:term:`SRC_URI` to list additional source files to use when ``rpi`` is found in
> +the list of :term:`OVERRIDES`.  The :ref:`ref-tasks-install` task will then perform a
> +check for an additional :term:`MACHINE_FEATURES` that if set will cause these
> +additional files to be installed.  These additional files are listed in
> +:term:`FILES` so that they will be packaged.
> +
>  Prioritizing Your Layer
>  -----------------------
>  
> -- 
> 2.17.1
> 

> 
> 
> 


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

* Re: [docs] [PATCHv2] common-tasks: Add an example of using bbappends to add a file
  2021-08-20  7:59 ` [docs] " Quentin Schulz
@ 2021-09-13 15:41   ` Michael Opdenacker
  0 siblings, 0 replies; 3+ messages in thread
From: Michael Opdenacker @ 2021-09-13 15:41 UTC (permalink / raw)
  To: Quentin Schulz, Tom Rini; +Cc: docs

Tom, Quentin,

On 8/20/21 9:59 AM, Quentin Schulz wrote:
> Hi Tom,
>
> On Thu, Aug 19, 2021 at 11:12:33AM -0400, Tom Rini wrote:
>> Use the xserver-xf86-config_%.bbappend from meta-raspberrypi to provide
>> an example of having a bbappend file add files to an existing recipe.
>>
>> Signed-off-by: Tom Rini <trini@konsulko.com>
> Reviewed-by: Quentin Schulz <foss@0leil.net>

Thanks for the nice patch and reviews.

Merged into "master-next" (at last!)

Cheers,
Michael.

-- 
Michael Opdenacker, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


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

end of thread, other threads:[~2021-09-13 15:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-19 15:12 [PATCHv2] common-tasks: Add an example of using bbappends to add a file Tom Rini
2021-08-20  7:59 ` [docs] " Quentin Schulz
2021-09-13 15:41   ` Michael Opdenacker

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.