From: Mike Looijmans <mike.looijmans@topic.nl>
To: Benjamin Esquivel <benjamin.esquivel@linux.intel.com>,
<openembedded-core@lists.openembedded.org>
Cc: paul.eggleton@linux.intel.com
Subject: Re: [PATCH V2] populate SDK: prepare calling of bb.utils for exceptions
Date: Mon, 19 Oct 2015 07:27:02 +0200 [thread overview]
Message-ID: <56247F26.1010101@topic.nl> (raw)
In-Reply-To: <1445032208-31789-1-git-send-email-benjamin.esquivel@linux.intel.com>
On 16-10-15 23:50, Benjamin Esquivel wrote:
> bb.utils.remove, bb.utils.movefile and bb.utils.mkdirhier can throw
> exceptions that need handling and proper error messages
> more work is required for these methods to handle properly the
> exceptions that can be raised within the various OS calls they make
> but this is a start to at least not hide the errors in the requested
> operations
>
> [YOCTO#8213]
>
> Signed-off-by: Benjamin Esquivel <benjamin.esquivel@linux.intel.com>
> ---
...
> + def movefile(self, sourcefile, destdir):
> + try:
> + # FIXME: this check of movefile's return code to None should be
> + # fixed within the function to use only exceptions to signal when
> + # something goes wrong
> + if (bb.utils.movefile(sourcefile, destdir) == None):
> + raise OSError("moving %s to %s failed"
> + %(sourcefile, destdir))
> + #FIXME: using umbrella exc catching because bb.utils method raises it
> + except Exception as e:
> + bb.debug(1, "printing the stack trace\n %s" %traceback.format_exc())
> + bb.error("unable to place %s in final SDK location" % sourcefile)
> +
> + def mkdirhier(self, dirpath):
> + try:
> + bb.utils.mkdirhier(dirpath)
> + except OSError as e:
> + bb.debug(1, "printing the stack trace\n %s" %traceback.format_exc())
> + bb.fatal("cannot make dir for SDK: %s" % dirpath)
> +
> + def remove(self, path, recurse=False):
> + try:
> + bb.utils.remove(path, recurse)
> + #FIXME: using umbrella exc catching because bb.utils method raises it
> + except Exception as e:
> + bb.debug(1, "printing the stack trace\n %s" %traceback.format_exc())
> + bb.warn("cannot remove SDK dir: %s" % path)
All these methods have a "self" in their argument list, but don't use it. Make
them static functions (inside or outside the class, that's your call. I'd put
them outside, they're totally unrelated).
Kind regards,
Mike Looijmans
System Expert
TOPIC Embedded Products
Eindhovenseweg 32-C, NL-5683 KH Best
Postbus 440, NL-5680 AK Best
Telefoon: +31 (0) 499 33 69 79
Telefax: +31 (0) 499 33 69 70
E-mail: mike.looijmans@topicproducts.com
Website: www.topicproducts.com
Please consider the environment before printing this e-mail
Visit us at : Aerospace Electrical Systems Expo Europe which will be held from 17.11.2015 till 19.11.2015, Findorffstra�e 101 Bremen, Germany, Hall 5, stand number C65
http://www.aesexpo.eu
next prev parent reply other threads:[~2015-10-19 5:27 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-15 17:27 [PATCH] populate SDK: prepare calling of bb.utils for exceptions Benjamin Esquivel
2015-10-16 2:15 ` Christopher Larson
2015-10-16 20:28 ` Benjamin Esquivel
2015-10-16 21:50 ` [PATCH V2] " Benjamin Esquivel
2015-10-19 5:27 ` Mike Looijmans [this message]
2015-10-19 15:28 ` [PATCH V3] " Benjamin Esquivel
2015-10-16 7:00 ` [PATCH] " Mike Looijmans
2015-10-16 20:27 ` Benjamin Esquivel
2015-10-16 10:01 ` Richard Purdie
2015-10-16 20:18 ` Benjamin Esquivel
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=56247F26.1010101@topic.nl \
--to=mike.looijmans@topic.nl \
--cc=benjamin.esquivel@linux.intel.com \
--cc=openembedded-core@lists.openembedded.org \
--cc=paul.eggleton@linux.intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox