Project

General

Profile

  • svn:executable: *

# Date Author Comment
11970 01/20/2014 11:33 AM Aaron Marcuse-Kubitza

moved everything into /trunk/ to create the standard svn layout, for use with tools that require this (eg. git-svn). IMPORTANT: do NOT do an `svn up`. instead, re-use your working copy's existing files with `svn switch` (http://svnbook.red-bean.com/en/1.6/svn.ref.svn.c.switch.html).

11428 10/24/2013 03:26 PM Aaron Marcuse-Kubitza

bugfix: lib/runscripts/util.run: `trap on_exit EXIT`: only set this if the script is not a dot script, because if it is a dot script, on_exit() will not be invoked until the calling shell exits, which may be much later than when the script is run. previously, this was handled by canceling the EXIT trap if on_exit() is run manually, but this would not work correctly if a load-time error prevented on_exit() from running and canceling the trap.

11427 10/24/2013 03:21 PM Aaron Marcuse-Kubitza

bugfix: lib/runscripts/util.run: if is_dot_script, fix $ when no args causes this to incorrectly contain the script name. use is_dot_script rather than the presence of $ args to decide whether to use @BASH_ARGV, because @BASH_ARGV is actually wrong when run as a .-script (it contains the script name).

11418 10/23/2013 11:02 PM Aaron Marcuse-Kubitza

lib/runscripts/util.run: run script template: changed sample command name to all() because each runscript requires this in order to be run without args

11417 10/23/2013 11:00 PM Aaron Marcuse-Kubitza

lib/runscripts/util.run: support scripts that are run as shell-includes (with leading "."), by allowing the calling script to manually invoke on_exit() without it then being invoked twice (the end of a shell-include does not trigger the EXIT trap)

11414 10/23/2013 10:17 PM Aaron Marcuse-Kubitza

lib/runscripts/util.run: support scripts that are run as shell-includes (with leading "."), by also accepting $@ args that are passed along in the util.run include, in addition to @BASH_ARGV

11359 10/18/2013 09:52 PM Aaron Marcuse-Kubitza

bugfix: lib/runscripts/util.run: to_top_file(): need to pass "$@" to to_file

11358 10/18/2013 08:17 PM Aaron Marcuse-Kubitza

lib/runscripts/util.run: to_top_file: added function for this (in addition to alias), so that this can be run from sudo in a wrap_fn command

11348 10/18/2013 05:28 PM Aaron Marcuse-Kubitza

lib/runscripts/util.run: added $wrap_fn to run any function via sudo, etc.

10835 08/30/2013 06:06 PM Aaron Marcuse-Kubitza

lib/runscripts/util.run: usage: documented that this usage also applies to all files that include this file

10834 08/30/2013 06:06 PM Aaron Marcuse-Kubitza

lib/runscripts/util.run: usage: clarified that the cmd to run is a function

10766 08/27/2013 07:30 PM Aaron Marcuse-Kubitza

lib/runscripts/util.run: added to_top_file alias for use with $top_file

10272 07/14/2013 01:52 AM Aaron Marcuse-Kubitza

lib/runscripts/util.run: added , function, which treats each of the command-line args as commands the way make does (instead of as args to the same command, the way runscripts do)

10271 07/14/2013 01:39 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: moved runscript-related commands to lib/runscripts/util.run because these only apply to runscripts

9854 06/12/2013 03:25 AM Aaron Marcuse-Kubitza

*{.sh,run}: use simpler .rel() instead of `. "$(dirname "${BASH_SOURCE0}")"/...` for relative includes

9507 05/23/2013 12:15 PM Aaron Marcuse-Kubitza

bugfix: lib/runscripts/util.run: need to include sh/make.sh for all runscripts that use make-style commands

9298 05/12/2013 02:08 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: run_args_cmd(): moved test of $? to lib/runscripts/util.run on_exit() since it needs to be performed for all run_args_cmd() functions, not just the default implementation. (this test ensures that no commands are executed if the EXIT trap was encountered due to a parsing/loading error).

9268 05/12/2013 10:34 AM Aaron Marcuse-Kubitza

