Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: Robert Yang <liezhi.yang@windriver.com>
Cc: openembedded-core@lists.openembedded.org
Subject: Re: [PATCH 1/1] sstate.bbclass: remove previous version's stamp
Date: Fri, 17 Jan 2014 12:17:35 +0000	[thread overview]
Message-ID: <1389961055.14987.118.camel@ted> (raw)
In-Reply-To: <52D90D85.7010106@windriver.com>

On Fri, 2014-01-17 at 19:01 +0800, Robert Yang wrote:
> 
> On 01/17/2014 06:36 PM, Richard Purdie wrote:
> > On Fri, 2014-01-17 at 14:43 +0800, Robert Yang wrote:
> >> +        # Keep the sigdata
> >> +        if not re.match(re_sigdata, stfile):
> >> +            oe.path.remove(stfile)
> >
> > I'm not sure its worth the overhead of using regexps here. Can we not do
> > something simple like:
> >
> > if ".sigdata." not in stfile:
> >
> 
> Sounds better, I've updated the PULL:
> 
> git://git.pokylinux.org/poky-contrib rbt/clean_stamp
> 
> and here is the patch:
> 
> diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass
> index 35c3f85..d4e0dcb 100644
> --- a/meta/classes/sstate.bbclass
> +++ b/meta/classes/sstate.bbclass
> @@ -331,11 +331,17 @@ def sstate_clean_manifest(manifest, d):
> 
>   def sstate_clean(ss, d):
>       import oe.path
> +    import glob
> 
>       d2 = d.createCopy()
> +    stamp_clean = d.getVar("STAMPCLEAN", True)
>       extrainf = d.getVarFlag("do_" + ss['task'], 'stamp-extra-info', True)
>       if extrainf:
>           d2.setVar("SSTATE_MANMACH", extrainf)
> +        wildcard_stfile = "%s.do_%s*.%s" % (stamp_clean, ss['task'], extrainf)
> +    else:
> +        wildcard_stfile = "%s.do_%s*" % (stamp_clean, ss['task'])
> +
>       manifest = d2.expand("${SSTATE_MANFILEPREFIX}.%s" % ss['name'])
> 
>       if os.path.exists(manifest):
> @@ -350,15 +356,11 @@ def sstate_clean(ss, d):
>           for lock in locks:
>               bb.utils.unlockfile(lock)
> 
> -    stfile = d.getVar("STAMP", True) + ".do_" + ss['task']
> -    oe.path.remove(stfile)
> -    oe.path.remove(stfile + "_setscene")
> -    if extrainf:
> -        oe.path.remove(stfile + ".*" + extrainf)
> -        oe.path.remove(stfile + "_setscene" + ".*" + extrainf)
> -    else:
> -        oe.path.remove(stfile + ".*")
> -        oe.path.remove(stfile + "_setscene" + ".*")
> +    # Remove the current and previous stamps, but keep the sigdata
> +    for stfile in glob.glob(wildcard_stfile):
> +        # Keep the sigdata
> +        if ".sigdata." not in stfile:
> +            oe.path.remove(stfile)

Sorry Robert, there is one more issue here. You're doing "do_%s*" but
this can match multiple tasks, e.g. do_package* would also wipe out
do_package_write_ipk, do_package_write_rpm etc.

The easiest way to handle this is probably in the for loop, making sure
that do_<task>. or do_<task>_setscene. are in the filename.

It might be worth putting some comments in the code about these
subtleties. 

Cheers,

Richard







  reply	other threads:[~2014-01-17 12:18 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-17  6:43 [PATCH 0/1 V2] sstate.bbclass: remove previous version's stamp Robert Yang
2014-01-17  6:43 ` [PATCH 1/1] " Robert Yang
2014-01-17 10:36   ` Richard Purdie
2014-01-17 11:01     ` Robert Yang
2014-01-17 12:17       ` Richard Purdie [this message]
2014-01-20  9:28         ` Robert Yang
  -- strict thread matches above, loose matches on Subject: below --
2014-01-20 11:42 [PATCH 0/1 V3] " Robert Yang
2014-01-20 11:42 ` [PATCH 1/1] " Robert Yang
2014-01-15  7:09 [PATCH 0/1] " Robert Yang
2014-01-15  7:09 ` [PATCH 1/1] " Robert Yang
2014-01-15  9:40   ` 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=1389961055.14987.118.camel@ted \
    --to=richard.purdie@linuxfoundation.org \
    --cc=liezhi.yang@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox