mbox

[RFC,0/3] Implement RECIPE_UPDATE_EXTRA_TASKS

Message ID cover.1717361301.git.tim.orling@konsulko.com
State Not Applicable, archived
Headers show

Pull-request

https://git.yoctoproject.org/poky-contrib timo/RECIPE_UPDATE_EXTRA_TASKS

Message

Tim Orling June 2, 2024, 9 p.m. UTC
From: Tim Orling <tim.orling@konsulko.com>

Whenever a recipe which inherits cargo-update-recipe-crates is upgraded with
devtool (such as with the Auto Upgrade Helper) we frequently see failures.
If the upstream Cargo.toml or Cargo.lock has been changed, the corresponding
<recipe_name>-crates.inc needs to be updated. This is done by running the
"bitbake -c update_crates <recipe_name>" task, but this has until now been
a manual operation.

Add a new variable RECIPE_UPDATE_EXTRA_TASKS which is a string delimited
list of tasks to be run during the upgrade() method of
meta/lib/devtool/upgrade.py.

To solve the problem described above, the solution is for all recipes which
inherit cargo-update-recipe-crates to add the "do_update_crates" task to
the RECIPE_UPDATE_EXTRA_TASKS variable. Add this to the bbclass.

Add test case based on the guessing-game source we currently use for the
maturin runtime test cases, based on https://www.maturin.rs/tutorial.
This oe-selftest case checks for both the change in the recipe file and
the recipe -crates.inc file.

This will rely on a new "guessing-game" git repository to be added to
git.yoctoproject.org/guessing-game (currently hosted on GitHub for the
purposes of this RFC).

Currently, update_crates is the only task known to the author to fall into
this RECIPE_UPDATE_EXTRA_TASKS use case. If anyone can think of other use
cases that can also be added (and tested!), please let me know.

Two obvious use cases that would be nice to add with changes in oe-core are:
(1) some kind of "go-mod://" update class to use a similar <recipe>-go-mods.inc
(2) some kind of rework of the "npm://" fetcher to use <recipe>-npm-mods.inc
But both of those are out of scope for this proposal.

The _run_recipe_update_extra_tasks() method added to lib/devtool/upgrade.py
is functional, but could probably use some more guards and checks. Ideas for
improvements are welcome, hence the RFC.

An attempt at documenting the new variable has been added to ref-manual,
but if anyone has some ideas for better clarification, input is welcome.

The following changes since commit af6d28d2b0abdfcfa70edcc95abd99a3c1a64ac8:

  sanity: Check if tar is gnutar (2024-05-31 16:58:36 +0100)

are available in the Git repository at:

  https://git.yoctoproject.org/poky-contrib timo/RECIPE_UPDATE_EXTRA_TASKS
  https://git.yoctoproject.org/poky-contrib/log/?h=timo/RECIPE_UPDATE_EXTRA_TASKS

Tim Orling (5):
  devtool upgrade: enable RECIPE_UPDATE_EXTRA_TASKS
  cargo-update-recipe-crates: add RECIPE_UPDATE_EXTRA_TASKS
  ref-manual: add RECIPE_UPDATE_EXTRA_TASKS variable
  meta-selftest: add python3-guessing-game
  oe-selftest: add RECIPE_UPDATE_EXTRA_TASKS test

 documentation/ref-manual/variables.rst        |  7 ++
 .../python/python3-guessing-game-crates.inc   | 82 +++++++++++++++++
 .../python3-guessing-game-crates.inc.upgraded | 88 +++++++++++++++++++
 .../python/python3-guessing-game_git.bb       | 19 ++++
 .../python3-guessing-game_git.bb.upgraded     | 19 ++++
 .../cargo-update-recipe-crates.bbclass        |  2 +
 meta/lib/oeqa/selftest/cases/devtool.py       | 46 ++++++++++
 scripts/lib/devtool/upgrade.py                | 12 +++
 8 files changed, 275 insertions(+)
 create mode 100644 meta-selftest/recipes-devtools/python/python3-guessing-game-crates.inc
 create mode 100644 meta-selftest/recipes-devtools/python/python3-guessing-game-crates.inc.upgraded
 create mode 100644 meta-selftest/recipes-devtools/python/python3-guessing-game_git.bb
 create mode 100644 meta-selftest/recipes-devtools/python/python3-guessing-game_git.bb.upgraded

Comments

Alexander Kanavin June 3, 2024, 9:09 a.m. UTC | #1
Thanks, I like the idea. There are a number of other recipes that for
various reasons need 'special handling' in version updates that
devtool doesn't know how to perform, and this could be used to define
that handling where it belongs, which is in the recipe itself.

E.g. updating cmake could also rename cmake-native_*.bb to match.

Alex