lib/runscripts/util.run: added setting of $top_file, $top_filename to set_paths()

9267 05/12/2013 10:25 AM Aaron Marcuse-Kubitza

lib/runscripts/util.run: set $top_file, $top_filename in a function (set_paths__util_run())

9248 05/12/2013 08:13 AM Aaron Marcuse-Kubitza

lib/runscripts/util.run: $top_file: also match dir-level runscripts by removing /run suffix

9239 05/12/2013 06:10 AM Aaron Marcuse-Kubitza

*{.sh,run}: echo all global vars (except those defined before echo_vars is available)

9074 05/10/2013 12:08 PM Aaron Marcuse-Kubitza

*{.sh,run}: removed extra space between function name and (), which is apparently not needed even though `help function` includes it. this greatly improves readability, including when function names are pasted into commit messages!

9013 05/10/2013 04:05 AM Aaron Marcuse-Kubitza

moved lib/*.sh to sh/ subdir so it's easier to find the .sh files among all the other lib/ files

8999 05/10/2013 02:20 AM Aaron Marcuse-Kubitza

lib/util.sh: run all commands verbosely by default, not just runscripts. this ensures verbose output for invoked commands like inputs/GBIF/MySQL_export.

8988 05/10/2013 12:42 AM Aaron Marcuse-Kubitza

lib/util.sh: moved $top_file* to runscripts/util.run because they only apply to runscripts

8972 05/09/2013 11:11 PM Aaron Marcuse-Kubitza

lib/runscripts/util.run: tell users to override run_args_cmd rather than this function to perform other commands, so that on_exit () can contain other exit-related processing that should not be overriden by the user

8922 05/09/2013 06:51 AM Aaron Marcuse-Kubitza

lib/util.sh: echo_vars (): output vars with log_level 3 so they can be excluded separately from function calls to reduce clutter in the logging output. increase the default util.run verbosity so that vars are still printed by default.

8881 05/08/2013 08:02 PM Aaron Marcuse-Kubitza

*{.sh,run}: changed echo_func to an alias that includes the "$", so that callers don't need to specify the "$" manually. although the original echo_func function is still there, callers need to switch over to the alias at the same time as it's defined because otherwise the "$@" would be doubled, since echo_func refers to the alias instead.

8774 05/02/2013 04:47 AM Aaron Marcuse-Kubitza

moved lib/*.run into runscripts/ subdir so runscripts are grouped together and easier to find rather than being scattered throughout lib/

8715 04/25/2013 06:05 PM Aaron Marcuse-Kubitza

lib/util.run: doc comment: changed "run scripts" to "runscripts"

8714 04/25/2013 06:04 PM Aaron Marcuse-Kubitza

lib/util.run: factored general utils (non-runscript-specific) out into new util.sh

8713 04/25/2013 05:55 PM Aaron Marcuse-Kubitza

lib/util.run: renamed $verbose to $verbosity because it's an integer level, not a boolean. continue to support specifying the verbosity in $verbose.

8712 04/25/2013 05:52 PM Aaron Marcuse-Kubitza

lib/util.run: support $verbose="", which is treated as 0

8711 04/25/2013 05:50 PM Aaron Marcuse-Kubitza

lib/util.run: only automatically echo env vars when they are set if verbosity is >= 2

8710 04/25/2013 05:49 PM Aaron Marcuse-Kubitza

lib/util.run: added $verbose var to control logging. this is normally set to 0, but defaults to 2 for a runscript.

8709 04/25/2013 05:41 PM Aaron Marcuse-Kubitza

lib/util.run: moved `shopt -s expand_aliases` inside the include guard so callers can override the setting without it being reset if util.run is included again

8704 04/25/2013 04:30 PM Aaron Marcuse-Kubitza

bugfix: lib/util.run: added include guard to prevent issues in "diamond includes", where a runscript includes two runscripts and each includes util.run, causing the second include of util.run to reset any methods overridden in the first included runscript. this prevents util.run from being included twice in the first place.

8703 04/25/2013 04:25 PM Aaron Marcuse-Kubitza

lib/util.run: added include_guard_var (), self_not_included () for use by path-based include guards

8702 04/25/2013 03:40 PM Aaron Marcuse-Kubitza

lib/util.run: echo_stdin (): print a separator before and after the echoed output to help distinguish it from other verbose output

8700 04/25/2013 03:36 PM Aaron Marcuse-Kubitza

lib/util.run: echo_export (): run the export builtin using `builtin` to avoid recursively calling any export alias or function defined by the user (e.g. `alias export=echo_export`. this causes util.run to be idempotent, such that it can be included multiple times without causing problems due to the redefinition of functions, vars, etc.

8694 04/24/2013 11:16 PM Aaron Marcuse-Kubitza

lib/util.run: added set_var ()

8693 04/24/2013 10:58 PM Aaron Marcuse-Kubitza

bugfix: lib/util.run: run_args_cmd (): `set --`: need to use eval so that the output of reverse is interpreted as escaped args rather than split using $IFS

8692 04/24/2013 10:40 PM Aaron Marcuse-Kubitza

bugfix: lib/util.run: run_args_cmd (): BASH_ARGV is stored in reverse order, so it needs to be reversed to be usable as $@

8691 04/24/2013 10:38 PM Aaron Marcuse-Kubitza

lib/util.run: added reverse ()

8659 04/23/2013 11:06 PM Aaron Marcuse-Kubitza

lib/util.run: added zip/unzip_newer aliases

8658 04/23/2013 11:05 PM Aaron Marcuse-Kubitza

lib/util.run: added zip/unzip echo_run aliases

8653 04/23/2013 09:58 PM Aaron Marcuse-Kubitza

bugfix: lib/util.run: inline_make (): put echo_func at the top of the function

8652 04/23/2013 09:58 PM Aaron Marcuse-Kubitza

lib/util.run: inline_make (): pass Makefile commands using /dev/fd/3 (i.e. 3<<'EOF' ...) instead of stdin, to allow stdin to be used by commands that prompt the user

8651 04/23/2013 09:44 PM Aaron Marcuse-Kubitza

lib/util.run: inline_make (): use <() to pass Makefile commands as a named descriptor rather than using stdin, to allow stdin to be used by commands that prompt the user

8650 04/23/2013 09:27 PM Aaron Marcuse-Kubitza

bugfix: lib/util.run: echo_vars (): remove any value to set (=*) from the vars, since this is often used with export

8649 04/23/2013 09:14 PM Aaron Marcuse-Kubitza

bugfix: lib/util.run: echo_export (): set the vars before echoing them

8648 04/23/2013 08:55 PM Aaron Marcuse-Kubitza

lib/util.run: run_args_cmd (): use new canon_rel_path() to resolve .. in the script path, so it's easier to see where the script is actually located

8647 04/23/2013 08:52 PM Aaron Marcuse-Kubitza

lib/util.run: echo_func (): use new canon_rel_path() to resolve .. in the script path, so it's easier to see where the script is actually located

8646 04/23/2013 08:51 PM Aaron Marcuse-Kubitza

lib/util.run: added canon_rel_path ()

8645 04/23/2013 08:40 PM Aaron Marcuse-Kubitza

lib/util.run: inline_make (): provide $self as make var

8644 04/23/2013 08:35 PM Aaron Marcuse-Kubitza

lib/util.run: inline_make (): provide self_dir to make as env var instead of as make var, to avoid specifying every make var both as a local var and as a make var in the make command

8643 04/23/2013 08:31 PM Aaron Marcuse-Kubitza

lib/util.run: export alias: added comment explaining what it does

8642 04/23/2013 08:30 PM Aaron Marcuse-Kubitza

lib/util.run: aliased export to echo_export so all env vars are automatically echoed when they are set

8641 04/23/2013 08:29 PM Aaron Marcuse-Kubitza

lib/util.run: added echo_vars (), echo_export ()

8640 04/23/2013 08:17 PM Aaron Marcuse-Kubitza

lib/util.run: inline_make (): added local $self and use it to create $self_dir

8639 04/23/2013 08:15 PM Aaron Marcuse-Kubitza

lib/util.run: inline_make (): set $self_dir as a local var before passing it to make, to avoid clutter in the command that invokes make

8465 04/13/2013 02:46 AM Aaron Marcuse-Kubitza

lib/util.run: run_cmd (): renamed to run_args_cmd to clarify that this runs only the command line args command, not any command. added doc comment to clarify this.

8464 04/13/2013 02:41 AM Aaron Marcuse-Kubitza

lib/util.run: EXIT trap: use on_exit() function which calls run_cmd instead of having run_cmd be the handler, so that users can override this function to perform other commands (or no commands) after the script is read

8463 04/13/2013 02:28 AM Aaron Marcuse-Kubitza

lib/util.run: echo_func (): use the caller's FUNCNAME via the $FUNCNAME[] array instead of requiring them to pass it in the function args as `echo_func "$FUNCNAME" "$@"`

8298 04/02/2013 02:57 PM Aaron Marcuse-Kubitza

lib/util.run: echo_func: Fixed bug where need to use BASH_LINENO0 for the line #s to match up with the files. For some reason the required array indexes for BASH_SOURCE (1) and BASH_LINENO (0) differ by one.

8294 04/02/2013 02:48 PM Aaron Marcuse-Kubitza

lib/util.run: echo_func: Include the line # of the function to make it easier to find where the code being run is

8292 04/02/2013 02:26 PM Aaron Marcuse-Kubitza

lib/util.run: run_cmd: If bash exited with an error, don't run the "$@" command. This test is necessary because `trap run_cmd EXIT` will run run_cmd as the result of any exit from the shell, including an error.

8291 04/02/2013 02:21 PM Aaron Marcuse-Kubitza

*run: Use -e option to bash on the #! line instead of separate `set -o errexit` line so that there is no issue with the `set -o errexit` line getting separated from the #! line (errexit is required for the scripts to work properly)

8290 04/02/2013 02:09 PM Aaron Marcuse-Kubitza

lib/util.run: run_cmd: When no command specified, default to running the `all` command, just like make

8289 04/02/2013 02:07 PM Aaron Marcuse-Kubitza

lib/util.run: Run run_cmd at shell exit (using trap) instead of requiring every runscript to have `run_cmd ` at the end of it

8284 04/02/2013 01:42 PM Aaron Marcuse-Kubitza

lib/util.run: fwd: Check that $subdirs is defined. Added $subdirs to usage.

8283 04/02/2013 01:39 PM Aaron Marcuse-Kubitza

lib/util.run: fwd: Added usage

8281 04/02/2013 01:16 PM Aaron Marcuse-Kubitza

lib/util.run: run_cmd: Echo the command being run, including the top-level run script. This is in addition to the echoing of the command in the function itself (using echo_func), which provides both the runscript that was run and the file where the invoked command was actually located (which may be different due to includes).

8280 04/02/2013 01:12 PM Aaron Marcuse-Kubitza

lib/util.run: Echo the command at the beginning of each function using new echo_func, instead of having to type echo_run before every call to a function. Note that because echo_func uses BASH_SOURCE, the path to the file containing the function will be included in the debug message, which greatly facilitates locating which file a command is in.

8279 04/02/2013 01:08 PM Aaron Marcuse-Kubitza

lib/util.run: Added echo_func

8278 04/02/2013 12:50 PM Aaron Marcuse-Kubitza

lib/util.run: Added echo_cmd and use it in echo_run

8277 04/02/2013 12:46 PM Aaron Marcuse-Kubitza

lib/util.run: echo_cmd(): Renamed to echo_run for clarity, because it also runs the command

8276 04/02/2013 12:39 PM Aaron Marcuse-Kubitza

lib/util.run: Added inline_make()

8275 04/02/2013 12:39 PM Aaron Marcuse-Kubitza

lib/util.run: Added echo_stdin()

8272 04/02/2013 10:35 AM Aaron Marcuse-Kubitza

Added lib/util.run with general functions and template for run scripts (a bash-based replacement for make). Unlike make, run scripts support full bash functionality including multiline commands. The run script template also includes syntax for various kinds of relative includes in bash.