Import newer scripts upstream

This commit is contained in:
Pierre Pronchery 2020-11-03 22:31:50 +01:00
parent 4294fc2101
commit e4708275e3
4 changed files with 76 additions and 25 deletions

View File

@ -1,6 +1,6 @@
#!/bin/sh
#$Id$
#Copyright (c) 2016-2019 Pierre Pronchery <khorben@defora.org>
#Copyright (c) 2016-2020 Pierre Pronchery <khorben@defora.org>
#
#Redistribution and use in source and binary forms, with or without
#modification, are permitted provided that the following conditions are met:
@ -35,6 +35,7 @@ DEBUG="_debug"
FIND="find"
GREP="grep"
LINT="lint -g"
MKDIR="mkdir -p"
SORT="sort -n"
TR="tr"
@ -43,8 +44,8 @@ TR="tr"
#clint
_clint()
{
ret=0
subdirs="data doc src tests tools"
res=0
subdirs=
$DATE
while read line; do
@ -58,6 +59,10 @@ _clint()
;;
esac
done < "$PROJECTCONF"
if [ ! -n "$subdirs" ]; then
_error "Could not locate directories to analyze"
return $?
fi
for subdir in $subdirs; do
[ -d "../$subdir" ] || continue
for filename in $($FIND "../$subdir" -type f | $SORT); do
@ -79,13 +84,13 @@ _clint()
if [ $? -ne 0 ]; then
echo "FAIL"
echo "$PROGNAME: $filename: FAIL" 1>&2
ret=2
res=2
else
echo "OK"
fi
done
done
return $ret
return $res
}
_clint_lint()
@ -117,6 +122,14 @@ _debug()
}
#error
_error()
{
echo "$PROGNAME: $@" 1>&2
return 2
}
#usage
_usage()
{
@ -125,14 +138,6 @@ _usage()
}
#warning
_warning()
{
echo "$PROGNAME: $@" 1>&2
return 2
}
#main
clean=0
while getopts "cO:P:" name; do
@ -162,9 +167,15 @@ fi
[ $clean -ne 0 ] && exit 0
exec 3>&1
ret=0
while [ $# -gt 0 ]; do
target="$1"
dirname="${target%/*}"
shift
_clint > "$target" || exit 2
if [ -n "$dirname" -a "$dirname" != "$target" ]; then
$MKDIR -- "$dirname" || ret=$?
fi
_clint > "$target" || ret=$?
done
exit $ret

View File

@ -1,6 +1,6 @@
#!/bin/sh
#$Id$
#Copyright (c) 2017-2019 Pierre Pronchery <khorben@defora.org>
#Copyright (c) 2017-2020 Pierre Pronchery <khorben@defora.org>
#
#Redistribution and use in source and binary forms, with or without
#modification, are permitted provided that the following conditions are met:
@ -42,6 +42,7 @@ TR="tr"
_fixme()
{
res=0
subdirs=
$DATE
echo
@ -56,6 +57,10 @@ _fixme()
;;
esac
done < "$PROJECTCONF"
if [ ! -n "$subdirs" ]; then
_error "Could not locate directories to analyze"
return $?
fi
for subdir in $subdirs; do
[ -d "../$subdir" ] || continue
for filename in $($FIND "../$subdir" -type f | $SORT); do
@ -152,6 +157,14 @@ _debug()
}
#error
_error()
{
echo "$PROGNAME: $@" 1>&2
return 2
}
#usage
_usage()
{

View File

@ -1,6 +1,6 @@
#!/bin/sh
#$Id$
#Copyright (c) 2014-2017 Pierre Pronchery <khorben@defora.org>
#Copyright (c) 2014-2020 Pierre Pronchery <khorben@defora.org>
#
#Redistribution and use in source and binary forms, with or without
#modification, are permitted provided that the following conditions are met:
@ -33,6 +33,7 @@ DATE="date"
DEBUG="_debug"
FIND="find"
HTMLLINT="xmllint --html --nonet"
MKDIR="mkdir -p"
SORT="sort -n"
TR="tr"
@ -41,7 +42,7 @@ TR="tr"
#htmllint
_htmllint()
{
ret=0
res=0
$DATE
echo
@ -64,11 +65,11 @@ _htmllint()
echo "$filename:"
else
echo "$PROGNAME: $filename: FAIL" 1>&2
ret=2
res=2
fi
done
done
return $ret
return $res
}
@ -121,9 +122,15 @@ fi
[ $clean -ne 0 ] && exit 0
exec 3>&1
ret=0
while [ $# -gt 0 ]; do
target="$1"
dirname="${target%/*}"
shift
_htmllint > "$target" || exit 2
if [ -n "$dirname" -a "$dirname" != "$target" ]; then
$MKDIR -- "$dirname" || ret=$?
fi
_htmllint > "$target" || ret=$?
done
exit $ret

View File

@ -1,6 +1,6 @@
#!/bin/sh
#$Id$
#Copyright (c) 2014-2017 Pierre Pronchery <khorben@defora.org>
#Copyright (c) 2014-2020 Pierre Pronchery <khorben@defora.org>
#
#Redistribution and use in source and binary forms, with or without
#modification, are permitted provided that the following conditions are met:
@ -32,6 +32,7 @@ PROJECTCONF="../project.conf"
DATE="date"
DEBUG="_debug"
FIND="find"
MKDIR="mkdir -p"
SORT="sort -n"
TR="tr"
XMLLINT="xmllint --nonet"
@ -41,7 +42,8 @@ XMLLINT="xmllint --nonet"
#xmllint
_xmllint()
{
ret=0
res=0
subdirs=
$DATE
echo
@ -56,6 +58,10 @@ _xmllint()
;;
esac
done < "$PROJECTCONF"
if [ ! -n "$subdirs" ]; then
_error "Could not locate directories to analyze"
return $?
fi
for subdir in $subdirs; do
[ -d "../$subdir" ] || continue
for filename in $($FIND "../$subdir" -type f -a \( -name '*.xml' -o -name '*.xsl' \) | $SORT); do
@ -64,11 +70,11 @@ _xmllint()
echo "$filename:"
else
echo "$PROGNAME: $filename: FAIL" 1>&2
ret=2
res=2
fi
done
done
return $ret
return $res
}
@ -84,6 +90,14 @@ _debug()
}
#error
_error()
{
echo "$PROGNAME: $@" 1>&2
return 2
}
#usage
_usage()
{
@ -121,9 +135,15 @@ fi
[ $clean -ne 0 ] && exit 0
exec 3>&1
ret=0
while [ $# -gt 0 ]; do
target="$1"
dirname="${target%/*}"
shift
_xmllint > "$target" || exit 2
if [ -n "$dirname" -a "$dirname" != "$target" ]; then
$MKDIR -- "$dirname" || ret=$?
fi
_xmllint > "$target" || ret=$?
done
exit $ret