All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] recipetool: create: keep tag= in SRC_URI
@ 2026-11-12  3:58 Babanpreet Singh
  2026-11-12  3:58 ` [PATCH 2/2] recipetool: create: fix git URLs that only specify a tag Babanpreet Singh
  0 siblings, 1 reply; 5+ messages in thread
From: Babanpreet Singh @ 2026-11-12  3:58 UTC (permalink / raw)
  To: openembedded-core; +Cc: Ross Burton, Babanpreet Singh

The fetcher now checks that tag= resolves to SRCREV, so stop dropping
the tag from the SRC_URI of the recipe.

[YOCTO #15816]

Signed-off-by: Babanpreet Singh <bbnpreetsingh@gmail.com>
---
 meta/lib/oeqa/selftest/cases/recipetool.py | 7 ++++++-
 scripts/lib/recipetool/create.py           | 2 --
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/meta/lib/oeqa/selftest/cases/recipetool.py b/meta/lib/oeqa/selftest/cases/recipetool.py
index 54b7cb3a65..c278abdab2 100644
--- a/meta/lib/oeqa/selftest/cases/recipetool.py
+++ b/meta/lib/oeqa/selftest/cases/recipetool.py
@@ -776,7 +776,7 @@ class RecipetoolCreateTests(RecipetoolBase):
         inherits = ['setuptools3']
         self._test_recipe_contents(recipefile, checkvars, inherits)
 
-    def _test_recipetool_create_git(self, srcuri, branch=None):
+    def _test_recipetool_create_git(self, srcuri, branch=None, extravars=None):
         # Basic test to check http git URL mangling works
         temprecipe = os.path.join(self.tempdir, 'recipe')
         os.makedirs(temprecipe)
@@ -792,6 +792,7 @@ class RecipetoolCreateTests(RecipetoolBase):
                 checkvars['SRC_URI'] = 'git%s;protocol=%s' % (srcuri[len(scheme):], scheme)
         if ';branch=' not in srcuri:
             checkvars['SRC_URI'] += ';branch=' + (branch or 'master')
+        checkvars.update(extravars or {})
         self._test_recipe_contents(recipefile, checkvars, [])
 
     def test_recipetool_create_git_http(self):
@@ -806,6 +807,10 @@ class RecipetoolCreateTests(RecipetoolBase):
     def test_recipetool_create_git_srcbranch(self):
         self._test_recipetool_create_git('git://git.yoctoproject.org/matchbox-keyboard;protocol=https', 'matchbox-keyboard-0-1')
 
+    def test_recipetool_create_git_srcuri_branch_tag(self):
+        self._test_recipetool_create_git('git://git.yoctoproject.org/matchbox-keyboard;branch=matchbox-keyboard-0-1;protocol=https;tag=0.1.1',
+                                         extravars={'SRCREV': '630d89068dc0a1e9199306d405cb32f892dfa4d3'})
+
     def _go_urifiy(self, url, version, modulepath = None, pathmajor = None, subdir = None):
         modulepath = ",path='%s'" % modulepath if len(modulepath) else ''
         pathmajor = ",pathmajor='%s'" % pathmajor if len(pathmajor) else ''
diff --git a/scripts/lib/recipetool/create.py b/scripts/lib/recipetool/create.py
index e0da96dea0..662e7a6232 100644
--- a/scripts/lib/recipetool/create.py
+++ b/scripts/lib/recipetool/create.py
@@ -600,8 +600,6 @@ def create_recipe(args):
                 logger.error(str(err))
                 logger.error("Possibly wrong tag name is provided")
                 sys.exit(1)
-            # Drop tag from srcuri as it will have conflicts with SRCREV during recipe parse.
-            del params['tag']
         srcuri = bb.fetch.encodeurl((scheme, network, path, user, passwd, params))
 
         if os.path.exists(os.path.join(srctree, '.gitmodules')) and srcuri.startswith('git://'):
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] recipetool: create: fix git URLs that only specify a tag
  2026-11-12  3:58 [PATCH 1/2] recipetool: create: keep tag= in SRC_URI Babanpreet Singh
@ 2026-11-12  3:58 ` Babanpreet Singh
  2026-11-23  9:30   ` Paul Barker
  0 siblings, 1 reply; 5+ messages in thread
From: Babanpreet Singh @ 2026-11-12  3:58 UTC (permalink / raw)
  To: openembedded-core; +Cc: Ross Burton, Babanpreet Singh

A git URL with tag= and no branch= fails with:

  Unable to resolve '' in upstream git repository

AUTOREV has no branch to follow now that bitbake no longer defaults to
master. Fetch the tag itself, which also lets the branch be found from
it.

AI-Generated: Uses Claude (claude-fable-5-2)
Signed-off-by: Babanpreet Singh <bbnpreetsingh@gmail.com>
---

Notes:
    Tested with oe-selftest -r recipetool.RecipetoolCreateTests. Not tried
    on wrynose, which has the same code.

 meta/lib/oeqa/selftest/cases/recipetool.py | 7 +++++++
 scripts/lib/recipetool/create.py           | 4 ++++
 2 files changed, 11 insertions(+)

diff --git a/meta/lib/oeqa/selftest/cases/recipetool.py b/meta/lib/oeqa/selftest/cases/recipetool.py
index c278abdab2..804efcc755 100644
--- a/meta/lib/oeqa/selftest/cases/recipetool.py
+++ b/meta/lib/oeqa/selftest/cases/recipetool.py
@@ -811,6 +811,13 @@ class RecipetoolCreateTests(RecipetoolBase):
         self._test_recipetool_create_git('git://git.yoctoproject.org/matchbox-keyboard;branch=matchbox-keyboard-0-1;protocol=https;tag=0.1.1',
                                          extravars={'SRCREV': '630d89068dc0a1e9199306d405cb32f892dfa4d3'})
 
+    def test_recipetool_create_git_srcuri_tag(self):
+        # The 0.1.1 tag is only on the matchbox-keyboard-0-1 branch
+        srcuri = 'git://git.yoctoproject.org/matchbox-keyboard;protocol=https;tag=0.1.1'
+        self._test_recipetool_create_git(srcuri,
+                                         extravars={'SRC_URI': srcuri + ';branch=matchbox-keyboard-0-1',
+                                                    'SRCREV': '630d89068dc0a1e9199306d405cb32f892dfa4d3'})
+
     def _go_urifiy(self, url, version, modulepath = None, pathmajor = None, subdir = None):
         modulepath = ",path='%s'" % modulepath if len(modulepath) else ''
         pathmajor = ",pathmajor='%s'" % pathmajor if len(pathmajor) else ''
diff --git a/scripts/lib/recipetool/create.py b/scripts/lib/recipetool/create.py
index 662e7a6232..0e73f462d3 100644
--- a/scripts/lib/recipetool/create.py
+++ b/scripts/lib/recipetool/create.py
@@ -520,6 +520,10 @@ def create_recipe(args):
             storeTagName = params['tag']
             params['nobranch'] = '1'
             del params['tag']
+            if srcrev == '${AUTOREV}':
+                # Nothing for ${AUTOREV} to resolve without a branch, so
+                # fetch the tag itself
+                srcrev = storeTagName
         # Assume 'master' branch if not set
         if scheme in ['git', 'gitsm'] and 'branch' not in params and 'nobranch' not in params:
             params['branch'] = 'master'
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] recipetool: create: fix git URLs that only specify a tag
  2026-11-12  3:58 ` [PATCH 2/2] recipetool: create: fix git URLs that only specify a tag Babanpreet Singh
