diff mbox series

devtool: Support variables in SRC_URI when upgrading recipes

Message ID 20250916100956.319729-1-frieder@fris.de
State New
Headers show
Series devtool: Support variables in SRC_URI when upgrading recipes | expand

Commit Message

Frieder Schrempf Sept. 16, 2025, 10:09 a.m. UTC
From: Frieder Schrempf <frieder.schrempf@kontron.de>

Currently when upgrading recipes SRC_URI doesn't get expanded which
can lead to failures if variables are used in SRC_URI. Remove this
limitation by always expanding SRC_URI.

Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
---
 scripts/lib/devtool/standard.py | 4 ++--
 scripts/lib/devtool/upgrade.py  | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

Comments

Frieder Schrempf Sept. 16, 2025, 4:28 p.m. UTC | #1
Am 16.09.25 um 12:09 schrieb Frieder Schrempf:
> From: Frieder Schrempf <frieder.schrempf@kontron.de>
> 
> Currently when upgrading recipes SRC_URI doesn't get expanded which
> can lead to failures if variables are used in SRC_URI. Remove this
> limitation by always expanding SRC_URI.

Hm, it seems like it already works on master without this patch (no idea
why as this still uses getVar('SRC_URI', False). But on Scarthgap I'm
getting:

ERROR: Could not decode SRC_URI: The URL: '${SRC_URI_PLATFORM_BSP}' is
invalid and cannot be interpreted

> 
> Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
> ---
>  scripts/lib/devtool/standard.py | 4 ++--
>  scripts/lib/devtool/upgrade.py  | 2 +-
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py
> index 1fd5947c41..9e8889f897 100644
> --- a/scripts/lib/devtool/standard.py
> +++ b/scripts/lib/devtool/standard.py
> @@ -1540,7 +1540,7 @@ def _update_recipe_srcrev(recipename, workspace, srctree, rd, appendlayerdir, wi
>      remove_files = []
>      patchfields = {}
>      patchfields['SRCREV'] = srcrev
> -    orig_src_uri = rd.getVar('SRC_URI', False) or ''
> +    orig_src_uri = rd.getVar('SRC_URI') or ''
>      srcuri = orig_src_uri.split()
>      tempdir = tempfile.mkdtemp(prefix='devtool')
>      update_srcuri = False
> @@ -1672,7 +1672,7 @@ def _update_recipe_patch(recipename, workspace, srctree, rd, appendlayerdir, wil
>          updatefiles = False
>          updaterecipe = False
>          destpath = None
> -        srcuri = (rd.getVar('SRC_URI', False) or '').split()
> +        srcuri = (rd.getVar('SRC_URI') or '').split()
>  
>          if appendlayerdir:
>              files = OrderedDict((os.path.join(local_files_dir, key), val) for
> diff --git a/scripts/lib/devtool/upgrade.py b/scripts/lib/devtool/upgrade.py
> index dda0a58098..6df53b0232 100644
> --- a/scripts/lib/devtool/upgrade.py
> +++ b/scripts/lib/devtool/upgrade.py
> @@ -359,7 +359,7 @@ def _create_new_recipe(newpv, checksums, srcrev, srcbranch, srcsubdir_old, srcsu
>          newvalues['SRCREV'] = srcrev
>  
>      if srcbranch:
> -        src_uri = oe.recipeutils.split_var_value(rd.getVar('SRC_URI', False) or '')
> +        src_uri = oe.recipeutils.split_var_value(rd.getVar('SRC_URI') or '')
>          changed = False
>          replacing = True
>          new_src_uri = []
diff mbox series

Patch

diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py
index 1fd5947c41..9e8889f897 100644
--- a/scripts/lib/devtool/standard.py
+++ b/scripts/lib/devtool/standard.py
@@ -1540,7 +1540,7 @@  def _update_recipe_srcrev(recipename, workspace, srctree, rd, appendlayerdir, wi
     remove_files = []
     patchfields = {}
     patchfields['SRCREV'] = srcrev
-    orig_src_uri = rd.getVar('SRC_URI', False) or ''
+    orig_src_uri = rd.getVar('SRC_URI') or ''
     srcuri = orig_src_uri.split()
     tempdir = tempfile.mkdtemp(prefix='devtool')
     update_srcuri = False
@@ -1672,7 +1672,7 @@  def _update_recipe_patch(recipename, workspace, srctree, rd, appendlayerdir, wil
         updatefiles = False
         updaterecipe = False
         destpath = None
-        srcuri = (rd.getVar('SRC_URI', False) or '').split()
+        srcuri = (rd.getVar('SRC_URI') or '').split()
 
         if appendlayerdir:
             files = OrderedDict((os.path.join(local_files_dir, key), val) for
diff --git a/scripts/lib/devtool/upgrade.py b/scripts/lib/devtool/upgrade.py
index dda0a58098..6df53b0232 100644
--- a/scripts/lib/devtool/upgrade.py
+++ b/scripts/lib/devtool/upgrade.py
@@ -359,7 +359,7 @@  def _create_new_recipe(newpv, checksums, srcrev, srcbranch, srcsubdir_old, srcsu
         newvalues['SRCREV'] = srcrev
 
     if srcbranch:
-        src_uri = oe.recipeutils.split_var_value(rd.getVar('SRC_URI', False) or '')
+        src_uri = oe.recipeutils.split_var_value(rd.getVar('SRC_URI') or '')
         changed = False
         replacing = True
         new_src_uri = []