diff options
Diffstat (limited to 'project')
-rwxr-xr-x | project | 101 |
1 files changed, 36 insertions, 65 deletions
@@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # # High-level script to manage the project. # Run `./project --help' for a description of how to use it. @@ -66,14 +66,12 @@ print_help() { # Print the output. cat <<EOF Usage: $scriptname configure [OPTIONS] - $scriptname prepare [OPTIONS] $scriptname make [OPTIONS] Top-level script to manage the reproducible project. The high-level operation is defined by the (mandatory) second argument: configure - Configure project for this machine (e.g., build software). - prepare - Low-level preparations to optimize building with 'make'. make - Run the project (do analysis and build outputs). RECOMMENDATION: If this is the first time you are configuring this @@ -146,12 +144,11 @@ func_operation_set() { fi } -while [[ $# -gt 0 ]] +while [ $# -gt 0 ] do case $1 in # Main operation. configure) func_operation_set $1; shift;; - prepare) func_operation_set $1; shift;; make) func_operation_set $1; shift;; @@ -163,8 +160,8 @@ do -e*|--existing-conf=*) on_off_option_error --existing-conf -e;; --host-cc) host_cc=1; shift;; --host-cc=*) on_off_option_error --host-cc;; - -i|--inputdir) input_dir="$2"; check_v "$1" "$input_dir"; shift;shift;; - -i=*|--inputdir=*) input_dir="${1#*=}"; check_v "$1" "$input_dir"; shift;; + -i|--input-dir) input_dir="$2"; check_v "$1" "$input_dir"; shift;shift;; + -i=*|--input-dir=*) input_dir="${1#*=}"; check_v "$1" "$input_dir"; shift;; -i*) input_dir=$(echo "$1" | sed -e's/-i//'); check_v "$1" "$input_dir"; shift;; -m|--minmapsize) minmapsize="$2"; check_v "$1" "$minmapsize"; shift;shift;; -m=*|--minmapsize=*) minmapsize="${1#*=}"; check_v "$1" "$minmapsize"; shift;; @@ -212,8 +209,8 @@ if ! [ x$check_config = x ]; then # Find the color option to pass to `ls'. Note that `--color' (for GNU # Coreutils `ls') should be checked first because it also has `-G', but # for something else. - if ls --color &> /dev/null; then coloropt="--color=auto" - elif ls -G &> /dev/null; then coloropt="-G" + if ls --color 2> /dev/null > /dev/null; then coloropt="--color=auto" + elif ls -G 2> /dev/null > /dev/null; then coloropt="-G" else coloropt="" fi @@ -294,48 +291,10 @@ controlled_env() { -# Error messages -# -------------- -# -# Having the error messages here helps the over-all process be more -# readable. -print_error_abort() { - case $1 in - prepare) - cat <<EOF - -The project isn't configured for this system, or the configuration wasn't -successful. To configure the project, please use this command: - - $ ./project configure - -(TIP: if you have already ran this command once, run it with '-e' to use -the previous configuration, run with '--help' for more info) - -EOF - exit 1; - ;; - make) - cat <<EOF - -The project preparation hasn't been completed, or it wasn't successful. To -prepare the project prior to building it, please use this command: - - $ ./project prepare - -EOF - exit 1; - ;; - esac -} - - - - # Do requested operation # ---------------------- perms="u+r,u+w,g+r,g+w,o-r,o-w,o-x" -configscript=./reproduce/software/bash/configure.sh +configscript=./reproduce/software/shell/configure.sh case $operation in # Build the project's software. @@ -355,7 +314,7 @@ case $operation in # `reproduce/*/bash' should need executable flags, so we are giving # them executable flags by default. If any other file in your project # needs such flags, add them here. - chmod +x reproduce/software/bash/* reproduce/analysis/bash/* + chmod +x reproduce/software/shell/* reproduce/analysis/bash/* # If the user requested, clean the TeX directory from the extra # (to-be-built) directories that may already be there (and will not @@ -398,32 +357,39 @@ case $operation in - # Run the input management. - prepare) + # Run the project. + make) # Make sure the configure script has been completed properly # (`configuration-done.txt' exists). if ! [ -f .build/software/configuration-done.txt ]; then - print_error_abort $operation - fi + cat <<EOF - # Run input-preparations in control environment - controlled_env reproduce/analysis/make/top-prepare.mk - ;; +The project is either (1) not configured on this system, or (2) the +configuration wasn't successful. +(1) If it hasn't been configured at all, use the command below to configure +it (set a build directory and let it build its necessary software in it). + $ ./project configure +(2) If it has been configured, but the configuration failed in a step, you +can re-configure it using your previous settings with the command +below. All successful steps will be skipped, allowing a fast completion. + $ ./project configure -e - # Run the project - make) +If there was a problem, please let us know by filling this online form: + http://savannah.nongnu.org/support/?func=additem&group=reproduce - # Make sure the configure script has been completed properly - # (`configuration-done.txt' exists). - if ! [ -f .build/software/preparation-done.mk ]; then - print_error_abort $operation +EOF + exit 1 fi + # Run input-preparations (optionally build Makefiles with special + # values for optimizing the main `top-make.mk'). + controlled_env reproduce/analysis/make/top-prepare.mk + # Run the actual project. controlled_env reproduce/analysis/make/top-make.mk ;; @@ -434,9 +400,14 @@ case $operation in # Operation not specified. *) - echo "No operation defined." - echo "Please run with '--help' for more information." - echo "Available operations are: 'configure', 'prepare', or 'make')." + cat <<EOF + +No operation defined! + +Please run with '--help' for more information. +(TIP: available operations are: 'configure' or 'make'). + +EOF exit 1 ;; esac |