Poky Project Discussions
 help / color / mirror / Atom feed
From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: Yu Ke <ke.yu@intel.com>
Cc: poky@yoctoproject.org
Subject: Re: [PATCH 2/8] git.py: move git specific url data initialization earlier
Date: Thu, 06 Jan 2011 11:02:48 +0000	[thread overview]
Message-ID: <1294311768.17519.24188.camel@rex> (raw)
In-Reply-To: <c9580df3dfe41b22e6cee32ac7c228197fcecd01.1293457442.git.ke.yu@intel.com>

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@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.

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



  reply	other threads:[~2011-01-06 11:03 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-27 13:57 [PATCH 0/8] RFC: break fetcher src rev deadlock Yu Ke
2010-12-27 13:57 ` [PATCH 1/8] Fetch: fix support-srcrev typo Yu Ke
2011-01-06 10:39   ` Richard Purdie
2010-12-27 13:57 ` [PATCH 2/8] git.py: move git specific url data initialization earlier Yu Ke
2011-01-06 11:02   ` Richard Purdie [this message]
2011-01-06 12:34     ` Yu Ke
2010-12-27 13:57 ` [PATCH 3/8] svn.py: move svn " Yu Ke
2010-12-27 13:57 ` [PATCH 4/8] hg.py: move hg " Yu Ke
2010-12-27 13:57 ` [PATCH 5/8] bzr.py: move bzr " Yu Ke
2010-12-27 13:58 ` [PATCH 6/8] recpies: use SRCPV instead of SRCREV for PV Yu Ke
2011-01-06 10:38   ` Richard Purdie
2010-12-27 13:58 ` [PATCH 7/8] Fetcher: break the "SRCREVINACTION" deadlock Yu Ke
2011-01-06 11:06   ` Richard Purdie
2011-01-06 11:56     ` Richard Purdie
2011-01-06 13:01       ` Yu Ke
2010-12-27 13:58 ` [PATCH 8/8] Fetcher: only set __BB_DONT_CACHE when SRCREV = "${AUTOREV}" Yu Ke
2011-01-05  2:30 ` [PATCH 0/8] RFC: break fetcher src rev deadlock Yu Ke
2011-01-05  2:33   ` Gary Thomas
2011-01-05  8:03     ` Koen Kooi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1294311768.17519.24188.camel@rex \
    --to=richard.purdie@linuxfoundation.org \
    --cc=ke.yu@intel.com \
    --cc=poky@yoctoproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox