diff mbox series

bitbake/bzr: Drop check for unset .revision after .setup_revisions()

Message ID 20251006140246.2459639-2-u.kleine-koenig@baylibre.com
State New
Headers show
Series bitbake/bzr: Drop check for unset .revision after .setup_revisions() | expand

Commit Message

Uwe Kleine-König Oct. 6, 2025, 2:02 p.m. UTC
FetchMethod.latest_revision() expects three parameters, so the call
`self.latest_revision(ud, d)` triggers an exception.

Drop that error path that obviously isn't used.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
---
Hello,

I didn't hit this exception and only noticed that problem during
research for another problem. I'm unsure if deleting is really the right
thing to do (i.e. if .setup_revisions() always returns something that
evaluates to True when interpreted as Bool), but it seems nobody hit
that error path since commit 7b7a4517c600 ("fetch2: Allow multiple src
rev to be used in one src_uri").
(Hmm, maybe the author of commit 7c94ca56b2fd ("fetch2: Correct a few
calls to latest_revision()") should have noticed ....)

There is a similar issue in lib/bb/fetch2/hg.py. I'll postpone sending a
patch for that until we agreed on what to do here.

Best regards
Uwe

 lib/bb/fetch2/bzr.py | 3 ---
 1 file changed, 3 deletions(-)


base-commit: 7bd36f6c6d33211bb2a6b6fc6d40bdbd83b8b7c3

Comments

Paul Barker Feb. 11, 2026, 11:56 a.m. UTC | #1
On Mon, 2025-10-06 at 16:02 +0200, Uwe Kleine-König wrote:
> FetchMethod.latest_revision() expects three parameters, so the call
> `self.latest_revision(ud, d)` triggers an exception.
> 
> Drop that error path that obviously isn't used.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
> ---
> Hello,
> 
> I didn't hit this exception and only noticed that problem during
> research for another problem. I'm unsure if deleting is really the right
> thing to do (i.e. if .setup_revisions() always returns something that
> evaluates to True when interpreted as Bool), but it seems nobody hit
> that error path since commit 7b7a4517c600 ("fetch2: Allow multiple src
> rev to be used in one src_uri").
> (Hmm, maybe the author of commit 7c94ca56b2fd ("fetch2: Correct a few
> calls to latest_revision()") should have noticed ....)
> 
> There is a similar issue in lib/bb/fetch2/hg.py. I'll postpone sending a
> patch for that until we agreed on what to do here.

Apologies, this patch seems to have dropped through the cracks. Feel
free to send us a ping after a couple of weeks in the future if you've
had no replies.

> 
> Best regards
> Uwe
> 
>  lib/bb/fetch2/bzr.py | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/lib/bb/fetch2/bzr.py b/lib/bb/fetch2/bzr.py
> index fc558f50b047..443195fa00bc 100644
> --- a/lib/bb/fetch2/bzr.py
> +++ b/lib/bb/fetch2/bzr.py
> @@ -35,9 +35,6 @@ class Bzr(FetchMethod):
>  
>          ud.setup_revisions(d)
>  
> -        if not ud.revision:
> -            ud.revision = self.latest_revision(ud, d)
> -

Looking at the git fetcher, this should probably be fixed to call
self.latest_revision(ud, d, ud.name) instead.

Are you actually using the bzr fetcher? I'd like to propose deprecating
it then removing it after the LTS release.

Best regards,
Uwe Kleine-König Feb. 11, 2026, 5:37 p.m. UTC | #2
Hello Paul,

On Wed, Feb 11, 2026 at 11:56:29AM +0000, Paul Barker wrote:
> On Mon, 2025-10-06 at 16:02 +0200, Uwe Kleine-König wrote:
> > FetchMethod.latest_revision() expects three parameters, so the call
> > `self.latest_revision(ud, d)` triggers an exception.
> > 
> > Drop that error path that obviously isn't used.
> > 
> > Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
> > ---
> > Hello,
> > 
> > I didn't hit this exception and only noticed that problem during
> > research for another problem. I'm unsure if deleting is really the right
> > thing to do (i.e. if .setup_revisions() always returns something that
> > evaluates to True when interpreted as Bool), but it seems nobody hit
> > that error path since commit 7b7a4517c600 ("fetch2: Allow multiple src
> > rev to be used in one src_uri").
> > (Hmm, maybe the author of commit 7c94ca56b2fd ("fetch2: Correct a few
> > calls to latest_revision()") should have noticed ....)
> > 
> > There is a similar issue in lib/bb/fetch2/hg.py. I'll postpone sending a
> > patch for that until we agreed on what to do here.
> 
> Apologies, this patch seems to have dropped through the cracks. Feel
> free to send us a ping after a couple of weeks in the future if you've
> had no replies.

I forgot about this, too :-) I only sent it because the status quo
looked wrong to me and after sending the patch considered my duty done.

> >  lib/bb/fetch2/bzr.py | 3 ---
> >  1 file changed, 3 deletions(-)
> > 
> > diff --git a/lib/bb/fetch2/bzr.py b/lib/bb/fetch2/bzr.py
> > index fc558f50b047..443195fa00bc 100644
> > --- a/lib/bb/fetch2/bzr.py
> > +++ b/lib/bb/fetch2/bzr.py
> > @@ -35,9 +35,6 @@ class Bzr(FetchMethod):
> >  
> >          ud.setup_revisions(d)
> >  
> > -        if not ud.revision:
> > -            ud.revision = self.latest_revision(ud, d)
> > -
> 
> Looking at the git fetcher, this should probably be fixed to call
> self.latest_revision(ud, d, ud.name) instead.
> 
> Are you actually using the bzr fetcher? I'd like to propose deprecating
> it then removing it after the LTS release.

No I don't. I worked on the git fetcher (resulting in commits
ddf00d6aee955878c070327ee8d751fdb6099444 and
cb36e8a62d7d31b75b3ddc6b84c1bdee09ebbc60 in oe-core) and just looked
left and right while doing that.

So I'm unsure what to do next here. Given that I'm not using the bzr
fetcher (nor the hg one), is a patch adding `ud.name` to these callers
welcome and sensible?

Best regards
Uwe
diff mbox series

Patch

diff --git a/lib/bb/fetch2/bzr.py b/lib/bb/fetch2/bzr.py
index fc558f50b047..443195fa00bc 100644
--- a/lib/bb/fetch2/bzr.py
+++ b/lib/bb/fetch2/bzr.py
@@ -35,9 +35,6 @@  class Bzr(FetchMethod):
 
         ud.setup_revisions(d)
 
-        if not ud.revision:
-            ud.revision = self.latest_revision(ud, d)
-
         ud.localfile = d.expand('bzr_%s_%s_%s.tar.gz' % (ud.host, ud.path.replace('/', '.'), ud.revision))
 
     def _buildbzrcommand(self, ud, d, command):