[bitbake-devel] [bitbake-devel, 1.42, 1.40, v2] git.py: Handle space in git repo name for http/https protocol

Ankur Tyagi ankur.tyagi85 at gmail.com
Mon Jul 8 23:50:44 UTC 2019


On Tue, Jul 9, 2019 at 11:01 AM Mark Hatle <mark.hatle at windriver.com> wrote:
>
> On 7/8/19 4:12 PM, Ankur Tyagi wrote:
> > We are using TFS in our company and within TFS we have different
> > project names that can have spaces.
> > With new version of TFS, git repo can also be created inside it and
> > the path of those repo also includes the project name that can have
> > space.
>
> Yes, spaces are valid.  I don't dispute that.. but however are you entering them?

I am entering the url in SRC_URI with %20 in place of space

> > Hence the SRC_URI will have a space and that's when I started seeing errors.
>
>
> SRC_URI = "https://foo.com/bar foobar bar"

In my case, it is SRC_URI = "https://foo.com/bar%20foobar%20bar"

> That will result in -three- entries:
>
> https://foo.com/bar
> foobar
> bar
>
> The later two are invalid, because SRC_URI is split on whitespace (spaces and tabs.)
>
> So what I don't understand is how are spaces being entered into the SRC_URI
> (other then with %20) unless they are coming in via gitsm?

Then during the fetch task, git clone command looks like this
"git clone https://foo.com/bar foobar bar" which results in errors

That's why I am trying to insert "%20" back

Regards
Ankur
>
> --Mark
>
> > Hope it answers your question
> >
> > regards
> > Ankur
> >
> > On Tue, Jul 9, 2019 at 6:28 AM Mark Hatle <mark.hatle at windriver.com> wrote:
> >>
> >> How is a space being added?  I'm a bit confused by this.  Is it due to the gitsm
> >> fetching?  or has someone figured out a way in SRC_URI to included spaces?
> >>
> >> If it's only in the gitsm fetching, then maybe we need to do the conversion
> >> there instead.
> >>
> >> --Mark
> >>
> >> On 7/3/19 11:46 PM, Ankur Tyagi wrote:
> >>> Signed-off-by: Ankur Tyagi <ankur.tyagi85 at gmail.com>
> >>> ---
> >>>  lib/bb/fetch2/git.py | 3 +++
> >>>  1 file changed, 3 insertions(+)
> >>>
> >>> diff --git a/lib/bb/fetch2/git.py b/lib/bb/fetch2/git.py
> >>> index 59a2ee8f..a8fcc2bf 100644
> >>> --- a/lib/bb/fetch2/git.py
> >>> +++ b/lib/bb/fetch2/git.py
> >>> @@ -156,6 +156,9 @@ class Git(FetchMethod):
> >>>          if not ud.proto in ('git', 'file', 'ssh', 'http', 'https', 'rsync'):
> >>>              raise bb.fetch2.ParameterError("Invalid protocol type", ud.url)
> >>>
> >>> +        if ud.proto in ('http', 'https'):
> >>> +            ud.path = ud.path.replace(" ", "%20")
> >>> +
> >>>          ud.nocheckout = ud.parm.get("nocheckout","0") == "1"
> >>>
> >>>          ud.rebaseable = ud.parm.get("rebaseable","0") == "1"
> >>>
> >>
>


More information about the bitbake-devel mailing list