]> xenbits.xensource.com Git - people/sstabellini/raisin.git/commitdiff
raisin: Rework component specification
authorGeorge Dunlap <george.dunlap@eu.citrix.com>
Mon, 20 Apr 2015 15:58:11 +0000 (15:58 +0000)
committerStefano Stabellini <stefano.stabellini@eu.citrix.com>
Mon, 20 Apr 2015 15:58:11 +0000 (15:58 +0000)
From: George Dunlap <george.dunlap@eu.citrix.com>

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@eu.citrix.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
README
defconfig
lib/common-functions.sh

diff --git a/README b/README
index 847128e01bb22cdc4aa2cb5996aa0079d9db53e8..ab8d3e73fefd48a5d7c4635c2322b45ecebe970b 100644 (file)
--- a/README
+++ b/README
@@ -39,6 +39,10 @@ configure the system for you. If you want this behaviour run
 raise.sh performs the installation by installing the deb or rpm package,
 hence it can be easily uninstalled by unraise.sh or manually by the
 user.
+It is also possible to specify which components to enable on the command
+line:
+
+COMPONENTS="xen qemu" ./raise build
 
 
 = Adding new components =
index 23c76eb094be4b2c391c123a42a069f0ffe231ec..1aa4319d58b7434fc918c633ef884289a22c186b 100644 (file)
--- a/defconfig
+++ b/defconfig
@@ -1,5 +1,13 @@
 # Config variables for raisin
 
+# Components
+## All components: xen qemu grub libvirt
+## Core xen functionality: xen
+## Remove a component from the list below, if you want to disable it
+## You can manually overwrite this list using the COMPONENTS
+## environmental variable.
+ENABLED_COMPONENTS="xen qemu grub libvirt"
+
 # Build config
 ## Make command to run
 MAKE="make -j2"
@@ -18,9 +26,7 @@ QEMU_URL="git://git.qemu.org/qemu.git"
 GRUB_URL="git://git.savannah.gnu.org/grub.git"
 LIBVIRT_URL="git://libvirt.org/libvirt.git"
 
-# Software versions. Leave blank if you want to avoid the build, like
-# this: GRUB_REVISION=
-# Grub and Libvirt needs Xen to build and run.
+# Software versions.
 XEN_REVISION="master"
 QEMU_REVISION="master"
 GRUB_REVISION="master"
index 5aecdb97d67ab6b51a2cbb057bd0b12753ed7366..dc3a2bb95b2cd573e2aea3d3eacfb640ae6e38cd 100644 (file)
@@ -31,13 +31,47 @@ function common_init() {
 
     get_distro
     get_arch
+    get_components
 
-    for f in `cat "$BASEDIR"/components/series`
+    if [[ $VERBOSE -eq 1 ]]
+    then
+        echo "Distro: $DISTRO"
+        echo "Arch: $ARCH"
+        echo "Components: $COMPONENTS"
+    fi
+
+    for f in $COMPONENTS
     do
         source "$BASEDIR"/components/"$f"
     done
 }
 
+function get_components() {
+    if [[ -z "$COMPONENTS" ]]
+    then
+        COMPONENTS="$ENABLED_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"_REVISION ]]
+            then
+                COMPONENTS="$COMPONENTS $component"
+                if [[ $VERBOSE -eq 1 ]]
+                then
+                    echo "Found component $component"
+                fi
+            fi
+        done
+    fi
+    export COMPONENTS
+}
+
 function get_distro() {
     if [[ -x "`which lsb_release 2>/dev/null`" ]]
     then
@@ -222,25 +256,38 @@ function stop_initscripts() {
 }
 
 function for_each_component () {
+    local component
+    local enabled
+    local found
+
     for component in `cat "$BASEDIR"/components/series`
     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
-            if [[ $VERBOSE -eq 1 ]]
+        found=0
+        for enabled in $COMPONENTS
+        do
+            if [[ $enabled = $component ]]
             then
-                echo calling "$component"_"$1"
+                found=1
+                break
             fi
-            "$component"_"$1"
+        done
+        if [[ $found -eq 0 ]]
+        then
             if [[ $VERBOSE -eq 1 ]]
             then
-                echo "$component"_"$1" done
+                echo "$component" is disabled
             fi
+            continue
+        fi
+
+        if [[ $VERBOSE -eq 1 ]]
+        then
+            echo calling "$component"_"$1"
+        fi
+        "$component"_"$1"
+        if [[ $VERBOSE -eq 1 ]]
+        then
+            echo "$component"_"$1" done
         fi
     done
 }