ref-manual: classes: fix bin_package description
PATCH v2 1/1 ref-manual: classes: fix bin_package description
The previous bin_package description was confusing: it would instruct to use the git fetcher to extract the content of an RPM package using the subpath option - but that's not possible as the git fetcher can be used to clone a repository but not to do the extraction.
Simplify the example with the HTTP fetcher that points to an RPM file, and instruct the user to use subdir to extract its content to the directory expected by S.
---
Changes in v2:
- Instead of updating the example, update the description of the class
with a more common (and working) example usage of the class.
- Link to v1: https://lore.kernel.org/r/[email protected]
--- documentation/ref-manual/classes.rst | 38 ++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 21 deletions(-)
documentation/ref-manual/classes.rst +17 -21
@@ -159,27 +159,23 @@ software that includes bash-completion data. ``bin_package`` =============== -The :ref:`ref-classes-bin-package` class is a helper class for recipes that extract the -contents of a binary package (e.g. an RPM) and install those contents -rather than building the binary from source. The binary package is -extracted and new packages in the configured output package format are -created. Extraction and installation of proprietary binaries is a good -example use for this class. - -.. note:: - - For RPMs and other packages that do not contain a subdirectory, you - should specify an appropriate fetcher parameter to point to the - subdirectory. For example, if BitBake is using the Git fetcher (``git://``), - the "subpath" parameter limits the checkout to a specific subpath - of the tree. Here is an example where ``${BP}`` is used so that the files - are extracted into the subdirectory expected by the default value of - :term:`S`:: - - SRC_URI = "git://example.com/downloads/somepackage.rpm;branch=main;subpath=${BP}" - - See the ":ref:`bitbake-user-manual/bitbake-user-manual-fetching:fetchers`" section in the BitBake User Manual for - more information on supported BitBake Fetchers. +The :ref:`ref-classes-bin-package` class is a helper class for recipes that +extracts the contents of a binary package (e.g. an RPM package) and installs +those contents rather than building the binary from source. The binary package +is extracted and new packages in the configured output package format are +created. Extraction and installation of proprietary binaries is a good example +use for this class. + +For RPMs and other packages that do not contain a subdirectory, you should set +the :term:`SRC_URI` option ``subdir`` to :term:`BP` so that the contents are +extracted to the directory expected by the default value of :term:`S`. For +example:: + + SRC_URI = "https://example.com/downloads/somepackage.rpm;subdir=${BP}" + +See the ":ref:`bitbake-user-manual/bitbake-user-manual-fetching:fetchers`" +section in the BitBake User Manual for more information about supported BitBake +Fetchers. .. _ref-classes-binconfig:
---
base-commit: 7d5eb0cee5b2b7096969819d7d7ce569a3c92f27
change-id: 20241115-fix-bin-package-eed7633fbecd
Best regards,
Signature · 1 line
Antonin Godard <[email protected]>
Hi Antonin,
Quoted 10 lines · Antonin Godard
The previous
bin_packagedescription was confusing: it would instruct to use the git fetcher to extract the content of an RPM package using thesubpathoption - but that's not possible as the git fetcher can be used to clone a repository but not to do the extraction.Simplify the example with the HTTP fetcher that points to an RPM file, and instruct the user to use
subdirto extract its content to the directory expected by S.Signed-off-by Antonin Godard <[email protected]>
[...]
documentation/ref-manual/classes.rst software that includes bash-completion data. · line 165
Quoted 4 lines
documentation/ref-manual/classes.rst +4
-0+The :ref:`ref-classes-bin-package` class is a helper class for recipes that +extracts the contents of a binary package (e.g. an RPM package) and installs +those contents rather than building the binary from source. The binary package +is extracted and new packages in the configured output package format are
I think this is actually all misleading, this is not what bin_package class does.
What it does is disable the configure and compile tasks, take the entirety of ${S} (aside from patches/ and .pc/ directories) and install it in ${D}.
However, it is mostly useful when providing RPMs/tarballs/debs, etc... but the extraction is actually done by the fetcher I believe?
While looking in the fetcher, I discovered that there's a parameter we haven't documented yet for RPMs which is "extract", c.f. https://git.openembedded.org/bitbake/tree/lib/bb/fetch2/__init__.py#n1568 I believe this is a way to extract only one (or more?) files from an RPM and then extract it again? c.f. commit 906285ff00d6ffd3fd7713af52250e7c6503edb7 in poky. Unrelated though :)
So we should document this and states for what kind of recipes this is usually inherited but I think the current content is inadequate?
Cheers,
Quentin
Hi Quentin,
Quoted 23 lines · Quentin Schulz
Hi Antonin,
Quoted 10 lines · Antonin Godard
The previous
bin_packagedescription was confusing: it would instruct to use the git fetcher to extract the content of an RPM package using thesubpathoption - but that's not possible as the git fetcher can be used to clone a repository but not to do the extraction.Simplify the example with the HTTP fetcher that points to an RPM file, and instruct the user to use
subdirto extract its content to the directory expected by S.Signed-off-by Antonin Godard <[email protected]>[...]
documentation/ref-manual/classes.rst software that includes bash-completion data. · line 165
Quoted 4 lines
documentation/ref-manual/classes.rst +4
-0+The :ref:`ref-classes-bin-package` class is a helper class for recipes that +extracts the contents of a binary package (e.g. an RPM package) and installs +those contents rather than building the binary from source. The binary package +is extracted and new packages in the configured output package format areI think this is actually all misleading, this is not what
bin_packageclass does.
Quoted 3 lines
What it does is disable the configure and compile tasks, take the entirety of ${S} (aside from patches/ and .pc/ directories) and install it in ${D}.
True.
Quoted 2 lines
However, it is mostly useful when providing RPMs/tarballs/debs, etc... but the extraction is actually done by the fetcher I believe?
Yes.
Quoted 6 lines
While looking in the fetcher, I discovered that there's a parameter we haven't documented yet for RPMs which is "extract", c.f.
https://git.openembedded.org/bitbake/tree/lib/bb/fetch2/__init__.py#n1568
I believe this is a way to extract only one (or more?) files from an RPM and then extract it again? c.f. commit906285ff00d6ffd3fd7713af52250e7c6503edb7in poky. Unrelated though :)
Interesting (and old) find :) I couldn't find examples of this in poky, and there's no test associated to it. I think we should probably add both doc and test, probably.
Quoted 2 lines
So we should document this and states for what kind of recipes this is usually inherited but I think the current content is inadequate?
Right I agree, I'll explain the S to D copying, which is what bin_package does. And mention that the extraction is done by the fetcher in most cases.
Antonin
Signature · 3 lines
Antonin Godard, Bootlin Embedded Linux and Kernel engineering https://bootlin.com