[bitbake-devel] [PATCH 1/1] fetch2: remove "." in the end

Mark Hatle mark.hatle at windriver.com
Mon Jun 27 18:19:46 UTC 2016


Based on some feedback on IRC.  I tried to move this into the git.py
'urldata_init' function.

This was pretty simple and appeared to work on the surface.  I then added a test
case to the fetch.py test cases.  At which point I can not reconcile the work.

In the test harness, around line 296 -- 'def test_uri', the system compares the
input URI, to the generated URI, i.e.:

        "git://example.net/path/example/": {
            'uri': 'git://example.net/path/example',
            'scheme': 'git',
            ...

The URI function and the fetch processing run two different paths.  Since the
URI class has no concept of special processing, the 'uri' it ends up with is
always "git://example.net/path/example/".  However, the fetchers processing,
after stripping the trailing '/' from the ud.path and then reconstructing the
URI ends up with "git://example.net/path/example".  And a test case failure I
can't get around.

So I have a couple of questions:

1) Why do we have both a URI and encodeurl/decodeurl set of functions?  It seems
like we have multiple ways of getting exactly the same data.

2) Is there a flaw in this test harness, that it verifies that element 1 and
element 2:uri always have to match?

The commit that highlights this issue is available as:

http://git.yoctoproject.org/cgit/cgit.cgi/poky-contrib/commit/?h=mgh/bitbake-git&id=5e45f3dea413f5b95fd8a872d48b72c11df15680

--Mark

On 6/24/16 2:55 AM, Robert Yang wrote:
> From: Jason Wessel <jason.wessel at windriver.com>
> 
> The filename can't be "foo." for MS Windows filesystem, it will renamed
> to "foo" automatically, so we can't upload sources like "foo." to the
> Windows server, remove "." in the end will fix the problem.
> 
> Signed-off-by: Jason Wessel <jason.wessel at windriver.com>
> Signed-off-by: Robert Yang <liezhi.yang at windriver.com>
> ---
>  bitbake/lib/bb/fetch2/__init__.py | 2 ++
>  bitbake/lib/bb/fetch2/git.py      | 2 ++
>  2 files changed, 4 insertions(+)
> 
> diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
> index b6fcaaa..1633c81 100644
> --- a/bitbake/lib/bb/fetch2/__init__.py
> +++ b/bitbake/lib/bb/fetch2/__init__.py
> @@ -865,6 +865,8 @@ def build_mirroruris(origud, mirrors, ld):
>      replacements["PATH"] = origud.path
>      replacements["BASENAME"] = origud.path.split("/")[-1]
>      replacements["MIRRORNAME"] = origud.host.replace(':','.') + origud.path.replace('/', '.').replace('*', '.')
> +    if replacements["MIRRORNAME"].endswith('.'):
> +        replacements["MIRRORNAME"] = replacements["MIRRORNAME"][:-1]
>  
>      def adduri(ud, uris, uds, mirrors):
>          for line in mirrors:
> diff --git a/bitbake/lib/bb/fetch2/git.py b/bitbake/lib/bb/fetch2/git.py
> index 59827e3..e669efc 100644
> --- a/bitbake/lib/bb/fetch2/git.py
> +++ b/bitbake/lib/bb/fetch2/git.py
> @@ -142,6 +142,8 @@ class Git(FetchMethod):
>          gitsrcname = '%s%s' % (ud.host.replace(':', '.'), ud.path.replace('/', '.').replace('*', '.'))
>          if gitsrcname.startswith('.'):
>              gitsrcname = gitsrcname[1:]
> +        if gitsrcname.endswith('.'):
> +            gitsrcname = gitsrcname[:-1]
>  
>          # for rebaseable git repo, it is necessary to keep mirror tar ball
>          # per revision, so that even the revision disappears from the
> 




More information about the bitbake-devel mailing list