[poky] [PATCH 2/8] git.py: move git specific url data initialization earlier

Yu Ke ke.yu at intel.com
Thu Jan 6 04:34:37 PST 2011


On Jan 06, 11:02, Richard Purdie wrote:
> On Mon, 2010-12-27 at 21:57 +0800, Yu Ke wrote:
> > move the url data init earlier, so that Git.latest_revision()
> > can work before Git.localpath()
> > 
> > This change allow FetchData:__init__ to set FetchData.revison by
> > Git.latest_revision()
> > 
> > Signed-off-by: Yu Ke <ke.yu at intel.com>
> > ---
> >  bitbake/lib/bb/fetch/git.py |   19 ++++++++++++++-----
> >  1 files changed, 14 insertions(+), 5 deletions(-)
> > 
> > diff --git a/bitbake/lib/bb/fetch/git.py b/bitbake/lib/bb/fetch/git.py
> > index a8ec104..df582a3 100644
> > --- a/bitbake/lib/bb/fetch/git.py
> > +++ b/bitbake/lib/bb/fetch/git.py
> > @@ -38,10 +38,17 @@ class Git(Fetch):
> >          """
> >          Check to see if a given url can be fetched with git.
> >          """
> > -        return ud.type in ['git']
> > -
> > -    def localpath(self, url, ud, d):
> > +        if ud.type in ['git']:
> > +            self.urldata_init(ud, d)
> > +            return True
> > +        else:
> > +            return False
> >  
> > +    def urldata_init(self, ud, d):
> > +        """
> > +        init git specific variable within url data
> > +        so that the git method like latest_revision() can work
> > +        """
> >          if 'protocol' in ud.parm:
> 
> I like the idea of having a urldata_init method but I don't like the way
> you're calling it from supports(). Each methods need to do one thing
> clearly and well.
> 
> Your patch does help clean things up and this is good but I'd just
> suggest you call urldata_init() from the fetcher __init__.py code
> alongside any supports() calls for now. This way, the supports() method
> remains 'clean'. You can make it so you only call the urldata_init()
> method if its present.

Yes, calling from supports() is not good. I will revise it to calling seperately from FetchData:__init__()

Regards
Ke

> 
> Ultimately, what needs to happen in the fetcher is to split the
> mechanics of fetching out from the actual urldata object. The code has
> been heading in that direction but python class usage isn't one of my
> better skills and I need to spend time I'm struggling to find working
> out what needs to happen there :(.
> 
> Cheers,
> 
> Richard
> 
> _______________________________________________
> poky mailing list
> poky at yoctoproject.org
> https://lists.yoctoproject.org/listinfo/poky



More information about the poky mailing list