On Sun, 2 Jun 2024 at 23:01, Tim Orling via lists.openembedded.org
<tim.orling=konsulko.com@lists.openembedded.org> wrote:
>
> From: Tim Orling <tim.orling@konsulko.com>
>
> Whenever a recipe which inherits cargo-update-recipe-crates is upgraded with
> devtool (such as with the Auto Upgrade Helper) we frequently see failures.
> If the upstream Cargo.toml or Cargo.lock has been changed, the corresponding
> <recipe_name>-crates.inc needs to be updated. This is done by running the
> "bitbake -c update_crates <recipe_name>" task, but this has until now been
> a manual operation.
>
> Add a new variable RECIPE_UPDATE_EXTRA_TASKS which is a string delimited
> list of tasks to be run during the upgrade() method of
> meta/lib/devtool/upgrade.py.
>
> To solve the problem described above, the solution is for all recipes which
> inherit cargo-update-recipe-crates to add the "do_update_crates" task to
> the RECIPE_UPDATE_EXTRA_TASKS variable. Add this to the bbclass.
>
> Add test case based on the guessing-game source we currently use for the
> maturin runtime test cases, based on https://www.maturin.rs/tutorial.
> This oe-selftest case checks for both the change in the recipe file and
> the recipe -crates.inc file.
>
> This will rely on a new "guessing-game" git repository to be added to
> git.yoctoproject.org/guessing-game (currently hosted on GitHub for the
> purposes of this RFC).
>
> Currently, update_crates is the only task known to the author to fall into
> this RECIPE_UPDATE_EXTRA_TASKS use case. If anyone can think of other use
> cases that can also be added (and tested!), please let me know.
>
> Two obvious use cases that would be nice to add with changes in oe-core are:
> (1) some kind of "go-mod://" update class to use a similar <recipe>-go-mods.inc
> (2) some kind of rework of the "npm://" fetcher to use <recipe>-npm-mods.inc
> But both of those are out of scope for this proposal.
>
> The _run_recipe_update_extra_tasks() method added to lib/devtool/upgrade.py
> is functional, but could probably use some more guards and checks. Ideas for
> improvements are welcome, hence the RFC.
>
> An attempt at documenting the new variable has been added to ref-manual,
> but if anyone has some ideas for better clarification, input is welcome.
>
> The following changes since commit af6d28d2b0abdfcfa70edcc95abd99a3c1a64ac8:
>
>   sanity: Check if tar is gnutar (2024-05-31 16:58:36 +0100)
>
> are available in the Git repository at:
>
>   https://git.yoctoproject.org/poky-contrib timo/RECIPE_UPDATE_EXTRA_TASKS
>   https://git.yoctoproject.org/poky-contrib/log/?h=timo/RECIPE_UPDATE_EXTRA_TASKS
>
> Tim Orling (5):
>   devtool upgrade: enable RECIPE_UPDATE_EXTRA_TASKS
>   cargo-update-recipe-crates: add RECIPE_UPDATE_EXTRA_TASKS
>   ref-manual: add RECIPE_UPDATE_EXTRA_TASKS variable
>   meta-selftest: add python3-guessing-game
>   oe-selftest: add RECIPE_UPDATE_EXTRA_TASKS test
>
>  documentation/ref-manual/variables.rst        |  7 ++
>  .../python/python3-guessing-game-crates.inc   | 82 +++++++++++++++++
>  .../python3-guessing-game-crates.inc.upgraded | 88 +++++++++++++++++++
>  .../python/python3-guessing-game_git.bb       | 19 ++++
>  .../python3-guessing-game_git.bb.upgraded     | 19 ++++
>  .../cargo-update-recipe-crates.bbclass        |  2 +
>  meta/lib/oeqa/selftest/cases/devtool.py       | 46 ++++++++++
>  scripts/lib/devtool/upgrade.py                | 12 +++
>  8 files changed, 275 insertions(+)
>  create mode 100644 meta-selftest/recipes-devtools/python/python3-guessing-game-crates.inc
>  create mode 100644 meta-selftest/recipes-devtools/python/python3-guessing-game-crates.inc.upgraded
>  create mode 100644 meta-selftest/recipes-devtools/python/python3-guessing-game_git.bb
>  create mode 100644 meta-selftest/recipes-devtools/python/python3-guessing-game_git.bb.upgraded
>
> --
> 2.45.2
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#200216): https://lists.openembedded.org/g/openembedded-core/message/200216
> Mute This Topic: https://lists.openembedded.org/mt/106450866/1686489
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alex.kanavin@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Richard Purdie June 3, 2024, 2:08 p.m. UTC | #2
On Sun, 2024-06-02 at 14:00 -0700, Tim Orling via lists.openembedded.org wrote:
> From: Tim Orling <tim.orling@konsulko.com>
> 
> Whenever a recipe which inherits cargo-update-recipe-crates is upgraded with
> devtool (such as with the Auto Upgrade Helper) we frequently see failures.
> If the upstream Cargo.toml or Cargo.lock has been changed, the corresponding
> <recipe_name>-crates.inc needs to be updated. This is done by running the
> "bitbake -c update_crates <recipe_name>" task, but this has until now been
> a manual operation.
> 
> Add a new variable RECIPE_UPDATE_EXTRA_TASKS which is a string delimited
> list of tasks to be run during the upgrade() method of
> meta/lib/devtool/upgrade.py.
> 
> To solve the problem described above, the solution is for all recipes which
> inherit cargo-update-recipe-crates to add the "do_update_crates" task to
> the RECIPE_UPDATE_EXTRA_TASKS variable. Add this to the bbclass.
> 
> Add test case based on the guessing-game source we currently use for the
> maturin runtime test cases, based on https://www.maturin.rs/tutorial.
> This oe-selftest case checks for both the change in the recipe file and
> the recipe -crates.inc file.
> 
> This will rely on a new "guessing-game" git repository to be added to
> git.yoctoproject.org/guessing-game (currently hosted on GitHub for the
> purposes of this RFC).
> 
> Currently, update_crates is the only task known to the author to fall into
> this RECIPE_UPDATE_EXTRA_TASKS use case. If anyone can think of other use
> cases that can also be added (and tested!), please let me know.

This looks good to me, thanks.

Would we want to add the task that updates the python recipe's manifest
to this?

Cheers,

Richard
Tim Orling June 3, 2024, 3:13 p.m. UTC | #3
On Mon, Jun 3, 2024 at 7:08 AM Richard Purdie <
richard.purdie@linuxfoundation.org> wrote:

> On Sun, 2024-06-02 at 14:00 -0700, Tim Orling via lists.openembedded.org
> wrote:
> > From: Tim Orling <tim.orling@konsulko.com>
> >
> > Whenever a recipe which inherits cargo-update-recipe-crates is upgraded
> with
> > devtool (such as with the Auto Upgrade Helper) we frequently see
> failures.
> > If the upstream Cargo.toml or Cargo.lock has been changed, the
> corresponding
> > <recipe_name>-crates.inc needs to be updated. This is done by running the
> > "bitbake -c update_crates <recipe_name>" task, but this has until now
> been
> > a manual operation.
> >
> > Add a new variable RECIPE_UPDATE_EXTRA_TASKS which is a string delimited
> > list of tasks to be run during the upgrade() method of
> > meta/lib/devtool/upgrade.py.
> >
> > To solve the problem described above, the solution is for all recipes
> which
> > inherit cargo-update-recipe-crates to add the "do_update_crates" task to
> > the RECIPE_UPDATE_EXTRA_TASKS variable. Add this to the bbclass.
> >
> > Add test case based on the guessing-game source we currently use for the
> > maturin runtime test cases, based on https://www.maturin.rs/tutorial.
> > This oe-selftest case checks for both the change in the recipe file and
> > the recipe -crates.inc file.
> >
> > This will rely on a new "guessing-game" git repository to be added to
> > git.yoctoproject.org/guessing-game (currently hosted on GitHub for the
> > purposes of this RFC).
> >
> > Currently, update_crates is the only task known to the author to fall
> into
> > this RECIPE_UPDATE_EXTRA_TASKS use case. If anyone can think of other use
> > cases that can also be added (and tested!), please let me know.
>
> This looks good to me, thanks.
>
> Would we want to add the task that updates the python recipe's manifest
> to this?
>

Probably yes. Good idea. Which then brings up perl which has a similar
issue with the perl-rdepends.txt.


>
> Cheers,
>
> Richard
>
>
>
Tim Orling June 3, 2024, 3:14 p.m. UTC | #4
On Mon, Jun 3, 2024 at 2:09 AM Alexander Kanavin <alex.kanavin@gmail.com>
wrote:

> Thanks, I like the idea. There are a number of other recipes that for
> various reasons need 'special handling' in version updates that
> devtool doesn't know how to perform, and this could be used to define
> that handling where it belongs, which is in the recipe itself.
>
> E.g. updating cmake could also rename cmake-native_*.bb to match.
>

Good point. I had not considered that. As RP pointed out, python manifest
is another.

I suspect we will find many use cases for this pattern.


>
> Alex
>
> On Sun, 2 Jun 2024 at 23:01, Tim Orling via lists.openembedded.org
> <tim.orling=konsulko.com@lists.openembedded.org> wrote:
> >
> > From: Tim Orling <tim.orling@konsulko.com>
> >
> > Whenever a recipe which inherits cargo-update-recipe-crates is upgraded
> with
> > devtool (such as with the Auto Upgrade Helper) we frequently see
> failures.
> > If the upstream Cargo.toml or Cargo.lock has been changed, the
> corresponding
> > <recipe_name>-crates.inc needs to be updated. This is done by running the
> > "bitbake -c update_crates <recipe_name>" task, but this has until now
> been
> > a manual operation.
> >
> > Add a new variable RECIPE_UPDATE_EXTRA_TASKS which is a string delimited
> > list of tasks to be run during the upgrade() method of
> > meta/lib/devtool/upgrade.py.
> >
> > To solve the problem described above, the solution is for all recipes
> which
> > inherit cargo-update-recipe-crates to add the "do_update_crates" task to
> > the RECIPE_UPDATE_EXTRA_TASKS variable. Add this to the bbclass.
> >
> > Add test case based on the guessing-game source we currently use for the
> > maturin runtime test cases, based on https://www.maturin.rs/tutorial.
> > This oe-selftest case checks for both the change in the recipe file and
> > the recipe -crates.inc file.
> >
> > This will rely on a new "guessing-game" git repository to be added to
> > git.yoctoproject.org/guessing-game (currently hosted on GitHub for the
> > purposes of this RFC).
> >
> > Currently, update_crates is the only task known to the author to fall
> into
> > this RECIPE_UPDATE_EXTRA_TASKS use case. If anyone can think of other use
> > cases that can also be added (and tested!), please let me know.
> >
> > Two obvious use cases that would be nice to add with changes in oe-core
> are:
> > (1) some kind of "go-mod://" update class to use a similar
> <recipe>-go-mods.inc
> > (2) some kind of rework of the "npm://" fetcher to use
> <recipe>-npm-mods.inc
> > But both of those are out of scope for this proposal.
> >
> > The _run_recipe_update_extra_tasks() method added to
> lib/devtool/upgrade.py
> > is functional, but could probably use some more guards and checks. Ideas
> for
> > improvements are welcome, hence the RFC.
> >
> > An attempt at documenting the new variable has been added to ref-manual,
> > but if anyone has some ideas for better clarification, input is welcome.
> >
> > The following changes since commit
> af6d28d2b0abdfcfa70edcc95abd99a3c1a64ac8:
> >
> >   sanity: Check if tar is gnutar (2024-05-31 16:58:36 +0100)
> >
> > are available in the Git repository at:
> >
> >   https://git.yoctoproject.org/poky-contrib
> timo/RECIPE_UPDATE_EXTRA_TASKS
> >
> https://git.yoctoproject.org/poky-contrib/log/?h=timo/RECIPE_UPDATE_EXTRA_TASKS
> >
> > Tim Orling (5):
> >   devtool upgrade: enable RECIPE_UPDATE_EXTRA_TASKS
> >   cargo-update-recipe-crates: add RECIPE_UPDATE_EXTRA_TASKS
> >   ref-manual: add RECIPE_UPDATE_EXTRA_TASKS variable
> >   meta-selftest: add python3-guessing-game
> >   oe-selftest: add RECIPE_UPDATE_EXTRA_TASKS test
> >
> >  documentation/ref-manual/variables.rst        |  7 ++
> >  .../python/python3-guessing-game-crates.inc   | 82 +++++++++++++++++
> >  .../python3-guessing-game-crates.inc.upgraded | 88 +++++++++++++++++++
> >  .../python/python3-guessing-game_git.bb       | 19 ++++
> >  .../python3-guessing-game_git.bb.upgraded     | 19 ++++
> >  .../cargo-update-recipe-crates.bbclass        |  2 +
> >  meta/lib/oeqa/selftest/cases/devtool.py       | 46 ++++++++++
> >  scripts/lib/devtool/upgrade.py                | 12 +++
> >  8 files changed, 275 insertions(+)
> >  create mode 100644
> meta-selftest/recipes-devtools/python/python3-guessing-game-crates.inc
> >  create mode 100644
> meta-selftest/recipes-devtools/python/python3-guessing-game-crates.inc.upgraded
> >  create mode 100644 meta-selftest/recipes-devtools/python/
> python3-guessing-game_git.bb
> >  create mode 100644
> meta-selftest/recipes-devtools/python/python3-guessing-game_git.bb.upgraded
> >
> > --
> > 2.45.2
> >
> >
> > -=-=-=-=-=-=-=-=-=-=-=-
> > Links: You receive all messages sent to this group.
> > View/Reply Online (#200216):
> https://lists.openembedded.org/g/openembedded-core/message/200216
> > Mute This Topic: https://lists.openembedded.org/mt/106450866/1686489
> > Group Owner: openembedded-core+owner@lists.openembedded.org
> > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [
> alex.kanavin@gmail.com]
> > -=-=-=-=-=-=-=-=-=-=-=-
> >
>