Project

General

Profile

Statistics
| Revision:

# Date Author Comment
9016 05/10/2013 05:01 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: split make utils out into separate make.sh

9015 05/10/2013 04:38 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: split archive (zip) utils out into separate archives.sh

9014 05/10/2013 04:24 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: split databases utils out into separate db.sh

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

9012 05/10/2013 03:32 AM Aaron Marcuse-Kubitza

lib/util.sh: removed no longer used limit_stderr_extern. use `limit_stderr_cmd extern` instead.

9011 05/10/2013 03:29 AM Aaron Marcuse-Kubitza

lib/util.sh: specify limit_stderr_cmd just for the (few) commands that need it, rather than for all commands, so that commands that use stderr to print important error messages don't have those error messages hidden when the verbosity is too low. (error messages should always be displayed, regardless of the verbosity.)

9010 05/10/2013 03:13 AM Aaron Marcuse-Kubitza

lib/util.sh: limit_stderr_cmd (): only echo the command if it starts with echo_run. this requires adding echo_run before commands that use limit_stderr_cmd, such as limit_stderr_extern.

9009 05/10/2013 03:07 AM Aaron Marcuse-Kubitza

lib/util.sh: limit_stderr_cmd (): remove echo_run from the command to run so that the command name isn't echoed twice

9008 05/10/2013 02:56 AM Aaron Marcuse-Kubitza

lib/util.sh: limit_stderr_cmd: alias-expand command after it

9007 05/10/2013 02:53 AM Aaron Marcuse-Kubitza

lib/util.sh: $verbosity: ensure it's an integer using `declare -i`

9006 05/10/2013 02:45 AM Aaron Marcuse-Kubitza

lib/util.sh: grouped set verbosity statements together and commented them

9005 05/10/2013 02:43 AM Aaron Marcuse-Kubitza

bugfix: lib/util.sh: verbose output: $verbosity defaults to $verbose (boolean) converted to integer. the previous set-default of $verbosity to $verbose has been removed because it came after `: "${verbosity=3}"` and thus didn't have an effect.

9004 05/10/2013 02:40 AM Aaron Marcuse-Kubitza

lib/util.sh: added bool2int ()

9003 05/10/2013 02:32 AM Aaron Marcuse-Kubitza

*{.sh,run}: use new isset

9002 05/10/2013 02:31 AM Aaron Marcuse-Kubitza

lib/util.sh: added isset ()

9001 05/10/2013 02:28 AM Aaron Marcuse-Kubitza

*{.sh,run}: use ${var+isset} instead of ${var+t} for clarity

9000 05/10/2013 02:22 AM Aaron Marcuse-Kubitza

lib/util.sh: propagate the verbosity to invoked commands by exporting it

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.

8998 05/10/2013 02:15 AM Aaron Marcuse-Kubitza

lib/util.sh: echo_stdin (): use new pipe_delay

8997 05/10/2013 02:12 AM Aaron Marcuse-Kubitza

lib/util.sh: added pipe_delay (used as `cmd1 | { pipe_delay; cmd2; }`)

8996 05/10/2013 02:06 AM Aaron Marcuse-Kubitza

lib/util.sh: limit_stderr_cmd (): echo the command like echo_run so that callers don't have to separately call echo_run. this reduces clutter of the nested aliases, ensures that the command is always echoed outside of the inner stderr-limiter (which has a different log_level), and avoids echoing "limit_stderr_cmd" itself as part of the command name.

8995 05/10/2013 01:47 AM Aaron Marcuse-Kubitza

lib/util.sh: limit_stderr (): increase the log_level so that stderr of verbose commands can be turned off separately from the names of the commands themselves. it will now usually have log_level 2, indicating output that is useful primarily for debugging (this is the same as for shell function calls).

8994 05/10/2013 01:39 AM Aaron Marcuse-Kubitza

lib/util.sh: renamed log_stderr* to limit_stderr* to reflect that stderr is limited (i.e. controlled) rather than logged

8993 05/10/2013 01:36 AM Aaron Marcuse-Kubitza

lib/util.sh: echo_run_extern: renamed to log_stderr_extern since controlling stderr is its primary function

8992 05/10/2013 01:25 AM Aaron Marcuse-Kubitza

inputs/GBIF/MySQL_export: only include WHERE clause if $filter is set. support configuring LIMIT/OFFSET.

8991 05/10/2013 01:00 AM Aaron Marcuse-Kubitza

inputs/GBIF/table.run: table.tsv/make (): use new to_target to auto-delete $target on error

8990 05/10/2013 12:59 AM Aaron Marcuse-Kubitza

inputs/GBIF/table.run: table.tsv/make (): use new check_target_exists

