From f23c54fc95495b3ada82ffc529b95887d4d528ce Mon Sep 17 00:00:00 2001 From: EsGeh Date: Thu, 23 May 2019 15:46:32 +0200 Subject: [PATCH] simplified and improved external dependency management --- .gitignore | 5 +---- schema/tei | 1 + scripts/example2odd.sh | 8 ++++---- scripts/exit.sh | 5 ++--- scripts/init.sh | 21 ++++++++++----------- scripts/local_stylesheet.sh | 4 ++-- scripts/tei_stylesheet.sh | 6 +++--- scripts/validate_xml.sh | 3 ++- 8 files changed, 25 insertions(+), 28 deletions(-) create mode 120000 schema/tei diff --git a/.gitignore b/.gitignore index 07994d5..23e16a4 100644 --- a/.gitignore +++ b/.gitignore @@ -5,10 +5,7 @@ /doc/generated # these files are created/removed by ./scripts/{un,}install.sh -/tei/ -/schema/tei_all.rnc -/schema/tei_all.rng -/schema/tei +/dependencies/ items/ CONVERT diff --git a/schema/tei b/schema/tei new file mode 120000 index 0000000..d317fff --- /dev/null +++ b/schema/tei @@ -0,0 +1 @@ +../dependencies/tei-schema \ No newline at end of file diff --git a/scripts/example2odd.sh b/scripts/example2odd.sh index 76861c9..2ac3f09 100755 --- a/scripts/example2odd.sh +++ b/scripts/example2odd.sh @@ -1,11 +1,11 @@ #!/bin/bash BASE_DIR=$(dirname $0)/.. -TEI_DIR=$BASE_DIR/tei +DEP_DIR=$BASE_DIR/dependencies INPUT_DIR="$BASE_DIR/corpus" OUTPUT_DIR="$BASE_DIR/schema/odd" -STYLESHEET="$BASE_DIR/tei/Stylesheets/tools/oddbyexample.xsl" +STYLESHEET="$DEP_DIR/Stylesheets/tools/oddbyexample.xsl" NAME_PATTERN='*' SUFFIX='.odd' COMBINATIONS='all' @@ -92,7 +92,7 @@ if [[ "$COMBINATIONS" = 'single' || "$COMBINATIONS" = 'both' ]]; then echo "file: $file" read -d '' cmd << EOF -java -jar "$TEI_DIR/Stylesheets/lib/saxon9he.jar" +java -jar "$DEP_DIR/Stylesheets/lib/saxon9he.jar" "$STYLESHEET" -o:"$OUTPUT_DIR/$output_file" -it:main @@ -115,7 +115,7 @@ fi if [[ "$COMBINATIONS" = 'all' || "$COMBINATIONS" = 'both' ]]; then echo "applying on the whole corpus..." read -d '' cmd << EOF -java -jar "$TEI_DIR/Stylesheets/lib/saxon9he.jar" +java -jar "$DEP_DIR/Stylesheets/lib/saxon9he.jar" "$STYLESHEET" -o:"$OUTPUT_DIR/autogen_all$SUFFIX" -it:main diff --git a/scripts/exit.sh b/scripts/exit.sh index 982d851..e24fecf 100755 --- a/scripts/exit.sh +++ b/scripts/exit.sh @@ -1,8 +1,7 @@ #!/bin/bash BASE_DIR=$(dirname $0)/.. -TEI_DIR=$BASE_DIR/tei +DEP_DIR=$BASE_DIR/dependencies -rm -rf "$TEI_DIR" +rm -rf "$DEP_DIR" $BASE_DIR/scripts/clean_output.sh -rm -rf $BASE_DIR/schema/tei diff --git a/scripts/init.sh b/scripts/init.sh index a4b15d7..4c74f47 100755 --- a/scripts/init.sh +++ b/scripts/init.sh @@ -1,23 +1,22 @@ #!/bin/bash BASE_DIR=$(dirname $0)/.. -TEI_DIR=$BASE_DIR/tei +DEP_DIR=$BASE_DIR/dependencies +mkdir -vp "$DEP_DIR" # download TEI repositories: -mkdir -vp "$TEI_DIR" -cd "$TEI_DIR" -git clone https://github.com/TEIC/TEI.git +cd "$DEP_DIR" +git clone https://github.com/TEIC/TEI.git git clone https://github.com/TEIC/Stylesheets.git -cd .. # download some schemata from TEI: -mkdir -p $BASE_DIR/schema/tei/rnc -mkdir -p $BASE_DIR/schema/tei/rng -mkdir -p $BASE_DIR/schema/tei/odd -curl -L http://www.tei-c.org/Vault/P5/current/xml/tei/custom/schema/relaxng/tei_all.rnc > $BASE_DIR/schema/tei/rnc/tei_all.rnc -curl -L http://www.tei-c.org/Vault/P5/current/xml/tei/custom/schema/relaxng/tei_all.rng > $BASE_DIR/schema/tei/rng/tei_all.rng -curl -L http://www.tei-c.org/Vault/P5/current/xml/tei/odd/p5subset.xml > $BASE_DIR/schema/tei/odd/p5subset.xml +mkdir -p tei-schema/rnc +mkdir -p tei-schema/rng +mkdir -p tei-schema/odd +curl -L http://www.tei-c.org/Vault/P5/current/xml/tei/custom/schema/relaxng/tei_all.rnc > "tei-schema/rnc/tei_all.rnc" +curl -L http://www.tei-c.org/Vault/P5/current/xml/tei/custom/schema/relaxng/tei_all.rng > "tei-schema/rng/tei_all.rng" +curl -L http://www.tei-c.org/Vault/P5/current/xml/tei/odd/p5subset.xml > "tei-schema/odd/p5subset.xml" $(realpath $BASE_DIR)/scripts/updateOutput.sh diff --git a/scripts/local_stylesheet.sh b/scripts/local_stylesheet.sh index 92f1db9..0a2ee58 100755 --- a/scripts/local_stylesheet.sh +++ b/scripts/local_stylesheet.sh @@ -1,7 +1,7 @@ #!/bin/bash BASE_DIR=$(dirname $0)/.. -TEI_DIR=$BASE_DIR/tei +DEP_DIR=$BASE_DIR/dependencies ####################################### # variables @@ -127,7 +127,7 @@ do output=${output%.*}$SUFFIX # echo "output: $output" read -d '' cmd << EOF -java -jar "$TEI_DIR/Stylesheets/lib/saxon9he.jar" +java -jar "$DEP_DIR/Stylesheets/lib/saxon9he.jar" "$BASE_DIR/stylesheets/$STYLESHEET" -s:"$file" -o:"$OUTPUT_DIR/$output" diff --git a/scripts/tei_stylesheet.sh b/scripts/tei_stylesheet.sh index d821e1a..2e45c06 100755 --- a/scripts/tei_stylesheet.sh +++ b/scripts/tei_stylesheet.sh @@ -1,7 +1,7 @@ #!/bin/bash BASE_DIR=$(dirname $0)/.. -TEI_DIR=$BASE_DIR/tei +DEP_DIR=$BASE_DIR/dependencies ####################################### # variables @@ -10,7 +10,7 @@ TEI_DIR=$BASE_DIR/tei input_dir_default="$BASE_DIR/schema/odd" input_dirs=() output_dir="$BASE_DIR/schema/generated" -script_dirs=( "$TEI_DIR/Stylesheets/bin" "$BASE_DIR/stylesheets" ) +script_dirs=( "$DEP_DIR/Stylesheets/bin" "$BASE_DIR/stylesheets" ) name_pattern='*' cmd="teitornc" options= @@ -45,7 +45,7 @@ function print_help { echo " teitornc: create relax-ng schemas" echo " teitohtml: create html docu" echo "all values:" - for f in $(ls $TEI_DIR/Stylesheets/bin); do + for f in $(ls $DEP_DIR/Stylesheets/bin); do echo " $f" done } diff --git a/scripts/validate_xml.sh b/scripts/validate_xml.sh index 812f2d6..e57ba24 100644 --- a/scripts/validate_xml.sh +++ b/scripts/validate_xml.sh @@ -1,6 +1,7 @@ #!/bin/bash BASE_DIR=$(dirname $0)/.. +DEP_DIR=$BASE_DIR/dependencies input_dir="$BASE_DIR/corpus" schema_dir="$BASE_DIR/schema/s2/generated/rnc" @@ -58,7 +59,7 @@ while read schema_file; do while read input_file; do echo -en " with '$input_file'..." log="$(mktemp)" - java -jar ./tei/Stylesheets/lib/lib/jing.jar \ + java -jar $DEP_DIR/Stylesheets/lib/lib/jing.jar \ -c \ "$schema_file" \ "$input_file" \