diff --git a/Makefile b/Makefile index 448d8c5..02b16ab 100644 --- a/Makefile +++ b/Makefile @@ -41,7 +41,9 @@ dist: $(PACKAGE)-$(VERSION)/doc/scripts/gtkdoc.sh \ $(PACKAGE)-$(VERSION)/doc/scripts/pkgconfig.sh \ $(PACKAGE)-$(VERSION)/doc/scripts/manual.css.xml \ + $(PACKAGE)-$(VERSION)/doc/scripts/shlint.sh \ $(PACKAGE)-$(VERSION)/doc/scripts/subst.sh \ + $(PACKAGE)-$(VERSION)/doc/scripts/xmllint.sh \ $(PACKAGE)-$(VERSION)/doc/scripts/project.conf \ $(PACKAGE)-$(VERSION)/src/configure.c \ $(PACKAGE)-$(VERSION)/src/settings.c \ diff --git a/doc/scripts/Makefile b/doc/scripts/Makefile index 57e40d6..ab72585 100644 --- a/doc/scripts/Makefile +++ b/doc/scripts/Makefile @@ -25,7 +25,11 @@ install: $(MKDIR) $(DESTDIR)$(PREFIX)/share/doc/configure/scripts $(INSTALL) -m 0644 manual.css.xml $(DESTDIR)$(PREFIX)/share/doc/configure/scripts/manual.css.xml $(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 + $(MKDIR) $(DESTDIR)$(PREFIX)/share/doc/configure/scripts + $(INSTALL) -m 0644 xmllint.sh $(DESTDIR)$(PREFIX)/share/doc/configure/scripts/xmllint.sh uninstall: $(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/pkgconfig.sh $(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/xmllint.sh .PHONY: all clean distclean install uninstall diff --git a/doc/scripts/project.conf b/doc/scripts/project.conf index b377070..a551228 100644 --- a/doc/scripts/project.conf +++ b/doc/scripts/project.conf @@ -1,5 +1,5 @@ #$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] install=$(PREFIX)/share/doc/configure/scripts @@ -19,5 +19,11 @@ install=$(PREFIX)/share/doc/configure/scripts [pkgconfig.sh] install=$(PREFIX)/share/doc/configure/scripts +[shlint.sh] +install=$(PREFIX)/share/doc/configure/scripts + [subst.sh] install=$(PREFIX)/share/doc/configure/scripts + +[xmllint.sh] +install=$(PREFIX)/share/doc/configure/scripts diff --git a/doc/scripts/shlint.sh b/doc/scripts/shlint.sh new file mode 100755 index 0000000..d202afc --- /dev/null +++ b/doc/scripts/shlint.sh @@ -0,0 +1,78 @@ +#!/bin/sh +#$Id$ +#Copyright (c) 2014 Pierre Pronchery +#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 . + + + +#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 diff --git a/doc/scripts/xmllint.sh b/doc/scripts/xmllint.sh new file mode 100755 index 0000000..c5f911d --- /dev/null +++ b/doc/scripts/xmllint.sh @@ -0,0 +1,78 @@ +#!/bin/sh +#$Id$ +#Copyright (c) 2014 Pierre Pronchery +#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 . + + + +#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