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 <jdma...@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/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to