Openembedded Bitbake Development
 help / color / mirror / Atom feed
From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: "Xu, Dongxiao" <dongxiao.xu@intel.com>
Cc: bitbake-devel@lists.openembedded.org
Subject: Re: [PATCH 2/6] data_smart: Improve the calculation of config hash
Date: Mon, 16 Apr 2012 09:28:13 +0100	[thread overview]
Message-ID: <1334564893.16992.64.camel@ted> (raw)
In-Reply-To: <1334560504.4305.6.camel@dongxiao-osel>

On Mon, 2012-04-16 at 15:15 +0800, Xu, Dongxiao wrote:
> On Wed, 2012-04-11 at 00:00 +0100, Richard Purdie wrote:
> > On Mon, 2012-04-09 at 16:41 +0800, Dongxiao Xu wrote:
> > > The order of keys are not sensitive for config hash, so we need to
> > > identify its order while calculating the md5 value.
> > > 
> > > While for certain values, order is also not sensitive (for example,
> > > BBINCLUDED), we also need to identify its order while calculating md5
> > > value.
> > > 
> > > This could fix the problem that Martin Jansa reported in the mailing
> > > list:
> > > 
> > > http://lists.linuxtogo.org/pipermail/bitbake-devel/2012-March/002122.html
> > > 
> > > Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
> > > ---
> > >  lib/bb/data_smart.py |   10 +++++++---
> > >  1 files changed, 7 insertions(+), 3 deletions(-)
> > > 
> > > diff --git a/lib/bb/data_smart.py b/lib/bb/data_smart.py
> > > index 2c200db..cc61a03 100644
> > > --- a/lib/bb/data_smart.py
> > > +++ b/lib/bb/data_smart.py
> > > @@ -462,13 +462,17 @@ class DataSmart(MutableMapping):
> > >          self.delVar(var)
> > >  
> > >      def get_hash(self):
> > > -        data = ""
> > > +        data = {}
> > >          config_whitelist = set((self.getVar("BB_HASHCONFIG_WHITELIST", True) or "").split())
> > > +        config_sort = set((self.getVar("BB_HASHCONFIG_SORT", True) or "").split())
> > >          keys = set(key for key in iter(self) if not key.startswith("__"))
> > >          for key in keys:
> > >              if key in config_whitelist:
> > >                  continue
> > >              value = self.getVar(key, False) or ""
> > > -            data = data + key + ': ' + str(value) + '\n'
> > > +            if key in config_sort:
> > > +                value = " ".join(sorted(value.split()))
> > > +            data.update({key:value})
> > >  
> > > -        return hashlib.md5(data).hexdigest()
> > > +        data_str = str([(k, data[k]) for k in sorted(data.keys())])
> > > +        return hashlib.md5(data_str).hexdigest()
> > 
> > 
> > This and the corresponding change in bitbake.conf look rather worrying
> > to me. The order in BBINCLUDED is significant and if it changes we
> > should be reparsing.
> 
> Hi Richard,
> 
> Why do you say the order in BBINCLUDED is significant?
> 
> I saw the original code ignores the order when handling __depends and
> __base_depends.
> 
> For example:
> 
> def mark_dependency(d, f):
>     if f.startswith('./'):
>         f = "%s/%s" % (os.getcwd(), f[2:]) 
>     deps = d.getVar('__depends') or set() 
>     deps.update([(f, cached_mtime(f))])
>     d.setVar('__depends', deps)    
> 
> I think the get_file_depends(d) just follows the original logic.
> 
> Or do you mean the mark_dependency(d, f) is also buggy?

In that case I think the original code is also buggy.

Cheers,

Richard




  reply	other threads:[~2012-04-16  8:37 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-09  8:41 [PATCH 0/6][PULL] Hob: Bug fixes Dongxiao Xu
2012-04-09  8:41 ` [PATCH 1/6] Hob: Change base image to "Create your own image" if customized Dongxiao Xu
2012-04-09  8:41 ` [PATCH 2/6] data_smart: Improve the calculation of config hash Dongxiao Xu
2012-04-10 23:00   ` Richard Purdie
2012-04-16  7:15     ` Xu, Dongxiao
2012-04-16  8:28       ` Richard Purdie [this message]
2012-04-16  8:41         ` Xu, Dongxiao
2012-04-16  9:00           ` Richard Purdie
2012-04-09  8:41 ` [PATCH 3/6] Hob: Fix the pattern patch for image name Dongxiao Xu
2012-04-09  8:42 ` [PATCH 4/6] Hob: Fix tooltips in image configuration page Dongxiao Xu
2012-04-09  8:42 ` [PATCH 5/6] Hob: Fix tooltips in Settings dialog Dongxiao Xu
2012-04-09  8:42 ` [PATCH 6/6] Hob: Add an extra 50M space if zypper is selected Dongxiao Xu
2012-04-10 22:46 ` [PATCH 0/6][PULL] Hob: Bug fixes Richard Purdie

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=1334564893.16992.64.camel@ted \
    --to=richard.purdie@linuxfoundation.org \
    --cc=bitbake-devel@lists.openembedded.org \
    --cc=dongxiao.xu@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