From: George Dunlap Date: Mon, 20 Apr 2015 15:58:11 +0000 (+0000) Subject: raisin: Rework component specification X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=455e0a893cd64d12fb9fe67323568699f2d6eb40;p=raisin.git raisin: Rework component specification From: George Dunlap 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 Signed-off-by: Stefano Stabellini --- diff --git a/README b/README index 847128e..ab8d3e7 100644 --- 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 = diff --git a/defconfig b/defconfig index 23c76eb..1aa4319 100644 --- 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" diff --git a/lib/common-functions.sh b/lib/common-functions.sh index 5aecdb9..dc3a2bb 100644 --- a/lib/common-functions.sh +++ b/lib/common-functions.sh @@ -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 }