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

Re: [Xen-devel] [PATCH 4/8] Import raise.sh and unraise.sh into library



On Thu, 9 Apr 2015, George Dunlap wrote:
> Make as few changes as possible to begin with, just to separate code
> motion from changes.
> 
> For now, remove raise.sh and unraise.sh from package creation, until
> we can figure out what to do instead.
> 
> Signed-off-by: George Dunlap <george.dunlap@xxxxxxxxxxxxx>

Good idea, I like it.


> CC: Stefano Stabellini <stefano.stabellini@xxxxxxxxxx>
> ---
>  raise.sh => lib/build.sh | 62 
> ++++++++++++++++--------------------------------
>  raise                    |  6 +++++
>  scripts/mkdeb            |  3 ++-
>  scripts/mkrpm            |  5 ++--
>  unraise.sh               | 17 -------------
>  5 files changed, 31 insertions(+), 62 deletions(-)
>  rename raise.sh => lib/build.sh (77%)
>  delete mode 100755 unraise.sh
> 
> diff --git a/raise.sh b/lib/build.sh
> similarity index 77%
> rename from raise.sh
> rename to lib/build.sh
> index 422fbe4..ab1e087 100755
> --- a/raise.sh
> +++ b/lib/build.sh
> @@ -2,10 +2,6 @@
>  
>  set -e
>  
> -source config
> -source lib/common-functions.sh
> -source lib/git-checkout.sh
> -
>  _help() {
>      echo "Usage: ./build.sh <options> <command>"
>      echo "where options are:"
> @@ -18,7 +14,9 @@ _help() {
>      echo "    configure            Configure the system  (requires sudo)"
>  }
>  
> -_build() {
> +build() {
> +    $arg_parse
> +
>      if [[ $YES != "y" ]]
>      then
>          echo "Do you want Raisin to automatically install build time 
> dependencies for you? (y/n)"
> @@ -50,7 +48,20 @@ _build() {
>      build_package xen-system
>  }
>  
> -_install() {
> +unraise() {
> +    $arg_parse
> +
> +    for_each_component clean
> +
> +    uninstall_package xen-system
> +    for_each_component unconfigure
> +
> +    rm -rf "$INST_DIR"
> +}
> +
> +install() {
> +    $arg_parse
> +
>      # need single braces for filename matching expansion
>      if [ ! -f xen-sytem*rpm ] && [ ! -f xen-system*deb ]
>      then
> @@ -60,7 +71,9 @@ _install() {
>      install_package xen-system
>  }
>  
> -_configure() {
> +configure() {
> +    $arg_parse
> +
>      if [[ $YES != "y" ]]
>      then
>          echo "Proceeding we'll make changes to the running system,"
> @@ -82,38 +95,3 @@ _configure() {
>      for_each_component configure
>  }
>  
> -# start execution
> -common_init
> -
> -# parameters check
> -export VERBOSE=0
> -export YES="n"
> -export NO_DEPS=0
> -while [[ $# -gt 1 ]]
> -do
> -  if [[ "$1" = "-v" || "$1" = "--verbose" ]]
> -  then
> -    VERBOSE=1
> -    shift 1
> -  elif [[ "$1" = "-y" || "$1" = "--yes" ]]
> -  then
> -    YES="y"
> -    shift 1
> -  else
> -    _help
> -    exit 1
> -  fi
> -done
> -
> -case "$1" in
> -    "build" | "install" | "configure" )
> -        COMMAND=$1
> -        ;;
> -    *)
> -        _help
> -        exit 1
> -        ;;
> -esac

I would move the command line parsing to raise so that it can work
without core.sh.


> -_$COMMAND
> -
> diff --git a/raise b/raise
> index 7f3faae..142956d 100755
> --- a/raise
> +++ b/raise
> @@ -10,6 +10,12 @@ fi
>  
>  # Then as many as the sub-libraries as you need
>  . ${RAISIN_PATH}/core.sh
> +. ${RAISIN_PATH}/common-functions.sh
> +. ${RAISIN_PATH}/git-checkout.sh
> +. ${RAISIN_PATH}/build.sh
> +
> +# Set up basic functionality
> +common_init
>  
>  # And do your own thing rather than running commands
>  # I suggest defining a "main" function of your own and running it like this.
> diff --git a/scripts/mkdeb b/scripts/mkdeb
> index 46ade07..cb2a1b6 100755
> --- a/scripts/mkdeb
> +++ b/scripts/mkdeb
> @@ -35,7 +35,8 @@ mkdir -p deb/opt/raisin
>  cp -r data deb/opt/raisin
>  cp -r components deb/opt/raisin
>  cp -r scripts deb/opt/raisin
> -cp config raise.sh unraise.sh deb/opt/raisin
> +# FIXME
> +#cp config raise.sh unraise.sh deb/opt/raisin

This can be easily fixed by copying lib and raise.

>  
>  # Debian doesn't use /usr/lib64 for 64-bit libraries
> diff --git a/scripts/mkrpm b/scripts/mkrpm
> index c530466..90d9bdc 100755
> --- a/scripts/mkrpm
> +++ b/scripts/mkrpm
> @@ -48,8 +48,9 @@ cp -r "$BASEDIR"/data \$RPM_BUILD_ROOT/opt/raisin
>  cp -r "$BASEDIR"/components \$RPM_BUILD_ROOT/opt/raisin
>  cp -r "$BASEDIR"/scripts \$RPM_BUILD_ROOT/opt/raisin
>  cp "$BASEDIR"/config \$RPM_BUILD_ROOT/opt/raisin
> -cp "$BASEDIR"/raise.sh \$RPM_BUILD_ROOT/opt/raisin
> -cp "$BASEDIR"/unraise.sh \$RPM_BUILD_ROOT/opt/raisin
> +# FIXME
> +# cp "$BASEDIR"/raise.sh \$RPM_BUILD_ROOT/opt/raisin
> +# cp "$BASEDIR"/unraise.sh \$RPM_BUILD_ROOT/opt/raisin

same


>  %clean
>  
> diff --git a/unraise.sh b/unraise.sh
> deleted file mode 100755
> index 50ce310..0000000
> --- a/unraise.sh
> +++ /dev/null
> @@ -1,17 +0,0 @@
> -#!/usr/bin/env bash
> -
> -set -e
> -
> -source config
> -source lib/common-functions.sh
> -
> -
> -# start execution
> -common_init
> -
> -for_each_component clean
> -
> -uninstall_package xen-system
> -for_each_component unconfigure
> -
> -rm -rf "$INST_DIR"
> -- 
> 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®.