@ 2026-11-23  9:30   ` Paul Barker
  2026-11-25  3:04     ` Babanpreet Singh
  2026-12-01 18:18     ` [PATCH v2] " Babanpreet Singh
  0 siblings, 2 replies; 5+ messages in thread
From: Paul Barker @ 2026-11-23  9:30 UTC (permalink / raw)
  To: Babanpreet Singh, openembedded-core; +Cc: Ross Burton

On Thu Nov 12, 2026 at 3:58 AM GMT, Babanpreet Singh wrote:
> A git URL with tag= and no branch= fails with:
>
>   Unable to resolve '' in upstream git repository
>
> AUTOREV has no branch to follow now that bitbake no longer defaults to
> master. Fetch the tag itself, which also lets the branch be found from
> it.
>
> AI-Generated: Uses Claude (claude-fable-5-2)
> Signed-off-by: Babanpreet Singh <bbnpreetsingh@gmail.com>

Hi,

The explanation in the commit message doesn't really make sense. The
issue with the test recipe created for matchbox-keyboard is that the
commit tagged as "0.1.1" isn't present on the default branch. This is
not true for all git URLs with "tag=..." and no "branch=...".

> ---
>
> Notes:
>     Tested with oe-selftest -r recipetool.RecipetoolCreateTests. Not tried
>     on wrynose, which has the same code.
>
>  meta/lib/oeqa/selftest/cases/recipetool.py | 7 +++++++
>  scripts/lib/recipetool/create.py           | 4 ++++
>  2 files changed, 11 insertions(+)
>
> diff --git a/meta/lib/oeqa/selftest/cases/recipetool.py b/meta/lib/oeqa/selftest/cases/recipetool.py
> index c278abdab2..804efcc755 100644
> --- a/meta/lib/oeqa/selftest/cases/recipetool.py
> +++ b/meta/lib/oeqa/selftest/cases/recipetool.py
> @@ -811,6 +811,13 @@ class RecipetoolCreateTests(RecipetoolBase):
>          self._test_recipetool_create_git('git://git.yoctoproject.org/matchbox-keyboard;branch=matchbox-keyboard-0-1;protocol=https;tag=0.1.1',
>                                           extravars={'SRCREV': '630d89068dc0a1e9199306d405cb32f892dfa4d3'})
>  
> +    def test_recipetool_create_git_srcuri_tag(self):
> +        # The 0.1.1 tag is only on the matchbox-keyboard-0-1 branch
> +        srcuri = 'git://git.yoctoproject.org/matchbox-keyboard;protocol=https;tag=0.1.1'
> +        self._test_recipetool_create_git(srcuri,
> +                                         extravars={'SRC_URI': srcuri + ';branch=matchbox-keyboard-0-1',
> +                                                    'SRCREV': '630d89068dc0a1e9199306d405cb32f892dfa4d3'})
> +
>      def _go_urifiy(self, url, version, modulepath = None, pathmajor = None, subdir = None):
>          modulepath = ",path='%s'" % modulepath if len(modulepath) else ''
>          pathmajor = ",pathmajor='%s'" % pathmajor if len(pathmajor) else ''
> diff --git a/scripts/lib/recipetool/create.py b/scripts/lib/recipetool/create.py
> index 662e7a6232..0e73f462d3 100644
> --- a/scripts/lib/recipetool/create.py
> +++ b/scripts/lib/recipetool/create.py
> @@ -520,6 +520,10 @@ def create_recipe(args):
>              storeTagName = params['tag']
>              params['nobranch'] = '1'
>              del params['tag']
> +            if srcrev == '${AUTOREV}':
> +                # Nothing for ${AUTOREV} to resolve without a branch, so
> +                # fetch the tag itself
> +                srcrev = storeTagName

There is no situation where we are "without a branch". As the following
comment says, we assume we're on the "master" branch if the branch is
not specified.

>          # Assume 'master' branch if not set
>          if scheme in ['git', 'gitsm'] and 'branch' not in params and 'nobranch' not in params:
>              params['branch'] = 'master'

Best regards,

-- 
Paul Barker


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] recipetool: create: fix git URLs that only specify a tag
  2026-11-23  9:30   ` Paul Barker
@ 2026-11-25  3:04     ` Babanpreet Singh
  2026-12-01 18:18     ` [PATCH v2] " Babanpreet Singh
  1 sibling, 0 replies; 5+ messages in thread
From: Babanpreet Singh @ 2026-11-25  3:04 UTC (permalink / raw)
  To: Paul Barker; +Cc: openembedded-core, Ross Burton, Babanpreet Singh

On Mon Nov 23, 2026 at 9:30 AM GMT, Paul Barker wrote:
> The explanation in the commit message doesn't really make sense. The
> issue with the test recipe created for matchbox-keyboard is that the
> commit tagged as "0.1.1" isn't present on the default branch. This is
> not true for all git URLs with "tag=..." and no "branch=...".

Hi Paul,

Yes, the message is wrong. bitbake 2515fbd10 has nothing to do with
it, the fetcher gives the same error for a nobranch=1 URL with
${AUTOREV} before that commit too. The tag being off master isn't the
cause either, though. libfakekey's 0.3 tag is the tip of master, and
git://git.yoctoproject.org/libfakekey;protocol=https;tag=0.3 fails on
current master with the same "Unable to resolve ''". Where the tag
lives matters later, for the branch= written into the recipe, which is
what the matchbox-keyboard test checks.

> There is no situation where we are "without a branch". As the following
> comment says, we assume we're on the "master" branch if the branch is
> not specified.

