logo       
Google Custom Search
    AddThis Social Bookmark Button

Re: [PATCH 2/12] Crucible patches from ILM: msg#00050

Subject: Re: [PATCH 2/12] Crucible patches from ILM
Applied, thanks!

On Wed, Sep 13, 2006 at 12:29:59PM -0700, Bryce Harrington wrote:
> --- ../../crucible/scripts/package_installer  2006-08-31 15:33:43.000000000 
> -0700
> +++ package_installer 2006-08-07 16:45:56.000000000 -0700
> @@ -4,9 +4,13 @@
>  # arbitrary software packages.  Each step in the process is implemented
>  # as a function that can be overridden in a *.fns file.
>  
> +### ELI: added to make work properly:
> +[ -f /san/dept/srd/benchmarks/pkg/CRUCIBLE/local.cfg ] && . 
> /san/dept/srd/benchmarks/pkg/CRUCIBLE/local.cfg
> +
> +
>  usage() {
>      cat <<EOF
> -Usage:  $0 [-vfnb] [-l <LOG_DIR>] [-p <PATCH>] [-t <TARGET_DIR>] <PACKAGE>
> +Usage:  $0 [-v] [-f] [-n] [-l <LOG_DIR>] [-p <PATCH>] [-t <TARGET_DIR>] 
> <PACKAGE>
>  
>  PACKAGE should be resolvable to the full package directory path.
>  Multiple patches can be specified in application order via multiple -p's.
> @@ -20,19 +24,26 @@
>      exit $1
>  }
>  
> -PATH=$PATH:/testing/usr/bin
>  log_dir=${LOG_DIR:-"."}
> -all_packages="/testing/packages"
> +###all_packages="/testing/packages"
> +all_packages="/${BASE_DIR}/packages"
> +
> +
> +
> +declare -a patch_list
>  target_dir=${TARGET_DIR:-"/usr/src"}
> +#target_dir=${TARGET_DIR:-"${BUILD_BASE}"}
>  verbose=${VERBOSE:-""}
>  
> -while getopts ":l:p:t:fnvb" opt; do
> +#ELI:
> +echo "/// TARGET_DIR = $TARGET_DIR , all_packages = $all_packages "
> +
> +while getopts ":l:p:t:fnv" opt; do
>      case $opt in
>      l ) log_dir=$OPTARG ;;
> -    p ) patch_list="$patch_list $OPTARG" ;;
> +    p ) patch_list[${#patches[*]}]=$OPTARG ;;
>      t ) target_dir=$OPTARG ;;
>      f ) force=1 ;;
> -    b ) no_build=1 ;;
>      n ) no_install=1 ;;
>      v ) verbose="-v" ;;
>      \? ) usage 1 ;;
> @@ -40,7 +51,16 @@
>  done
>  shift `expr $OPTIND - 1`
>  
> -[ "$1" ] || usage
> +if [ -z "$target_dir" ]; then
> +    echo "Error:  Target directory (e.g. /usr/src) not specified."
> +fi
> +
> +if [ -z "$1" ]; then
> +    usage
> +    exit -1
> +fi
> +
> +# Determine the package directory
>  pkg=$1
>  
>  # if pkg isn't found, try to lookup latest version
> @@ -50,45 +70,72 @@
>      echo "$all_packages/$pkg found, attempting to get latest"
>      if [ -f $all_packages/$pkg/LATEST ]; then
>        version=`head -n1 $all_packages/$pkg/LATEST`
> -      patch_list="`cat $all_packages/$pkg/LATEST | grep -vx \$version` 
> $patch_list"
> +      patch_list=`cat $all_packages/$pkg/LATEST | grep -vx \$version`
> +      #pkg="$all_packages/$pkg/$pkg-$version"
>        pkg=`ls -dt $all_packages/$pkg/$pkg*$version.* | head -n 1`
> +    elif [ -e $all_packages/$pkg/current ]; then
> +      current=`ls -l $all_packages/$pkg/current | awk '{print $11}'`
> +      pkg="$all_packages/$pkg/$current"
> +    else
> +      echo "Error:  Failed to determine current $pkg"
> +      exit 1
>      #else
>      #  pkg=`ls -t $all_packages/$pkg/* | head -n1`
>      fi
> +  else
> +    echo "Error:  No such package $pkg."
> +    exit 1
>    fi
>  fi
>  
> -# Exit if still no valid package
> -[ ! -f $pkg ] && echo "Error:  No such package $pkg." && exit 1
> -
>  pkg_version=${PKG_VERSION:-`basename $pkg`}
>  pkg_name=${PKG_NAME:-`basename ${pkg%/$pkg_version}`}
> -target_name=`echo $pkg_version | sed 's/\.gz//; s/\.tgz//; s/\.bz2//; 
> s/\.tar//'`
>  pkg_dir=${pkg%/$pkg_name/$pkg_version}
>  echo "pkg_dir: $pkg_dir"
>  
>  # if package is a patch, find base package to apply to
> -if ( echo $pkg_version | egrep 'dif+$|patch' >/dev/null ); then
> +if ( echo $pkg_version | grep -e 'dif$' -e 'diff$' >/dev/null ); then
>    echo "This looks like a patch.  Attempting to find base package..."
> -  target_name=`echo $target_name | sed 's/^patch-/linux-/; s/\.dif\+$//; 
> s/\.patch$//'`
> -  #patch_list=$pkg_version
> -  patch_list="$pkg_version $patch_list"
> -  pkg=`package_base $pkg`
> -  [ $? -ne 0 ] && echo "ERROR: no package found" && exit 10
> +  patch_list=$pkg_version
> +  fields=`echo $pkg_version | grep -o '-' | wc -l`
> +  found=0
> +  while [ $fields -gt 0 ] && [ $found -lt 1 ]; do
> +    base=`echo $pkg_version | cut -d '-' -f 1-$fields`
> +    for ext in tar.gz tar.bz2 tgz tar; do
> +      echo "Trying $pkg_dir/$pkg_name/$base.$ext ..."
> +      if [ -f "$pkg_dir/$pkg_name/$base.$ext" ]; then
> +        pkg_version="$base.$ext"
> +     pkg="$pkg_dir/$pkg_name/$base.$ext"
> +     found=1
> +        echo "Found $pkg_version!"
> +        break
> +      fi
> +    done
> +    let fields=$fields-1
> +  done 
> +  [ ! $found ] && echo "ERROR: no package found" && exit 10
>  fi
>  
> -
>  echo "Installing '$pkg_name' '$pkg_version'"
>  
> -# Sanity check
> -[ ! -d $target_dir ] && echo "ERROR:  Dir $target_dir not found." && exit -10
> -[ ! -w $target_dir ] && echo "ERROR:  Dir $target_dir not writeable." && 
> exit -12
> -[ ! -d $pkg_dir/$pkg_name ] && echo "ERROR:  $pkg_dir/$pkg_name not found." 
> && exit -20
> +if [ ! -d $target_dir ]; then
> +    echo "ERROR:  Source code directory '$target_dir' does not exist."
> +    exit -10
> +elif [ ! -w $target_dir ]; then
> +    echo "ERROR:  Source code directory '$target_dir' is not writeable."
> +    exit -12
> +fi
>  
>  # Set up the default function implementations
>  echo "source $pkg_dir/package.fns"
> +[ -f $pkg_dir/package.fns ] || echo "// WARNING: $pkg_dir/package.fns NOT 
> FOUND "
>  source $pkg_dir/package.fns
>  
> +if [ ! -d $pkg_dir/$pkg_name/ ]; then
> +    echo "ERROR:  $pkg_dir/$pkg_name does not exist."
> +    exit -20
> +fi
> +
>  # Verify the log directory exists
>  if [ ! -d $log_dir ]; then
>      if [ "x$log_dir" != "x/dev/stdout" ]; then
> @@ -127,9 +174,12 @@
>  echo >> $logfile
>  
>  echo "### UNPACK ###" >> $logfile
> -echo "action_unpack $pkg $target_dir $target_name"
> -action_unpack "$pkg" "$target_dir" "$target_name" "$force" >> $logfile 2>&1
> +echo "action_unpack $pkg $target_dir $force >> $logfile "
> +#echo "// LISTING function action_unpack: "
> +declare -f action_unpack > /dev/null || echo "// WARNING: action_unpack not 
> found! "
> +action_unpack "$pkg" "$target_dir" "$force" >> $logfile 2>&1
>  err=$?
> +echo "// action_unpack DONE, exit code == $err "
>  pkg_location="$ACTION_RESULT"
>  if [ $err -eq 50 ]; then
>      echo "WARNING($err):  Directory already exists."
> @@ -143,51 +193,64 @@
>      exit -31
>  fi
>  
> -if [ "$patch_list" ]; then
> +if [ ! -z "$patch_list" ]; then
>      echo "### PATCH ###" >> $logfile
>      echo "action_patch"
>      action_patch "$pkg_dir/$pkg_name" "$pkg_location" "$patch_list" >> 
> $logfile 2>&1
>      err=$?
> -    [ $err -ne 0 ] && echo "ERROR($err): Failed to patch $pkg_location" && 
> exit -40
> +    if [ $err -ne 0 ]; then
> +        echo "ERROR($err): Failed to patch $pkg_location"
> +        exit -40
> +    fi
>      echo >> $logfile
>  fi
>  
>  cd $pkg_location
>  err=$?
> -[ $err -ne 0 ] && echo "ERROR($err):  Could not chdir to '$pkg_location'" && 
> exit -22
> -
> -# Exit here if No Build was requested
> -[ $no_build ] && echo "No Build requested." && exit 0
> +if [ $err -ne 0 ]; then
> +    echo "ERROR($err):  Could not chdir to '$pkg_location'"
> +    exit -22
> +fi
>  
>  echo "### CONFIGURE ###" >> $logfile
>  echo "action_configure $pkg_location"
>  action_configure "$pkg_location" >> $logfile 2>&1
>  err=$?
> -[ $err -ne 0 ] && echo "ERROR($err): Failed to configure $pkg_location" && 
> exit -50
> +if [ $err -ne 0 ]; then
> +    echo "ERROR($err): Failed to configure $pkg_location"
> +    exit -50
> +fi
>  echo >> $logfile
>  
>  echo "### BUILD ###" >> $logfile
>  echo "action_build"
>  action_build >> $logfile 2>&1
>  err=$?
> -[ $err -ne 0 ] && echo "ERROR($err): Failed to build $pkg_location" && exit 
> -60
> +if [ $err -ne 0 ]; then
> +    echo "ERROR($err): Failed to build $pkg_location"
> +    exit -60
> +fi
>  echo >> $logfile
>  
>  ### CHECK ###
>  echo "action_check"
>  action_check >> $logfile 2>&1
>  err=$?
> -[ $err -ne 0 ] && echo "ERROR($err): Failed to check $pkg_location"
> +if [ $err -ne 0 ]; then
> +    echo "ERROR($err): Failed to check $pkg_location"
> +fi
>  echo >> $logfile
>  
> -# Exit here if No Install was requested
> -[ $no_install ] && echo "No Install requested." && exit 0
> -
> -### INSTALL ###
> -echo "action_install"
> -action_install >> $logfile 2>&1
> -err=$?
> -[ $err -ne 0 ] && echo "ERROR($err): Failed to install $pkg_location" && 
> exit -70
> -echo >> $logfile
> +if [ ! $no_install ]; then
> +    ### INSTALL ###
> +    echo "action_install"
> +    action_install >> $logfile 2>&1
> +    err=$?
> +    if [ $err -ne 0 ]; then
> +        echo "ERROR($err): Failed to install $pkg_location"
> +        exit -70
> +    fi
> +    echo >> $logfile
> +fi
>  
>  exit 0
> 
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Crucible-devel mailing list
> Crucible-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@xxxxxxxxxxxxxxxx
> https://lists.sourceforge.net/lists/listinfo/crucible-devel

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV



Try Searching:
servers, voip, java, networking, microsoft ...
<Prev in Thread] Current Thread [Next in Thread>