Patchwork [1/1] utils.bbclass: modify create_wrapper to correctly follow symlinks

login
register
mail settings
Submitter Saul Wold
Date May 18, 2011, 6:57 p.m.
Message ID <acb069f6d1606913110f0829a4d8f738395d3baa.1305745000.git.sgw@linux.intel.com>
Download mbox | patch
Permalink /patch/4391/
State New, archived
Headers show

Comments

Saul Wold - May 18, 2011, 6:57 p.m.
From: Saul Wold <sgw@linux.intel.com>

This ensures you look up the symbolic link to get the full path

Signed-off-by: Saul Wold <sgw@linux.intel.com>
---
 meta/classes/utils.bbclass |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
Gary Thomas - May 19, 2011, 11:57 a.m.
On 05/18/2011 12:57 PM, Saul Wold wrote:
> From: Saul Wold<sgw@linux.intel.com>
>
> This ensures you look up the symbolic link to get the full path
>
> Signed-off-by: Saul Wold<sgw@linux.intel.com>

Verified - this patch fixes the current breakage in the Poky tree as well.

Thanks

> ---
>   meta/classes/utils.bbclass |    3 ++-
>   1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/meta/classes/utils.bbclass b/meta/classes/utils.bbclass
> index 6bcaf86..1965d2f 100644
> --- a/meta/classes/utils.bbclass
> +++ b/meta/classes/utils.bbclass
> @@ -312,7 +312,8 @@ create_wrapper () {
>      cmdname=`basename $cmd`.real
>      cat<<END>$cmd
>   #!/bin/sh
> -exec env $@ \`dirname \$0\`/$cmdname "\$@"
> +realpath=\`readlink -fn \$0\`
> +exec env $@ \`dirname \$realpath\`/$cmdname "\$@"
>   END
>      chmod +x $cmd
>   }

Patch

diff --git a/meta/classes/utils.bbclass b/meta/classes/utils.bbclass
index 6bcaf86..1965d2f 100644
--- a/meta/classes/utils.bbclass
+++ b/meta/classes/utils.bbclass
@@ -312,7 +312,8 @@  create_wrapper () {
    cmdname=`basename $cmd`.real
    cat <<END >$cmd
 #!/bin/sh
-exec env $@ \`dirname \$0\`/$cmdname "\$@"
+realpath=\`readlink -fn \$0\`
+exec env $@ \`dirname \$realpath\`/$cmdname "\$@"
 END
    chmod +x $cmd
 }