Update the ansible role from upstream

Signed-off-by: Parag Nemade <pnemade@fedoraproject.org>
This commit is contained in:
Parag Nemade 2019-05-25 09:18:20 +05:30
parent f49d04d10f
commit 250bd73de6
No known key found for this signature in database
GPG Key ID: 71932951EB71E972
2 changed files with 53 additions and 10 deletions

View File

@ -18,8 +18,10 @@ Options:
-v, --verbose Turn on debug -v, --verbose Turn on debug
-l, --lang=LANG Test LANG language coverage (default: en) -l, --lang=LANG Test LANG language coverage (default: en)
-p, --path=PATH Test fonts on PATH -p, --path=PATH Test fonts on PATH
-n, --name=NAME Set NAME to store a log file.
-a, --artifactsdir=DIR test environment dir to store artifacts -a, --artifactsdir=DIR test environment dir to store artifacts
-i, --ignore=FILE Ignore FILE to check. -e, --exclude=FILE Exclude FILE to check.
-i, --include=FILE Include File to check.
_EOF_ _EOF_
} }
@ -28,14 +30,24 @@ DEBUG="${DEBUG:-}"
OPT_LANG="${OPT_LANG:-en}" OPT_LANG="${OPT_LANG:-en}"
OPT_PATH="${OPT_PATH:-}" OPT_PATH="${OPT_PATH:-}"
OPT_ARTIFACTS_DIR="${OPT_ARTIFACTS_DIR:-}" OPT_ARTIFACTS_DIR="${OPT_ARTIFACTS_DIR:-}"
OPT_IGNORE=() OPT_EXCLUDE=()
OPT_INCLUDE=()
OPT_NAME="${OPT_NAME:-}"
opt=$(getopt -n "$0" --options "hvl:p:t:a:i:" --longoptions "help,verbose,lang:,path:,test:,artifactsdir:,ignore:" -- "$@") opt=$(getopt -n "$0" --options "hvl:p:n:a:e:i:" --longoptions "help,verbose,lang:,path:,name:,artifactsdir:,exclude:,include:" -- "$@")
eval set -- "$opt" eval set -- "$opt"
while [[ $# -gt 0 ]]; do while [[ $# -gt 0 ]]; do
case "$1" in case "$1" in
-i|--ignore) -n|--name)
OPT_IGNORE+=("$2") OPT_NAME="$2"
shift 2
;;
-i|--include)
OPT_INCLUDE+=("$2")
shift 2
;;
-e|--exclude)
OPT_EXCLUDE+=("$2")
shift 2 shift 2
;; ;;
-a|--artifactsdir) -a|--artifactsdir)
@ -72,11 +84,31 @@ if [ -z "$OPT_ARTIFACTS_DIR" ] || [ -z "$OPT_LANG" ] || [ -z "$OPT_PATH" ]; then
exit 0 exit 0
fi fi
expand_regex() {
local e ret=()
local path="$1"
shift
(cd $path;
for e; do
debug "$e"
set +f
local x=$(find -regextype posix-egrep -regex "./$e" -print|sed -e 's,^\./,,g')
ret+=($x)
set -f
echo ${ret[@]}
done)
echo ${ret[@]}
}
OPT_INCLUDE=($(expand_regex $OPT_PATH ${OPT_INCLUDE[@]}))
OPT_EXCLUDE=($(expand_regex $OPT_PATH ${OPT_EXCLUDE[@]}))
debug "Path: $OPT_PATH" debug "Path: $OPT_PATH"
debug "Lang: $OPT_LANG" debug "Lang: $OPT_LANG"
debug "Artifacts dir: $OPT_ARTIFACTS_DIR" debug "Artifacts dir: $OPT_ARTIFACTS_DIR"
debug "Ignore: ${OPT_IGNORE[@]}" debug "Exclude: ${OPT_EXCLUDE[@]}"
STR_TEST_DASHED=$(echo "$OPT_PATH" | sed -e 's/\//-/g') debug "Include: ${OPT_INCLUDE[@]}"
STR_TEST_DASHED=$(echo "${OPT_NAME:-${OPT_LANG}_${OPT_PATH}}" | sed -e 's/\//-/g')
clean_exit() { clean_exit() {
rc=$?; rc=$?;
@ -130,19 +162,29 @@ contains() {
debug "Check language coverage" debug "Check language coverage"
set +f set +f
for i in `find $OPT_PATH -regex '.*/*\.\(t1\)?\(ttf\)?\(otf\)?\(ttc\)?\(pcf.*\)?'`; do for i in `find $OPT_PATH -regex '.*/*\.\(t1\)?\(ttf\)?\(otf\)?\(ttc\)?\(pcf.*\)?\(pfa\)?'`; do
set -f set -f
debug "$i" debug "$i"
if test -f $i; then if test -f $i; then
n=`basename $i` n=`basename $i`
set +e set +e
contains "$n" "${OPT_IGNORE[@]}" contains "$n" "${OPT_EXCLUDE[@]}"
ret=$? ret=$?
set -e set -e
if [ $ret -eq 1 ]; then if [ $ret -eq 1 ]; then
debug "ignoring $i" debug "ignoring $i"
continue continue
fi fi
if [ ${#OPT_INCLUDE[@]} -ne 0 ]; then
set +e
contains "$n" "${OPT_INCLUDE[@]}"
ret=$?
set -e
if [ $ret -eq 0 ]; then
debug "$i isn't targeted file"
continue
fi
fi
debug " $i" debug " $i"
res=`fc-validate -l $OPT_LANG $i` res=`fc-validate -l $OPT_LANG $i`
if echo $res | grep -q Missing; then if echo $res | grep -q Missing; then

View File

@ -2,10 +2,11 @@
- block: - block:
- name: language coverage - name: language coverage
script: run-lang-coverage-test --lang "{{ item }}" --path "{{ path_prefix }}" --artifactsdir "{{ remote_artifacts }}" {{ "" if coverage.values is not defined or coverage[item].ignore is not defined else "--ignore " + (coverage[item].ignore | join('--ignore ')) }} script: run-lang-coverage-test --lang "{{ item }}" --path "{{ path_prefix }}" --artifactsdir "{{ remote_artifacts }}" {{ "" if coverage.values is not defined or coverage[item].name is not defined else "--name " + coverage[item].name }} {{ "" if coverage.values is not defined or coverage[item].exclude is not defined else '--exclude "' + (coverage[item].exclude | join('" --exclude "')) + '"'}} {{ "" if coverage.values is not defined or coverage[item].include is not defined else '--include "' + (coverage[item].include | join('" --include "')) + '"'}}
with_items: with_items:
- "{{ coverage if coverage.keys is not defined else coverage.keys()|list }}" - "{{ coverage if coverage.keys is not defined else coverage.keys()|list }}"
- name: generic family assignment - name: generic family assignment
when: families is defined
script: run-family-test --lang {{ item.lang }} --family '{{ item.family }}' --alias {{ item.alias }} --artifactsdir {{ remote_artifacts }} --package {{ package if item.package is not defined else item.package }} script: run-family-test --lang {{ item.lang }} --family '{{ item.family }}' --alias {{ item.alias }} --artifactsdir {{ remote_artifacts }} --package {{ package if item.package is not defined else item.package }}
with_items: with_items:
- "{{ families }}" - "{{ families }}"