* [OE-core] [PATCH] bitbake: fetch: Extend subdir unpack parameter to local folder @ 2015-09-28 13:11 Ming Liu 2015-10-03 18:35 ` Christopher Larson 0 siblings, 1 reply; 4+ messages in thread From: Ming Liu @ 2015-09-28 13:11 UTC (permalink / raw) To: bitbake-devel; +Cc: Peter Liu From: Peter Liu <peter.x.liu@external.atlascopco.com> This fixes urls of the form file://some/path/file;subdir=b. When the file is a folder. Signed-off-by: Peter Liu <peter.x.liu@external.atlascopco.com> --- lib/bb/fetch2/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/bb/fetch2/__init__.py b/lib/bb/fetch2/__init__.py index 288a1c8..3a425aa 100644 --- a/lib/bb/fetch2/__init__.py +++ b/lib/bb/fetch2/__init__.py @@ -1423,6 +1423,8 @@ class FetchMethod(object): if basepath and basepath.find("/") != -1: destdir = basepath[:basepath.rfind('/')] destdir = destdir.strip('/') + if urldata.parm.get('subdir') != None: + destdir = urldata.parm.get('subdir') + "/" + destdir if destdir != "." and not os.access("%s/%s" % (rootdir, destdir), os.F_OK): os.makedirs("%s/%s" % (rootdir, destdir)) cmd = 'cp -fpPR %s %s/%s/' % (file, rootdir, destdir) -- 1.9.1 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [OE-core] [PATCH] bitbake: fetch: Extend subdir unpack parameter to local folder 2015-09-28 13:11 [OE-core] [PATCH] bitbake: fetch: Extend subdir unpack parameter to local folder Ming Liu @ 2015-10-03 18:35 ` Christopher Larson 2015-10-05 8:07 ` Richard Purdie 0 siblings, 1 reply; 4+ messages in thread From: Christopher Larson @ 2015-10-03 18:35 UTC (permalink / raw) To: Ming Liu; +Cc: Peter Liu, bitbake-devel@lists.openembedded.org [-- Attachment #1: Type: text/plain, Size: 699 bytes --] On Mon, Sep 28, 2015 at 6:11 AM, Ming Liu <liu.ming50@gmail.com> wrote: > + if urldata.parm.get('subdir') != None: > + destdir = urldata.parm.get('subdir') + "/" + > destdir > If you really care about the difference between None and the empty string, then this should be 'is not None', not '!= None', but most likely you don't, in which case 'if urldata.parm.get('subdir')' is sufficient, and cleaner. Also you do the parm.get() twice, it may be better to store that in a variable. -- Christopher Larson clarson at kergoth dot com Founder - BitBake, OpenEmbedded, OpenZaurus Maintainer - Tslib Senior Software Engineer, Mentor Graphics [-- Attachment #2: Type: text/html, Size: 1167 bytes --] ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [OE-core] [PATCH] bitbake: fetch: Extend subdir unpack parameter to local folder 2015-10-03 18:35 ` Christopher Larson @ 2015-10-05 8:07 ` Richard Purdie 2015-11-13 18:24 ` Ming Liu 0 siblings, 1 reply; 4+ messages in thread From: Richard Purdie @ 2015-10-05 8:07 UTC (permalink / raw) To: Christopher Larson Cc: bitbake-devel@lists.openembedded.org, Peter Liu, Ming Liu On Sat, 2015-10-03 at 11:35 -0700, Christopher Larson wrote: > > On Mon, Sep 28, 2015 at 6:11 AM, Ming Liu <liu.ming50@gmail.com> > wrote: > + if urldata.parm.get('subdir') != None: > + destdir = urldata.parm.get('subdir') > + "/" + destdir > > If you really care about the difference between None and the empty > string, then this should be 'is not None', not '!= None', but most > likely you don't, in which case 'if urldata.parm.get('subdir')' is > sufficient, and cleaner. Also you do the parm.get() twice, it may be > better to store that in a variable. Chris is correct, this patch needs tweaking. This area of the code also keeps seeing various issues so I'd like to ask that we add a test case for this in lib/bb/tests/ so we can ensure this doesn't regress in the future please. Cheers, Richard ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [OE-core] [PATCH] bitbake: fetch: Extend subdir unpack parameter to local folder 2015-10-05 8:07 ` Richard Purdie @ 2015-11-13 18:24 ` Ming Liu 0 siblings, 0 replies; 4+ messages in thread From: Ming Liu @ 2015-11-13 18:24 UTC (permalink / raw) To: Richard Purdie Cc: bitbake-devel@lists.openembedded.org, Christopher Larson, Peter Liu [-- Attachment #1: Type: text/plain, Size: 1282 bytes --] Hi, Christopher, Richard: Thanks for the reviewing! And sorry to this delayed feedback, I was on a vacation. I had send another patch set which tweaked the code like Christopher suggested, and added a test case for it. the best, thank you 2015-10-05 10:07 GMT+02:00 Richard Purdie < richard.purdie@linuxfoundation.org>: > On Sat, 2015-10-03 at 11:35 -0700, Christopher Larson wrote: > > > > On Mon, Sep 28, 2015 at 6:11 AM, Ming Liu <liu.ming50@gmail.com> > > wrote: > > + if urldata.parm.get('subdir') != None: > > + destdir = urldata.parm.get('subdir') > > + "/" + destdir > > > > If you really care about the difference between None and the empty > > string, then this should be 'is not None', not '!= None', but most > > likely you don't, in which case 'if urldata.parm.get('subdir')' is > > sufficient, and cleaner. Also you do the parm.get() twice, it may be > > better to store that in a variable. > > Chris is correct, this patch needs tweaking. This area of the code also > keeps seeing various issues so I'd like to ask that we add a test case > for this in lib/bb/tests/ so we can ensure this doesn't regress in the > future please. > > Cheers, > > Richard > > > [-- Attachment #2: Type: text/html, Size: 1906 bytes --] ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-11-13 18:24 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2015-09-28 13:11 [OE-core] [PATCH] bitbake: fetch: Extend subdir unpack parameter to local folder Ming Liu 2015-10-03 18:35 ` Christopher Larson 2015-10-05 8:07 ` Richard Purdie 2015-11-13 18:24 ` Ming Liu
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.