All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: Joe MacDonald <joe.macdonald@windriver.com>
Cc: bitbake-devel@lists.openembedded.org
Subject: Re: [bitbake][oe-core][RFC PATCH 1/2] fetch2: Add an extra check for sstate_mirrors
Date: Fri, 28 Jun 2013 17:56:35 +0100	[thread overview]
Message-ID: <1372438595.9930.274.camel@ted> (raw)
In-Reply-To: <1372431907-10142-2-git-send-email-joe.macdonald@windriver.com>

On Fri, 2013-06-28 at 11:05 -0400, Joe MacDonald wrote:
> BB_NO_NETWORK disables any fetching, however if we're using an external
> sstate cache, we may want to be able to fetch those objects even if we are
> not fetching the upstream sources.
> 
> Signed-off-by: Joe MacDonald <joe.macdonald@windriver.com>
> ---
>  bitbake/lib/bb/fetch2/__init__.py |   18 +++++++++++++-----
>  1 file changed, 13 insertions(+), 5 deletions(-)


Bitbake's fetch module knows nothing about sstate right now and I don't
see any reason to teach it about it. Why can't you just change
BB_NO_NETWORK in sstate.bbclass before we call into the fetcher?

Cheers,

Richard

> diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
> index 6211cd7..edd290b3 100644
> --- a/bitbake/lib/bb/fetch2/__init__.py
> +++ b/bitbake/lib/bb/fetch2/__init__.py
> @@ -714,10 +714,13 @@ def check_network_access(d, info = "", url = None):
>      """
>      log remote network access, and error if BB_NO_NETWORK is set
>      """
> -    if d.getVar("BB_NO_NETWORK", True) == "1":
> -        raise NetworkAccess(url, info)
> +    if d.getVar("SSTATE_MIRROR_ALLOW_NETWORK", True) == "1" and d.getVar("LOCAL_SSTATE_CACHE", True) == True:
> +        logger.debug(1, "Fetcher accessed the network for sstate cache data with the command %s" % info)
>      else:
> -        logger.debug(1, "Fetcher accessed the network with the command %s" % info)
> +        if d.getVar("BB_NO_NETWORK", True) == "1":
> +            raise NetworkAccess(url, info)
> +        else:
> +            logger.debug(1, "Fetcher accessed the network with the command %s" % info)
>  
>  def build_mirroruris(origud, mirrors, ld):
>      uris = []
> @@ -1301,7 +1304,7 @@ class FetchMethod(object):
>          return "%s-%s" % (key, d.getVar("PN", True) or "")
>  
>  class Fetch(object):
> -    def __init__(self, urls, d, cache = True, localonly = False):
> +    def __init__(self, urls, d, cache = True, localonly = False, sstate_cache = False):
>          if localonly and cache:
>              raise Exception("bb.fetch2.Fetch.__init__: cannot set cache and localonly at same time")
>  
> @@ -1310,6 +1313,8 @@ class Fetch(object):
>          self.urls = urls
>          self.d = d
>          self.ud = {}
> +        self.sstate_cache = sstate_cache
> +        d.setVar("LOCAL_SSTATE_CACHE", sstate_cache)
>  
>          fn = d.getVar('FILE', True)
>          if cache and fn and fn in urldata_cache:
> @@ -1354,7 +1359,10 @@ class Fetch(object):
>          if len(urls) == 0:
>              urls = self.urls
>  
> -        network = self.d.getVar("BB_NO_NETWORK", True)
> +        if self.sstate_cache == True and self.d.getVar("SSTATE_MIRROR_ALLOW_NETWORK", True) == True:
> +            network = True
> +        else:
> +            network = self.d.getVar("BB_NO_NETWORK", True)
>          premirroronly = (self.d.getVar("BB_FETCH_PREMIRRORONLY", True) == "1")
>  
>          for u in urls:




  reply	other threads:[~2013-06-28 16:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-28 15:05 [RFC PATCH] Allow remote sstate cache fetches when BB_NO_NETWORK set Joe MacDonald
2013-06-28 15:05 ` [bitbake][oe-core][RFC PATCH 1/2] fetch2: Add an extra check for sstate_mirrors Joe MacDonald
2013-06-28 16:56   ` Richard Purdie [this message]
2013-06-28 17:00     ` Mark Hatle
2013-06-28 17:04       ` Richard Purdie
2013-06-28 19:19         ` Joe MacDonald
2013-06-28 15:05 ` [bitbake][oe-core][RFC PATCH 2/2] sstate.bbclass: " Joe MacDonald

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=1372438595.9930.274.camel@ted \
    --to=richard.purdie@linuxfoundation.org \
    --cc=bitbake-devel@lists.openembedded.org \
    --cc=joe.macdonald@windriver.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.