[oe,v2,0/2] implement applying patches from a directory

Message ID 20211220101405.26735-1-max.krummenacher@toradex.com
Headers show
Series implement applying patches from a directory | expand

Message

Max Krummenacher Dec. 20, 2021, 10:14 a.m. UTC
The current developer manual [1] specifies that patches that are
part of a directory which is given in SRC_URI are applied by
the do_patch task. However that is not implemented in the
current code.

This patchset implements that, but deviates from what is
documented. If the patches are applied I will send a patch
for the documentation changing the relevant part to:

```
If you have a directory full of patch files and you want to
apply them all you can add the directory to SRC_URI and add
the "apply=yes" parameter. This will apply ALL files in the
directiory, including files in subdirectories.
The patches will be applied sorted by their filename. Files
from subdirectories will be sorted into the list at the
position given by the subdirectory name.

   SRC_URI = " \
       git://path_to_repo/some_package \
       file://path_to_lots_of_patch_files;apply=yes \
       "

In the previous example all the files in the directory holding
the patch files would be applied as a patch.
```

Changes in v2:
- using python glob to get a directories content recursively as
  proposed by Konrad Weihmann
- dropped 'lib/oe/recipeutils.py: follow changed method argument list',
  the use of glob allowed to keep the original argument list
- added a oe-selftest which tests applying patches aspects

Max

[1] https://www.yoctoproject.org/docs/current/mega-manual/mega-manual.html#ref-tasks-patch

Max Krummenacher (2):
  lib/oe/patch.py: apply patches from src_uri specified directories
  oe-selftest: bbtests: add test_patching test

 .../patchtest/patchtest/0001-10.patch         | 25 +++++
 .../patchtest/patchtest/0001-111.patch        | 25 +++++
 .../patchtest/patchtest/expected_source_file  | 11 +++
 .../patchtest/patchtest/expected_src_patches  |  5 +
 .../patchtest/patchtest/expected_src_sources  |  7 ++
 .../patchtest/patchset1/0001-11.patch         | 25 +++++
 .../patchtest/patchset2/0001-2.patch          | 25 +++++
 .../patchset2/0002_subset1/0001-4.patch       | 27 ++++++
 .../patchset2/0002_subset1/0002-6.patch       | 26 ++++++
 .../patchtest/patchset2/0003-8.patch          | 25 +++++
 .../patchtest/patchset3/0001-111.patch        | 25 +++++
 .../patchtest/patchtest/src_patches           |  5 +
 .../patchtest/patchtest/the_source_file       |  5 +
 .../recipes-test/patchtest/patchtest_1.0.bb   | 37 ++++++++
 meta/lib/oe/patch.py                          | 92 +++++++++++--------
 meta/lib/oeqa/selftest/cases/bbtests.py       | 18 ++++
 16 files changed, 346 insertions(+), 37 deletions(-)
 create mode 100644 meta-selftest/recipes-test/patchtest/patchtest/0001-10.patch
 create mode 100644 meta-selftest/recipes-test/patchtest/patchtest/0001-111.patch
 create mode 100644 meta-selftest/recipes-test/patchtest/patchtest/expected_source_file
 create mode 100644 meta-selftest/recipes-test/patchtest/patchtest/expected_src_patches
 create mode 100644 meta-selftest/recipes-test/patchtest/patchtest/expected_src_sources
 create mode 100644 meta-selftest/recipes-test/patchtest/patchtest/patchset1/0001-11.patch
 create mode 100644 meta-selftest/recipes-test/patchtest/patchtest/patchset2/0001-2.patch
 create mode 100644 meta-selftest/recipes-test/patchtest/patchtest/patchset2/0002_subset1/0001-4.patch
 create mode 100644 meta-selftest/recipes-test/patchtest/patchtest/patchset2/0002_subset1/0002-6.patch
 create mode 100644 meta-selftest/recipes-test/patchtest/patchtest/patchset2/0003-8.patch
 create mode 100644 meta-selftest/recipes-test/patchtest/patchtest/patchset3/0001-111.patch
 create mode 100644 meta-selftest/recipes-test/patchtest/patchtest/src_patches
 create mode 100644 meta-selftest/recipes-test/patchtest/patchtest/the_source_file
 create mode 100644 meta-selftest/recipes-test/patchtest/patchtest_1.0.bb

Comments

Alexander Kanavin Dec. 20, 2021, 10:45 a.m. UTC | #1
I still want to question the need for this. I’d rather allow only an
explicit list giving an explicit order in the recipe.

Alex

On Mon 20. Dec 2021 at 13.15, Max Krummenacher <max.oss.09@gmail.com> wrote:

> The current developer manual [1] specifies that patches that are
> part of a directory which is given in SRC_URI are applied by
> the do_patch task. However that is not implemented in the
> current code.
>
> This patchset implements that, but deviates from what is
> documented. If the patches are applied I will send a patch
> for the documentation changing the relevant part to:
>
> ```
> If you have a directory full of patch files and you want to
> apply them all you can add the directory to SRC_URI and add
> the "apply=yes" parameter. This will apply ALL files in the
> directiory, including files in subdirectories.
> The patches will be applied sorted by their filename. Files
> from subdirectories will be sorted into the list at the
> position given by the subdirectory name.
>
>    SRC_URI = " \
>        git://path_to_repo/some_package \
>        file://path_to_lots_of_patch_files;apply=yes \
>        "
>
> In the previous example all the files in the directory holding
> the patch files would be applied as a patch.
> ```
>
> Changes in v2:
> - using python glob to get a directories content recursively as
>   proposed by Konrad Weihmann
> - dropped 'lib/oe/recipeutils.py: follow changed method argument list',
>   the use of glob allowed to keep the original argument list
> - added a oe-selftest which tests applying patches aspects
>
> Max
>
> [1]
> https://www.yoctoproject.org/docs/current/mega-manual/mega-manual.html#ref-tasks-patch
>
> Max Krummenacher (2):
>   lib/oe/patch.py: apply patches from src_uri specified directories
>   oe-selftest: bbtests: add test_patching test
>
>  .../patchtest/patchtest/0001-10.patch         | 25 +++++
>  .../patchtest/patchtest/0001-111.patch        | 25 +++++
>  .../patchtest/patchtest/expected_source_file  | 11 +++
>  .../patchtest/patchtest/expected_src_patches  |  5 +
>  .../patchtest/patchtest/expected_src_sources  |  7 ++
>  .../patchtest/patchset1/0001-11.patch         | 25 +++++
>  .../patchtest/patchset2/0001-2.patch          | 25 +++++
>  .../patchset2/0002_subset1/0001-4.patch       | 27 ++++++
>  .../patchset2/0002_subset1/0002-6.patch       | 26 ++++++
>  .../patchtest/patchset2/0003-8.patch          | 25 +++++
>  .../patchtest/patchset3/0001-111.patch        | 25 +++++
>  .../patchtest/patchtest/src_patches           |  5 +
>  .../patchtest/patchtest/the_source_file       |  5 +
>  .../recipes-test/patchtest/patchtest_1.0.bb   | 37 ++++++++
>  meta/lib/oe/patch.py                          | 92 +++++++++++--------
>  meta/lib/oeqa/selftest/cases/bbtests.py       | 18 ++++
>  16 files changed, 346 insertions(+), 37 deletions(-)
>  create mode 100644
> meta-selftest/recipes-test/patchtest/patchtest/0001-10.patch
>  create mode 100644
> meta-selftest/recipes-test/patchtest/patchtest/0001-111.patch
>  create mode 100644
> meta-selftest/recipes-test/patchtest/patchtest/expected_source_file
>  create mode 100644
> meta-selftest/recipes-test/patchtest/patchtest/expected_src_patches
>  create mode 100644
> meta-selftest/recipes-test/patchtest/patchtest/expected_src_sources
>  create mode 100644
> meta-selftest/recipes-test/patchtest/patchtest/patchset1/0001-11.patch
>  create mode 100644
> meta-selftest/recipes-test/patchtest/patchtest/patchset2/0001-2.patch
>  create mode 100644
> meta-selftest/recipes-test/patchtest/patchtest/patchset2/0002_subset1/0001-4.patch
>  create mode 100644
> meta-selftest/recipes-test/patchtest/patchtest/patchset2/0002_subset1/0002-6.patch
>  create mode 100644
> meta-selftest/recipes-test/patchtest/patchtest/patchset2/0003-8.patch
>  create mode 100644
> meta-selftest/recipes-test/patchtest/patchtest/patchset3/0001-111.patch
>  create mode 100644
> meta-selftest/recipes-test/patchtest/patchtest/src_patches
>  create mode 100644
> meta-selftest/recipes-test/patchtest/patchtest/the_source_file
>  create mode 100644 meta-selftest/recipes-test/patchtest/patchtest_1.0.bb
>
> --
> 2.20.1
>
>