aboutsummaryrefslogtreecommitdiff
path: root/project
diff options
context:
space:
mode:
Diffstat (limited to 'project')
-rwxr-xr-xproject157
1 files changed, 92 insertions, 65 deletions
diff --git a/project b/project
index 51274eb..e2d4c66 100755
--- a/project
+++ b/project
@@ -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.
@@ -33,9 +33,11 @@ host_cc=0
operation=
build_dir=
input_dir=
+check_config=
make_targets=
software_dir=
clean_texdir=0
+prepare_redo=0
existing_conf=0
scriptname="./project"
minmapsize=10000000000
@@ -65,14 +67,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
@@ -97,6 +97,7 @@ Configure options:
-i, --input-dir=STR Directory containing input datasets (optional).
-m, --minmapsize=INT [Gnuastro] Minimum number of bytes to use RAM.
-s, --software-dir=STR Directory containing necessary software tarballs.
+ --check-config During configuration, show what is being built.
--clean-texdir Remove possibly existing build-time subdirectories
under the project's 'tex/' directory (can happen
when source is from arXiv for example).
@@ -108,6 +109,7 @@ Configure and Make options:
Make options:
-d, --debug=FLAGS Print various types of debugging information.
+ -p, --prepare-redo Re-do preparation (only done automatically once).
Mandatory or optional arguments to long options are also mandatory or optional
for any corresponding short options.
@@ -144,12 +146,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;;
@@ -161,8 +162,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;;
@@ -170,6 +171,8 @@ do
-s|--software-dir) software_dir="$2"; check_v "$1" "$software_dir"; shift;shift;;
-s=*|--software-dir=*) software_dir="${1#*=}"; check_v "$1" "$software_dir"; shift;;
-s*) software_dir=$(echo "$1" | sed -e's/-s//'); check_v "$1" "$software_dir"; shift;;
+ --check-config) check_config=1; shift;;
+ --check-config=*) on_off_option_error --check-config;;
--clean-texdir) clean_texdir=1; shift;;
--clean-texdir=*) on_off_option_error --clean-texdir;;
@@ -183,12 +186,17 @@ do
-'?'|--help) print_help; exit 0;;
-'?'*|--help=*) on_off_option_error --help -?;;
- # Make options (note that Make's `debug' can take values, but when called
- # without any value, it is like giving it a value of `a'):
+ # Make options
+ # ------------
+ #
+ # Note that Make's `debug' can take values, but when called without any
+ # value, it is like giving it a value of `a'):
-d|--debug) if [ x"$2" = x ]; then debug=a; shift;
else debug="$2"; check_v debug "$debug"; shift;shift; fi;;
-d=*|--debug=*) debug="${1#*=}"; check_v debug "$debug"; shift;;
-d*) debug=$(echo "$1" | sed -e's/-d//'); check_v debug "$debug"; shift;;
+ -p|--prepare-redo) prepare_redo=1; shift;;
+ -p=*|--prepare-redo=*) on_off_option_error --prepare-redo; shift;;
# Unrecognized option:
-*) echo "$scriptname: unknown option '$1'"; exit 1;;
@@ -202,6 +210,44 @@ done
+# Check configuration status
+# --------------------------
+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 2> /dev/null > /dev/null; then coloropt="--color=auto"
+ elif ls -G 2> /dev/null > /dev/null; then coloropt="-G"
+ else coloropt=""
+ fi
+
+ # Print a notice to let the user know what is happening.
+ cat <<EOF
+
+This is an infinite loop that will print what software are being built at
+every moment. It is actually a listing ('ls' command) of the temporary
+directory where software source code are unpacked while they are being
+built. If the project isn't being configured, the output (every second)
+will either be empty (only a date) or a with an error about a non-existant
+directory. This feature is thus only useful when the project's software are
+being built.
+
+EOF
+
+ # Run the infinite loop.
+ while true; do
+ echo;
+ echo "$(date) [[press CTRL-C to stop]]";
+ ls $coloropt .build/software/build-tmp || junk=1;
+ sleep 1;
+ done
+ exit 0
+fi
+
+
+
+
+
# Basic group settings
# --------------------
if ! [ x$group = x ]; then
@@ -252,48 +298,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.
@@ -313,7 +321,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
@@ -356,30 +364,44 @@ 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 data preparation phase (optionally build Makefiles with
+ # special values for optimizing the main `top-make.mk'). But note
+ # that data preparation is only done automatically the first time
+ # the project is built (when `.build/software/preparation-done.mk'
+ # doesn't yet exist). After that, if the user wants to re-do the
+ # preparation they have to use the `--prepare-redo' option.
+ if ! [ -f .build/software/preparation-done.mk ] \
+ || [ x"$prepare_redo" = x1 ]; then
+ controlled_env reproduce/analysis/make/top-prepare.mk
fi
# Run the actual project.
@@ -392,9 +414,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