8989 05/10/2013 12:58 AM Aaron Marcuse-Kubitza

lib/util.sh: make: added check_target_exists

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

8987 05/10/2013 12:36 AM Aaron Marcuse-Kubitza

lib/util.sh: make: added to_target, which uses to_file on $target

8986 05/10/2013 12:35 AM Aaron Marcuse-Kubitza

lib/util.sh: added to_file (), which auto-removes a command's output file on error (like make's .DELETE_ON_ERROR)

8985 05/10/2013 12:31 AM Aaron Marcuse-Kubitza

lib/util.sh: echo_run_extern, extern: fixed/added comments to indicate that echo_run_extern echoes and controls stderr of an external command, while the extern alias does this for all external commands

8984 05/10/2013 12:28 AM Aaron Marcuse-Kubitza

lib/util.sh: auto-echo common external commands, such as rm

8983 05/10/2013 12:24 AM Aaron Marcuse-Kubitza

lib/util.sh: echo_run_extern, extern aliases: alias-expand next word (the command) by adding trailing space to alias def

8982 05/10/2013 12:21 AM Aaron Marcuse-Kubitza

bugfix: lib/util.sh: exceptions: log_e: must include `declare e` in the alias and not when save_e is called, so that $e is a local var of the caller. this bug did not appear in testing because the save_e alias, which re-scopes $e within log_e (), was not expanded inside log_e () (since new aliases were not loaded between save_e and log_e ()).

8981 05/10/2013 12:12 AM Aaron Marcuse-Kubitza

lib/util.sh: exceptions: added log_e (), which prints a "command exited with error" message (like make) when applicable

8980 05/10/2013 12:09 AM Aaron Marcuse-Kubitza

lib/util.sh: exceptions: try_ (): renamed to try () and use the function keyword to distinguish it from the alias

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

lib/util.sh: exceptions: try_ (): use new save_e

8978 05/10/2013 12:05 AM Aaron Marcuse-Kubitza

lib/util.sh: exceptions: added save_e

8977 05/10/2013 12:01 AM Aaron Marcuse-Kubitza

lib/util.sh: exceptions: end_try* aliases: use new rethrow*

8976 05/09/2013 11:59 PM Aaron Marcuse-Kubitza

lib/util.sh: exceptions: added rethrow, rethrow_subshell aliases

8975 05/09/2013 11:47 PM Aaron Marcuse-Kubitza

lib/util.sh: always use '' rather than "" around alias definitions, to ensure that variables are evaluated at expand time rather than compile time

8974 05/09/2013 11:44 PM Aaron Marcuse-Kubitza

lib/util.sh: zip_newer/unzip_newer: evaluate $no_force at alias expansion time rather than at alias compile time, so that the $no_force can be overridden in the context the alias is used in

8973 05/09/2013 11:18 PM Aaron Marcuse-Kubitza

lib/util.sh: use `|| return` instead of `|| exit` because `|| exit` doesn't seem to work inside functions (it does not have the errexit effect). also, `|| return` has the advantage of not exiting the program if the caller used || after the command (i.e. as an error handler) to temporarily disable errexit.

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

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

lib/util.sh: removed "" around $?, $# because they are guaranteed to always be non-empty and contain no special chars

8970 05/09/2013 10:17 PM Aaron Marcuse-Kubitza

lib/util.sh: say "last space" instead of "trailing space" so the comment will be more likely to fit at the end of the line

8969 05/09/2013 06:11 PM Aaron Marcuse-Kubitza

lib/local.sh: removed mysql () since its functionality is now provided by mysql () in util.sh

8968 05/09/2013 05:59 PM Aaron Marcuse-Kubitza

lib/util.sh: mysql_cmd (): $server: like $ssh_server, clear the value when it's equal to this machine's hostname

8967 05/09/2013 05:58 PM Aaron Marcuse-Kubitza

lib/util.sh: mysql_cmd (): $ssh_server: use new localize_url to clear the value when it's equal to this machine's hostname

8966 05/09/2013 05:37 PM Aaron Marcuse-Kubitza

lib/util.sh: added localize_url ()

8965 05/09/2013 05:36 PM Aaron Marcuse-Kubitza

inputs/GBIF/table.run: table.tsv/make (): use extern so the MySQL_export command is echoed

8964 05/09/2013 05:24 PM Aaron Marcuse-Kubitza

inputs/GBIF/table.run: table.tsv/make (): don't make the target if it already exists

8963 05/09/2013 05:16 PM Aaron Marcuse-Kubitza

inputs/GBIF/table.run: table.tsv/make (): create the file directly rather than using inline_make, so that the command to create the file can use shell functions such as mysql

8962 05/09/2013 05:07 PM Aaron Marcuse-Kubitza

