Project

General

Profile

Statistics
| Revision:

# Date Author Comment
9192 05/11/2013 04:41 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: merged limit_stderr_cmd/limit_stdout_cmd into command(), using flag vars to control what limiting actions it needs to perform. in command invocations, this involves setting the appropriate flag vars instead of using a limit_std*_cmd alias.

9191 05/11/2013 04:37 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: added run_cmd

9190 05/11/2013 04:04 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: limit_stderr(): moved before command echoing because it does not depend on it and is a separate feature

9189 05/11/2013 03:47 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: run_args_cmd(): use $top_script instead of `"$(canon_rel_path "$0")"`

9188 05/11/2013 03:42 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: $top_script: run canon_rel_path on $0

9187 05/11/2013 03:35 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: use `minor=1 echo_func` instead of echo_minor_func because the syntax is simple enough that you don't need a separate alias for it

9186 05/11/2013 03:32 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: echo_func: support using minor=1 to increase the log_level that the function call is echoed at. use this in echo_minor_func.

9185 05/11/2013 03:28 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: echo_*func aliases: use simpler && syntax (with `|| true` to prevent errexit if the condition is false) instead of an if statement. this also allows prefixing the alias with var definitions.

9184 05/11/2013 03:27 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: echo_*func aliases: use simpler && syntax (with `|| true` to prevent errexit if the condition is false) instead of an if statement. this also allows prefixing the alias with var definitions.

9183 05/11/2013 03:18 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: echo_func: only indent if the function call was displayed. this avoids confusing extra whitespace when a function call causes an indent but the function call itself isn't printed.

9182 05/11/2013 03:10 PM Aaron Marcuse-Kubitza

bugfix: lib/sh/util.sh: echo_minor_func: need to include "$@" in echo_func() call

9181 05/11/2013 03:08 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: echo_func(): added usage

9180 05/11/2013 03:07 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: echo_func: added usage

