All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: Hongxu Jia <hongxu.jia@windriver.com>
Cc: openembedded-core@lists.openembedded.org
Subject: Re: [PATCH 5/5] sstatesig: incremental dump lockedsigs
Date: Tue, 16 Sep 2014 17:57:31 +0100	[thread overview]
Message-ID: <1410886651.14624.62.camel@ted> (raw)
In-Reply-To: <f7654c9c712e2a736e7d177186e16b6a261ca7fc.1410446513.git.hongxu.jia@windriver.com>

On Thu, 2014-09-11 at 23:04 +0800, Hongxu Jia wrote:
> While including an existed lockedsigs file to build from
> locked sstate-cache, and we want to incremental build the
> locked sstate-cache. Config with:
> ...
> SIGGEN_DUMP_LOCKEDSIGS = '1'
> SIGGEN_LOCKEDSIGS_CONFIG = "${TOPDIR}/locked-sigs.inc"
> require ${SIGGEN_LOCKEDSIGS_CONFIG}
> ...
> So we support to dump lockedsigs file incrementally
> 
> Since we improve to handle locking of multiple machines and
> add a new SIGGEN_LOCKEDSIGS_TYPES variable which lists the
> package architectures to load in. We should add package
> architectures as type to self.lockedsigs to reflect that.
> Such as:
> {recipename:{task:{hash1}}} --> {type:{recipename:{task:{hash1}}}}
> 
> Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
> ---
>  meta/lib/oe/sstatesig.py | 67 ++++++++++++++++++++++++++++++++----------------
>  1 file changed, 45 insertions(+), 22 deletions(-)

I've stared long and hard at this patch and I simply don't understand
why we need to complicate the structure of the lockedsigs variable.

I understand wanting to generate an incremental sig file, that much is
fine, I just don't like the other seemingly unrelated change.
Regardless, they should be split into separate patches.

Can you explain more about what you're trying to do?

Cheers,

Richard


