Updates around the UNPACKDIR variable
cover Updates around the UNPACKDIR variable
In the overview manual, for images that should mention UNPACKDIR, update them to SVGs. Using SVGs will allow maintainers to grep for variables and find it in SVGs images, since they are text. It also renders them much better in the doc.
Preview the files here:
https://lufi.bootlin.com/r/wRQmbAvsew#U/AfVq1d88D9hE7Dp2jPHoRzSY6NN5F/2ar+Bki5u3U=
https://lufi.bootlin.com/r/fG3m9UF9DH#6cs07TfeggRurNR/ohUd8y7hGQ3McD0rBV1ip13XWKI=
https://lufi.bootlin.com/r/MJzY5kNWA4#+tBsGlCLQpx9tFB33wJtCbdXjO06TTAzlIDM9OgLm+Y=
https://lufi.bootlin.com/r/xjExs3h2Ht#98BQnm2Tj0ZVoS9NZdCOGbV8KqdTNGt19QRcIZ+UVZU=
The last patches attempt at clarifying the purpose of the UNPACKDIR variable. The overview manual being an overview, I've phrased the paragraph to remain simple and straightforward.
The last patch modifies the reference manual so that:
1. It gives advice on how S and UNPACKDIR should be set.
2. Explain the directory move behavior when a subdirectory of S matched one in UNPACKDIR.
---
Antonin Godard (6):
overview-manual: convert source-fetching.png to svg and fix UNPACKDIR
overview-manual: convert patching.png to svg
overview-manual: convert configuration-compile-autoreconf.png to svg
overview-manual: convert analysis-for-package-splitting.png to svg
overview-manual: add UNPACKDIR in the directory description ref-manual/variables: improve the UNPACKDIR documentation
documentation/overview-manual/concepts.rst | 24 +- .../figures/analysis-for-package-splitting.png | Bin 68434 -> 0 bytes .../figures/configuration-compile-autoreconf.png | Bin 70877 -> 0 bytes documentation/overview-manual/figures/patching.png | Bin 57414 -> 0 bytes .../overview-manual/figures/source-fetching.png | Bin 46896 -> 0 bytes .../svg/analysis-for-package-splitting.svg | 2111 ++++++++++++++++++++ .../svg/configuration-compile-autoreconf.svg | 1561 +++++++++++++++ documentation/overview-manual/svg/patching.svg | 1350 +++++++++++++ .../overview-manual/svg/source-fetching.svg | 1220 +++++++++++ documentation/ref-manual/variables.rst | 39 +- 10 files changed, 6292 insertions(+), 13 deletions(-)
---
base-commit: 6eda443c7fcfeecebd6b44b96a1587c4bb093a34
change-id: 20250217-overview-figures-ead01baaeebf
Best regards,
Signature · 1 line
Antonin Godard <[email protected]>
PATCH 1/6 overview-manual: convert source-fetching.png to svg and fix UNPACKDIR
Convert the png file to an SVG file. This will be easier to maintain and also weighs a little less in the repository. Also, add the new UNPACKDIR directory to the image.
This fixes [YOCTO #15730].
--- documentation/overview-manual/concepts.rst | 2 +- .../overview-manual/figures/source-fetching.png | Bin 46896 -> 0 bytes .../overview-manual/svg/source-fetching.svg | 1220 ++++++++++++++++++++ 3 files changed, 1221 insertions(+), 1 deletion(-)
documentation/overview-manual/concepts.rst +1 -1
@@ -683,7 +683,7 @@ Source Fetching The first stages of building a recipe are to fetch and unpack the source code: -.. image:: figures/source-fetching.png +.. image:: svg/source-fetching.* :width: 100% The :ref:`ref-tasks-fetch` and :ref:`ref-tasks-unpack` tasks fetch
documentation/overview-manual/figures/source-fetching.png deleted binary +0 -0
documentation/overview-manual/svg/source-fetching.svg new file +1220 -0
1,220 lines not on this page · raw message
Signature · 1 line
2.47.0
Re: [docs] [PATCH 1/6] overview-manual: convert source-fetching.png to svg and fix UNPACKDIR
Hi Antonin,
Quoted 2 lines · Antonin Godard via lists.yoctoproject.org
Convert the png file to an SVG file. This will be easier to maintain and also weighs a little less in the repository. Also, add the new UNPACKDIR
Well, it'll still be in the git objects so except if you download a tarball or limit the depth of the fetch, we won't gain anything in terms of size :)
In any case, PNG bad, SVG good!
Thanks!
Quentin
PATCH 2/6 overview-manual: convert patching.png to svg
In reply to Antonin GodardConvert the png file to an SVG file, and add the UNPACKDIR reference.
--- documentation/overview-manual/concepts.rst | 2 +- documentation/overview-manual/figures/patching.png | Bin 57414 -> 0 bytes documentation/overview-manual/svg/patching.svg | 1350 ++++++++++++++++++++ 3 files changed, 1351 insertions(+), 1 deletion(-)
documentation/overview-manual/concepts.rst +1 -1
@@ -764,7 +764,7 @@ Patching Once source code is fetched and unpacked, BitBake locates patch files and applies them to the source files: -.. image:: figures/patching.png +.. image:: svg/patching.* :width: 100% The :ref:`ref-tasks-patch` task uses a
documentation/overview-manual/figures/patching.png deleted binary +0 -0
documentation/overview-manual/svg/patching.svg new file +1350 -0
1,350 lines not on this page · raw message
Signature · 1 line
2.47.0
Re: [docs] [PATCH 2/6] overview-manual: convert patching.png to svg
Hi Antonin,
Quoted 2 lines · Antonin Godard via lists.yoctoproject.org
Convert the png file to an SVG file, and add the UNPACKDIR reference.
Thanks!
Quentin
PATCH 3/6 overview-manual: convert configuration-compile-autoreconf.png to svg
In reply to Antonin GodardConvert the png file to an SVG file, and add the UNPACKDIR reference.
--- documentation/overview-manual/concepts.rst | 2 +- .../figures/configuration-compile-autoreconf.png | Bin 70877 -> 0 bytes .../svg/configuration-compile-autoreconf.svg | 1561 ++++++++++++++++++++ 3 files changed, 1562 insertions(+), 1 deletion(-)
documentation/overview-manual/concepts.rst +1 -1
@@ -805,7 +805,7 @@ After source code is patched, BitBake executes tasks that configure and compile the source code. Once compilation occurs, the files are copied to a holding area (staged) in preparation for packaging: -.. image:: figures/configuration-compile-autoreconf.png +.. image:: svg/configuration-compile-autoreconf.* :width: 100% This step in the build process consists of the following tasks:
documentation/overview-manual/figures/configuration-compile-autoreconf.png deleted binary +0 -0
documentation/overview-manual/svg/configuration-compile-autoreconf.svg new file +1561 -0
1,561 lines not on this page · raw message
Signature · 1 line
2.47.0
Re: [docs] [PATCH 3/6] overview-manual: convert configuration-compile-autoreconf.png to svg
Hi Antonin,
Quoted 2 lines · Antonin Godard via lists.yoctoproject.org
Convert the png file to an SVG file, and add the UNPACKDIR reference.
The arrows for the build directory are misaligned, especially for the machine-specific package.
I'm also a bit skeptical about the position of the star before EXTRA_OECONF, it feels like it's somehow part of the variable name. Maybe add a space or make the star appear a bit higher (like in the current PNG?).
A remark for the original content as well, but I don't really understand why B isn't passed to do_configure and do_install as well? Isn't it where build artifacts will be configured before do_compile runs and from where do_install will run in order to install files into $D?
do_configure[dirs] = "${B}"
do_install[dirs] = "${B}"
in base.bbclass for example.
I'm wondering also if we shouldn't have a bidirectional arrow for B for the configure and compile task as they are run from there, i.e. they generate files in there as well?
Cheers,
Quentin
Re: [docs] [PATCH 3/6] overview-manual: convert configuration-compile-autoreconf.png to svg
Hi Quentin,
Quoted 8 lines · Quentin Schulz
Hi Antonin,
Quoted 2 lines · Antonin Godard via lists.yoctoproject.org
Convert the png file to an SVG file, and add the UNPACKDIR reference.
The arrows for the build directory are misaligned, especially for the machine-specific package.
Yes, I noticed afterwards too. There were some font issues, rsvg-convert was not properly picking them up. And also having so many arrows require precision that is not taken into account when converting from SVGs to PNGs.
In the end, I think having the different arrows as text (for the rightmost part) is much better and will always meet the alignment no matter what the font is. E.g:
${PV} -------- WORKDIRSo now the output is this:
https://lufi.bootlin.com/r/EuK0sscTNP#uV4rb2CQCPCMXONMGiBTfR9PY8BTDm0g0xeIAI+AsH8=
What do you think?
Quoted 4 lines
I'm also a bit skeptical about the position of the star before
EXTRA_OECONF, it feels like it's somehow part of the variable name. Maybe add a space or make the star appear a bit higher (like in the current PNG?).
I will adjust that.
Quoted 5 lines
A remark for the original content as well, but I don't really understand why B isn't passed to
do_configureanddo_installas well? Isn't it where build artifacts will be configured beforedo_compileruns and from wheredo_installwill run in order to install files into $D?
Quoted 8 lines
do_configure[dirs] = "${B}"
do_install[dirs] = "${B}"in base.bbclass for example.
I'm wondering also if we shouldn't have a bidirectional arrow for B for the configure and compile task as they are run from there, i.e. they generate files in there as well?
I agree, B is used in all three.
For do_install, I guess a unidirectional arrow would make more sense as D is already used to point towards the other way.
Thanks,
Antonin
Signature · 3 lines
Antonin Godard, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
Re: [docs] [PATCH 3/6] overview-manual: convert configuration-compile-autoreconf.png to svg
Hi Antonin,
Quoted 16 lines · Antonin Godard
Hi Quentin,
Quoted 8 lines · Quentin Schulz
Hi Antonin,
Quoted 2 lines · Antonin Godard via lists.yoctoproject.org
Convert the png file to an SVG file, and add the UNPACKDIR reference.
The arrows for the build directory are misaligned, especially for the machine-specific package.
Yes, I noticed afterwards too. There were some font issues, rsvg-convert was not properly picking them up. And also having so many arrows require precision that is not taken into account when converting from SVGs to PNGs.
Quoted 6 lines
In the end, I think having the different arrows as text (for the rightmost part) is much better and will always meet the alignment no matter what the font is. E.g:
${PV} -------- WORKDIR
Maybe
${PV} <------- WORKDIR
?
Quoted 5 lines
So now the output is this:
https://lufi.bootlin.com/r/EuK0sscTNP#uV4rb2CQCPCMXONMGiBTfR9PY8BTDm0g0xeIAI+AsH8=What do you think?
I do not see much of a difference with "real" arrows, so that's fine by me :)
Quoted 17 lines
Quoted 4 lines
I'm also a bit skeptical about the position of the star before
EXTRA_OECONF, it feels like it's somehow part of the variable name. Maybe add a space or make the star appear a bit higher (like in the current PNG?).I will adjust that.
Quoted 10 lines
A remark for the original content as well, but I don't really understand why B isn't passed to
do_configureanddo_installas well? Isn't it where build artifacts will be configured beforedo_compileruns and from wheredo_installwill run in order to install files into $D?do_configure[dirs] = "${B}"
do_install[dirs] = "${B}"in base.bbclass for example.
Quoted 9 lines
Quoted 3 lines
I'm wondering also if we shouldn't have a bidirectional arrow for B for the configure and compile task as they are run from there, i.e. they generate files in there as well?
I agree, B is used in all three.
For
do_install, I guess a unidirectional arrow would make more sense as D is already used to point towards the other way.
Unidirectional D arrow makes sense to me as there's nothing D before do_install I think?
Now to come to think of it, I'm not sure there's anything in B before do_configure? So should we have unidirectional for do_configure and bidirectional for do_compile?
Cheers,
Quentin
Re: [docs] [PATCH 3/6] overview-manual: convert configuration-compile-autoreconf.png to svg
Hi Quentin,
Quoted 23 lines · Quentin Schulz
Hi Antonin,
Quoted 20 lines · Antonin Godard
Hi Quentin,
Quoted 8 lines · Quentin Schulz
Hi Antonin,
Quoted 2 lines · Antonin Godard via lists.yoctoproject.org
Convert the png file to an SVG file, and add the UNPACKDIR reference.
The arrows for the build directory are misaligned, especially for the machine-specific package.
Yes, I noticed afterwards too. There were some font issues, rsvg-convert was not properly picking them up. And also having so many arrows require precision that is not taken into account when converting from SVGs to PNGs.
In the end, I think having the different arrows as text (for the rightmost part) is much better and will always meet the alignment no matter what the font is. E.g:
Quoted 8 lines
Quoted 2 lines
${PV} -------- WORKDIRMaybe
${PV} <------- WORKDIR
?
Yes, that sounds good.
Quoted 31 lines
Quoted 6 lines
So now the output is this:
https://lufi.bootlin.com/r/EuK0sscTNP#uV4rb2CQCPCMXONMGiBTfR9PY8BTDm0g0xeIAI+AsH8=What do you think?
I do not see much of a difference with "real" arrows, so that's fine by me :)
Quoted 21 lines
Quoted 4 lines
I'm also a bit skeptical about the position of the star before
EXTRA_OECONF, it feels like it's somehow part of the variable name. Maybe add a space or make the star appear a bit higher (like in the current PNG?).I will adjust that.
Quoted 13 lines
A remark for the original content as well, but I don't really understand why B isn't passed to
do_configureanddo_installas well? Isn't it where build artifacts will be configured beforedo_compileruns and from wheredo_installwill run in order to install files into $D?do_configure[dirs] = "${B}"
do_install[dirs] = "${B}"in base.bbclass for example.
I'm wondering also if we shouldn't have a bidirectional arrow for B for the configure and compile task as they are run from there, i.e. they generate files in there as well?
Quoted 8 lines
Quoted 5 lines
I agree, B is used in all three.
For
do_install, I guess a unidirectional arrow would make more sense as D is already used to point towards the other way.Unidirectional D arrow makes sense to me as there's nothing D before
do_installI think?
Yes that's what I meant, I think the current figure looks good. Just missing B in the other way. Sorry if that wasn't clear.
Quoted 3 lines
Now to come to think of it, I'm not sure there's anything in B before
do_configure? So should we have unidirectional fordo_configureand bidirectional fordo_compile?
True I also agree.
Thanks for your feedback, appreciate it :)
Antonin
Signature · 3 lines
Antonin Godard, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH 4/6 overview-manual: convert analysis-for-package-splitting.png to svg
In reply to Antonin GodardConvert the png file to an SVG file, and add the UNPACKDIR reference.
--- documentation/overview-manual/concepts.rst | 2 +- .../figures/analysis-for-package-splitting.png | Bin 68434 -> 0 bytes .../svg/analysis-for-package-splitting.svg | 2111 ++++++++++++++++++++ 3 files changed, 2112 insertions(+), 1 deletion(-)
documentation/overview-manual/concepts.rst +1 -1
@@ -861,7 +861,7 @@ Package Splitting After source code is configured, compiled, and staged, the build system analyzes the results and splits the output into packages: -.. image:: figures/analysis-for-package-splitting.png +.. image:: svg/analysis-for-package-splitting.* :width: 100% The :ref:`ref-tasks-package` and
documentation/overview-manual/figures/analysis-for-package-splitting.png deleted binary +0 -0
documentation/overview-manual/svg/analysis-for-package-splitting.svg new file +2111 -0
2,111 lines not on this page · raw message
Signature · 1 line
2.47.0
Re: [docs] [PATCH 4/6] overview-manual: convert analysis-for-package-splitting.png to svg
Hi Antonin,
Quoted 2 lines · Antonin Godard via lists.yoctoproject.org
Convert the png file to an SVG file, and add the UNPACKDIR reference.
Not only that, it seems:
- -${PR} suffix is gone from ${PV}-${PR}
- ${BPN}-${PV} has become ${BP}
-
Same as previous patch, the arrows in the build directory are misaligned.
The arrows from the do_package_write_* tasks started from the green box and not the surrounding border like now.
Cheers,
Quentin
Re: [docs] [PATCH 4/6] overview-manual: convert analysis-for-package-splitting.png to svg
Hi Quentin,
Quoted 9 lines · Quentin Schulz
Hi Antonin,
Quoted 2 lines · Antonin Godard via lists.yoctoproject.org
Convert the png file to an SVG file, and add the UNPACKDIR reference.
Not only that, it seems:
- -${PR} suffix is gone from ${PV}-${PR}
I should have mentioned that in the commit message, but forgot.
$ bitbake-getvar WORKDIR
# $WORKDIR [2 operations]
# set /build/../work/openembedded-core/meta/conf/bitbake.conf:409
# "${BASE_WORKDIR}/${MULTIMACH_TARGET_SYS}/${PN}/${PV}"
...
# pre-expansion value:
# "${BASE_WORKDIR}/${MULTIMACH_TARGET_SYS}/${PN}/${PV}"See cc83e4548465 ("bitbake.conf: Drop PE and PR from WORKDIR and STAMP") on OE-core.
Quoted 1 line
- ${BPN}-${PV} has become ${BP}
Because BP = ${BPN}-${PV}, and I think we better stick to the correct definitions:
$ bitbake-getvar S
# $S [2 operations]
# set /build/../work/openembedded-core/meta/conf/bitbake.conf:413
# "${WORKDIR}/${BP}"
...
# pre-expansion value:
# "${WORKDIR}/${BP}"Antonin
Signature · 3 lines
Antonin Godard, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
Re: [docs] [PATCH 4/6] overview-manual: convert analysis-for-package-splitting.png to svg
Hi Antonin,
Quoted 31 lines · Antonin Godard
Hi Quentin,
Quoted 9 lines · Quentin Schulz
Hi Antonin,
Quoted 2 lines · Antonin Godard via lists.yoctoproject.org
Convert the png file to an SVG file, and add the UNPACKDIR reference.
Not only that, it seems:
- -${PR} suffix is gone from ${PV}-${PR}
I should have mentioned that in the commit message, but forgot.
$ bitbake-getvar WORKDIR # $WORKDIR [2 operations] # set /build/../work/openembedded-core/meta/conf/bitbake.conf:409 # "${BASE_WORKDIR}/${MULTIMACH_TARGET_SYS}/${PN}/${PV}" ... # pre-expansion value: # "${BASE_WORKDIR}/${MULTIMACH_TARGET_SYS}/${PN}/${PV}"See
cc83e4548465("bitbake.conf: Drop PE and PR from WORKDIR and STAMP") on OE-core.Quoted 1 line
- ${BPN}-${PV} has become ${BP}
Because BP = ${BPN}-${PV}, and I think we better stick to the correct definitions:
Quoted 8 lines
$ bitbake-getvar S
# $S [2 operations]
# set /build/../work/openembedded-core/meta/conf/bitbake.conf:413
# "${WORKDIR}/${BP}"
...
# pre-expansion value:
# "${WORKDIR}/${BP}"Yes, another option is to do that through commits, e.g.:
migrate to svg first, then add UNPACKDIR, then remove PR.
But I'm not sure editing SVGs is a lot of fun, so mentioning it in the commit log is acceptable :)
Cheers,
Quentin
PATCH 5/6 overview-manual: add UNPACKDIR in the directory description
In reply to Antonin GodardMention that UNPACKDIR is used as a location to unpack the source code, and that S is the final location of the source code. This is deliberately vague, because as there are multiple instances of how these directories can be defined and used.
The proper explanation of how the UNPACKDIR and S directories interact is left to the reference manual, under the UNPACKDIR variable description.
--- documentation/overview-manual/concepts.rst | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
documentation/overview-manual/concepts.rst +8 -8
@@ -704,10 +704,10 @@ a defined structure. For additional general information on the the Yocto Project Reference Manual. Each recipe has an area in the :term:`Build Directory` where the unpacked -source code resides. The :term:`S` variable points to this area for a recipe's -unpacked source code. The name of that directory for any given recipe is -defined from several different variables. The preceding figure and the -following list describe the :term:`Build Directory`'s hierarchy: +source code resides. The :term:`UNPACKDIR` variable points to this area for a +recipe's unpacked source code, and has the default ``sources-unpack`` name. The +preceding figure and the following list describe the :term:`Build Directory`'s +hierarchy: - :term:`TMPDIR`: The base directory where the OpenEmbedded build system performs all its work during the
@@ -736,11 +736,11 @@ following list describe the :term:`Build Directory`'s hierarchy: - :term:`PV`: The version of the recipe used to build the package. - - :term:`PR`: The revision of the - recipe used to build the package. +- :term:`UNPACKDIR`: Contains the unpacked source files for a given recipe. + +- :term:`S`: Contains the final location of the source code. -- :term:`S`: Contains the unpacked source - files for a given recipe. + The default value for :term:`BP` is ``${BPN}-${PV}`` where: - :term:`BPN`: The name of the recipe used to build the package. The :term:`BPN` variable is a version of
Signature · 1 line
2.47.0
Re: [docs] [PATCH 5/6] overview-manual: add UNPACKDIR in the directory description
Hi Antonin,
Quoted 9 lines · Antonin Godard via lists.yoctoproject.org
Mention that UNPACKDIR is used as a location to unpack the source code, and that S is the final location of the source code. This is deliberately vague, because as there are multiple instances of how these directories can be defined and used.
The proper explanation of how the UNPACKDIR and S directories interact is left to the reference manual, under the UNPACKDIR variable description.
PR is also removed in this commit, maybe a separate one to explain what's happened to it would be nice? Or at the very least in the commit log so it doesn't look like a mistake?
Looks ok to me otherwise,
Cheers,
Quentin
PATCH 6/6 ref-manual/variables: improve the UNPACKDIR documentation
In reply to Antonin GodardIt was clear why UNPACKDIR was introduced at first, and what is the recommended way of setting S and UNPACKDIR for a clean separation of the source code and WORKDIR. Add documentation for this in the reference manual.
--- documentation/ref-manual/variables.rst | 39 +++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-)
documentation/ref-manual/variables.rst +38 -1
@@ -10035,9 +10035,46 @@ system and gives an overview of their function and contents. :term:`UNPACKDIR` This variable, used by the :ref:`ref-classes-base` class, - specifies where fetches sources should be unpacked by the + specifies where fetched sources should be unpacked by the :ref:`ref-tasks-unpack` task. + Although the default value of this directory is + ``${WORKDIR}/sources-unpack``, the recommended way of setting + :term:`UNPACKDIR` and :term:`S` is:: + + S = "${WORKDIR}/sources" + UNPACKDIR = "${S}" + + This allows the source code to be safely unpacked and patched in a + separate directory. + + .. note:: + + In some cases, the :term:`UNPACKDIR` directory only holds the sources + temporarily. When the first directory after :term:`WORKDIR` in the + :term:`S` variable is matched in :term:`UNPACKDIR`, the directory + in :term:`UNPACKDIR` is moved to the :term:`WORKDIR` directory. + + For example, let's represent the :term:`UNPACKDIR` directory + for the ``foobar`` recipe after extraction as follows:: + + ${WORKDIR}/sources-unpack/foobar-1.0.0/... + + And the variable :term:`S` for this recipe defined as:: + + S = "${WORKDIR}/${BP}" + + Where :term:`BP` expands to ``foobar-1.0.0``. + + Since the first directory of :term:`S` after :term:`WORKDIR` + (``foobar-1.0.0``) matches the directory ``foobar-1.0.0`` under + ``sources-unpack``, the latter is moved to the :term:`WORKDIR` + directory. The final location of the source code will then be + ``${WORKDIR}/foobar-1.0.0``. + + This behavior was added for compatibility for recipes that do not set + the :term:`UNPACKDIR` and :term:`S` variable in the recommended way. + :term:`UPDATERCPN` For recipes inheriting the :ref:`ref-classes-update-rc.d` class, :term:`UPDATERCPN`
Signature · 1 line
2.47.0
Re: [docs] [PATCH 6/6] ref-manual/variables: improve the UNPACKDIR documentation
Hi Antonin,
Quoted 19 lines · Antonin Godard via lists.yoctoproject.org
It was clear why UNPACKDIR was introduced at first, and what is the recommended way of setting S and UNPACKDIR for a clean separation of the source code and WORKDIR. Add documentation for this in the reference manual.
Signed-off-by Antonin Godard <[email protected]>--- documentation/ref-manual/variables.rst | 39 +++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-)documentation/ref-manual/variables.rst +0
-1@@ -10035,9 +10035,46 @@ system and gives an overview of their function and contents. :term:`UNPACKDIR` This variable, used by the :ref:`ref-classes-base` class, - specifies where fetches sources should be unpacked by the
documentation/ref-manual/variables.rst system and gives an overview of their function and contents. · line 10047
Quoted 10 lines
documentation/ref-manual/variables.rst +8
-0+ specifies where fetched sources should be unpacked by the :ref:`ref-tasks-unpack` task. + Although the default value of this directory is + ``${WORKDIR}/sources-unpack``, the recommended way of setting + :term:`UNPACKDIR` and :term:`S` is:: + + S = "${WORKDIR}/sources" + UNPACKDIR = "${S}" +
Mmmm I think this is an issue, because we then show a non-recommended configuration in the SVG in the previous patches where UNPACKDIR != S.
documentation/ref-manual/variables.rst system and gives an overview of their function and contents. · line 10050
Quoted 3 lines
documentation/ref-manual/variables.rst +3
-0+ This allows the source code to be safely unpacked and patched in a + separate directory. +
I think I know where you want to go with this, but the first time I read this I didn't understand it. UNPACKDIR = S in the example above, why does this say the source code is unpacked and patched (implying two steps/stages) in a separate directory then?
I think this is because we used to put everything from the fetcher into WORKDIR and there were unexpected leftovers between builds and UNPACKDIR now is a separate directory for the fetcher to put everything it does in, instead of WORKDIR?
I'm not sure we need to document how messed up it was in the past rather just what this does now?
Quoted 17 lines
documentation/ref-manual/variables.rst +17
-0+ .. note:: + + In some cases, the :term:`UNPACKDIR` directory only holds the sources + temporarily. When the first directory after :term:`WORKDIR` in the + :term:`S` variable is matched in :term:`UNPACKDIR`, the directory + in :term:`UNPACKDIR` is moved to the :term:`WORKDIR` directory. + + For example, let's represent the :term:`UNPACKDIR` directory + for the ``foobar`` recipe after extraction as follows:: + + ${WORKDIR}/sources-unpack/foobar-1.0.0/... + + And the variable :term:`S` for this recipe defined as:: + + S = "${WORKDIR}/${BP}" + + Where :term:`BP` expands to ``foobar-1.0.0``.
documentation/ref-manual/variables.rst system and gives an overview of their function and contents. · line 10077
Quoted 10 lines
documentation/ref-manual/variables.rst +10
-0+ + Since the first directory of :term:`S` after :term:`WORKDIR` + (``foobar-1.0.0``) matches the directory ``foobar-1.0.0`` under + ``sources-unpack``, the latter is moved to the :term:`WORKDIR` + directory. The final location of the source code will then be + ``${WORKDIR}/foobar-1.0.0``. + + This behavior was added for compatibility for recipes that do not set + the :term:`UNPACKDIR` and :term:`S` variable in the recommended way. +
I've read this 5 times now, it may be too late for my brain today but I am not sure I got it :)
Let me try to reword it just to make sure I understood/got it right?
If UNPACKDIR differs from S, but the name of the directory (dirA) where sources are unpacked in UNPACKDIR matches the basename of the directory used for S, then the content of UNPACKDIR/dirA is moved into S?
If that's right, what really happens? Is UNPACKDIR variable modified to point to S once the move is done? When is this happening?
Cheers,
Quentin
Re: [docs] [PATCH 6/6] ref-manual/variables: improve the UNPACKDIR documentation
Hi Quentin,
Quoted 25 lines · Quentin Schulz
Hi Antonin,
Quoted 22 lines · Antonin Godard via lists.yoctoproject.org
It was clear why UNPACKDIR was introduced at first, and what is the recommended way of setting S and UNPACKDIR for a clean separation of the source code and WORKDIR. Add documentation for this in the reference manual.
Signed-off-by Antonin Godard <[email protected]>--- documentation/ref-manual/variables.rst | 39 +++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-)documentation/ref-manual/variables.rst +1
-1@@ -10035,9 +10035,46 @@ system and gives an overview of their function and contents. :term:`UNPACKDIR` This variable, used by the :ref:`ref-classes-base` class, - specifies where fetches sources should be unpacked by the + specifies where fetched sources should be unpacked by the :ref:`ref-tasks-unpack` task.
Quoted 10 lines
documentation/ref-manual/variables.rst system and gives an overview of their function and contents. · line 10047
Quoted 7 lines
documentation/ref-manual/variables.rst +7
-0+ Although the default value of this directory is + ``${WORKDIR}/sources-unpack``, the recommended way of setting + :term:`UNPACKDIR` and :term:`S` is:: + + S = "${WORKDIR}/sources" + UNPACKDIR = "${S}" +Mmmm I think this is an issue, because we then show a non-recommended configuration in the SVG in the previous patches where UNPACKDIR != S.
I'd rather show the default definitions in the figures, because there's no guarantee that a recipe will define UNPACKDIR and S that way.
It also feels weird to me that a recommended approach is not the default, but it is probably related to backward compatiblity, that would be my guess.
Quoted 8 lines
documentation/ref-manual/variables.rst system and gives an overview of their function and contents. · line 10050
Quoted 3 lines
documentation/ref-manual/variables.rst +3
-0+ This allows the source code to be safely unpacked and patched in a + separate directory. +I think I know where you want to go with this, but the first time I read this I didn't understand it. UNPACKDIR = S in the example above, why does this say the source code is unpacked and patched (implying two steps/stages) in a separate directory then?
I wanted to say that the code is unpacked and patched in the same directory, but separate from the WORKDIR. I should probably rephrase or remove this sentence to avoid adding confusion.
Quoted 4 lines
I think this is because we used to put everything from the fetcher into WORKDIR and there were unexpected leftovers between builds and UNPACKDIR now is a separate directory for the fetcher to put everything it does in, instead of WORKDIR?
Yes, I think that's it.
Quoted 2 lines
I'm not sure we need to document how messed up it was in the past rather just what this does now?
So I guess we can go with the sentence removal. However I think we'd probably want to keep the recommended assignment.
Quoted 31 lines
Quoted 17 lines
documentation/ref-manual/variables.rst +17
-0+ .. note:: + + In some cases, the :term:`UNPACKDIR` directory only holds the sources + temporarily. When the first directory after :term:`WORKDIR` in the + :term:`S` variable is matched in :term:`UNPACKDIR`, the directory + in :term:`UNPACKDIR` is moved to the :term:`WORKDIR` directory. + + For example, let's represent the :term:`UNPACKDIR` directory + for the ``foobar`` recipe after extraction as follows:: + + ${WORKDIR}/sources-unpack/foobar-1.0.0/... + + And the variable :term:`S` for this recipe defined as:: + + S = "${WORKDIR}/${BP}" + + Where :term:`BP` expands to ``foobar-1.0.0``.documentation/ref-manual/variables.rst system and gives an overview of their function and contents. · line 10077
Quoted 10 lines
documentation/ref-manual/variables.rst +10
-0+ + Since the first directory of :term:`S` after :term:`WORKDIR` + (``foobar-1.0.0``) matches the directory ``foobar-1.0.0`` under + ``sources-unpack``, the latter is moved to the :term:`WORKDIR` + directory. The final location of the source code will then be + ``${WORKDIR}/foobar-1.0.0``. + + This behavior was added for compatibility for recipes that do not set + the :term:`UNPACKDIR` and :term:`S` variable in the recommended way. +I've read this 5 times now, it may be too late for my brain today but I am not sure I got it :)
Quoted 5 lines
Let me try to reword it just to make sure I understood/got it right?
If UNPACKDIR differs from S, but the name of the directory (dirA) where sources are unpacked in UNPACKDIR matches the basename of the directory used for S, then the content of UNPACKDIR/dirA is moved into S?
That's it. And it is a pain to describe textually. I'd take any recommendations for improving it.
Quoted 2 lines
If that's right, what really happens? Is UNPACKDIR variable modified to point to S once the move is done? When is this happening?
No, UNPACKDIR isn't modified. This move is repeated at the end of the do_unpack task, each time. See:
https://git.openembedded.org/openembedded-core/tree/meta/classes-global/base.bbclass#n158
I may consider removing that note entirely depending on how useful it is to document a backwards-compatibility behavior.
Antonin
Signature · 3 lines
Antonin Godard, Bootlin Embedded Linux and Kernel engineering https://bootlin.com