public inbox for docs@lists.yoctoproject.org
 help / color / mirror / Atom feed
* [PATCH] overview-manual: concepts: add details on package splitting
@ 2024-10-16 13:19 Antonin Godard
  2024-10-16 14:10 ` [docs] " Quentin Schulz
  0 siblings, 1 reply; 7+ messages in thread
From: Antonin Godard @ 2024-10-16 13:19 UTC (permalink / raw)
  To: docs; +Cc: Thomas Petazzoni, Antonin Godard

The package splitting section of the overview manual currently lacks any
explanation of how package splitting is implemented and redirects to
the package class, which is not really understandable for newcomers to
the project.

This patch adds a short explanation of what is done:

* How the PACKAGES variable is defined.
* How the FILES variable is defined.
* How the two work together.
* How to add a custom package.

This should give enough details to a new user on what package splitting
achieves and how to add a custom package.

Adresses [YOCTO #13225]

Signed-off-by: Antonin Godard <antonin.godard@bootlin.com>
---
 documentation/overview-manual/concepts.rst | 49 +++++++++++++++++++++++++++---
 1 file changed, 44 insertions(+), 5 deletions(-)

diff --git a/documentation/overview-manual/concepts.rst b/documentation/overview-manual/concepts.rst
index 62f2327a7e27a777f738523e7fafe62422186abb..d3e90b80d4fe1954c7aacba8f0fe243cba04c1b5 100644
--- a/documentation/overview-manual/concepts.rst
+++ b/documentation/overview-manual/concepts.rst
@@ -912,11 +912,50 @@ the analysis and package splitting process use several areas:
    execute on a system and it generates code for yet another machine
    (e.g. :ref:`ref-classes-cross-canadian` recipes).
 
-The :term:`FILES` variable defines the
-files that go into each package in
-:term:`PACKAGES`. If you want
-details on how this is accomplished, you can look at
-:yocto_git:`package.bbclass </poky/tree/meta/classes-global/package.bbclass>`.
+Packages for a recipe are listed in the :term:`PACKAGES` variable. The
+:yocto_git:`meta/conf/bitbake.conf </poky/tree/meta/conf/bitbake.conf>`
+configuration file defines the following default list of packages::
+
+  PACKAGES = "${PN}-src ${PN}-dbg ${PN}-staticdev ${PN}-dev ${PN}-doc ${PN}-locale ${PACKAGE_BEFORE_PN} ${PN}"
+
+Each of these packages contain a default list of files defined with the
+:term:`FILES` variable. For example, the package ``${PN}-dev`` represents the
+development variant of the main package ``${PN}`` and its default list of file
+contains development-oriented files only::
+
+  FILES:${PN}-dev = "${includedir} ${FILES_SOLIBSDEV} ${libdir}/*.la \
+                  ${libdir}/*.o ${libdir}/pkgconfig ${datadir}/pkgconfig \
+                  ${datadir}/aclocal ${base_libdir}/*.o \
+                  ${libdir}/${BPN}/*.la ${base_libdir}/*.la \
+                  ${libdir}/cmake ${datadir}/cmake"
+
+The paths in this list must be *absolute*, and must use the path prefixes
+defined by the :yocto_git:`bitbake.conf </poky/tree/meta/conf/bitbake.conf>`
+configuration file, such as ``${sysconfdir}``, ``${bindir}``, etc. They can
+optionally use wildcards (``*`` ) to match multiple files installed in a
+directory.
+
+.. note::
+
+   The list of files for a package is defined using the override syntax by
+   separating :term:`FILES` and the package name by a semi-colon (``:``).
+
+The order of the packages in the :term:`PACKAGES` is important: during package
+splitting, going from the first element in :term:`PACKAGES` to the last, each
+file matching a pattern specified in the corresponding :term:`FILES` definition
+will be included in the package and *excluded* for the remaining packages listed
+in :term:`PACKAGES`. As a consequence, custom packages should be added using the
+prepend operator (``=+``) to be prioritized.
+
+For example, to add a custom package variant of the ``${PN}`` recipe named
+``${PN}-extra`` (name is arbitrary), one should write::
+
+  PACKAGES =+ "${PN}-extra"
+
+Alternatively, a custom package can be added to the
+:term:`PACKAGE_BEFORE_PN` variable::
+
+  PACKAGE_BEFORE_PN += "${PN}-extra"
 
 Depending on the type of packages being created (RPM, DEB, or IPK), the
 :ref:`do_package_write_* <ref-tasks-package_write_deb>`

---
base-commit: 3820a7bec0bb23bcd26bd99be2275d6d214a3a04
change-id: 20241015-bug-13225-package-split-57c8dc0f96b5

Best regards,
-- 
Antonin Godard <antonin.godard@bootlin.com>



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

end of thread, other threads:[~2024-10-22 13:08 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-16 13:19 [PATCH] overview-manual: concepts: add details on package splitting Antonin Godard
2024-10-16 14:10 ` [docs] " Quentin Schulz
2024-10-17  8:44   ` Antonin Godard
2024-10-18 12:37     ` Quentin Schulz
2024-10-22 11:54       ` Antonin Godard
2024-10-22 12:02         ` Quentin Schulz
2024-10-22 13:08           ` Antonin Godard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox