* [RFC] recipeutils: check for SRC_URI name in get_recipe_upstream_version
@ 2024-03-27 18:45 Jon Mason
2024-03-27 20:31 ` [OE-core] " Alexander Kanavin
0 siblings, 1 reply; 3+ messages in thread
From: Jon Mason @ 2024-03-27 18:45 UTC (permalink / raw
To: openembedded-core
Previously, get_recipe_upstream_version took whatever the first entry in
SRC_URI was for determining the upstream version. This does not work
for recipes that append to the SRC_URI, as theirs will never be first.
To work around this, add a new variable to specify the SRC_URI name
field and use that to match. If nothing is specified, it will use the
first SRC_URI.
Signed-off-by: Jon Mason <jdmason@kudzu.us>
---
documentation/ref-manual/devtool-reference.rst | 4 ++--
documentation/ref-manual/variables.rst | 8 ++++++++
meta/lib/oe/recipeutils.py | 11 +++++++++--
3 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/documentation/ref-manual/devtool-reference.rst b/documentation/ref-manual/devtool-reference.rst
index 9319addc3c61..b774dcb1092b 100644
--- a/documentation/ref-manual/devtool-reference.rst
+++ b/documentation/ref-manual/devtool-reference.rst
@@ -340,8 +340,8 @@ being able to upgrade it, displayed in a table.
This upgrade checking mechanism relies on the optional :term:`UPSTREAM_CHECK_URI`,
:term:`UPSTREAM_CHECK_REGEX`, :term:`UPSTREAM_CHECK_GITTAGREGEX`,
-:term:`UPSTREAM_CHECK_COMMITS` and :term:`UPSTREAM_VERSION_UNKNOWN`
-variables in package recipes.
+:term:`UPSTREAM_CHECK_COMMITS`, :term: `UPSTREAM_CHECK_SRCNAME`, and
+:term:`UPSTREAM_VERSION_UNKNOWN` variables in package recipes.
.. note::
diff --git a/documentation/ref-manual/variables.rst b/documentation/ref-manual/variables.rst
index 435481c9aa12..12372c1e67f3 100644
--- a/documentation/ref-manual/variables.rst
+++ b/documentation/ref-manual/variables.rst
@@ -9686,6 +9686,14 @@ system and gives an overview of their function and contents.
UPSTREAM_CHECK_REGEX = "package_regex"
+ :term:`UPSTREAM_CHECK_SRCNAME`
+ By default, the first entry in :term:`SRC_URI` is what is used to
+ determine the latest upstream source code version. If this is not
+ the desired behavior, the :term:`UPSTREAM_CHECK_SRCNAME` variable
+ is used to specify which of the other entries in SRC_URI should be
+ used for this determination. The value should match the specified
+ name of the :term:`SRC_URI` entry.
+
:term:`UPSTREAM_CHECK_URI`
You can perform a per-recipe check for what the latest upstream
source code version is by calling ``devtool latest-version recipe``. If
diff --git a/meta/lib/oe/recipeutils.py b/meta/lib/oe/recipeutils.py
index de1fbdd3a8c8..6fb9fbbc6abc 100644
--- a/meta/lib/oe/recipeutils.py
+++ b/meta/lib/oe/recipeutils.py
@@ -1041,9 +1041,15 @@ def get_recipe_upstream_version(rd):
ru['datetime'] = datetime.now()
return ru
- # XXX: we suppose that the first entry points to the upstream sources
+ # If the upstream name has been specified, take that one.
+ # Otherwise, default to the first URI in the list
src_uri = src_uris.split()[0]
- uri_type, _, _, _, _, _ = decodeurl(src_uri)
+ if str(rd.getVar('UPSTREAM_CHECK_SRCNAME')):
+ for s in src_uris.split():
+ ud = bb.fetch2.FetchData(s, rd)
+ if ud.parm.get('name') == str(rd.getVar('UPSTREAM_CHECK_SRCNAME')):
+ src_uri = s
+ uri_type, _, _, _, _, _ = decodeurl(src_uri)
(pv, pfx, sfx) = get_recipe_pv_with_pfx_sfx(rd.getVar('PV'), uri_type)
ru['current_version'] = pv
@@ -1127,6 +1133,7 @@ def get_recipe_upgrade_status(recipes=None):
'UPSTREAM_CHECK_COMMITS',
'UPSTREAM_CHECK_GITTAGREGEX',
'UPSTREAM_CHECK_REGEX',
+ 'UPSTREAM_CHECK_SRCNAME',
'UPSTREAM_CHECK_URI',
'UPSTREAM_VERSION_UNKNOWN',
'RECIPE_MAINTAINER',
--
2.30.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [OE-core] [RFC] recipeutils: check for SRC_URI name in get_recipe_upstream_version
2024-03-27 18:45 [RFC] recipeutils: check for SRC_URI name in get_recipe_upstream_version Jon Mason
@ 2024-03-27 20:31 ` Alexander Kanavin
2024-03-28 15:13 ` Jon Mason
0 siblings, 1 reply; 3+ messages in thread
From: Alexander Kanavin @ 2024-03-27 20:31 UTC (permalink / raw
To: Jon Mason; +Cc: openembedded-core
I wonder if adding another variable is really necessary if instead you
can set UPSTREAM_CHECK_URI to anything, including entries in SRC_URI?
What is the specific example where you ran into the issue?
Alex
On Wed, 27 Mar 2024 at 19:45, Jon Mason <jdmason@kudzu.us> wrote:
>
> Previously, get_recipe_upstream_version took whatever the first entry in
> SRC_URI was for determining the upstream version. This does not work
> for recipes that append to the SRC_URI, as theirs will never be first.
> To work around this, add a new variable to specify the SRC_URI name
> field and use that to match. If nothing is specified, it will use the
> first SRC_URI.
>
> Signed-off-by: Jon Mason <jdmason@kudzu.us>
> ---
> documentation/ref-manual/devtool-reference.rst | 4 ++--
> documentation/ref-manual/variables.rst | 8 ++++++++
> meta/lib/oe/recipeutils.py | 11 +++++++++--
> 3 files changed, 19 insertions(+), 4 deletions(-)
>
> diff --git a/documentation/ref-manual/devtool-reference.rst b/documentation/ref-manual/devtool-reference.rst
> index 9319addc3c61..b774dcb1092b 100644
> --- a/documentation/ref-manual/devtool-reference.rst
> +++ b/documentation/ref-manual/devtool-reference.rst
> @@ -340,8 +340,8 @@ being able to upgrade it, displayed in a table.
>
> This upgrade checking mechanism relies on the optional :term:`UPSTREAM_CHECK_URI`,
> :term:`UPSTREAM_CHECK_REGEX`, :term:`UPSTREAM_CHECK_GITTAGREGEX`,
> -:term:`UPSTREAM_CHECK_COMMITS` and :term:`UPSTREAM_VERSION_UNKNOWN`
> -variables in package recipes.
> +:term:`UPSTREAM_CHECK_COMMITS`, :term: `UPSTREAM_CHECK_SRCNAME`, and
> +:term:`UPSTREAM_VERSION_UNKNOWN` variables in package recipes.
>
> .. note::
>
> diff --git a/documentation/ref-manual/variables.rst b/documentation/ref-manual/variables.rst
> index 435481c9aa12..12372c1e67f3 100644
> --- a/documentation/ref-manual/variables.rst
> +++ b/documentation/ref-manual/variables.rst
> @@ -9686,6 +9686,14 @@ system and gives an overview of their function and contents.
>
> UPSTREAM_CHECK_REGEX = "package_regex"
>
> + :term:`UPSTREAM_CHECK_SRCNAME`
> + By default, the first entry in :term:`SRC_URI` is what is used to
> + determine the latest upstream source code version. If this is not
> + the desired behavior, the :term:`UPSTREAM_CHECK_SRCNAME` variable
> + is used to specify which of the other entries in SRC_URI should be
> + used for this determination. The value should match the specified
> + name of the :term:`SRC_URI` entry.
> +
> :term:`UPSTREAM_CHECK_URI`
> You can perform a per-recipe check for what the latest upstream
> source code version is by calling ``devtool latest-version recipe``. If
> diff --git a/meta/lib/oe/recipeutils.py b/meta/lib/oe/recipeutils.py
> index de1fbdd3a8c8..6fb9fbbc6abc 100644
> --- a/meta/lib/oe/recipeutils.py
> +++ b/meta/lib/oe/recipeutils.py
> @@ -1041,9 +1041,15 @@ def get_recipe_upstream_version(rd):
> ru['datetime'] = datetime.now()
> return ru
>
> - # XXX: we suppose that the first entry points to the upstream sources
> + # If the upstream name has been specified, take that one.
> + # Otherwise, default to the first URI in the list
> src_uri = src_uris.split()[0]
> - uri_type, _, _, _, _, _ = decodeurl(src_uri)
> + if str(rd.getVar('UPSTREAM_CHECK_SRCNAME')):
> + for s in src_uris.split():
> + ud = bb.fetch2.FetchData(s, rd)
> + if ud.parm.get('name') == str(rd.getVar('UPSTREAM_CHECK_SRCNAME')):
> + src_uri = s
> + uri_type, _, _, _, _, _ = decodeurl(src_uri)
>
> (pv, pfx, sfx) = get_recipe_pv_with_pfx_sfx(rd.getVar('PV'), uri_type)
> ru['current_version'] = pv
> @@ -1127,6 +1133,7 @@ def get_recipe_upgrade_status(recipes=None):
> 'UPSTREAM_CHECK_COMMITS',
> 'UPSTREAM_CHECK_GITTAGREGEX',
> 'UPSTREAM_CHECK_REGEX',
> + 'UPSTREAM_CHECK_SRCNAME',
> 'UPSTREAM_CHECK_URI',
> 'UPSTREAM_VERSION_UNKNOWN',
> 'RECIPE_MAINTAINER',
> --
> 2.30.2
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#197567): https://lists.openembedded.org/g/openembedded-core/message/197567
> Mute This Topic: https://lists.openembedded.org/mt/105183205/1686489
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alex.kanavin@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [OE-core] [RFC] recipeutils: check for SRC_URI name in get_recipe_upstream_version
2024-03-27 20:31 ` [OE-core] " Alexander Kanavin
@ 2024-03-28 15:13 ` Jon Mason
0 siblings, 0 replies; 3+ messages in thread
From: Jon Mason @ 2024-03-28 15:13 UTC (permalink / raw
To: Alexander Kanavin; +Cc: openembedded-core
On Wed, Mar 27, 2024 at 4:31 PM Alexander Kanavin
<alex.kanavin@gmail.com> wrote:
>
> I wonder if adding another variable is really necessary if instead you
> can set UPSTREAM_CHECK_URI to anything, including entries in SRC_URI?
> What is the specific example where you ran into the issue?
Wow, I feel stupid. You are 100% correct. Changing recipeutils.py to
use UPSTREAM_CHECK_URI is exactly what is needed and the change is
almost trivial (at least for my use case).
The specific example I'm having an issue with is sbsa-acs in meta-arm,
which requires edk2-firmware (which has the first entry of the
SRC_URI). Since sbsa-acs specifies the destsuffix, it cannot be
prepended to the SRC_URI to be first (and even that would be a hack).
Thanks for the insight, v2 coming as a proper patch.
Thanks,
Jon
> Alex
>
> On Wed, 27 Mar 2024 at 19:45, Jon Mason <jdmason@kudzu.us> wrote:
> >
> > Previously, get_recipe_upstream_version took whatever the first entry in
> > SRC_URI was for determining the upstream version. This does not work
> > for recipes that append to the SRC_URI, as theirs will never be first.
> > To work around this, add a new variable to specify the SRC_URI name
> > field and use that to match. If nothing is specified, it will use the
> > first SRC_URI.
> >
> > Signed-off-by: Jon Mason <jdmason@kudzu.us>
> > ---
> > documentation/ref-manual/devtool-reference.rst | 4 ++--
> > documentation/ref-manual/variables.rst | 8 ++++++++
> > meta/lib/oe/recipeutils.py | 11 +++++++++--
> > 3 files changed, 19 insertions(+), 4 deletions(-)
> >
> > diff --git a/documentation/ref-manual/devtool-reference.rst b/documentation/ref-manual/devtool-reference.rst
> > index 9319addc3c61..b774dcb1092b 100644
> > --- a/documentation/ref-manual/devtool-reference.rst
> > +++ b/documentation/ref-manual/devtool-reference.rst
> > @@ -340,8 +340,8 @@ being able to upgrade it, displayed in a table.
> >
> > This upgrade checking mechanism relies on the optional :term:`UPSTREAM_CHECK_URI`,
> > :term:`UPSTREAM_CHECK_REGEX`, :term:`UPSTREAM_CHECK_GITTAGREGEX`,
> > -:term:`UPSTREAM_CHECK_COMMITS` and :term:`UPSTREAM_VERSION_UNKNOWN`
> > -variables in package recipes.
> > +:term:`UPSTREAM_CHECK_COMMITS`, :term: `UPSTREAM_CHECK_SRCNAME`, and
> > +:term:`UPSTREAM_VERSION_UNKNOWN` variables in package recipes.
> >
> > .. note::
> >
> > diff --git a/documentation/ref-manual/variables.rst b/documentation/ref-manual/variables.rst
> > index 435481c9aa12..12372c1e67f3 100644
> > --- a/documentation/ref-manual/variables.rst
> > +++ b/documentation/ref-manual/variables.rst
> > @@ -9686,6 +9686,14 @@ system and gives an overview of their function and contents.
> >
> > UPSTREAM_CHECK_REGEX = "package_regex"
> >
> > + :term:`UPSTREAM_CHECK_SRCNAME`
> > + By default, the first entry in :term:`SRC_URI` is what is used to
> > + determine the latest upstream source code version. If this is not
> > + the desired behavior, the :term:`UPSTREAM_CHECK_SRCNAME` variable
> > + is used to specify which of the other entries in SRC_URI should be
> > + used for this determination. The value should match the specified
> > + name of the :term:`SRC_URI` entry.
> > +
> > :term:`UPSTREAM_CHECK_URI`
> > You can perform a per-recipe check for what the latest upstream
> > source code version is by calling ``devtool latest-version recipe``. If
> > diff --git a/meta/lib/oe/recipeutils.py b/meta/lib/oe/recipeutils.py
> > index de1fbdd3a8c8..6fb9fbbc6abc 100644
> > --- a/meta/lib/oe/recipeutils.py
> > +++ b/meta/lib/oe/recipeutils.py
> > @@ -1041,9 +1041,15 @@ def get_recipe_upstream_version(rd):
> > ru['datetime'] = datetime.now()
> > return ru
> >
> > - # XXX: we suppose that the first entry points to the upstream sources
> > + # If the upstream name has been specified, take that one.
> > + # Otherwise, default to the first URI in the list
> > src_uri = src_uris.split()[0]
> > - uri_type, _, _, _, _, _ = decodeurl(src_uri)
> > + if str(rd.getVar('UPSTREAM_CHECK_SRCNAME')):
> > + for s in src_uris.split():
> > + ud = bb.fetch2.FetchData(s, rd)
> > + if ud.parm.get('name') == str(rd.getVar('UPSTREAM_CHECK_SRCNAME')):
> > + src_uri = s
> > + uri_type, _, _, _, _, _ = decodeurl(src_uri)
> >
> > (pv, pfx, sfx) = get_recipe_pv_with_pfx_sfx(rd.getVar('PV'), uri_type)
> > ru['current_version'] = pv
> > @@ -1127,6 +1133,7 @@ def get_recipe_upgrade_status(recipes=None):
> > 'UPSTREAM_CHECK_COMMITS',
> > 'UPSTREAM_CHECK_GITTAGREGEX',
> > 'UPSTREAM_CHECK_REGEX',
> > + 'UPSTREAM_CHECK_SRCNAME',
> > 'UPSTREAM_CHECK_URI',
> > 'UPSTREAM_VERSION_UNKNOWN',
> > 'RECIPE_MAINTAINER',
> > --
> > 2.30.2
> >
> >
> > -=-=-=-=-=-=-=-=-=-=-=-
> > Links: You receive all messages sent to this group.
> > View/Reply Online (#197567): https://lists.openembedded.org/g/openembedded-core/message/197567
> > Mute This Topic: https://lists.openembedded.org/mt/105183205/1686489
> > Group Owner: openembedded-core+owner@lists.openembedded.org
> > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alex.kanavin@gmail.com]
> > -=-=-=-=-=-=-=-=-=-=-=-
> >
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-03-28 15:13 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-27 18:45 [RFC] recipeutils: check for SRC_URI name in get_recipe_upstream_version Jon Mason
2024-03-27 20:31 ` [OE-core] " Alexander Kanavin
2024-03-28 15:13 ` Jon Mason
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.