9179 05/11/2013 02:50 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: $log_level_indent: changed to a single space rather than two, to avoid very deep indents as the call tree becomes more deeply nested. due to the + at the beginning of every line, a single space is enough to visualize the structure of the call tree (unlike source code, which requires more whitespace because it doesn't have a call tree structure).

9178 05/11/2013 02:46 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: echo_*func aliases: increase the indent for the duration of the function call. this causes function calls to be displayed in an indented call-tree structure, which makes the verbose output much easier to understand.

9177 05/11/2013 02:43 PM Aaron Marcuse-Kubitza

bugfix: lib/sh/util.sh: recursive aliases (i.e. aliases that call a command of the same name): use "" around the command name so it isn't reexpanded if the function using the alias is copied using copy_func(). (aliases will be reexpanded every time a function is redeclared since they appear unquoted in the function definition.) this is a bug in `declare -f` for which there is no fix, necessitating the "" alias workaround instead.

9176 05/11/2013 02:01 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: moved log-indent-related vars/aliases before they are first used (by log())

9175 05/11/2013 01:54 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: renamed inc_log_level/dec_log_level to shorter log++/log--

9174 05/11/2013 01:54 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: renamed inc_log_level/dec_log_level to shorter log++/log--

9173 05/11/2013 01:51 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: renamed cmd_indent to just indent now that indent is not being used for the PS4 level

9172 05/11/2013 01:47 PM Aaron Marcuse-Kubitza

*{.sh,run}: multi-command aliases: enclose in {} so the alias can be used after ||

9171 05/11/2013 01:44 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: renamed indent->PS4++ , outdent->PS4-- because these relate just to the PS4 length, not to the (whitespace-based) log_indent

9170 05/11/2013 01:38 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: removed no longer used echo_run(). use command() instead.

9169 05/11/2013 01:36 PM Aaron Marcuse-Kubitza

*{.sh,run}: use command instead of deprecated echo_run (don't prepend anything when the command is already aliased with `command`)

9168 05/11/2013 01:29 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: command(): perform echo_run_prep itself instead of requiring echo_run to be added in an alias. echo_run_prep will not be performed if limit_stderr_cmd() has performed it already outside the limit_stderr section. this requires using `builtin command` instead of "command" when you don't want the echoing (such as in include_guard_var()).

9167 05/11/2013 01:07 PM Aaron Marcuse-Kubitza

*{.sh,run}: multi-command aliases: enclose in {} so the alias can be used after ||

9166 05/11/2013 12:56 PM Aaron Marcuse-Kubitza

bugfix: lib/sh/util.sh: .(): also need to echo the . before the included file

9165 05/11/2013 12:48 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: added echo_params alias and use it instead of `log "$*"`

9164 05/11/2013 12:43 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: .(): echo the include at log_level 2 because it's an internal command

9163 05/11/2013 12:34 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: echo_cmd(): also remove `builtin` before the command name

9162 05/11/2013 12:32 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: echo_cmd(): don't remove -- after command, because it is added by the command() function instead and does not appear in the command sent to echo_run()

9161 05/11/2013 12:29 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: command alias: don't alias-expand next word, because the next word should only be interpreted as a command (part of the effect of the `command` builtin)

9160 05/11/2013 12:27 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: external commands: always use command rather than echo_run to indicate that a command is external, because command() ensures that what it invokes is not a shell function, and sets 2>&22 where needed

9159 05/11/2013 12:23 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: .(): use echo_run so that included files are echoed as they are included. note that echo_run uses cmd_indent, so the included files' load-time logging output will be indented according to the nesting level of the include.

9158 05/11/2013 12:20 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: moved .() command echoing > internal commands section

9157 05/11/2013 12:19 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: moved echo_run() to general command echoing section because it can also be used for internal commands

9156 05/11/2013 12:09 PM Aaron Marcuse-Kubitza

removed no longer used inputs/GBIF/MySQL_export. use lib/sh/local.sh mysql_export_local() instead.

9155 05/11/2013 12:07 PM Aaron Marcuse-Kubitza

inputs/GBIF/raw_occurrence_record/run: override table.tsv/make() instead of export_mysql()

9154 05/11/2013 12:06 PM Aaron Marcuse-Kubitza

inputs/GBIF/table.run: table.tsv/make(): use new mysql_export_local instead of ./MySQL_export

9153 05/11/2013 12:05 PM Aaron Marcuse-Kubitza

lib/sh/local.sh: added mysql_export_local()

9152 05/11/2013 12:05 PM Aaron Marcuse-Kubitza

lib/sh/db.sh: added mysql_export(). documented that mysql_export_outfile() supports CSV, but requires the FILE privilege.

9151 05/11/2013 12:02 PM Aaron Marcuse-Kubitza

lib/sh/db.sh: mysql(): use --column-names to ensure the output is formatted appropriately. note that --column-names is the default, but better to specify it to be sure.

9150 05/11/2013 12:01 PM Aaron Marcuse-Kubitza

lib/sh/db.sh: mysql(): output_data mode: use --batch to ensure the output is formatted appropriately. note that --batch is the default when stdin is from a pipe, but better to specify it to be sure.

9149 05/11/2013 11:49 AM Aaron Marcuse-Kubitza

*{.sh,run}: use new limit_stdout_cmd instead of `stdout2stderr=1 limit_stderr_cmd`

9148 05/11/2013 11:40 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: added limit_stdout_cmd alias

9147 05/11/2013 07:25 AM Aaron Marcuse-Kubitza

lib/sh/make.sh: added $rm short var for $remake

9146 05/11/2013 07:22 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: verbosity: removed `declare -i verbosity` because this does not actually ensure that $verbosity is an integer; it only has "arithmetic evaluation [...] done when the variable is assigned to" (`help declare`)

9145 05/11/2013 07:20 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: verbosity: support setting this in alternate short-name var $vb

9144 05/11/2013 07:15 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: override the `.` builtin (a.k.a. `source`) and run canon_rel_path on the included script. this removes .. in the path when it's displayed in bash error messages.

9143 05/11/2013 06:58 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: log_err(): ensure errors are visible by using 2>&22. since this is uses log(), verbosity=1 also needs to be set.

9142 05/11/2013 06:50 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: $explicit_errors_only: explicitly set verbosity=0 to hide startup logging

9141 05/11/2013 06:46 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: limit_stderr(): if stdout goes to stderr (i.e. is logging info), assume that stderr_is_errors

9140 05/11/2013 06:41 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: $explicit_errors_only: documented that this option should only be used for testing the explicit error displaying, as otherwise, important output may be missed

9139 05/11/2013 06:39 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: $explicit_errors_only: added usage

9138 05/11/2013 06:38 AM Aaron Marcuse-Kubitza

bugfix: lib/sh/util.sh: command(): updated $errors_only var name to $explicit_errors_only

9137 05/11/2013 06:27 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: $explicit_errors_only: noted that verbosity=0 displays everything that isn't explicitly hidden

9136 05/11/2013 06:24 AM Aaron Marcuse-Kubitza

lib/sh/local.sh: psql(): use new stderr_is_errors=1 since psql's logging output comes on stdout, so stderr contains only errors. (the caveat of this is that the query output is normally mixed with logging info on stdout, and needs to be separated out to a different file descriptor using --output.)

9135 05/11/2013 06:18 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: added $explicit_errors_only env var which shows only explicitly-displayed errors (those which have been redirected to fd 22). note that most of the time, this has the same effect as `verbosity=0 script...`.

9134 05/11/2013 06:17 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: command(): support ensuring errors are visible by redirecting them to fd 22 (global stderr) when $stderr_is_errors is set

9133 05/11/2013 05:51 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: `command`: always prepend -- to the args list (to ensure that the command name is not interpreted as a `command` option), not just when the command alias is used

9132 05/11/2013 05:40 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: set_global_fds(): increase the log_level so the shadow_fd()/set_fd() function names aren't output at the default verbosity (3), and the redirection commands themselves aren't output at verbosity <= 2. set_global_fds() happens at the beginning of every script that uses util.sh, and is fairly predictable, so it isn't necessary to always echo these commands.

9131 05/11/2013 05:29 AM Aaron Marcuse-Kubitza

lib/sh/local.sh: psql(): use new convention for command-specific alternate stdout

9130 05/11/2013 05:15 AM Aaron Marcuse-Kubitza

lib/sh/make.sh: inline_make: use new convention for command-specific alternate stdin

9129 05/11/2013 05:13 AM Aaron Marcuse-Kubitza

*{.sh,run}: removed extra space between function name and ()

9128 05/11/2013 05:12 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: streams: moved setting of global stdin/stdout/stderr into set_global_fds () function

9127 05/11/2013 05:05 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: streams: allow commands to access global stdin/stdout/stderr using fd 20/21/22. this works even when /dev/tty isn't available.

9126 05/11/2013 05:05 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: streams: added convention that fd 10/11/12 should be used for command-specific alternate stdin/stdout/stderr

9125 05/11/2013 05:04 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: added streams functions fd_exists, set_fd, shadow_fd, and helpers

9124 05/11/2013 05:01 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: added echo_minor_func alias

9123 05/11/2013 05:00 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: added echo_eval()

9122 05/11/2013 04:32 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: renamed require_exists() to require_not_exists() because the command actually checks if the file doesn't exist

9121 05/11/2013 02:26 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: echo_vars(): use log() instead of manually echoing the log indent, so that the log indent string ($log_indent$PS4) doesn't have to be maintained in several different places

9120 05/11/2013 02:23 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: logging: visually separate the log_level-based indenting from the external command indenting by using the standard `set -x` prefix (1st char of PS4) for log_level indenting and $log_level_indent (i.e. whitespace) for external command indenting

9119 05/11/2013 02:19 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: logging: separate the log_level-based indenting from the external command indenting so that the log_level-based indenting can use a different prefix. this involves propagating a new var, $log_indent, to invoked commands instead of $PS4, and always prepending $log_indent to $PS4 when printing log messages.

9118 05/11/2013 01:55 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: propagate $log_level_indent to invoked commands

9117 05/11/2013 01:54 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: renamed $log_indent to $log_level_indent to indicate that this is the string added at each level, rather than the entire indent

9116 05/11/2013 01:49 AM Aaron Marcuse-Kubitza

bugfix: lib/sh/util.sh: limit_stderr(): switched back to running inc_log_level inside limit_stderr(), because it should only apply during the function for use by can_log. documented why inc_log_level needs to be inside limit_stderr().

9115 05/11/2013 01:44 AM Aaron Marcuse-Kubitza

bugfix: lib/sh/util.sh: limit_stderr(): stdout2stderr mode: only limit stdout, since stderr may contain error messages (which should always be displayed)

9114 05/11/2013 01:32 AM Aaron Marcuse-Kubitza

bugfix: lib/sh/util.sh: limit_stderr_cmd(): need to load new aliases before it so limit_stderr is expanded

9113 05/11/2013 01:31 AM Aaron Marcuse-Kubitza

bugfix: lib/sh/util.sh: limit_stderr alias: need to inc_log_level before rather than after limit_stderr(), so that can_log uses the right verbosity (previously, inc_log_level was part of limit_stderr() itself, but was moved to the alias because its effects were needed outside the function)

9112 05/11/2013 01:25 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: stdout2stderr(): fixed doc comment after space-before-() search-and-replace

9111 05/11/2013 01:24 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: usage(): use `return` instead of `(exit ...)`

9110 05/11/2013 01:23 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: verbose output: put commands into subsections

9109 05/11/2013 01:10 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: echo_run(): factored prep code out into echo_run_prep alias, which can also be used in commands that mimic it, such as limit_stderr_cmd()

9108 05/11/2013 01:06 AM Aaron Marcuse-Kubitza

bugfix: lib/sh/util.sh: limit_stderr(): moved indent to echo_run prep, because it only applies to commands invoked with echo_run

9107 05/11/2013 01:00 AM Aaron Marcuse-Kubitza

bugfix: lib/sh/util.sh: limit_stderr(): need to apply inc_log_level in the caller so it won't get rolled back at the end of the function

9106 05/11/2013 12:51 AM Aaron Marcuse-Kubitza

lib/sh/db.sh: mysql_export_outfile(): ensure newline between format info ($mysql_load_data_format) and rest of SELECT query

9105 05/11/2013 12:49 AM Aaron Marcuse-Kubitza

lib/sh/db.sh: mysql_export_outfile(): ensure newline between SELECT columns list and INTO OUTFILE

9104 05/11/2013 12:44 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: limit_stderr_cmd(): moved stdout2stderr code to limit_stderr() because it is not specific to running limit_stderr on single commands

9103 05/11/2013 12:33 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: limit_stderr(): fixed doc comment after space-before-() search-and-replace

9102 05/11/2013 12:29 AM Aaron Marcuse-Kubitza

lib/sh/db.sh: added mysql_export_outfile(), which uses SELECT ... INTO OUTFILE

9101 05/11/2013 12:22 AM Aaron Marcuse-Kubitza

lib/sh/db.sh: mysql(): added $output_data option that turns off --verbose and uses echo_stdin instead so that queries are not echoed to stdout along with data. in --verbose mode, use limit_stderr_cmd with stdout2stderr=1 to redirect echoed queries through the logging mechanism.

9100 05/11/2013 12:17 AM Aaron Marcuse-Kubitza

lib/sh/db.sh: mysql_cmd(): removed set_database because this is now performed by each caller before they use $database

9099 05/11/2013 12:15 AM Aaron Marcuse-Kubitza

lib/sh/db.sh: mysql_cmd: get command name by adding $FUNCNAME in an alias instead of using ${FUNCNAME1} in the function, so that callers can also call mysql_cmd via a nested function, etc.

9098 05/11/2013 12:00 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: added ensure_nested_func()

9097 05/10/2013 11:59 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: added contains()

9096 05/10/2013 11:57 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: command alias: also prepend -- to args to prevent a first arg starting with -- from being interpreted as an option to the `command` builtin

9095 05/10/2013 10:16 PM Aaron Marcuse-Kubitza

lib/sh/db.sh: mysql_cmd(): moved setting of database to specific callers (mysql(), mysqldump()) because the syntax to set it differs between mysql* commands (e.g. mysql uses `--database=` while mysqldump uses `--databases ... --tables`)

9094 05/10/2013 10:13 PM Aaron Marcuse-Kubitza

lib/sh/db.sh: added set_database alias, and use it in mysql_cmd()

9093 05/10/2013 10:11 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: import_vars alias and applicable aliases that use it: documented that when used inside another alias 2+ levels deep, it must be run inside a function. this is due to a strange bug in bash where $() expressions in 2-level aliases produce a syntax error when the alias is expanded outside a function.