Patchwork scripts/bitbake: Allow to override path to pseudodone, make BUILDDIR optional

login
register
mail settings
Submitter Andreas Oberritter
Date March 20, 2012, 1:37 p.m.
Message ID <1332250625-18091-1-git-send-email-obi@opendreambox.org>
Download mbox | patch
Permalink /patch/23865/
State New
Headers show

Comments

Andreas Oberritter - March 20, 2012, 1:37 p.m.
* Allows to workaround breakage caused by commit
  b4df1c7c79b5c801658bcf890ba3a8eab3d83189.

* Related thread on OE-core mailing list:
  http://lists.linuxtogo.org/pipermail/openembedded-core/2012-March/019136.html

Signed-off-by: Andreas Oberritter <obi@opendreambox.org>
---
 scripts/bitbake |   22 ++++++++++++++++------
 1 files changed, 16 insertions(+), 6 deletions(-)
Andreas Oberritter - March 23, 2012, 8:20 p.m.
Paul,

how do you propose to go on solving this problem?

Regards,
Andreas

On 20.03.2012 14:37, Andreas Oberritter wrote:
> * Allows to workaround breakage caused by commit
>   b4df1c7c79b5c801658bcf890ba3a8eab3d83189.
> 
> * Related thread on OE-core mailing list:
>   http://lists.linuxtogo.org/pipermail/openembedded-core/2012-March/019136.html
> 
> Signed-off-by: Andreas Oberritter <obi@opendreambox.org>
> ---
>  scripts/bitbake |   22 ++++++++++++++++------
>  1 files changed, 16 insertions(+), 6 deletions(-)
> 
> diff --git a/scripts/bitbake b/scripts/bitbake
> index 45c8697..3377b26 100755
> --- a/scripts/bitbake
> +++ b/scripts/bitbake
> @@ -47,14 +47,24 @@ float_test() {
>  # but earlier versions do not
>  float_test "$TARVERSION > 1.23" && needtar="0"
>  
> -if [ "`pwd`" != "$BUILDDIR" ] ; then
> -    echo "BitBake must be run from your build directory: $BUILDDIR"
> +if [ -n "$BUILDDIR" ]; then
> +    if [ "`pwd`" != "$BUILDDIR" ] ; then
> +        echo "BitBake must be run from your build directory: $BUILDDIR"
> +        exit 1
> +    fi
> +    if [ -z "$PSEUDODONE" ]; then
> +        PSEUDODONE="$BUILDDIR/pseudodone"
> +    fi
> +fi
> +
> +if [ -z "$PSEUDODONE" ]; then
> +    echo "BitBake requires PSEUDODONE to be set."
>      exit 1
>  fi
>  
>  buildpseudo="1"
> -if [ $needpseudo = "1" ] && [ -e "$BUILDDIR/pseudodone" ]; then
> -    PSEUDOBINDIR=`cat $BUILDDIR/pseudodone`
> +if [ $needpseudo = "1" ] && [ -e "$PSEUDODONE" ]; then
> +    PSEUDOBINDIR=`cat $PSEUDODONE`
>      if [ -e "$PSEUDOBINDIR/pseudo" -a -e "$PSEUDOBINDIR/tar" -a "$needtar" = "1" ]; then
>          buildpseudo="0"
>      fi
> @@ -96,7 +106,7 @@ if [ $buildpseudo = "1" ]; then
>      if [ "$ret" != "0" ]; then
>          exit 1
>      fi
> -    echo $PSEUDOBINDIR > $BUILDDIR/pseudodone
> +    echo $PSEUDOBINDIR > $PSEUDODONE
>      # This needs to exist in case pseudo has to log somewhere
>      mkdir -p $PSEUDOBINDIR/../../var/pseudo
>  fi
> @@ -104,7 +114,7 @@ BITBAKE=`which bitbake`
>  export PATH=$OLDPATH
>  if [ $needpseudo = "1" ]; then
>      export PSEUDO_BUILD=2
> -    PSEUDOBINDIR=`cat $BUILDDIR/pseudodone`
> +    PSEUDOBINDIR=`cat $PSEUDODONE`
>      PSEUDO_BINDIR=$PSEUDOBINDIR PSEUDO_LIBDIR=$PSEUDOBINDIR/../lib/pseudo/lib PSEUDO_PREFIX=$PSEUDOBINDIR/../../ PSEUDO_DISABLED=1 $PSEUDOBINDIR/pseudo $BITBAKE $@
>  else
>      export PSEUDO_BUILD=0
Paul Eggleton - March 26, 2012, 10:07 a.m.
On Friday 23 March 2012 21:20:28 Andreas Oberritter wrote:
> how do you propose to go on solving this problem?

My original patch solved a problem for many newer users who forget to cd back 
to their build directories before running bitbake. At least now they get a 
reasonable error message they can understand. I'm not going to support 
reverting it unless we have a practical alternative and so far I don't see 
one.

Your original reason for using the configuration you use was that pseudo was 
being rebuilt for every new configuration. I have a fix here locally which will 
skip doing this - it just needs to call bitbake -e in order to find out 
STAGING_BINDIR_NATIVE if pseudodone hasn't been created.

Cheers,
Paul
Andreas Oberritter - March 26, 2012, 10:29 a.m.
On 26.03.2012 12:07, Paul Eggleton wrote:
> On Friday 23 March 2012 21:20:28 Andreas Oberritter wrote:
>> how do you propose to go on solving this problem?
> 
> My original patch solved a problem for many newer users who forget to cd back 
> to their build directories before running bitbake. At least now they get a 
> reasonable error message they can understand. I'm not going to support 
> reverting it unless we have a practical alternative and so far I don't see 
> one.
> 
> Your original reason for using the configuration you use was that pseudo was 
> being rebuilt for every new configuration. I have a fix here locally which will 
> skip doing this - it just needs to call bitbake -e in order to find out 
> STAGING_BINDIR_NATIVE if pseudodone hasn't been created.

Yes, this was my original reason (or better: the first one I mentioned).

However, I still don't want to export BUILDDIR just to run bitbake. It's
much more convenient to just have to call bitbake directly from every
machine's build directory than having to set up the environment every
single time the machine changes. How are me and my distro's users
supposed to do this in the future?

Can't bitbake just print a useful error message on its own if it doesn't
find a usable configuration?

Regards,
Andreas

Patch

diff --git a/scripts/bitbake b/scripts/bitbake
index 45c8697..3377b26 100755
--- a/scripts/bitbake
+++ b/scripts/bitbake
@@ -47,14 +47,24 @@  float_test() {
 # but earlier versions do not
 float_test "$TARVERSION > 1.23" && needtar="0"
 
-if [ "`pwd`" != "$BUILDDIR" ] ; then
-    echo "BitBake must be run from your build directory: $BUILDDIR"
+if [ -n "$BUILDDIR" ]; then
+    if [ "`pwd`" != "$BUILDDIR" ] ; then
+        echo "BitBake must be run from your build directory: $BUILDDIR"
+        exit 1
+    fi
+    if [ -z "$PSEUDODONE" ]; then
+        PSEUDODONE="$BUILDDIR/pseudodone"
+    fi
+fi
+
+if [ -z "$PSEUDODONE" ]; then
+    echo "BitBake requires PSEUDODONE to be set."
     exit 1
 fi
 
 buildpseudo="1"
-if [ $needpseudo = "1" ] && [ -e "$BUILDDIR/pseudodone" ]; then
-    PSEUDOBINDIR=`cat $BUILDDIR/pseudodone`
+if [ $needpseudo = "1" ] && [ -e "$PSEUDODONE" ]; then
+    PSEUDOBINDIR=`cat $PSEUDODONE`
     if [ -e "$PSEUDOBINDIR/pseudo" -a -e "$PSEUDOBINDIR/tar" -a "$needtar" = "1" ]; then
         buildpseudo="0"
     fi
@@ -96,7 +106,7 @@  if [ $buildpseudo = "1" ]; then
     if [ "$ret" != "0" ]; then
         exit 1
     fi
-    echo $PSEUDOBINDIR > $BUILDDIR/pseudodone
+    echo $PSEUDOBINDIR > $PSEUDODONE
     # This needs to exist in case pseudo has to log somewhere
     mkdir -p $PSEUDOBINDIR/../../var/pseudo
 fi
@@ -104,7 +114,7 @@  BITBAKE=`which bitbake`
 export PATH=$OLDPATH
 if [ $needpseudo = "1" ]; then
     export PSEUDO_BUILD=2
-    PSEUDOBINDIR=`cat $BUILDDIR/pseudodone`
+    PSEUDOBINDIR=`cat $PSEUDODONE`
     PSEUDO_BINDIR=$PSEUDOBINDIR PSEUDO_LIBDIR=$PSEUDOBINDIR/../lib/pseudo/lib PSEUDO_PREFIX=$PSEUDOBINDIR/../../ PSEUDO_DISABLED=1 $PSEUDOBINDIR/pseudo $BITBAKE $@
 else
     export PSEUDO_BUILD=0