From: Stefano Stabellini Date: Mon, 12 Oct 2015 16:28:18 +0000 (+0100) Subject: add a skip function in each components to disable the build X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=35c71f2d6ad852b4baf05aa887b379a84df71edb;p=raisin.git add a skip function in each components to disable the build Use it to disable building unnecessary components on ARM and ARM64. Remove the manual checks. Signed-off-by: Stefano Stabellini --- diff --git a/README b/README index 7fec089..3a880e7 100644 --- a/README +++ b/README @@ -66,6 +66,11 @@ depends on Xen, should be built after Xen). You need to implement a few bash functions in the component script file: +* component_skip +return 0 if the component should be skipped, 1 if it should be enabled. +It can be used to skip some components on platforms where they are not +used, for example pvgrub on ARM. + * component_check_package passes a list of build dependencies to check-package diff --git a/components/grub b/components/grub index 703d681..e6b615e 100644 --- a/components/grub +++ b/components/grub @@ -1,5 +1,14 @@ #!/usr/bin/env bash +function grub_skip() { + if [[ $RAISIN_ARCH != "x86_64" && $RAISIN_ARCH != "x86_32" ]] + then + return 0 + else + return 1 + fi +} + function grub_check_package() { local DEP_Debian_common="build-essential tar autoconf bison flex" local DEP_Debian_x86_32="$DEP_Debian_common" @@ -16,24 +25,12 @@ function grub_check_package() { local DEP_CentOS_x86_32="$DEP_Fedora_x86_32" local DEP_CentOS_x86_64="$DEP_Fedora_x86_64" - - if [[ $RAISIN_ARCH != "x86_64" && $RAISIN_ARCH != "x86_32" ]] - then - verbose_echo grub is only supported on x86_32 and x86_64 - return - fi verbose_echo Checking Grub dependencies eval check-package \$DEP_"$DISTRO"_"$RAISIN_ARCH" } function grub_build() { - if [[ $RAISIN_ARCH != "x86_64" && $RAISIN_ARCH != "x86_32" ]] - then - verbose_echo grub is only supported on x86_32 and x86_64 - return - fi - cd "$BASEDIR" rm -f memdisk.tar tar cf memdisk.tar -C data grub.cfg diff --git a/components/libvirt b/components/libvirt index 8ba642a..ae2f9ac 100644 --- a/components/libvirt +++ b/components/libvirt @@ -1,5 +1,9 @@ #!/usr/bin/env bash +function libvirt_skip() { + return 1 +} + function libvirt_check_package() { local DEP_Debian_common="build-essential libtool autoconf autopoint \ xsltproc libxml2-utils pkg-config python-dev \ diff --git a/components/linux b/components/linux index 9ae6955..9de692c 100644 --- a/components/linux +++ b/components/linux @@ -1,5 +1,9 @@ #!/usr/bin/env bash +function linux_skip() { + return 1 +} + function linux_check_package() { local DEP_Debian_common="build-essential bc openssl" local DEP_Debian_x86_32="$DEP_Debian_common" diff --git a/components/ovmf b/components/ovmf index 387044a..ffdde19 100644 --- a/components/ovmf +++ b/components/ovmf @@ -1,5 +1,14 @@ #!/usr/bin/env bash +function ovmf_skip() { + if [[ $RAISIN_ARCH != "x86_64" && $RAISIN_ARCH != "x86_32" ]] + then + return 0 + else + return 1 + fi +} + function ovmf_check_package() { local DEP_Debian_common="build-essential nasm uuid-dev python iasl" local DEP_Debian_x86_32="$DEP_Debian_common" @@ -11,24 +20,12 @@ function ovmf_check_package() { local DEP_Fedora_x86_32="$DEP_Fedora_common" local DEP_Fedora_x86_64="$DEP_Fedora_common" - - if [[ $RAISIN_ARCH != "x86_64" ]] - then - verbose_echo ovmf is only supported on x86_64 - return - fi verbose_echo Checking OVMF dependencies eval check-package \$DEP_"$DISTRO"_"$RAISIN_ARCH" } function ovmf_build() { - if [[ $RAISIN_ARCH != "x86_64" ]] - then - verbose_echo ovmf is only supported on x86_64 - return - fi - cd "$BASEDIR" git-checkout $OVMF_URL $OVMF_REVISION ovmf-dir cd ovmf-dir diff --git a/components/qemu b/components/qemu index dce4ce0..e0d92a5 100644 --- a/components/qemu +++ b/components/qemu @@ -1,5 +1,9 @@ #!/usr/bin/env bash +function qemu_skip() { + return 1 +} + function qemu_check_package() { local DEP_Debian_common="build-essential libglib2.0-dev libpixman-1-dev" local DEP_Debian_x86_32="$DEP_Debian_common" diff --git a/components/qemu_traditional b/components/qemu_traditional index ddf3db9..3150c3e 100644 --- a/components/qemu_traditional +++ b/components/qemu_traditional @@ -1,5 +1,14 @@ #!/usr/bin/env bash +function qemu_traditional_skip() { + if [[ $RAISIN_ARCH != "x86_64" && $RAISIN_ARCH != "x86_32" ]] + then + return 0 + else + return 1 + fi +} + function qemu_traditional_check_package() { local DEP_Debian_common="build-essential zlib1g-dev pciutils-dev pkg-config \ libncurses5-dev" @@ -10,23 +19,11 @@ function qemu_traditional_check_package() { local DEP_Fedora_x86_32="$DEP_Fedora_common" local DEP_Fedora_x86_64="$DEP_Fedora_common" - if [[ $RAISIN_ARCH != "x86_64" && $RAISIN_ARCH != "x86_32" ]] - then - verbose_echo qemu_traditional is only supported on x86_32 and x86_64 - return - fi - verbose_echo Checking QEMU dependencies eval check-package \$DEP_"$DISTRO"_"$RAISIN_ARCH" } function qemu_traditional_build() { - if [[ $RAISIN_ARCH != "x86_64" && $RAISIN_ARCH != "x86_32" ]] - then - verbose_echo qemu_traditional is only supported on x86_32 and x86_64 - return - fi - cd "$BASEDIR" git-checkout $QEMU_TRADITIONAL_URL $QEMU_TRADITIONAL_REVISION qemu_traditional-dir cd qemu_traditional-dir diff --git a/components/seabios b/components/seabios index 8fea193..9ce3fee 100644 --- a/components/seabios +++ b/components/seabios @@ -1,5 +1,14 @@ #!/usr/bin/env bash +function seabios_skip() { + if [[ $RAISIN_ARCH != "x86_64" && $RAISIN_ARCH != "x86_32" ]] + then + return 0 + else + return 1 + fi +} + function seabios_check_package() { local DEP_Debian_common="build-essential iasl" local DEP_Debian_x86_32="$DEP_Debian_common" @@ -11,24 +20,12 @@ function seabios_check_package() { local DEP_Fedora_x86_32="$DEP_Fedora_common" local DEP_Fedora_x86_64="$DEP_Fedora_common" - - if [[ $RAISIN_ARCH != "x86_64" && $RAISIN_ARCH != "x86_32" ]] - then - verbose_echo seabios is only supported on x86_32 and x86_64 - return - fi verbose_echo Checking SeaBIOS dependencies eval check-package \$DEP_"$DISTRO"_"$RAISIN_ARCH" } function seabios_build() { - if [[ $RAISIN_ARCH != "x86_64" && $RAISIN_ARCH != "x86_32" ]] - then - verbose_echo seabios is only supported on x86_32 and x86_64 - return - fi - cd "$BASEDIR" git-checkout $SEABIOS_URL $SEABIOS_REVISION seabios-dir cd seabios-dir diff --git a/components/xen b/components/xen index 6b700e5..090cceb 100644 --- a/components/xen +++ b/components/xen @@ -1,5 +1,9 @@ #!/usr/bin/env bash +function xen_skip() { + return 1 +} + function xen_check_package() { local DEP_Debian_common="build-essential python-dev gettext uuid-dev \ libncurses5-dev libyajl-dev libaio-dev pkg-config libglib2.0-dev \ diff --git a/lib/common-functions.sh b/lib/common-functions.sh index c222ce3..03642ae 100644 --- a/lib/common-functions.sh +++ b/lib/common-functions.sh @@ -301,7 +301,7 @@ function for_each_component () { break fi done - if ! $found + if ! $found || "$component"_skip then verbose_echo "$component" is disabled continue