bugfix: inputs/GBIF/table.run: table.tsv/make (): need to use $(target) (target's path relative to curdir) instead of just the filename, now that make does not change the directory

8961 05/09/2013 05:01 PM Aaron Marcuse-Kubitza

inputs/GBIF/table.run: moved table.tsv creation to separate table.tsv/make () function

8960 05/09/2013 04:59 PM Aaron Marcuse-Kubitza

lib/util.sh: echo_stdin (): display the echoed input after leading output of the echoed-to command, by using sleep with a small fractional # of seconds

8959 05/09/2013 04:38 PM Aaron Marcuse-Kubitza

*{.sh,run}: put functions on one line where possible (and where they are not expected to expand)

8958 05/09/2013 04:32 PM Aaron Marcuse-Kubitza

lib/local.sh: root_make (): use make () rather than extern make now that make () does not set its own current dir. using make () also automatically enables \$stdout2stderr, which is needed to redirect the echoed make commands.

8957 05/09/2013 04:26 PM Aaron Marcuse-Kubitza

lib/util.sh: extern (): use exec to ensure that the executed command is in fact external, and not a shell builtin or other type of non-function command. this also simplifies the code because any shell function for the command does not need to be unset.

8956 05/09/2013 04:20 PM Aaron Marcuse-Kubitza

lib/util.sh: make (): don't change the directory to $top_dir, because paths used by the caller will instead be relative to the current dir (note that in runscripts, paths are generally not absolute because of canon_rel_path ()). this requires manually specifying $top_dir when running make on a physical (rather than inlined) makefile.

8955 05/09/2013 04:01 PM Aaron Marcuse-Kubitza

lib/util.sh: log_stderr_cmd (): replaced the `|| exit` after the () with `|| return`, for the same reason that this was a problem for extern () (see r8954)

8954 05/09/2013 03:55 PM Aaron Marcuse-Kubitza

lib/util.sh: extern (): replaced the `|| exit` after the () with `|| return`, because `|| exit` strangely does not use $? as its exit status (even though `|| exit $?` works fine). in a shell function, it is actually sufficient, for errexit purposes, to use `|| return`, because the exit status is checked upon return from the function. it is in fact preferable to use return rather than exit, because then the caller can catch the exception using `|| true`.

8953 05/09/2013 03:51 PM Aaron Marcuse-Kubitza

lib/util.sh: extern (): removed the `|| exit` inside the (), because this strangely prevents the exit status from being propagated to the exit status of the ()

8952 05/09/2013 03:44 PM Aaron Marcuse-Kubitza

lib/util.sh: added explicit `set -o errexit` in case caller did not have -e in #! line

8951 05/09/2013 02:47 PM Aaron Marcuse-Kubitza

inputs/GBIF/table.run: renamed MySQL_export () to export_mysql () to match schemas/VegCore/VegCore.ERD.mwb.run

8950 05/09/2013 02:21 PM Aaron Marcuse-Kubitza

inputs/GBIF/table.run: renamed MySQL_export () to export_mysql () to match schemas/VegCore/VegCore.ERD.mwb.run

8949 05/09/2013 02:06 PM Aaron Marcuse-Kubitza

inputs/FIA/_archive/2011-10-17/: set svn:ignore to *

8948 05/09/2013 01:52 PM Aaron Marcuse-Kubitza

web/links/index.htm: updated to Firefox bookmarks. added Mac upgrade and recovery-related bookmarks.

8947 05/09/2013 12:07 PM Aaron Marcuse-Kubitza

bugfix: lib/import.sh: remake_VegBIEN_mappings (): don't run if there is no public schema to perform the test on (e.g. if the staging tables have just been reinstalled)

8946 05/09/2013 12:06 PM Aaron Marcuse-Kubitza

lib/import.sh: added public_schema_exists (), which just calls psql_script_vegbien (i.e. with the default search_path temp, public, etc.) and sees if returns an error

8945 05/09/2013 11:50 AM Aaron Marcuse-Kubitza

/README.TXT: Maintenance: to synchronize vegbiendev, jupiter, and your local machine: when changes are made on vegbiendev: added step to download TWiki separately to your machine, to ensure that it gets backed up even if you don't sync the rest of the files. also, TWiki needs to be run with delete enabled to remove old session files, while the rest of the files should be run without delete.

8944 05/09/2013 08:28 AM Aaron Marcuse-Kubitza

schemas/VegCore/VegCore.ERD.mwb.run: use my2pg's new sql_ascii mode

8943 05/09/2013 08:27 AM Aaron Marcuse-Kubitza

bin/my2pg: support $sql_ascii mode, where varbinary is translated to text instead of bytea

8942 05/09/2013 08:27 AM Aaron Marcuse-Kubitza

bin/my2pg: remove any () after text

8941 05/09/2013 08:23 AM Aaron Marcuse-Kubitza

schemas/VegCore/VegCore.ERD.mwb.run: VegCore.my.sql/make (): leave out the DROP TABLE statements for now using --skip-add-drop-table

8940 05/09/2013 08:19 AM Aaron Marcuse-Kubitza

added schemas/VegCore/VegCore.pg.sql.run with install () command (also part of all ())

8939 05/09/2013 08:19 AM Aaron Marcuse-Kubitza

lib/local.sh: added root_make ()

8938 05/09/2013 08:15 AM Aaron Marcuse-Kubitza

bin/my2pg: unpack custom types set('...')

8937 05/09/2013 08:12 AM Aaron Marcuse-Kubitza

lib/local.sh: psql (): use fd 4 for the logging output instead of 3 because 3 is generally used for passing inline input commands (it is used this way by inline_make)

8936 05/09/2013 08:05 AM Aaron Marcuse-Kubitza

schemas/VegCore/VegCore.ERD.mwb.run: sync (): don't pass "$@" to export_/import because they do not accept args, and the same set of args would not be meaningful for both

8935 05/09/2013 08:00 AM Aaron Marcuse-Kubitza

schemas/VegCore/VegCore.ERD.mwb.run: use new $top_filename instead of $archive_filename

8934 05/09/2013 08:00 AM Aaron Marcuse-Kubitza

lib/util.sh: added $top_script (alias for $0), $top_file, $top_filename. use new $top_file in $top_dir.

8933 05/09/2013 07:54 AM Aaron Marcuse-Kubitza

schemas/VegCore/VegCore.ERD.mwb.run: put zip_newer/unzip_newer on the same line as the `cd "$top_dir"`

8932 05/09/2013 07:45 AM Aaron Marcuse-Kubitza

bin/my2pg: translate varbinary to bytea

8931 05/09/2013 07:42 AM Aaron Marcuse-Kubitza

schemas/VegCore/VegCore.ERD.mwb.run: added export_postgres (), which calls VegCore.pg.sql/make ()

8930 05/09/2013 07:29 AM Aaron Marcuse-Kubitza

lib/util.sh: wrapper functions of external commands: use new self alias

8929 05/09/2013 07:28 AM Aaron Marcuse-Kubitza

lib/util.sh: added self alias, for use with wrapper functions of external commands

8928 05/09/2013 07:18 AM Aaron Marcuse-Kubitza

schemas/VegCore/VegCore.my.sql: regenerated using `VegCore.ERD.mwb.run export_mysql` (also part of the all target). note that this uses mysqldump, so the format and table order is different than it was for MySQL Workbench's custom export script.

8927 05/09/2013 07:05 AM Aaron Marcuse-Kubitza

schemas/VegCore/VegCore.ERD.mwb.run: added export_mysql (), which runs VegCore.my.sql/make ()

8926 05/09/2013 07:05 AM Aaron Marcuse-Kubitza

schemas/VegCore/VegCore.ERD.mwb.run: added export_mysql (), which runs VegCore.my.sql/make ()

8925 05/09/2013 07:03 AM Aaron Marcuse-Kubitza

bugfix: lib/local.sh: $PATH: use $bin_dir_abs so the path will remain valid if the current directory is changed

8924 05/09/2013 07:02 AM Aaron Marcuse-Kubitza

lib/local.sh: added \$bin_dir_abs

8923 05/09/2013 06:58 AM Aaron Marcuse-Kubitza

bugfix: lib/util.sh: extern (): added `|| exit` after "$@" in addition to after the (), because this additional `|| exit` is apparently needed in order to propagate the exit status of the command to the exit status of the () and cause an error to abort the script properly

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.

8921 05/09/2013 06:47 AM Aaron Marcuse-Kubitza

bugfix: lib/util.sh: echo_vars (): output each var separately so that each is prefixed by $PS4

8920 05/09/2013 06:39 AM Aaron Marcuse-Kubitza

lib/util.sh: inc/dec_log_level: indent commands at higher log levels using $log_indent

8919 05/09/2013 06:39 AM Aaron Marcuse-Kubitza

lib/util.sh: inc/dec_log_level: indent commands at higher log levels using $log_indent

8918 05/09/2013 06:31 AM Aaron Marcuse-Kubitza

bugfix: lib/util.sh: make (): use stdout2stderr=1 so that commands make runs are properly output to stderr

8917 05/09/2013 06:21 AM Aaron Marcuse-Kubitza

bugfix: lib/util.sh: include_guard_var (): use extern () when invoking sed so that this internal use of it isn't verbosely logged along with other external commands. note the "" around extern to refer to the function, not the alias.