[bitbake-devel] toaster: set INHERIT var in the script that starts toaster

Submitted by Cristiana Voicu on Oct. 28, 2013, 11:28 a.m.

Details

Message ID 1382959696-24874-1-git-send-email-cristiana.voicu@intel.com
State New
Headers show

Commit Message

Cristiana Voicu Oct. 28, 2013, 11:28 a.m.
In order to use toaster, now you have to set INHERIT+="toaster buildhistory"
To keep it simple, I've done some changes in order to automate it. When toaster
is started, this line is added to local.conf. When it is stoped, it is removed.

Signed-off-by: Cristiana Voicu <cristiana.voicu@intel.com>
---
 bitbake/bin/toaster |   17 +++++++++++++++++
 1 file changed, 17 insertions(+)

Patch hide | download patch | download mbox

diff --git a/bitbake/bin/toaster b/bitbake/bin/toaster
index 16de52b..639b7b7 100755
--- a/bitbake/bin/toaster
+++ b/bitbake/bin/toaster
@@ -49,6 +49,21 @@  function webserverStartAll()
         return $retval
 }
 
+#Helper functions to add/remove a line from a configuration file
+
+function addtoConfiguration()
+{
+        echo "#added by toaster" >> ${BUILDDIR}/conf/$2
+        echo $1 >> ${BUILDDIR}/conf/$2
+}
+
+function removefromConfiguration()
+{
+        comment_line=$(grep -n "#added by toaster" "$file" | cut -f1 -d:)
+        variable_line=$((comment_line+1))
+        lines="${comment_line},${variable_line}"
+        sed -i "$lines"'d' ${BUILDDIR}/conf/$1
+}
 
 # We make sure we're running in the current shell and in a good environment
 
@@ -120,6 +135,7 @@  fi
 
 case $CMD in
     start )
+        addtoConfiguration "INHERIT+=\"toaster buildhistory\"" local.conf
         webserverStartAll || return 4
         unset BBSERVER
         bitbake --server-only -t xmlrpc -B localhost:8200
@@ -138,6 +154,7 @@  case $CMD in
         webserverKillAll
         # force stop any misbehaving bitbake server
         lsof bitbake.lock | awk '{print $2}' | grep "[0-9]\+" | xargs -n1 -r kill
+        removefromConfiguration local.conf
     ;;
 esac
 

Comments

Alex Damian Oct. 30, 2013, 3:37 p.m.
Taken in toaster/master.


On Mon, Oct 28, 2013 at 11:28 AM, Cristiana Voicu <cristiana.voicu@intel.com
> wrote:

> In order to use toaster, now you have to set INHERIT+="toaster
> buildhistory"
> To keep it simple, I've done some changes in order to automate it. When
> toaster
> is started, this line is added to local.conf. When it is stoped, it is
> removed.
>
> Signed-off-by: Cristiana Voicu <cristiana.voicu@intel.com>
> ---
>  bitbake/bin/toaster |   17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
>
> diff --git a/bitbake/bin/toaster b/bitbake/bin/toaster
> index 16de52b..639b7b7 100755
> --- a/bitbake/bin/toaster
> +++ b/bitbake/bin/toaster
> @@ -49,6 +49,21 @@ function webserverStartAll()
>          return $retval
>  }
>
> +#Helper functions to add/remove a line from a configuration file
> +
> +function addtoConfiguration()
> +{
> +        echo "#added by toaster" >> ${BUILDDIR}/conf/$2
> +        echo $1 >> ${BUILDDIR}/conf/$2
> +}
> +
> +function removefromConfiguration()
> +{
> +        comment_line=$(grep -n "#added by toaster" "$file" | cut -f1 -d:)
> +        variable_line=$((comment_line+1))
> +        lines="${comment_line},${variable_line}"
> +        sed -i "$lines"'d' ${BUILDDIR}/conf/$1
> +}
>
>  # We make sure we're running in the current shell and in a good
> environment
>
> @@ -120,6 +135,7 @@ fi
>
>  case $CMD in
>      start )
> +        addtoConfiguration "INHERIT+=\"toaster buildhistory\"" local.conf
>          webserverStartAll || return 4
>          unset BBSERVER
>          bitbake --server-only -t xmlrpc -B localhost:8200
> @@ -138,6 +154,7 @@ case $CMD in
>          webserverKillAll
>          # force stop any misbehaving bitbake server
>          lsof bitbake.lock | awk '{print $2}' | grep "[0-9]\+" | xargs -n1
> -r kill
> +        removefromConfiguration local.conf
>      ;;
>  esac
>
> --
> 1.7.9.5
>
> _______________________________________________
> bitbake-devel mailing list
> bitbake-devel@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/bitbake-devel
>