* [PATCH] selftest/fetch: Avoid occasional selftest failure from poor temp file name choice
@ 2021-06-03 22:23 Richard Purdie
2021-06-04 22:30 ` [OE-core] " Christopher Larson
0 siblings, 1 reply; 2+ messages in thread
From: Richard Purdie @ 2021-06-03 22:23 UTC (permalink / raw)
To: openembedded-core
The temp file name may contain "_" characters. Avoid this to avoid errors like:
bb.data_smart.ExpansionError: Failure expanding variable PN, expression was
${@bb.parse.vars_from_file(d.getVar('FILE', False),d)[0] or 'defaultpkgname'}
which triggered exception ParseError:
ParseError in /tmp/tmpd_f2__to.bb: Unable to generate default variables from
filename (too many underscores)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
meta/lib/oeqa/selftest/cases/fetch.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/meta/lib/oeqa/selftest/cases/fetch.py b/meta/lib/oeqa/selftest/cases/fetch.py
index 67e85d3e4c7..1d223c0778f 100644
--- a/meta/lib/oeqa/selftest/cases/fetch.py
+++ b/meta/lib/oeqa/selftest/cases/fetch.py
@@ -57,6 +57,8 @@ MIRRORS_forcevariable = "git://.*/.* http://downloads.yoctoproject.org/mirror/so
class Dependencies(OESelftestTestCase):
def write_recipe(self, content):
f = tempfile.NamedTemporaryFile(mode="wt", suffix=".bb")
+ while "_" in f.name:
+ f = tempfile.NamedTemporaryFile(mode="wt", suffix=".bb")
f.write(content)
f.flush()
return f
--
2.30.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [OE-core] [PATCH] selftest/fetch: Avoid occasional selftest failure from poor temp file name choice
2021-06-03 22:23 [PATCH] selftest/fetch: Avoid occasional selftest failure from poor temp file name choice Richard Purdie
@ 2021-06-04 22:30 ` Christopher Larson
0 siblings, 0 replies; 2+ messages in thread
From: Christopher Larson @ 2021-06-04 22:30 UTC (permalink / raw)
To: Richard Purdie; +Cc: Patches and discussions about the oe-core layer
[-- Attachment #1: Type: text/plain, Size: 1660 bytes --]
Couldn't we also create a temporary directory and create a file with a
consistent name there, rather than retrying the named file approach?
On Thu, Jun 3, 2021 at 3:24 PM Richard Purdie <
richard.purdie@linuxfoundation.org> wrote:
> The temp file name may contain "_" characters. Avoid this to avoid errors
> like:
>
> bb.data_smart.ExpansionError: Failure expanding variable PN, expression was
> ${@bb.parse.vars_from_file(d.getVar('FILE', False),d)[0] or
> 'defaultpkgname'}
> which triggered exception ParseError:
> ParseError in /tmp/tmpd_f2__to.bb: Unable to generate default variables
> from
> filename (too many underscores)
>
> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
> ---
> meta/lib/oeqa/selftest/cases/fetch.py | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/meta/lib/oeqa/selftest/cases/fetch.py
> b/meta/lib/oeqa/selftest/cases/fetch.py
> index 67e85d3e4c7..1d223c0778f 100644
> --- a/meta/lib/oeqa/selftest/cases/fetch.py
> +++ b/meta/lib/oeqa/selftest/cases/fetch.py
> @@ -57,6 +57,8 @@ MIRRORS_forcevariable = "git://.*/.*
> http://downloads.yoctoproject.org/mirror/so
> class Dependencies(OESelftestTestCase):
> def write_recipe(self, content):
> f = tempfile.NamedTemporaryFile(mode="wt", suffix=".bb")
> + while "_" in f.name:
> + f = tempfile.NamedTemporaryFile(mode="wt", suffix=".bb")
> f.write(content)
> f.flush()
> return f
> --
> 2.30.2
>
>
>
>
>
--
Christopher Larson
kergoth at gmail dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Senior Software Engineer, Mentor Graphics
[-- Attachment #2: Type: text/html, Size: 2553 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-06-04 22:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-03 22:23 [PATCH] selftest/fetch: Avoid occasional selftest failure from poor temp file name choice Richard Purdie
2021-06-04 22:30 ` [OE-core] " Christopher Larson
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.