From: fennecdjay Date: Fri, 4 Oct 2019 11:28:58 +0000 (+0200) Subject: :fire: help => scripts X-Git-Tag: nightly~2198^2~153 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=b57551a9feb507f92cc611432974580cd780dd9a;p=gwion.git :fire: help => scripts --- diff --git a/docs.mk b/docs.mk index 6461e166..0bd17945 100644 --- a/docs.mk +++ b/docs.mk @@ -6,7 +6,7 @@ include docs/config.mk mdr_list = $(filter-out docs/09_Benchmarks.mdr, $(shell find docs -type f -name "*.mdr")) md_list = $(mdr_list:.mdr=.md) -_docserver_config = bash help/doc-config.sh > mkdocs.yml +_docserver_config = bash scripts/doc-config.sh > mkdocs.yml _docserver_serve = $(call _docserver_config); $(DOCTOOL) -q serve _docserver_launch = $(call _docserver_serve)& echo $$! > .server_pid _docserver_kill = [ -f .server_pid ] && (kill $$(cat .server_pid); rm .server_pid) || true diff --git a/help/afl-dict/keyword.dict b/scripts/afl-dict/keyword.dict similarity index 100% rename from help/afl-dict/keyword.dict rename to scripts/afl-dict/keyword.dict diff --git a/help/afl-dict/sum b/scripts/afl-dict/sum similarity index 100% rename from help/afl-dict/sum rename to scripts/afl-dict/sum diff --git a/help/afl-dict/symbol.dict b/scripts/afl-dict/symbol.dict similarity index 100% rename from help/afl-dict/symbol.dict rename to scripts/afl-dict/symbol.dict diff --git a/help/afl.sh b/scripts/afl.sh similarity index 100% rename from help/afl.sh rename to scripts/afl.sh diff --git a/help/doc-config.sh b/scripts/doc-config.sh similarity index 100% rename from help/doc-config.sh rename to scripts/doc-config.sh diff --git a/scripts/gwion-pkg b/scripts/gwion-pkg new file mode 100644 index 00000000..a8033996 --- /dev/null +++ b/scripts/gwion-pkg @@ -0,0 +1,71 @@ +: "${GWION_PLUG_PATH:=$PWD}" +declare -A magic_variable=() + +read_manifest() { + name=$(basename $1 .manifest) + magic_variable[$name]=$((magic_variable[$name])) + [ -f $1 ] || return + while read LINE + do + [ "${LINE:0:1}" = "#" ] && continue + magic_variable[$LINE]=$((magic_variable[$LINE] + 1)) + find_manifest $LINE.manifest + done < $1 +} + +find_manifest() { + for DIR in $GWION_PLUG_PATH + do + [ -f DIR/$1 ] || continue + read_manifest $1 + return + done +} + +install_plug() { + [ -d .gwion-pkg ] || mkdir .gwion-pkg + echo "installing $2 $3" + index=$(printf "%04i" $3) + [ -f .gwion-pkg/${index}_$(basename $1 .manifest).so ] && rm .gwion-pkg/${index}_$(basename $1 .manifest).so + ln $PLUG .gwion-pkg/${index}_$(basename $1 .manifest).so +} + +install_manifest() { + for DIR in $GWION_PLUG_PATH + do + [ -d $DIR ] || continue + PLUG=$DIR/$(basename $1 .manifest).so + if [ -f $PLUG ] + then + install_plug "$1" "$PLUG" $2 + return + fi + done +} + +if [ "$1" = "list" ] +then # clear + [ -d .gwion-pkg ] && ls .gwion-pkg | sort -u | cut -d_ -f 2 +elif [ "$1" = "run" ] +then # run + shift + gwion -p .gwion-pkg $@ +elif [ "$1" = "clear" ] +then rm -rf .gwion-pkg +else +for FILE in *.manifest +do read_manifest $FILE +done + +MAX=0 +for i in "${!magic_variable[@]}" +do [ "${magic_variable[$i]}" -gt "$MAX" ] && MAX="${magic_variable[$i]}" +done + + +for i in "${!magic_variable[@]}" +do + install_manifest "$i" $(( MAX - ${magic_variable[$i]})) +done +fi + diff --git a/help/opcode.sh b/scripts/opcode.sh similarity index 100% rename from help/opcode.sh rename to scripts/opcode.sh diff --git a/help/struct_check.sh b/scripts/struct_check.sh similarity index 100% rename from help/struct_check.sh rename to scripts/struct_check.sh diff --git a/help/supp b/scripts/supp similarity index 100% rename from help/supp rename to scripts/supp diff --git a/help/test.sh b/scripts/test.sh similarity index 99% rename from help/test.sh rename to scripts/test.sh index cfb2ad08..c996e29c 100644 --- a/help/test.sh +++ b/scripts/test.sh @@ -184,7 +184,7 @@ test_gw(){ if [ "$VALGRIND" == "NO_VALGRIND" ] then LANG=C ./"$PRG" "$GWOPT" -d "$DRIVER" "$file" > "$slog" 2>"$elog" |: else - LANG=C "$VALGRIND" --suppressions=help/supp --log-file="$vlog" \ + LANG=C "$VALGRIND" --suppressions=scripts/supp --log-file="$vlog" \ ./"$PRG" "$GWOPT" -d "$DRIVER" "$file" > "$slog" 2>"$elog" |: fi ret=$? diff --git a/tests/sh/plugin.sh b/tests/sh/plugin.sh index 55b0d43a..93616113 100644 --- a/tests/sh/plugin.sh +++ b/tests/sh/plugin.sh @@ -14,7 +14,7 @@ export GWION_ADD_DIR test_plugin() { export NAME=$"$1" export PRG=$"../../gwion" - export SUPP=$"../../help/supp" + export SUPP=$"../../scripts/supp" make if [ -f "$NAME.gw" ] then GWOPT+=-p. test_gw "$NAME.gw" "$n" diff --git a/tests/sh/test.sh b/tests/sh/test.sh index 353e7b6d..98d4e764 100644 --- a/tests/sh/test.sh +++ b/tests/sh/test.sh @@ -15,7 +15,7 @@ : "${DRIVER:=dummy}" : "${MODULE:=dummy}" -: "${SUPP:=help/supp}" +: "${SUPP:=scripts/supp}" : "${ASYNC:=4}" : "${async:=$ASYNC}"