The tag block just above sets nobranch=1, so that default is skipped
and ${AUTOREV} has no branch to resolve.

I'll send a v2 with a fixed message.
Thanks for the review.

Baban

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2] recipetool: create: fix git URLs that only specify a tag
  2026-11-23  9:30   ` Paul Barker
  2026-11-25  3:04     ` Babanpreet Singh
@ 2026-12-01 18:18     ` Babanpreet Singh
  1 sibling, 0 replies; 5+ messages in thread
From: Babanpreet Singh @ 2026-12-01 18:18 UTC (permalink / raw)
  To: openembedded-core; +Cc: Paul Barker, Ross Burton, Babanpreet Singh

A git URL with tag= and no branch= fails with:

  Unable to resolve '' in upstream git repository

recipetool fetches it with nobranch=1, which leaves ${AUTOREV} no branch
to follow. Fetch the tag itself instead.

AI-Generated: Uses Claude (claude-opus-5-5)
Signed-off-by: Babanpreet Singh <bbnpreetsingh@gmail.com>
---
 meta/lib/oeqa/selftest/cases/recipetool.py | 8 ++++++++
 scripts/lib/recipetool/create.py           | 4 ++++
 2 files changed, 12 insertions(+)

diff --git a/meta/lib/oeqa/selftest/cases/recipetool.py b/meta/lib/oeqa/selftest/cases/recipetool.py
index 181d95804f..ad5ec226af 100644
--- a/meta/lib/oeqa/selftest/cases/recipetool.py
+++ b/meta/lib/oeqa/selftest/cases/recipetool.py
@@ -825,6 +825,14 @@ class RecipetoolCreateTests(RecipetoolBase):
         self._test_recipetool_create_git('git://git.yoctoproject.org/matchbox-keyboard;branch=matchbox-keyboard-0-1;protocol=https;tag=0.1.1',
                                          extravars={'SRCREV': '630d89068dc0a1e9199306d405cb32f892dfa4d3'})
 
+    def test_recipetool_create_git_srcuri_tag(self):
+        # The 0.1.1 tag is only on the matchbox-keyboard-0-1 branch, so the
+        # recipe should name that branch rather than master
+        srcuri = 'git://git.yoctoproject.org/matchbox-keyboard;protocol=https;tag=0.1.1'
+        self._test_recipetool_create_git(srcuri,
+                                         extravars={'SRC_URI': srcuri + ';branch=matchbox-keyboard-0-1',
+                                                    'SRCREV': '630d89068dc0a1e9199306d405cb32f892dfa4d3'})
+
     def _go_urifiy(self, url, version, modulepath = None, pathmajor = None, subdir = None):
         modulepath = ",path='%s'" % modulepath if len(modulepath) else ''
         pathmajor = ",pathmajor='%s'" % pathmajor if len(pathmajor) else ''
diff --git a/scripts/lib/recipetool/create.py b/scripts/lib/recipetool/create.py
index 46a321a866..4c20938a82 100644
--- a/scripts/lib/recipetool/create.py
+++ b/scripts/lib/recipetool/create.py
@@ -532,6 +532,10 @@ def create_recipe(args):
             storeTagName = params['tag']
             params['nobranch'] = '1'
             del params['tag']
+            if srcrev == '${AUTOREV}':
+                # nobranch=1 leaves ${AUTOREV} no branch to follow, so
+                # fetch the tag itself
+                srcrev = storeTagName
         # Assume 'master' branch if not set
         if scheme in ['git', 'gitsm'] and 'branch' not in params and 'nobranch' not in params:
             params['branch'] = 'master'
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-12-01 18:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-12  3:58 [PATCH 1/2] recipetool: create: keep tag= in SRC_URI Babanpreet Singh
2026-11-12  3:58 ` [PATCH 2/2] recipetool: create: fix git URLs that only specify a tag Babanpreet Singh
2026-11-23  9:30   ` Paul Barker
2026-11-25  3:04     ` Babanpreet Singh
2026-12-01 18:18     ` [PATCH v2] " Babanpreet Singh

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.