bitbake: fetch: Extend subdir unpack parameter to local folder
PATCH 1/1 bitbake: fetch: Extend subdir unpack parameter to local folder
From: Peter Liu <[email protected]>
This fixes urls of the form file://some/path/file;subdir=b. When the file is a folder.
--- lib/bb/fetch2/__init__.py | 2 ++ 1 file changed, 2 insertions(+)
lib/bb/fetch2/__init__.py +2 -0
@@ -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)
Signature · 1 line
1.9.1
Quoted 4 lines · Ming Liu
(quoted diff) +2
-0+ 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.
Signature · 5 lines
Christopher Larson clarson at kergoth dot com Founder - BitBake, OpenEmbedded, OpenZaurus Maintainer - Tslib Senior Software Engineer, Mentor Graphics
Quoted 7 lines · Christopher Larson
On Mon, Sep 28, 2015 at 6:11 AM, Ming Liu <[email protected]> wrote:
+ ifurldata.parm.get('subdir')!= None:
+ destdir =urldata.parm.get('subdir')
+ "/" + destdir
Quoted 5 lines
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 theparm.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
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 <
[email protected]>:
Quoted 25 lines · Christopher Larson
Quoted 7 lines
On Mon, Sep 28, 2015 at 6:11 AM, Ming Liu <[email protected]> wrote:
+ ifurldata.parm.get('subdir')!= None:
+ destdir =urldata.parm.get('subdir')
+ "/" + destdirQuoted 5 lines
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 theparm.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