| Submitter | Andrei Gherzan |
|---|---|
| Date | April 3, 2012, 11:05 a.m. |
| Message ID | <1333451148-32709-1-git-send-email-andrei@gherzan.ro> |
| Download | mbox | patch |
| Permalink | /patch/25101/ |
| State | Accepted |
| Commit | fa51fe19a1dc1ddc4c9ec879a782953fd6a15117 |
| Headers | show |
Comments
On 04/03/2012 04:05 AM, Andrei Gherzan wrote: > A cleaner way to check if copyfile suceeded is to use os.path.isfile. > In this way we can omit warns in some python versions where copyfile > return the same non-0 value even is this action is successfull. > > Signed-off-by: Andrei Gherzan<andrei@gherzan.ro> > --- > meta/classes/license.bbclass | 5 +++-- > 1 files changed, 3 insertions(+), 2 deletions(-) > > diff --git a/meta/classes/license.bbclass b/meta/classes/license.bbclass > index c85233c..6c4a673 100644 > --- a/meta/classes/license.bbclass > +++ b/meta/classes/license.bbclass > @@ -215,9 +215,10 @@ python do_populate_lic() { > if spdx_generic and license_source: > # we really should copy to generic_ + spdx_generic, however, that ends up messing the manifest > # audit up. This should be fixed in emit_pkgdata (or, we actually got and fix all the recipes) > - ret = bb.copyfile(os.path.join(license_source, spdx_generic), os.path.join(os.path.join(d.getVar('LICSSTATEDIR', True), pn), "generic_" + license_type)) > + > + bb.copyfile(os.path.join(license_source, spdx_generic), os.path.join(os.path.join(d.getVar('LICSSTATEDIR', True), pn), "generic_" + license_type)) > + if not os.path.isfile(os.path.join(os.path.join(d.getVar('LICSSTATEDIR', True), pn), "generic_" + license_type)): > # If the copy didn't occur, something horrible went wrong and we fail out > - if not ret: > bb.warn("%s for %s could not be copied for some reason. It may not exist. WARN for now." % (spdx_generic, pn)) > else: > # And here is where we warn people that their licenses are lousy Merged into OE-Core Thanks Sau!
Patch
diff --git a/meta/classes/license.bbclass b/meta/classes/license.bbclass index c85233c..6c4a673 100644 --- a/meta/classes/license.bbclass +++ b/meta/classes/license.bbclass @@ -215,9 +215,10 @@ python do_populate_lic() { if spdx_generic and license_source: # we really should copy to generic_ + spdx_generic, however, that ends up messing the manifest # audit up. This should be fixed in emit_pkgdata (or, we actually got and fix all the recipes) - ret = bb.copyfile(os.path.join(license_source, spdx_generic), os.path.join(os.path.join(d.getVar('LICSSTATEDIR', True), pn), "generic_" + license_type)) + + bb.copyfile(os.path.join(license_source, spdx_generic), os.path.join(os.path.join(d.getVar('LICSSTATEDIR', True), pn), "generic_" + license_type)) + if not os.path.isfile(os.path.join(os.path.join(d.getVar('LICSSTATEDIR', True), pn), "generic_" + license_type)): # If the copy didn't occur, something horrible went wrong and we fail out - if not ret: bb.warn("%s for %s could not be copied for some reason. It may not exist. WARN for now." % (spdx_generic, pn)) else: # And here is where we warn people that their licenses are lousy
A cleaner way to check if copyfile suceeded is to use os.path.isfile. In this way we can omit warns in some python versions where copyfile return the same non-0 value even is this action is successfull. Signed-off-by: Andrei Gherzan <andrei@gherzan.ro> --- meta/classes/license.bbclass | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)