[bitbake-devel] [PATCH v2 3/3] fetch2/git: provide information about missing sources

Christopher Larson kergoth at gmail.com
Wed Nov 14 21:23:38 UTC 2018


On Mon, Oct 8, 2018 at 2:48 AM Urs Fässler <urs.fassler at bbv.ch> wrote:

> Provide more information in the case the sources are not found in the
> unpack step.
>
> Signed-off-by: Urs Fässler <urs.fassler at bbv.ch>
> Signed-off-by: Pascal Bach <pascal.bach at siemens.com>
> ---
>  lib/bb/fetch2/git.py  | 29 +++++++++++++++++++++--------
>  lib/bb/tests/fetch.py |  2 ++
>  2 files changed, 23 insertions(+), 8 deletions(-)
>
> diff --git a/lib/bb/fetch2/git.py b/lib/bb/fetch2/git.py
> index 51259df9..15858a62 100644
> --- a/lib/bb/fetch2/git.py
> +++ b/lib/bb/fetch2/git.py
> @@ -476,14 +476,27 @@ class Git(FetchMethod):
>          if os.path.exists(destdir):
>              bb.utils.prunedir(destdir)
>
> -        clonedir_is_up_to_date = not self.clonedir_need_update(ud, d)
> -        if clonedir_is_up_to_date:
> -            runfetchcmd("%s clone %s %s/ %s" % (ud.basecmd,
> ud.cloneflags, ud.clonedir, destdir), d)
> -        elif ud.shallow and os.path.exists(ud.fullshallow):
> -            bb.utils.mkdirhier(destdir)
> -            runfetchcmd("tar -xzf %s" % ud.fullshallow, d,
> workdir=destdir)
> -        else:
> -            raise bb.fetch2.UnpackError("No up to date source found",
> ud.url)
> +        source_found = False
> +        source_error = []
> +
> +        if not source_found:
> +            clonedir_is_up_to_date = not self.clonedir_need_update(ud, d)
> +            if clonedir_is_up_to_date:
> +                runfetchcmd("%s clone %s %s/ %s" % (ud.basecmd,
> ud.cloneflags, ud.clonedir, destdir), d)
> +                source_found = True
> +            else:
> +                source_error.append("clone directory not available or not
> up to date: " + ud.clonedir)
> +
> +        if not source_found:
> +            if ud.shallow and os.path.exists(ud.fullshallow):
> +                bb.utils.mkdirhier(destdir)
> +                runfetchcmd("tar -xzf %s" % ud.fullshallow, d,
> workdir=destdir)
> +                source_found = True
> +            else:
> +                source_error.append("shallow clone not enabled or not
> available: " + ud.fullshallow)
>

This logic is flawed. In the case where the source hasn’t been found and
ud.shallow is false, as shallow is disabled, the else clause tries to
access ud.fullshallow, which isn’t an existing attribute:

Exception: AttributeError: 'FetchData' object has no attribute 'fullshallow'
-- 
Christopher Larson
kergoth at gmail dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Senior Software Engineer, Mentor Graphics
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openembedded.org/pipermail/bitbake-devel/attachments/20181114/d4b0ba66/attachment.html>


More information about the bitbake-devel mailing list