Patchwork [bitbake-devel] parse: get_file_depends(): return deterministic result

login
register
mail settings
Submitter Enrico Scholz
Date May 20, 2012, 3:20 p.m.
Message ID <1337527217-5550-1-git-send-email-enrico.scholz@sigma-chemnitz.de>
Download mbox | patch
Permalink /patch/28009/
State New
Headers show

Comments

Enrico Scholz - May 20, 2012, 3:20 p.m.
The output of get_file_depends() concatenates elements of a set.  Result
of this operation is not deterministic because it is calculated by
parallel running parsing threads.

Because result of get_file_depends() is stored into BBINCLUDED which
goes in into various hash calculations, this can cause unwanted rebuilds
of cache or recipes.

Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
---
 lib/bb/parse/__init__.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Richard Purdie - May 23, 2012, 10:27 a.m.
On Sun, 2012-05-20 at 17:20 +0200, Enrico Scholz wrote:
> The output of get_file_depends() concatenates elements of a set.  Result
> of this operation is not deterministic because it is calculated by
> parallel running parsing threads.
> 
> Because result of get_file_depends() is stored into BBINCLUDED which
> goes in into various hash calculations, this can cause unwanted rebuilds
> of cache or recipes.
> 
> Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
> ---
>  lib/bb/parse/__init__.py |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/lib/bb/parse/__init__.py b/lib/bb/parse/__init__.py
> index 7b9c47e..1e69778 100644
> --- a/lib/bb/parse/__init__.py
> +++ b/lib/bb/parse/__init__.py
> @@ -138,6 +138,6 @@ def get_file_depends(d):
>      depends = depends.union(d.getVar('__base_depends', True) or set())
>      for (fn, _) in depends:
>          dep_files.append(os.path.abspath(fn))
> -    return " ".join(dep_files)
> +    return " ".join(sorted(dep_files))
>  
>  from bb.parse.parse_py import __version__, ConfHandler, BBHandler

I've commented before on this list about the problems in this variable.
We need to fix this problem so the list is both correctly ordered and
that the order is maintained.

I'm therefore reluctant to take this patch and would like one that fixes
all the issues properly once and for all.

Cheers,

Richard

Patch

diff --git a/lib/bb/parse/__init__.py b/lib/bb/parse/__init__.py
index 7b9c47e..1e69778 100644
--- a/lib/bb/parse/__init__.py
+++ b/lib/bb/parse/__init__.py
@@ -138,6 +138,6 @@  def get_file_depends(d):
     depends = depends.union(d.getVar('__base_depends', True) or set())
     for (fn, _) in depends:
         dep_files.append(os.path.abspath(fn))
-    return " ".join(dep_files)
+    return " ".join(sorted(dep_files))
 
 from bb.parse.parse_py import __version__, ConfHandler, BBHandler