From: Saul Wold <sgw@linux.intel.com>
To: Constantin Musca <constantinx.musca@intel.com>
Cc: openembedded-core@lists.openembedded.org
Subject: Re: [PATCH] patch.bbclass: Use one TMPDIR per patching process
Date: Fri, 14 Sep 2012 09:00:59 -0700 [thread overview]
Message-ID: <505354BB.1010705@linux.intel.com> (raw)
In-Reply-To: <1347451098-16659-1-git-send-email-constantinx.musca@intel.com>
On 09/12/2012 04:58 AM, Constantin Musca wrote:
> We must use one TMPDIR per process (/tmp/${PID}) so that the patching
> processes don't generate the same temp file name (the "patch" program
> uses the TMPDIR environment variable for deciding where to create the
> temp files).
>
> [YOCTO #3070]
>
> Signed-off-by: Constantin Musca <constantinx.musca@intel.com>
> ---
> meta/classes/patch.bbclass | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/meta/classes/patch.bbclass b/meta/classes/patch.bbclass
> index a724972..d010438 100644
> --- a/meta/classes/patch.bbclass
> +++ b/meta/classes/patch.bbclass
> @@ -139,6 +139,13 @@ python patch_do_patch() {
> path = os.getenv('PATH')
> os.putenv('PATH', d.getVar('PATH', True))
>
> + import shutil
> + process_tmpdir = os.path.join('/tmp', str(os.getpid()))
> + if os.path.exists(process_tmpdir):
> + shutil.rmtree(process_tmpdir)
> + os.makedirs(process_tmpdir)
> + os.environ['TMPDIR'] = process_tmpdir
> +
> for patch in src_patches(d):
> _, _, local, _, _, parm = bb.decodeurl(patch)
> On 09/12/2012 04:58 AM, Constantin Musca wrote:> We must use one TMPDIR per process (/tmp/${PID}) so that the patching
> processes don't generate the same temp file name (the "patch" program
> uses the TMPDIR environment variable for deciding where to create the
> temp files).
>
> [YOCTO #3070]
>
> Signed-off-by: Constantin Musca <constantinx.musca@intel.com>
> ---
> meta/classes/patch.bbclass | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/meta/classes/patch.bbclass b/meta/classes/patch.bbclass
> index a724972..d010438 100644
> --- a/meta/classes/patch.bbclass
> +++ b/meta/classes/patch.bbclass
> @@ -139,6 +139,13 @@ python patch_do_patch() {
> path = os.getenv('PATH')
> os.putenv('PATH', d.getVar('PATH', True))
>
> + import shutil
> + process_tmpdir = os.path.join('/tmp', str(os.getpid()))
> + if os.path.exists(process_tmpdir):
> + shutil.rmtree(process_tmpdir)
> + os.makedirs(process_tmpdir)
> + os.environ['TMPDIR'] = process_tmpdir
> +
> for patch in src_patches(d):
> _, _, local, _, _, parm = bb.decodeurl(patch)
>
> @@ -161,11 +168,15 @@ python patch_do_patch() {
> try:
> patchset.Import({"file":local, "strippath": parm['striplevel']}, True)
> except Exception as exc:
> + shutil.rmtree(process_tmpdir)
> bb.fatal(str(exc))
> try:
> resolver.Resolve()
> except bb.BBHandledException as e:
> + shutil.rmtree(process_tmpdir)
> bb.fatal(str(e))
> +
> + shutil.rmtree(process_tmpdir)
> }
> patch_do_patch[vardepsexclude] = "PATCHRESOLVE"
>
>
This initial version was merged into OE-Core
Thanks
Sau!
> @@ -161,11 +168,15 @@ python patch_do_patch() {
> try:
> patchset.Import({"file":local, "strippath": parm['striplevel']}, True)
> except Exception as exc:
> + shutil.rmtree(process_tmpdir)
> bb.fatal(str(exc))
> try:
> resolver.Resolve()
> except bb.BBHandledException as e:
> + shutil.rmtree(process_tmpdir)
> bb.fatal(str(e))
> +
> + shutil.rmtree(process_tmpdir)
> }
> patch_do_patch[vardepsexclude] = "PATCHRESOLVE"
>
>
prev parent reply other threads:[~2012-09-14 16:13 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-12 11:58 [PATCH] patch.bbclass: Use one TMPDIR per patching process Constantin Musca
2012-09-14 11:28 ` Enrico Scholz
2012-09-14 11:50 ` Richard Purdie
2012-09-14 12:24 ` Enrico Scholz
2012-09-14 13:33 ` Richard Purdie
2012-09-14 13:40 ` Enrico Scholz
2012-09-14 16:00 ` Saul Wold [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=505354BB.1010705@linux.intel.com \
--to=sgw@linux.intel.com \
--cc=constantinx.musca@intel.com \
--cc=openembedded-core@lists.openembedded.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox