[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 7/8] raisin: Rework component specification



On Thu, 16 Apr 2015, George Dunlap wrote:
> Allow COMPONENTS to be specified in the config (or on the command-line)
> 
> Now you can keep all components enabled in your config but build only
> one like so:
> 
> COMPONENTS="xen" ./raise build
> 
> Signed-off-by: George Dunlap <george.dunlap@xxxxxxxxxxxxx>
> ---
> CC: Stefano Stabellini <stefano.stabellini@xxxxxxxxxx>
> ---
>  defconfig               |  5 +++++
>  lib/common-functions.sh | 49 
> +++++++++++++++++++++++++++++++++++--------------
>  2 files changed, 40 insertions(+), 14 deletions(-)
> 
> diff --git a/defconfig b/defconfig
> index 23c76eb..4ec8a0b 100644
> --- a/defconfig
> +++ b/defconfig
> @@ -1,5 +1,10 @@
>  # Config variables for raisin
>  
> +# Components
> +# All components: xen grub libvirt
> +# Core xen functionality: xen
> +DEFAULT_COMPONENTS="xen grub libvirt"
> +
>  # Build config
>  ## Make command to run
>  MAKE="make -j2"
> diff --git a/lib/common-functions.sh b/lib/common-functions.sh
> index e66c6f4..42406e9 100644
> --- a/lib/common-functions.sh
> +++ b/lib/common-functions.sh
> @@ -31,13 +31,41 @@ function common_init() {
>  
>      get_distro
>      get_arch
> +    get_components
>  
> -    for f in `cat "$BASEDIR"/components/series`
> +    echo "Distro: $DISTRO"
> +    echo "Arch: $ARCH"
> +    echo "Components: $COMPONENTS"
> +
> +    for f in $COMPONENTS
>      do
>          source "$BASEDIR"/components/"$f"
>      done
>  }
>  
> +function get_components() {
> +    if [[ -z "$COMPONENTS" ]]
> +    then
> +     COMPONENTS="$DEFAULT_COMPONENTS"
> +    fi
> +
> +    if [[ -z "$COMPONENTS" ]] 
> +    then 
> +     local component
> +     for component in `cat "$BASEDIR"/components/series`
> +     do
> +         local capital
> +            capital=`echo $component | tr '[:lower:]' '[:upper:]'`
> +            if eval [[ ! -z \$"$capital"_UPSTREAM_REVISION ]]
> +            then
> +             COMPONENTS="$COMPONENTS $component"
> +             echo "Found component $component"
> +            fi
> +     done
> +     export COMPONENTS
> +    fi
> +}
> +
>  function get_distro() {
>      if [[ -x "`which lsb_release 2>/dev/null`" ]]
>      then
> @@ -222,20 +250,13 @@ function stop_initscripts() {
>  }
>  
>  function for_each_component () {
> -    for component in `cat "$BASEDIR"/components/series`
> +    local component

One important thing here is that the order is important: xen is the
first item in the series file for a reason. I think we should use the
COMPONENTS variable to check for what components are enabled, but then
still use the series file for the ordering.


> +    for component in $COMPONENTS
>      do
> -        capital=`echo $component | tr '[:lower:]' '[:upper:]'`
> -        if [[ $VERBOSE -eq 1 ]]
> -        then
> -            echo -n "$capital"_REVISION =" "
> -            eval echo \$"$capital"_REVISION
> -        fi
> -        if eval [[ ! -z \$"$capital"_REVISION ]]
> -        then
> -            [[ $VERBOSE -eq 0 ]] || echo calling "$component"_"$1"
> -            "$component"_"$1"
> -            [[ $VERBOSE -eq 0 ]] || echo "$component"_"$1" done
> -        fi
> +        [[ $VERBOSE -eq 0 ]] || echo calling "$component"_"$1"
> +        "$component"_"$1"
> +        [[ $VERBOSE -eq 0 ]] || echo "$component"_"$1" done
>      done
>  }
>  
> -- 
> 1.9.1
> 

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.