All of lore.kernel.org
 help / color / mirror / Atom feed
From: Beth 'pidge' Flanagan <pidge@toganlabs.com>
To: Richard Purdie <richard.purdie@linuxfoundation.org>,
	 bitbake-devel@lists.openembedded.org
Subject: Re: [PATCH] s3.py: Add support for fetching source mirrors/minor cleanup
Date: Tue, 28 Mar 2017 15:31:31 +0200	[thread overview]
Message-ID: <1490707891.16596.12.camel@toganlabs.com> (raw)
In-Reply-To: <1490707286.13980.280.camel@linuxfoundation.org>

On Tue, 2017-03-28 at 14:21 +0100, Richard Purdie wrote:
> On Tue, 2017-03-28 at 15:05 +0200, Beth 'pidge' Flanagan wrote:
> > 
> > On Tue, 2017-03-28 at 13:56 +0100, Richard Purdie wrote:
> > > 
> > > 
> > > On Tue, 2017-03-28 at 13:39 +0200, Elizabeth 'pidge' Flanagan
> > > wrote:
> > > > 
> > > > 
> > > > 
> > > > This commits main purpose is to add support for fetching source
> > > > mirrors. In the current incarnation:
> > > > 
> > > > SOURCE_MIRROR_URL ?= "s3://mybucket/downloads"
> > > > 
> > > > will fail for two reasons. First, download doesn't support it,
> > > > but second, without aws included in HOSTTOOLS you'll end up
> > > > with aws not being found by bitbake (for either source mirrors
> > > > or
> > > > sstate mirrors).
> > > > 
> > > > Part of this is fixed with this commit. However, this will
> > > > still
> > > > fail if HOSTTOOLS doesn't include 'aws' in bitbake.conf. I've
> > > > another
> > > > commit or two to fix that as well.
> > > > 
> > > > I've also DRYed up some of the error handling, removed the
> > > > hardcoded
> > > > aws and added some logging.
> > > > 
> > > > Signed-off-by: Elizabeth 'pidge' Flanagan <pidge@toganlabs.com>
> > > > ---
> > > >  lib/bb/fetch2/s3.py | 20 ++++++++++++++------
> > > >  1 file changed, 14 insertions(+), 6 deletions(-)
> > > > 
> > > > diff --git a/lib/bb/fetch2/s3.py b/lib/bb/fetch2/s3.py
> > > > index 27993aa..dbd86f4 100644
> > > > --- a/lib/bb/fetch2/s3.py
> > > > +++ b/lib/bb/fetch2/s3.py
> > > > @@ -34,6 +34,7 @@ import urllib.request, urllib.parse,
> > > > urllib.error
> > > >  from bb.fetch2 import FetchMethod
> > > >  from bb.fetch2 import FetchError
> > > >  from bb.fetch2 import runfetchcmd
> > > > +from bb.fetch2 import logger
> > > >  
> > > >  class S3(FetchMethod):
> > > >      """Class to fetch urls via 'aws s3'"""
> > > > @@ -60,8 +61,13 @@ class S3(FetchMethod):
> > > >          Fetch urls
> > > >          Assumes localpath was called first
> > > >          """
> > > > -
> > > > -        cmd = 'aws s3 cp s3://%s%s %s' % (ud.host, ud.path,
> > > > ud.localpath)
> > > > +        if 'downloadfilename' in ud.parm:
> > > > +            dldir = d.getVar("DL_DIR", True)
> > > > +            bb.utils.mkdirhier(os.path.dirname(dldir + os.sep
> > > > +
> > > > ud.localfile))
> > > > +            cmd = '%s cp s3://%s%s %s%s%s' %
> > > > (d.getVar("FETCHCMD_s3"), ud.host, ud.path, dldir, os.sep,
> > > > ud.localpath)
> > > > +        else:
> > > > +            cmd = '%s cp s3://%s%s %s' %
> > > > (d.getVar("FETCHCMD_s3"),
> > > > ud.host, ud.path, ud.localpath)
> > > > +        logger.debug(2, "Fetching %s using command '%s'" %
> > > > (ud.url,
> > > > cmd))
> > > Do you actually need/use FETCHCMD_s3 ?
> > > 
> > I use it so I can rip out aws-cli and use s3cmd.
> Ok. The way this needs to work then is that in __init__, you set a
> default command and then if d.getVar("FETCHCMD_s3") is set, overwrite
> it. This is so that the fetcher works without having to FETCHCMD_s3
> (in
> common with all the other fetchers. You'd then use ud.cmd instead of
> all the getVars.
> 

Ah, ok. v2 incoming in a bit.

> Cheers,
> Richard


      reply	other threads:[~2017-03-28 13:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-28 11:39 [PATCH] s3.py: Add support for fetching source mirrors/minor cleanup Elizabeth 'pidge' Flanagan
2017-03-28 12:56 ` Richard Purdie
2017-03-28 13:05   ` Beth 'pidge' Flanagan
2017-03-28 13:21     ` Richard Purdie
2017-03-28 13:31       ` Beth 'pidge' Flanagan [this message]

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=1490707891.16596.12.camel@toganlabs.com \
    --to=pidge@toganlabs.com \
    --cc=bitbake-devel@lists.openembedded.org \
    --cc=richard.purdie@linuxfoundation.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 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.