Message ID | 20240327184532.226557-1-jdmason@kudzu.us |
---|---|
State | New |
Headers | show |
Series | [RFC] recipeutils: check for SRC_URI name in get_recipe_upstream_version | expand |
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] > -=-=-=-=-=-=-=-=-=-=-=- >
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] > > -=-=-=-=-=-=-=-=-=-=-=- > >
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',
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(-)