Added two sample scripts to check for conformity of shell and XML files
This commit is contained in:
parent
712fa1e744
commit
65bbbf366f
2
Makefile
2
Makefile
@ -41,7 +41,9 @@ dist:
|
|||||||
$(PACKAGE)-$(VERSION)/doc/scripts/gtkdoc.sh \
|
$(PACKAGE)-$(VERSION)/doc/scripts/gtkdoc.sh \
|
||||||
$(PACKAGE)-$(VERSION)/doc/scripts/pkgconfig.sh \
|
$(PACKAGE)-$(VERSION)/doc/scripts/pkgconfig.sh \
|
||||||
$(PACKAGE)-$(VERSION)/doc/scripts/manual.css.xml \
|
$(PACKAGE)-$(VERSION)/doc/scripts/manual.css.xml \
|
||||||
|
$(PACKAGE)-$(VERSION)/doc/scripts/shlint.sh \
|
||||||
$(PACKAGE)-$(VERSION)/doc/scripts/subst.sh \
|
$(PACKAGE)-$(VERSION)/doc/scripts/subst.sh \
|
||||||
|
$(PACKAGE)-$(VERSION)/doc/scripts/xmllint.sh \
|
||||||
$(PACKAGE)-$(VERSION)/doc/scripts/project.conf \
|
$(PACKAGE)-$(VERSION)/doc/scripts/project.conf \
|
||||||
$(PACKAGE)-$(VERSION)/src/configure.c \
|
$(PACKAGE)-$(VERSION)/src/configure.c \
|
||||||
$(PACKAGE)-$(VERSION)/src/settings.c \
|
$(PACKAGE)-$(VERSION)/src/settings.c \
|
||||||
|
@ -25,7 +25,11 @@ install:
|
|||||||
$(MKDIR) $(DESTDIR)$(PREFIX)/share/doc/configure/scripts
|
$(MKDIR) $(DESTDIR)$(PREFIX)/share/doc/configure/scripts
|
||||||
$(INSTALL) -m 0644 manual.css.xml $(DESTDIR)$(PREFIX)/share/doc/configure/scripts/manual.css.xml
|
$(INSTALL) -m 0644 manual.css.xml $(DESTDIR)$(PREFIX)/share/doc/configure/scripts/manual.css.xml
|
||||||
$(MKDIR) $(DESTDIR)$(PREFIX)/share/doc/configure/scripts
|
$(MKDIR) $(DESTDIR)$(PREFIX)/share/doc/configure/scripts
|
||||||
|
$(INSTALL) -m 0644 shlint.sh $(DESTDIR)$(PREFIX)/share/doc/configure/scripts/shlint.sh
|
||||||
|
$(MKDIR) $(DESTDIR)$(PREFIX)/share/doc/configure/scripts
|
||||||
$(INSTALL) -m 0644 subst.sh $(DESTDIR)$(PREFIX)/share/doc/configure/scripts/subst.sh
|
$(INSTALL) -m 0644 subst.sh $(DESTDIR)$(PREFIX)/share/doc/configure/scripts/subst.sh
|
||||||
|
$(MKDIR) $(DESTDIR)$(PREFIX)/share/doc/configure/scripts
|
||||||
|
$(INSTALL) -m 0644 xmllint.sh $(DESTDIR)$(PREFIX)/share/doc/configure/scripts/xmllint.sh
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
$(RM) -- $(DESTDIR)$(PREFIX)/share/doc/configure/scripts/appbroker.sh
|
$(RM) -- $(DESTDIR)$(PREFIX)/share/doc/configure/scripts/appbroker.sh
|
||||||
@ -34,6 +38,8 @@ uninstall:
|
|||||||
$(RM) -- $(DESTDIR)$(PREFIX)/share/doc/configure/scripts/gtkdoc.sh
|
$(RM) -- $(DESTDIR)$(PREFIX)/share/doc/configure/scripts/gtkdoc.sh
|
||||||
$(RM) -- $(DESTDIR)$(PREFIX)/share/doc/configure/scripts/pkgconfig.sh
|
$(RM) -- $(DESTDIR)$(PREFIX)/share/doc/configure/scripts/pkgconfig.sh
|
||||||
$(RM) -- $(DESTDIR)$(PREFIX)/share/doc/configure/scripts/manual.css.xml
|
$(RM) -- $(DESTDIR)$(PREFIX)/share/doc/configure/scripts/manual.css.xml
|
||||||
|
$(RM) -- $(DESTDIR)$(PREFIX)/share/doc/configure/scripts/shlint.sh
|
||||||
$(RM) -- $(DESTDIR)$(PREFIX)/share/doc/configure/scripts/subst.sh
|
$(RM) -- $(DESTDIR)$(PREFIX)/share/doc/configure/scripts/subst.sh
|
||||||
|
$(RM) -- $(DESTDIR)$(PREFIX)/share/doc/configure/scripts/xmllint.sh
|
||||||
|
|
||||||
.PHONY: all clean distclean install uninstall
|
.PHONY: all clean distclean install uninstall
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#$Id$
|
#$Id$
|
||||||
dist=Makefile,appbroker.sh,docbook.sh,gettext.sh,gtkdoc.sh,pkgconfig.sh,manual.css.xml,subst.sh
|
dist=Makefile,appbroker.sh,docbook.sh,gettext.sh,gtkdoc.sh,pkgconfig.sh,manual.css.xml,shlint.sh,subst.sh,xmllint.sh
|
||||||
|
|
||||||
[appbroker.sh]
|
[appbroker.sh]
|
||||||
install=$(PREFIX)/share/doc/configure/scripts
|
install=$(PREFIX)/share/doc/configure/scripts
|
||||||
@ -19,5 +19,11 @@ install=$(PREFIX)/share/doc/configure/scripts
|
|||||||
[pkgconfig.sh]
|
[pkgconfig.sh]
|
||||||
install=$(PREFIX)/share/doc/configure/scripts
|
install=$(PREFIX)/share/doc/configure/scripts
|
||||||
|
|
||||||
|
[shlint.sh]
|
||||||
|
install=$(PREFIX)/share/doc/configure/scripts
|
||||||
|
|
||||||
[subst.sh]
|
[subst.sh]
|
||||||
install=$(PREFIX)/share/doc/configure/scripts
|
install=$(PREFIX)/share/doc/configure/scripts
|
||||||
|
|
||||||
|
[xmllint.sh]
|
||||||
|
install=$(PREFIX)/share/doc/configure/scripts
|
||||||
|
78
doc/scripts/shlint.sh
Executable file
78
doc/scripts/shlint.sh
Executable file
@ -0,0 +1,78 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#$Id$
|
||||||
|
#Copyright (c) 2014 Pierre Pronchery <khorben@defora.org>
|
||||||
|
#This program is free software: you can redistribute it and/or modify
|
||||||
|
#it under the terms of the GNU General Public License as published by
|
||||||
|
#the Free Software Foundation, version 3 of the License.
|
||||||
|
#
|
||||||
|
#This program is distributed in the hope that it will be useful,
|
||||||
|
#but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
#GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
#You should have received a copy of the GNU General Public License
|
||||||
|
#along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#variables
|
||||||
|
DEVNULL="/dev/null"
|
||||||
|
#executables
|
||||||
|
DEBUG="_debug"
|
||||||
|
FIND="find"
|
||||||
|
SHLINT="sh -n"
|
||||||
|
|
||||||
|
|
||||||
|
#functions
|
||||||
|
#debug
|
||||||
|
_debug()
|
||||||
|
{
|
||||||
|
echo "$@" 1>&2
|
||||||
|
"$@"
|
||||||
|
res=$?
|
||||||
|
#ignore errors when the command is not available
|
||||||
|
[ $res -eq 127 ] && return 0
|
||||||
|
return $res
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#usage
|
||||||
|
_usage()
|
||||||
|
{
|
||||||
|
echo "Usage: shlint.sh target" 1>&2
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#main
|
||||||
|
clean=0
|
||||||
|
while getopts "cP:" "name"; do
|
||||||
|
case "$name" in
|
||||||
|
c)
|
||||||
|
clean=1
|
||||||
|
;;
|
||||||
|
P)
|
||||||
|
#XXX ignored for compatibility
|
||||||
|
;;
|
||||||
|
?)
|
||||||
|
_usage
|
||||||
|
exit $?
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
shift $((OPTIND - 1))
|
||||||
|
if [ $# -ne 1 ]; then
|
||||||
|
_usage
|
||||||
|
exit $?
|
||||||
|
fi
|
||||||
|
target="$1"
|
||||||
|
|
||||||
|
#clean
|
||||||
|
[ $clean -ne 0 ] && return 0
|
||||||
|
|
||||||
|
ret=0
|
||||||
|
> "$target"
|
||||||
|
for i in $($FIND "../doc" "../src" "../tests" "../tools" -name '*.sh'); do
|
||||||
|
$DEBUG $SHLINT "$i" > "$DEVNULL" 2>> "$target" || ret=2
|
||||||
|
done
|
||||||
|
exit $ret
|
78
doc/scripts/xmllint.sh
Executable file
78
doc/scripts/xmllint.sh
Executable file
@ -0,0 +1,78 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#$Id$
|
||||||
|
#Copyright (c) 2014 Pierre Pronchery <khorben@defora.org>
|
||||||
|
#This program is free software: you can redistribute it and/or modify
|
||||||
|
#it under the terms of the GNU General Public License as published by
|
||||||
|
#the Free Software Foundation, version 3 of the License.
|
||||||
|
#
|
||||||
|
#This program is distributed in the hope that it will be useful,
|
||||||
|
#but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
#GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
#You should have received a copy of the GNU General Public License
|
||||||
|
#along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#variables
|
||||||
|
DEVNULL="/dev/null"
|
||||||
|
#executables
|
||||||
|
DEBUG="_debug"
|
||||||
|
FIND="find"
|
||||||
|
XMLLINT="xmllint"
|
||||||
|
|
||||||
|
|
||||||
|
#functions
|
||||||
|
#debug
|
||||||
|
_debug()
|
||||||
|
{
|
||||||
|
echo "$@" 1>&2
|
||||||
|
"$@"
|
||||||
|
res=$?
|
||||||
|
#ignore errors when the command is not available
|
||||||
|
[ $res -eq 127 ] && return 0
|
||||||
|
return $res
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#usage
|
||||||
|
_usage()
|
||||||
|
{
|
||||||
|
echo "Usage: xmllint.sh target" 1>&2
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#main
|
||||||
|
clean=0
|
||||||
|
while getopts "cP:" "name"; do
|
||||||
|
case "$name" in
|
||||||
|
c)
|
||||||
|
clean=1
|
||||||
|
;;
|
||||||
|
P)
|
||||||
|
#XXX ignored for compatibility
|
||||||
|
;;
|
||||||
|
?)
|
||||||
|
_usage
|
||||||
|
exit $?
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
shift $((OPTIND - 1))
|
||||||
|
if [ $# -ne 1 ]; then
|
||||||
|
_usage
|
||||||
|
exit $?
|
||||||
|
fi
|
||||||
|
target="$1"
|
||||||
|
|
||||||
|
#clean
|
||||||
|
[ $clean -ne 0 ] && return 0
|
||||||
|
|
||||||
|
ret=0
|
||||||
|
> "$target"
|
||||||
|
for i in $($FIND "../src" "../tools" -name '*.xml' -o -name '*.xsl'); do
|
||||||
|
$DEBUG $XMLLINT "$i" > "$DEVNULL" 2>> "$target" || ret=2
|
||||||
|
done
|
||||||
|
exit $ret
|
Loading…
Reference in New Issue
Block a user