diff --git a/INSTALL b/INSTALL index ad548dc..fbf3bb3 100755 --- a/INSTALL +++ b/INSTALL @@ -1,30 +1,29 @@ -#!/bin/bash +#!/usr/bin/env bash # Script to install required external packages -# Get the OS -OS=$(uname -s) - # Set location of WFM -WFM_DIR=$(pwd) - -# Set location where tarfiles for packages are kept -TAR_DIR=${WFM_DIR}/tarfiles +WFM_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) -# Set location where packages are built -BUILD_DIR=${WFM_DIR}/build - -# Set the location where libraries are installed -LIB_DIR=${WFM_DIR}/lib +# Set the location where gem dependencies are installed +GEM_DIR=${WFM_DIR}/gems # Process arguments for arg in $@; do case $arg in --with-ruby=*) RUBY=$(echo $arg | cut -f 2 -d "=")/bin/ruby;; + --with-xml2-dir=*) xml2dir=$(echo $arg | cut -f 2 -d "=");; + --with-xml2-include=*) xml2include=$(echo $arg | cut -f 2 -d "=");; + --with-xml2-config=*) xml2config=$(echo $arg | cut -f 2 -d "=");; + --with-xml2-lib=*) xml2lib=$(echo $arg | cut -f 2 -d "=");; -h|--help) echo echo "Run this script to install the Workflow Manager" echo - echo "INSTALL [--with-ruby=/path/to/ruby]" + echo 'INSTALL [--with-ruby=/path/to/ruby]' + echo '[--with-xml2-dir=/path/to/${xml2-dir}]' + echo '[--with-xml2-include=/path/to/${xml2-dir}/include]' + echo '[--with-xml2-config=/path/to/xml2-config]' + echo '[--with-xml2-lib=/path/to/${xml2-dir}/lib]' echo exit;; *) @@ -48,13 +47,34 @@ else exit 1 fi +GEM_ARGS="" +# Check whether libxml2 headers, libs, and xml2-config are defined +# xml2dir +if [[ -n "$xml2dir" && -d "$xml2dir" ]]; then + GEM_ARGS+=" --with-xml2-dir="$xml2dir + [[ -z "${xml2include+x}" || ! -d "${xml2include}" ]] && xml2include=${xml2dir}/include + [[ -z "${xml2lib+x}" || ! -d "${xml2lib}" ]] && xml2lib=${xml2dir}/lib + [[ -z "${xml2config+x}" || ! -d "${xml2config}" ]] && xml2config=${xml2dir}/bin/xml2-config +fi +# Add configuration options if they are set: +if [[ -n "${xml2include}" && -d "${xml2include}" ]]; then + GEM_ARGS+=" --with-xml2-include="$xml2include +fi + +if [[ -n "${xml2lib}" && -d "${xml2lib}" ]]; then + GEM_ARGS+=" --with-xml2-lib="$xml2lib +fi + +if [[ -n "${xml2config}" && -f "${xml2config}" ]]; then + GEM_ARGS+=" --with-xml2-config="$xml2config +fi # Abort if any command returns an error set -e -# Make sure ruby is at least 2.4.0 or higher -good_ruby=$($RUBY -e "puts RUBY_VERSION >= '2.4.0'") +# Make sure ruby is at least 3.0.0 or higher +good_ruby=$($RUBY -e "puts RUBY_VERSION >= '3.0.0'") if [ "$good_ruby" = "false" ]; then - echo "Ruby 2.4.0 or higher is required" + echo "Ruby 3.0.0 or higher is required" exit 1 fi @@ -67,147 +87,16 @@ for file in $(ls sbin | grep -v '\.sh'); do fi # Replace first line with correct shebang - sed "1s:.*:#!${RUBY}:" sbin/$file > sbin/$file.new - mv sbin/$file.new sbin/$file - - # Add path to libxml2 for AIX - if [ "$OS" = "AIX" ]; then - sed "2s%.*%ENV['LIBPATH']=\"${LIB_DIR}/libxml2/lib:#{ENV['LIBPATH']}\"%" sbin/$file > sbin/$file.new - mv sbin/$file.new sbin/$file - fi - - # Make sure the new file is executable - chmod ugo+x sbin/$file + sed "1s:.*:#!${RUBY}:" -i sbin/$file done -# Package versions -LIBXML2_VERSION="2.12.6" -LIBXML_RUBY_VERSION="5.0.3" -SYSTEMTIMER_VERSION="1.2.3" -SQLITE3_VERSION="autoconf-3450300" -SQLITE3_RUBY_VERSION="1.7.3" -OPEN4_VERSION="1.3.4" -RUBYSL_DATE_VERSION="2.0.9" -RUBYSL_PARSEDATE_VERSION="1.0.1" -THREAD_VERSION="0.2.2" - -# Set AIX_CFLAGS and AIX_LDFLAGS -if [ "$OS" = "AIX" ]; then - AIX_CFLAGS="-maix64 -g0" - AIX_LDFLAGS="-maix64 -g0" -else - AIX_CFLAGS="" - AIX_LDFLAGS="" -fi - -# Create the build directory -mkdir -p ${BUILD_DIR} - -# Install rubysl-date -echo "===========================================" -echo "= INSTALLING rubysl-date" -echo "===========================================" -cd ${LIB_DIR} -gunzip -c ${TAR_DIR}/rubysl-date-${RUBYSL_DATE_VERSION}.tar.gz | tar -xvf - -rm -rf rubysl-date -mv rubysl-date-${RUBYSL_DATE_VERSION} rubysl-date - -# Install rubysl-parsedate -echo "===========================================" -echo "= INSTALLING rubysl-parsedate" -echo "===========================================" -cd ${LIB_DIR} -gunzip -c ${TAR_DIR}/rubysl-parsedate-${RUBYSL_PARSEDATE_VERSION}.tar.gz | tar -xvf - -rm -rf rubysl-parsedate -mv rubysl-parsedate-${RUBYSL_PARSEDATE_VERSION} rubysl-parsedate - -# Install Open4 -echo "===========================================" -echo "= INSTALLING Open4" -echo "===========================================" -cd ${LIB_DIR} -gunzip -c ${TAR_DIR}/open4-${OPEN4_VERSION}.tar.gz | tar -xvf - -rm -rf open4 -mv open4-${OPEN4_VERSION} open4 - -# Install libxml2 -echo "===========================================" -echo "= INSTALLING libxml2 =" -echo "===========================================" -cd ${BUILD_DIR} -unxz -c ${TAR_DIR}/libxml2-${LIBXML2_VERSION}.tar.xz | tar -xvf - -cd libxml2-${LIBXML2_VERSION} -if [ "$LIBXML2_VERSION" = "2.9.0" ]; then # version 2.9.0 requires must be patched - echo "===========================================" - echo "= PATCHING libxml2 =" - echo "===========================================" - patch -p1 -i ${TAR_DIR}/libxml2-2.9.0.patch -fi -export OBJECT_MODE=64 -./configure --prefix=${LIB_DIR}/libxml2 CFLAGS="$AIX_CFLAGS" LDFLAGS="$AIX_LDFLAGS" --without-python -make clean -make -rm -rf ${LIB_DIR}/libxml2 -make install - -# Install libxml-ruby -echo "===========================================" -echo "= INSTALLING libxml-ruby =" -echo "===========================================" -libxml2_opts="--with-xml2-lib=${LIB_DIR}/libxml2/lib --with-xml2-include=${LIB_DIR}/libxml2/include/libxml2" -cd ${BUILD_DIR} -gunzip -c ${TAR_DIR}/libxml-ruby-${LIBXML_RUBY_VERSION}.tar.gz | tar -xvf - -cd libxml-ruby-${LIBXML_RUBY_VERSION}/ext/libxml -echo ${RUBY} extconf.rb $libxml2_opts -${RUBY} extconf.rb $libxml2_opts -if [ "$OS" = "AIX" ]; then - : -else - sed -i "/^ldflags/ s:$: -Wl,-rpath,${LIB_DIR}/libxml2/lib:" Makefile -fi -make clean -make -rm -rf ${LIB_DIR}/libxml-ruby -mkdir ${LIB_DIR}/libxml-ruby -cp -r ${BUILD_DIR}/libxml-ruby-${LIBXML_RUBY_VERSION}/lib/* ${LIB_DIR}/libxml-ruby -cp libxml_ruby.so ${LIB_DIR}/libxml-ruby - -# Install sqlite3 -echo "===========================================" -echo "= INSTALLING sqlite3 =" -echo "===========================================" -cd ${BUILD_DIR} -unxz -c ${TAR_DIR}/sqlite-${SQLITE3_VERSION}.tar.xz | tar -xvf - -cd sqlite-${SQLITE3_VERSION} -./configure --prefix=${LIB_DIR}/sqlite3 CFLAGS="-Os -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_THREADSAFE=1 $AIX_CFLAGS $AIX_CFLAGS" LD_FLAGS="$AIX_LDFLAGS" -make clean -make -rm -rf ${LIB_DIR}/sqlite3 -make install - -# Install sqlite3-ruby -echo "===========================================" -echo "= INSTALLING sqlite3-ruby =" -echo "===========================================" -cd ${BUILD_DIR} -gunzip -c ${TAR_DIR}/sqlite3-ruby-${SQLITE3_RUBY_VERSION}.tar.gz | tar -xvf - -cd sqlite3-ruby-${SQLITE3_RUBY_VERSION}/ext/sqlite3 -export LD_RUN_PATH=${LIB_DIR}/sqlite3/lib -${RUBY} extconf.rb -- --with-sqlite3-include=${LIB_DIR}/sqlite3/include --with-sqlite3-lib=${LIB_DIR}/sqlite3/lib --enable-system-libraries -make clean -make -rm -rf ${LIB_DIR}/sqlite3-ruby -mkdir ${LIB_DIR}/sqlite3-ruby -cp -r ${BUILD_DIR}/sqlite3-ruby-${SQLITE3_RUBY_VERSION}/lib/* ${LIB_DIR}/sqlite3-ruby -cp sqlite3_native.so ${LIB_DIR}/sqlite3-ruby/sqlite3 -unset LDFLAGS - -# Insteall thread -echo "===========================================" -echo "= INSTALLING Thread" -echo "===========================================" -cd ${LIB_DIR} -gunzip -c ${TAR_DIR}/thread-${THREAD_VERSION}.tar.gz | tar -xvf - -rm -rf thread -mv thread-${THREAD_VERSION} thread +# Install gem dependencies into local gem repository +gem install -i ${GEM_DIR} --no-user-install --no-document \ + open4:1.3.4 \ + rubysl-date:1.0.1 \ + rubysl-parsedate:1.0.1 \ + sqlite3:1.7.3 \ + thread:0.2.2 \ + libxml-ruby:5.0.3 \ + -- $GEM_ARGS diff --git a/lib/workflowmgr/workflowdoc.rb b/lib/workflowmgr/workflowdoc.rb index f865909..e0df337 100644 --- a/lib/workflowmgr/workflowdoc.rb +++ b/lib/workflowmgr/workflowdoc.rb @@ -14,7 +14,7 @@ class WorkflowXMLDoc require 'time' - require 'libxml-ruby/libxml' + require 'libxml' require 'workflowmgr/utilities' require 'workflowmgr/cycledef' require 'workflowmgr/workflowlog' diff --git a/lib/workflowmgr/workflowio.rb b/lib/workflowmgr/workflowio.rb index 5aa28eb..b6a0150 100644 --- a/lib/workflowmgr/workflowio.rb +++ b/lib/workflowmgr/workflowio.rb @@ -13,7 +13,7 @@ module WorkflowMgr class WorkflowIO require 'fileutils' - require 'libxml-ruby/libxml' + require 'libxml' ########################################## diff --git a/sbin/rocotoboot.rb b/sbin/rocotoboot.rb index 3cb2927..e5edf98 100755 --- a/sbin/rocotoboot.rb +++ b/sbin/rocotoboot.rb @@ -3,15 +3,12 @@ # Get the base directory of the WFM installation __WFMDIR__=File.expand_path("../../",__FILE__) -# Add include paths for WFM and libxml-ruby libraries +# Add include paths for WFM and gem dependencies $:.unshift("#{__WFMDIR__}/lib") -$:.unshift("#{__WFMDIR__}/lib/rubysl-date/lib") -$:.unshift("#{__WFMDIR__}/lib/rubysl-parsedate/lib") -$:.unshift("#{__WFMDIR__}/lib/libxml-ruby") -$:.unshift("#{__WFMDIR__}/lib/sqlite3-ruby") -$:.unshift("#{__WFMDIR__}/lib/SystemTimer") -$:.unshift("#{__WFMDIR__}/lib/open4/lib") -$:.unshift("#{__WFMDIR__}/lib/thread/lib") +Dir["#{__WFMDIR__}/gems/gems/*"].each do |gemdir| + next if gemdir == "." or gemdir == ".." + $:.unshift("#{gemdir}/lib") +end # Load workflow status library require 'workflowmgr/workflowengine' diff --git a/sbin/rocotocheck.rb b/sbin/rocotocheck.rb index 9840c5a..98d6f2e 100755 --- a/sbin/rocotocheck.rb +++ b/sbin/rocotocheck.rb @@ -3,15 +3,12 @@ # Get the base directory of the WFM installation __WFMDIR__=File.expand_path("../../",__FILE__) -# Add include paths for WFM and libxml-ruby libraries +# Add include paths for WFM and gem dependencies $:.unshift("#{__WFMDIR__}/lib") -$:.unshift("#{__WFMDIR__}/lib/rubysl-date/lib") -$:.unshift("#{__WFMDIR__}/lib/rubysl-parsedate/lib") -$:.unshift("#{__WFMDIR__}/lib/libxml-ruby") -$:.unshift("#{__WFMDIR__}/lib/sqlite3-ruby") -$:.unshift("#{__WFMDIR__}/lib/SystemTimer") -$:.unshift("#{__WFMDIR__}/lib/open4/lib") -$:.unshift("#{__WFMDIR__}/lib/thread/lib") +Dir["#{__WFMDIR__}/gems/gems/*"].each do |gemdir| + next if gemdir == "." or gemdir == ".." + $:.unshift("#{gemdir}/lib") +end # Load workflow status library require 'wfmstat/statusengine' diff --git a/sbin/rocotocomplete.rb b/sbin/rocotocomplete.rb index 92b6154..b58e6f5 100755 --- a/sbin/rocotocomplete.rb +++ b/sbin/rocotocomplete.rb @@ -3,15 +3,12 @@ # Get the base directory of the WFM installation __WFMDIR__=File.expand_path("../../",__FILE__) -# Add include paths for WFM and libxml-ruby libraries +# Add include paths for WFM and gem dependencies $:.unshift("#{__WFMDIR__}/lib") -$:.unshift("#{__WFMDIR__}/lib/rubysl-date/lib") -$:.unshift("#{__WFMDIR__}/lib/rubysl-parsedate/lib") -$:.unshift("#{__WFMDIR__}/lib/libxml-ruby") -$:.unshift("#{__WFMDIR__}/lib/sqlite3-ruby") -$:.unshift("#{__WFMDIR__}/lib/SystemTimer") -$:.unshift("#{__WFMDIR__}/lib/open4/lib") -$:.unshift("#{__WFMDIR__}/lib/thread/lib") +Dir["#{__WFMDIR__}/gems/gems/*"].each do |gemdir| + next if gemdir == "." or gemdir == ".." + $:.unshift("#{gemdir}/lib") +end # Load workflow status library require 'workflowmgr/workflowengine' diff --git a/sbin/rocotorewind.rb b/sbin/rocotorewind.rb index 4808efe..a6d3ede 100755 --- a/sbin/rocotorewind.rb +++ b/sbin/rocotorewind.rb @@ -3,15 +3,12 @@ # Get the base directory of the WFM installation __WFMDIR__=File.expand_path("../../",__FILE__) -# Add include paths for WFM and libxml-ruby libraries +# Add include paths for WFM and gem dependencies $:.unshift("#{__WFMDIR__}/lib") -$:.unshift("#{__WFMDIR__}/lib/rubysl-date/lib") -$:.unshift("#{__WFMDIR__}/lib/rubysl-parsedate/lib") -$:.unshift("#{__WFMDIR__}/lib/libxml-ruby") -$:.unshift("#{__WFMDIR__}/lib/sqlite3-ruby") -$:.unshift("#{__WFMDIR__}/lib/SystemTimer") -$:.unshift("#{__WFMDIR__}/lib/open4/lib") -$:.unshift("#{__WFMDIR__}/lib/thread/lib") +Dir["#{__WFMDIR__}/gems/gems/*"].each do |gemdir| + next if gemdir == "." or gemdir == ".." + $:.unshift("#{gemdir}/lib") +end # Load workflow engine library require 'workflowmgr/workflowengine' diff --git a/sbin/rocotorun.rb b/sbin/rocotorun.rb index 2e3034c..e7ca165 100755 --- a/sbin/rocotorun.rb +++ b/sbin/rocotorun.rb @@ -3,15 +3,12 @@ # Get the base directory of the WFM installation __WFMDIR__=File.expand_path("../../",__FILE__) -# Add include paths for WFM and libxml-ruby libraries +# Add include paths for WFM and gem dependencies $:.unshift("#{__WFMDIR__}/lib") -$:.unshift("#{__WFMDIR__}/lib/rubysl-date/lib") -$:.unshift("#{__WFMDIR__}/lib/rubysl-parsedate/lib") -$:.unshift("#{__WFMDIR__}/lib/libxml-ruby") -$:.unshift("#{__WFMDIR__}/lib/sqlite3-ruby") -$:.unshift("#{__WFMDIR__}/lib/SystemTimer") -$:.unshift("#{__WFMDIR__}/lib/open4/lib") -$:.unshift("#{__WFMDIR__}/lib/thread/lib") +Dir["#{__WFMDIR__}/gems/gems/*"].each do |gemdir| + next if gemdir == "." or gemdir == ".." + $:.unshift("#{gemdir}/lib") +end # Load workflow engine library require 'workflowmgr/workflowengine' diff --git a/sbin/rocotoserver b/sbin/rocotoserver index 1a293b9..8f7ee4c 100755 --- a/sbin/rocotoserver +++ b/sbin/rocotoserver @@ -3,15 +3,12 @@ # Get the base directory of the WFM installation __WFMDIR__=File.expand_path("../../",__FILE__) -# Add include paths for WFM and libxml-ruby libraries +# Add include paths for WFM and gem dependencies $:.unshift("#{__WFMDIR__}/lib") -$:.unshift("#{__WFMDIR__}/lib/rubysl-date/lib") -$:.unshift("#{__WFMDIR__}/lib/rubysl-parsedate/lib") -$:.unshift("#{__WFMDIR__}/lib/libxml-ruby") -$:.unshift("#{__WFMDIR__}/lib/sqlite3-ruby") -$:.unshift("#{__WFMDIR__}/lib/SystemTimer") -$:.unshift("#{__WFMDIR__}/lib/open4/lib") -$:.unshift("#{__WFMDIR__}/lib/thread/lib") +Dir["#{__WFMDIR__}/gems/gems/*"].each do |gemdir| + next if gemdir == "." or gemdir == ".." + $:.unshift("#{gemdir}/lib") +end # Load workflow engine library require 'tmpdir' diff --git a/sbin/rocotostat.rb b/sbin/rocotostat.rb index f59a271..eb41a64 100755 --- a/sbin/rocotostat.rb +++ b/sbin/rocotostat.rb @@ -3,15 +3,12 @@ # Get the base directory of the WFM installation __WFMDIR__=File.expand_path("../../",__FILE__) -# Add include paths for WFM and libxml-ruby libraries +# Add include paths for WFM and gem dependencies $:.unshift("#{__WFMDIR__}/lib") -$:.unshift("#{__WFMDIR__}/lib/rubysl-date/lib") -$:.unshift("#{__WFMDIR__}/lib/rubysl-parsedate/lib") -$:.unshift("#{__WFMDIR__}/lib/libxml-ruby") -$:.unshift("#{__WFMDIR__}/lib/sqlite3-ruby") -$:.unshift("#{__WFMDIR__}/lib/SystemTimer") -$:.unshift("#{__WFMDIR__}/lib/open4/lib") -$:.unshift("#{__WFMDIR__}/lib/thread/lib") +Dir["#{__WFMDIR__}/gems/gems/*"].each do |gemdir| + next if gemdir == "." or gemdir == ".." + $:.unshift("#{gemdir}/lib") +end # Load workflow status library require 'wfmstat/statusengine' diff --git a/sbin/rocotovacuum.rb b/sbin/rocotovacuum.rb index bb70508..d589111 100755 --- a/sbin/rocotovacuum.rb +++ b/sbin/rocotovacuum.rb @@ -3,15 +3,12 @@ # Get the base directory of the WFM installation __WFMDIR__=File.expand_path("../../",__FILE__) -# Add include paths for WFM and libxml-ruby libraries +# Add include paths for WFM and gem dependencies $:.unshift("#{__WFMDIR__}/lib") -$:.unshift("#{__WFMDIR__}/lib/rubysl-date/lib") -$:.unshift("#{__WFMDIR__}/lib/rubysl-parsedate/lib") -$:.unshift("#{__WFMDIR__}/lib/libxml-ruby") -$:.unshift("#{__WFMDIR__}/lib/sqlite3-ruby") -$:.unshift("#{__WFMDIR__}/lib/SystemTimer") -$:.unshift("#{__WFMDIR__}/lib/open4/lib") -$:.unshift("#{__WFMDIR__}/lib/thread/lib") +Dir["#{__WFMDIR__}/gems/gems/*"].each do |gemdir| + next if gemdir == "." or gemdir == ".." + $:.unshift("#{gemdir}/lib") +end # Load workflow status library require 'workflowmgr/workflowengine' diff --git a/tarfiles/libxml-ruby-5.0.3.tar.gz b/tarfiles/libxml-ruby-5.0.3.tar.gz deleted file mode 100644 index 00b3cb5..0000000 Binary files a/tarfiles/libxml-ruby-5.0.3.tar.gz and /dev/null differ diff --git a/tarfiles/libxml2-2.12.6.tar.xz b/tarfiles/libxml2-2.12.6.tar.xz deleted file mode 100644 index 201b4c8..0000000 Binary files a/tarfiles/libxml2-2.12.6.tar.xz and /dev/null differ diff --git a/tarfiles/open4-1.3.4.tar.gz b/tarfiles/open4-1.3.4.tar.gz deleted file mode 100644 index a98c41d..0000000 Binary files a/tarfiles/open4-1.3.4.tar.gz and /dev/null differ diff --git a/tarfiles/rubysl-date-2.0.9.tar.gz b/tarfiles/rubysl-date-2.0.9.tar.gz deleted file mode 100644 index a98cd99..0000000 Binary files a/tarfiles/rubysl-date-2.0.9.tar.gz and /dev/null differ diff --git a/tarfiles/rubysl-parsedate-1.0.1.tar.gz b/tarfiles/rubysl-parsedate-1.0.1.tar.gz deleted file mode 100644 index 83a38b9..0000000 Binary files a/tarfiles/rubysl-parsedate-1.0.1.tar.gz and /dev/null differ diff --git a/tarfiles/sqlite-autoconf-3450300.tar.xz b/tarfiles/sqlite-autoconf-3450300.tar.xz deleted file mode 100644 index bb01d21..0000000 Binary files a/tarfiles/sqlite-autoconf-3450300.tar.xz and /dev/null differ diff --git a/tarfiles/sqlite3-ruby-1.7.3.tar.gz b/tarfiles/sqlite3-ruby-1.7.3.tar.gz deleted file mode 100644 index 1a5bfcd..0000000 Binary files a/tarfiles/sqlite3-ruby-1.7.3.tar.gz and /dev/null differ diff --git a/tarfiles/thread-0.2.2.tar.gz b/tarfiles/thread-0.2.2.tar.gz deleted file mode 100644 index 27221e8..0000000 Binary files a/tarfiles/thread-0.2.2.tar.gz and /dev/null differ