> diff --git a/meta/lib/oe/sstatesig.py b/meta/lib/oe/sstatesig.py
> index c9edd80..8b491a6 100644
> --- a/meta/lib/oe/sstatesig.py
> +++ b/meta/lib/oe/sstatesig.py
> @@ -65,12 +65,15 @@ def sstate_lockedsigs(d):
>      sigs = {}
>      types = (d.getVar("SIGGEN_LOCKEDSIGS_TYPES", True) or "").split()
>      for t in types:
> +        if t not in sigs:
> +            sigs[t] = {}
> +
>          lockedsigs = (d.getVar("SIGGEN_LOCKEDSIGS_%s" % t, True) or "").split()
>          for ls in lockedsigs:
>              pn, task, h = ls.split(":", 2)
> -            if pn not in sigs:
> -                sigs[pn] = {}
> -            sigs[pn][task] = h
> +            if pn not in sigs[t]:
> +                sigs[t][pn] = {}
> +            sigs[t][pn][task] = h
>      return sigs
>  
>  class SignatureGeneratorOEBasic(bb.siggen.SignatureGeneratorBasic):
> @@ -115,10 +118,14 @@ class SignatureGeneratorOEBasicHash(bb.siggen.SignatureGeneratorBasicHash):
>          recipename = dataCache.pkg_fn[fn]
>          self.lockedpnmap[fn] = recipename
>          self.lockedhashfn[fn] = dataCache.hashfn[fn]
> -        if recipename in self.lockedsigs:
> -            if task in self.lockedsigs[recipename]:
> +
> +        t = self.lockedhashfn[fn].split(" ")[1].split(":")[5]
> +        if t not in self.lockedsigs:
> +            return h
> +        if recipename in self.lockedsigs[t]:
> +            if task in self.lockedsigs[t][recipename]:
>                  k = fn + "." + task
> -                h_locked = self.lockedsigs[recipename][task]
> +                h_locked = self.lockedsigs[t][recipename][task]
>                  self.lockedhashes[k] = h_locked
>                  self.taskhash[k] = h_locked
>                  #bb.warn("Using %s %s %s" % (recipename, task, h))
> @@ -137,6 +144,19 @@ class SignatureGeneratorOEBasicHash(bb.siggen.SignatureGeneratorBasicHash):
>              return
>          super(bb.siggen.SignatureGeneratorBasicHash, self).dump_sigtask(fn, task, stampbase, runtime)
>  
> +    def update_lockedsigs(self, type, recipename, task, hash):
> +        if type not in self.lockedsigs:
> +            self.lockedsigs[type] = {}
> +
> +        if recipename not in self.lockedsigs[type]:
> +            self.lockedsigs[type][recipename] = {}
> +
> +        if task not in self.lockedsigs[type][recipename]:
> +            self.lockedsigs[type][recipename][task] = hash
> +        elif hash != self.lockedsigs[type][recipename][task]:
> +            bb.warn('Conflict %s %s %s (new %s, old %s)' %
> +                    (type, recipename, task, hash, self.lockedsigs[type][recipename][task]))
> +
>      def dump_lockedsigs(self, where_to_dump=None):
>          if not where_to_dump:
>              where_to_dump = os.getcwd() + "/locked-sigs.inc"
> @@ -146,30 +166,33 @@ class SignatureGeneratorOEBasicHash(bb.siggen.SignatureGeneratorBasicHash):
>          for k in self.runtaskdeps:
>              fn = k.rsplit(".",1)[0]
>              t = self.lockedhashfn[fn].split(" ")[1].split(":")[5]
> -            if t not in types:
> -                types[t] = []
> -            types[t].append(k)
> +            recipename = self.lockedpnmap[fn]
> +            task = k.rsplit(".",1)[1]
> +            hash = self.taskhash[k]
> +            self.update_lockedsigs(t, recipename, task, hash)
>  
>          with open(where_to_dump, "w") as f:
> -            for t in types:
> -                f.write('SIGGEN_LOCKEDSIGS_%s = "\\\n' % t)
> -                types[t].sort()
> -                sortedk = sorted(types[t], key=lambda k: self.lockedpnmap[k.rsplit(".",1)[0]])
> -                for k in sortedk:
> -                    fn = k.rsplit(".",1)[0]
> -                    task = k.rsplit(".",1)[1]
> -                    if k not in self.taskhash:
> -                        continue
> -                    f.write("    " + self.lockedpnmap[fn] + ":" + task + ":" + self.taskhash[k] + " \\\n")
> +            for type in sorted(self.lockedsigs):
> +                f.write('SIGGEN_LOCKEDSIGS_%s = "\\\n' % type)
> +
> +                for recipename in sorted(self.lockedsigs[type]):
> +                    for task in sorted(self.lockedsigs[type][recipename]):
> +                        hash = self.lockedsigs[type][recipename][task]
> +                        f.write("    " + recipename + ":" + task + ":" + hash + " \\\n")
>                  f.write('    "\n')
> -            f.write('SIGGEN_LOCKEDSIGS_TYPES_%s = "%s"' % (self.machine, " ".join(types.keys())))
> +
> +            f.write('SIGGEN_LOCKEDSIGS_TYPES_%s = "%s"' % (self.machine, " ".join(self.lockedsigs.keys())))
>  
>      def checkhashes(self, missed, ret, sq_fn, sq_task, sq_hash, sq_hashfn, d):
>          checklevel = d.getVar("SIGGEN_LOCKEDSIGS_CHECK_LEVEL", True)
>          for task in range(len(sq_fn)):
>              if task not in ret:
> -                for pn in self.lockedsigs:
> -                    if sq_hash[task] in self.lockedsigs[pn].itervalues():
> +                t = sq_hashfn[task].split(" ")[1].split(":")[5]
> +                if t not in self.lockedsigs:
> +                    continue
> +
> +                for pn in self.lockedsigs[t]:
> +                    if sq_hash[task] in self.lockedsigs[t][pn].itervalues():
>                          self.checkmsgs.append("Locked sig is set for %s:%s (%s) yet not in sstate cache?"
>                                                 % (pn, sq_task[task], sq_hash[task]))
>  




  reply	other threads:[~2014-09-16 16:57 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-11 15:04 [PATCH 0/5] Add support for locked down sstate Hongxu Jia
2014-09-11 15:04 ` [PATCH 1/5] Richard Purdie : sstatesig/sstate: Add support for locked down sstate cache usage Hongxu Jia
2014-09-11 15:04 ` [PATCH 2/5] Richard Purdie : sstatesig: Improve to handle locking of multiple machines Hongxu Jia
2014-09-11 15:04 ` [PATCH 3/5] Richard Purdie : siggen/runqueue/bitbake-worker: Improve siggen data transfer interface Hongxu Jia
2014-09-11 15:04 ` [PATCH 4/5] sstate/sstatesig: optimize the support for locked down sstate cache usage Hongxu Jia
2014-09-16 17:00   ` Richard Purdie
2014-09-17  2:46     ` Hongxu Jia
2014-09-11 15:04 ` [PATCH 5/5] sstatesig: incremental dump lockedsigs Hongxu Jia
2014-09-16 16:57   ` Richard Purdie [this message]
2014-09-17  6:26     ` Hongxu Jia

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=1410886651.14624.62.camel@ted \
    --to=richard.purdie@linuxfoundation.org \
    --cc=hongxu.jia@windriver.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 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.