Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: Phil Blundell <philb@gnu.org>
Cc: oe-core <openembedded-core@lists.openembedded.org>
Subject: Re: [PATCH] staging: Avoid staging the same binaries again and again
Date: Mon, 24 Sep 2012 09:51:33 +0100	[thread overview]
Message-ID: <1348476693.10108.221.camel@ted> (raw)
In-Reply-To: <1348467993.4444.252.camel@x121e.pbcl.net>

On Mon, 2012-09-24 at 07:26 +0100, Phil Blundell wrote:
> It is possible that some or all of ${bindir}, ${base_bindir},
> ${sbindir} and ${base_sbindir} might be the same directory.  In
> particular, for micro it is often the case that all four are
> the same.  There is clearly no point in staging the same directory
> four times, so let's keep track of which paths have already been
> staged and skip any later duplicates.
> 
> Signed-off-by: Phil Blundell <pb@pbcl.net>
> ---
>  meta/classes/staging.bbclass |   24 ++++++++++++++++++++----
>  1 files changed, 20 insertions(+), 4 deletions(-)
> 
> diff --git a/meta/classes/staging.bbclass b/meta/classes/staging.bbclass
> index 82624cb..bd97ed5 100644
> --- a/meta/classes/staging.bbclass
> +++ b/meta/classes/staging.bbclass
> @@ -21,6 +21,21 @@ sysroot_stage_dir() {
>  	fi
>  }
>  
> +sysroot_stage_dir_once() {
> +	src="$1"
> +	dest="$2"
> +
> +	src_b64=`echo $src | base64 -w 0`
> +	for d in $staged_dirs; do
> +	    if [ $d = $src_b64 ]; then
> +	       echo "$src has been staged already"
> +	       return
> +	    fi
> +	done
> +	sysroot_stage_dir $src $dest
> +	staged_dirs="$staged_dirs $src_b64"
> +}

Wouldn't testing whether $dest already exists work just as well?

Cheers,

Richard

>  sysroot_stage_libdir() {
>  	src="$1"
>  	dest="$2"
> @@ -34,10 +49,11 @@ sysroot_stage_dirs() {
>  
>  	sysroot_stage_dir $from${includedir} $to${includedir}
>  	if [ "${BUILD_SYS}" = "${HOST_SYS}" ]; then
> -		sysroot_stage_dir $from${bindir} $to${bindir}
> -		sysroot_stage_dir $from${sbindir} $to${sbindir}
> -		sysroot_stage_dir $from${base_bindir} $to${base_bindir}
> -		sysroot_stage_dir $from${base_sbindir} $to${base_sbindir}
> +		staged_dirs=
> +		sysroot_stage_dir_once $from${bindir} $to${bindir}
> +		sysroot_stage_dir_once $from${sbindir} $to${sbindir}
> +		sysroot_stage_dir_once $from${base_bindir} $to${base_bindir}
> +		sysroot_stage_dir_once $from${base_sbindir} $to${base_sbindir}
>  		sysroot_stage_dir $from${libexecdir} $to${libexecdir}
>  		sysroot_stage_dir $from${sysconfdir} $to${sysconfdir}
>  		sysroot_stage_dir $from${localstatedir} $to${localstatedir}






  reply	other threads:[~2012-09-24  9:04 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-24  6:26 [PATCH] staging: Avoid staging the same binaries again and again Phil Blundell
2012-09-24  8:51 ` Richard Purdie [this message]
2012-09-24  9:40   ` Phil Blundell
2012-09-24  9:54     ` Richard Purdie
2012-09-24  9:59       ` Phil Blundell
2012-09-27 21:18       ` Phil Blundell
2012-09-27 21:35         ` Richard Purdie
2012-09-28 10:43           ` Phil Blundell

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=1348476693.10108.221.camel@ted \
    --to=richard.purdie@linuxfoundation.org \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=philb@gnu.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