[OE-core] [PATCH 2/2] sstatetests: limit the number of signature comparisons when differ

Leonardo Sandoval leonardo.sandoval.gonzalez at linux.intel.com
Mon Aug 7 17:06:12 UTC 2017


On Mon, 2017-08-07 at 17:32 +0100, Burton, Ross wrote:
> On 4 August 2017 at 19:57,
> <leonardo.sandoval.gonzalez at linux.intel.com> wrote:
>         +        i_sigfile, max_sigfiles_to_compare = 0, 20
>                  for k in files1.keys() | files2.keys():
>                      if k in files1 and k in files2:
>         +                i_sigfile += 1
>                          print("%s differs:" % k)
>         +                # this is an expensive computation, thus just
>         compare the first
>         +                # 'max_sigfiles_to_compare' k files
>         +                if i_sigfile > max_sigfiles_to_compare:
>         +                    continue
>                          sigdatafile1 = self.topdir +
>         "/tmp-sstatesamehash/stamps/" + k + "." + files1[k]
>                          sigdatafile2 = self.topdir +
>         "/tmp-sstatesamehash2/stamps/" + k + "." + files2[k]
>                          output =
>         bb.siggen.compare_sigfiles(sigdatafile1, sigdatafile2)
> 
> 
> A neater way to do this:
> 
> 
> -for k in files1.keys() | files2.keys():
> +for k in list(files1.keys() | files2.key())[:20];
> 
> 
yes, but we this way, we are not listing those > 20 and I believe this
is important. This fix just diffsigs the first 20, and the rest are just
listed for convenience.

also, sets are not 'subscriptable' thus slicing is not possible on sets.

Leo



> (take the union of the files1 and files2 keys, turn it into a list,
> and slice off up to the first 20)
> 
> 
> Ross





More information about the Openembedded-core mailing list