Re: [bitbake-devel] [PATCH 2/2] lib/bb: Further shell=True cleanups

Richard Purdie <[email protected]> Thu, 11 Jun 2026 15:26:14 +0100
Newsgroups org.openembedded.lists.bitbake-devel
Message-ID <3ed53ffdad2597c633e5664ae4f7752c12432362.camel@linuxfoundation.org>
On Thu, 2026-06-11 at 14:18 +0200, Anders Heimer wrote:
> On 6/11/26 13:05, Richard Purdie via lists.openembedded.org wrote:
> > @@ -186,12 +188,12 @@ class LocalhostBEController(BuildEnvironmentController):
> >               else:
> >                   if giturl in cached_layers:
> >                       logger.debug("localhostbecontroller git-copying %s to %s" % (cached_layers[giturl], localdirname))
> > -                    self._shellcmd("git clone \"%s\" \"%s\"" % (cached_layers[giturl], localdirname),env=git_env)
> > -                    self._shellcmd("git remote remove origin", localdirname,env=git_env)
> > -                    self._shellcmd("git remote add origin \"%s\"" % giturl, localdirname,env=git_env)
> > +                    self._shellcmd(['git', 'clone', cached_layers[giturl]], localdirname], env=git_env)
> One ] to much.

Thanks (and Quentin!). I'll tweak that.

> > diff --git a/lib/toaster/toastermain/settings.py b/lib/toaster/toastermain/settings.py
> > index d2a449627f8..9d2dbc464ec 100644
> > --- a/lib/toaster/toastermain/settings.py
> > +++ b/lib/toaster/toastermain/settings.py
> > @@ -229,8 +229,8 @@ from os.path import dirname as DN
> >   SITE_ROOT=DN(DN(os.path.abspath(__file__)))
> >   
> >   import subprocess
> > -TOASTER_BRANCH = subprocess.Popen('git branch | grep "^* " | tr -d "* "', cwd = SITE_ROOT, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()[0]
> > -TOASTER_REVISION = subprocess.Popen('git rev-parse HEAD ', cwd = SITE_ROOT, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()[0]
> > +TOASTER_BRANCH = subprocess.check_output(['git', 'branch', '--show-current'], cwd=SITE_ROOT, text=True).strip()
> If I am reading the correct doc version, the minimum Git version 
> supported is 1.8.3.1 while --show-current was added in 2.22.0.
> 

2.22 was released in June 2019 so at this point I think it is fine to
rely on that. Before I added that code, I did check which versions our
'supported' distros have and we're fine there. So we can update the
minimum version, I don't think it has changed in many years.

Cheers,

Richard