[bitbake-devel] [PATCH] fetch/git: Change to use clearer ssh url syntax for broken servers
Andre McCurdy
armccurdy at gmail.com
Wed Jan 13 21:37:36 UTC 2016
On Thu, Jan 7, 2016 at 5:18 AM, Richard Purdie
<richard.purdie at linuxfoundation.org> wrote:
> Some servers, e.g. bitbucket.org can't cope with ssh:// as part of
> the git url syntax. git itself is happy enough with this but you
> get server side errors when using it.
>
> This changes the git fetcher to use the more common ssh url format
> which also means we need a : before the path.
This seems to break SRC_URIs using ssh to access self hosted git
servers setup following the process described here:
https://git-scm.com/book/en/v2/Git-on-the-Server-Setting-Up-the-Server
An example of such a SRC_URI, which now fails to work:
SRC_URI = "git://git@mylocalserver.com:/opt/git/myrepo.git;protocol=ssh"
----
Looking at the original #8864 bug report, the problem seems to be that
the SRC_URI used to access BitBucket contains a ':' where it should
contain a '/'. ie
SRC_URI = "git://git@bitbucket.org:<username>/<repository>.git;protocol=ssh"
should be:
SRC_URI = "git://git@bitbucket.org/<username>/<repository>.git;protocol=ssh"
which is a format which works fine for both BitBucket and GitHub.
(Unfortunately the BitBucket website does provide copy and paste repo
URLs containing the ':' which work OK from the command line but need
to have the ':' manually replaced with a '/' for use in a SRC_URI).
> Seems a shame to have to do this due to broken servers however
> it should be safe enough since this other form is the one most people
> use on the commandline so it should be safe enough.
>
> [YOCTO #8864]
>
> Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
>
> diff --git a/bitbake/lib/bb/fetch2/git.py b/bitbake/lib/bb/fetch2/git.py
> index 5ffab22..10ba1d3 100644
> --- a/bitbake/lib/bb/fetch2/git.py
> +++ b/bitbake/lib/bb/fetch2/git.py
> @@ -330,6 +330,10 @@ class Git(FetchMethod):
> username = ud.user + '@'
> else:
> username = ""
> + if ud.proto == "ssh":
> + # Some servers, e.g. bitbucket.org can't cope with ssh://
> + # and removing that means we need a : before path.
> + return "%s%s:%s" % (username, ud.host, ud.path)
> return "%s://%s%s%s" % (ud.proto, username, ud.host, ud.path)
>
> def _revision_key(self, ud, d, name):
>
>
> --
> _______________________________________________
> bitbake-devel mailing list
> bitbake-devel at lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/bitbake-devel
More information about the bitbake-devel
mailing list