Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Paul Eggleton <paul.eggleton@linux.intel.com>
To: openembedded-core@lists.openembedded.org
Subject: Re: [PATCHv2] buildhistory: record tag names and show warning when the same tag corresponds to different revision
Date: Wed, 03 Apr 2013 17:45:44 +0100	[thread overview]
Message-ID: <2294036.Yb79BO8GKn@helios> (raw)
In-Reply-To: <1364978976-18388-1-git-send-email-Martin.Jansa@gmail.com>

On Wednesday 03 April 2013 10:49:36 Martin Jansa wrote:
> * persistent cache records tag-srcrev mappings, but is not shared between
> builders 
> * when tag is moved in remote repo, all builders should rebuild
> the component to use the same source, show warning when revision is
> different than what was used in last build
> 
> Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
> ---
>  meta/classes/buildhistory.bbclass | 29 +++++++++++++++++++++++++----
>  1 file changed, 25 insertions(+), 4 deletions(-)
> 
> diff --git a/meta/classes/buildhistory.bbclass
> b/meta/classes/buildhistory.bbclass index 82d0bf8..8c9f794 100644
> --- a/meta/classes/buildhistory.bbclass
> +++ b/meta/classes/buildhistory.bbclass
> @@ -538,24 +538,38 @@ def _get_srcrev_values(d):
>              scms.append(u)
> 
>      autoinc_templ = 'AUTOINC+'
> -    dict = {}
> +    dict_srcrevs = {}
> +    dict_tag_srcrevs = {}
>      for scm in scms:
>          ud = urldata[scm]
>          for name in ud.names:
>              rev = ud.method.sortable_revision(scm, ud, d, name)
>              if rev.startswith(autoinc_templ):
>                  rev = rev[len(autoinc_templ):]
> -            dict[name] = rev
> -    return dict
> +            dict_srcrevs[name] = rev
> +            if 'tag' in ud.parm:
> +                tag = ud.parm['tag'];
> +                key = name+'_'+tag
> +                dict_tag_srcrevs[key] = rev
> +    return (dict_srcrevs, dict_tag_srcrevs)
> 
>  python do_write_srcrev() {
>      pkghistdir = d.getVar('BUILDHISTORY_DIR_PACKAGE', True)
>      srcrevfile = os.path.join(pkghistdir, 'latest_srcrev')
> 
> -    srcrevs = _get_srcrev_values(d)
> +    srcrevs, tag_srcrevs = _get_srcrev_values(d)
>      if srcrevs:
>          if not os.path.exists(pkghistdir):
>              os.makedirs(pkghistdir)
> +        old_tag_srcrevs = {}
> +        if os.path.exists(srcrevfile):
> +            with open(srcrevfile) as f:
> +                for line in f:
> +                    if line.startswith('# tag_'):
> +                        key, value = line.split("=", 1)
> +                        key = key.replace('# tag_', '').strip()
> +                        value = value.replace('"', '').strip()
> +                        old_tag_srcrevs[key] = value
>          with open(srcrevfile, 'w') as f:
>              orig_srcrev = d.getVar('SRCREV', False) or 'INVALID'
>              if orig_srcrev != 'INVALID':
> @@ -568,6 +582,13 @@ python do_write_srcrev() {
>                      f.write('SRCREV_%s = "%s"\n' % (name, srcrev))
>              else:
>                  f.write('SRCREV = "%s"\n' % srcrevs.itervalues().next())
> +            if len(tag_srcrevs) > 0:
> +                for name, srcrev in tag_srcrevs.items():
> +                    f.write('# tag_%s = "%s"\n' % (name, srcrev))
> +                    if name in old_tag_srcrevs and old_tag_srcrevs[name] !=
> srcrev: +                        pkg = d.getVar('PN', True)
> +                        bb.warn("Revision for tag %s in package %s was
> changed since last build (from %s to %s)" % (name, pkg,
> old_tag_srcrevs[name], srcrev)) +
>      else:
>          if os.path.exists(srcrevfile):
>              os.remove(srcrevfile)

Acked-by: Paul Eggleton <paul.eggleton@linux.intel.com>

Cheers,
Paul

-- 

Paul Eggleton
Intel Open Source Technology Centre



      reply	other threads:[~2013-04-03 17:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-01 12:50 [PATCH] buildhistory: record tag names and show warning when the same tag corresponds to different revision Martin Jansa
2013-04-03  8:24 ` Martin Jansa
2013-04-03  8:49   ` [PATCHv2] " Martin Jansa
2013-04-03 16:45     ` Paul Eggleton [this message]

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=2294036.Yb79BO8GKn@helios \
    --to=paul.eggleton@linux.intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox