[debian-edu-commits] [Git][debian-edu/debian-edu-doc][master] 2 commits: Add autopkgtest to validate XML and HTML files
Wolfgang Schweer (@schweer-guest)
gitlab at salsa.debian.org
Fri Oct 22 01:14:53 BST 2021
Wolfgang Schweer pushed to branch master at Debian Edu / debian-edu-doc
Commits:
7ce80817 by Wolfgang Schweer at 2021-10-22T02:09:35+02:00
Add autopkgtest to validate XML and HTML files
validate-xmls-lint, taken unmodified from src:desktop-base
validate-html-lint, based upon validate-xmls-lint
xmllint-functions, taken from src:desktop-base and adjusted
Signed-off-by: Wolfgang Schweer <wschweer at arcor.de>
- - - - -
5c62c10c by Wolfgang Schweer at 2021-10-22T02:13:46+02:00
debian/copyright: Update after running 'make update-copyright'
Signed-off-by: Wolfgang Schweer <wschweer at arcor.de>
- - - - -
7 changed files:
- debian/changelog
- debian/copyright
- debian/copyright.packaging
- + debian/tests/control
- + debian/tests/validate-html-lint
- + debian/tests/validate-xmls-lint
- + debian/tests/xmllint-functions
Changes:
=====================================
debian/changelog
=====================================
@@ -9,6 +9,11 @@ debian-edu-doc (2.12.3) UNRELEASED; urgency=medium
- Spanish: Eulalio Barbero Espinosa
[ Wolfgang Schweer ]
+ * Add autopkgtest to validate XML and HTML files:
+ - validate-xmls-lint, taken unmodified from src:desktop-base.
+ - validate-html-lint, based upon validate-xmls-lint.
+ - xmllint-functions, taken from src:desktop-base and adjusted.
+ * debian/copyright: Update after running 'make update-copyright'.
* documentation/common/Makefile.common: Improve clean target. Closes: #989936
Thanks to hoxp18 for spotting and reporting the issue.
=====================================
debian/copyright
=====================================
@@ -16,6 +16,11 @@ Copyright: 2006-2020 Holger Levsen <holger at debian.org>
2004-2007 Frode Jemtland <frode.jemtland at skolelinux.no>
License: GPL-2+
+Files: debian/tests/*
+Copyright: 2021 Aurélien Couderc <coucouf at debian.org>
+ 2021 Wolfgang Schweer <wschweer at arcor.de>
+License: GPL-2+
+
Files: documentation/scripts/get_copyright
Copyright: 2012-2013 David Prévot <taffit at debian.org>
2016 Petter Reinholdtsen <pere at hungry.com>
@@ -147,7 +152,8 @@ Files: documentation/*/fixme-status.txt documentation/*/version
Copyright: Debian Edu Team (These files are generated by scripts.)
License: GPL-2+
-Files: documentation/audacity/audacity-manual.xml documentation/audacity/audacity-manual-stripped.xml documentation/audacity/source/AllInOne-audacity-manual.xml documentation/audacity/audacity-manual.potCopyright: 2008, 2009 Alf Tonny Bätz
+Files: documentation/audacity/audacity-manual.xml documentation/audacity/audacity-manual-stripped.xml documentation/audacity/source/AllInOne-audacity-manual.xml documentation/audacity/audacity-manual.pot
+Copyright: 2008, 2009 Alf Tonny Bätz
2009 Holger Levsen
License: GPL-2+
=====================================
debian/copyright.packaging
=====================================
@@ -16,6 +16,11 @@ Copyright: 2006-2020 Holger Levsen <holger at debian.org>
2004-2007 Frode Jemtland <frode.jemtland at skolelinux.no>
License: GPL-2+
+Files: debian/tests/*
+Copyright: 2021 Aurélien Couderc <coucouf at debian.org>
+ 2021 Wolfgang Schweer <wschweer at arcor.de>
+License: GPL-2+
+
Files: documentation/scripts/get_copyright
Copyright: 2012-2013 David Prévot <taffit at debian.org>
2016 Petter Reinholdtsen <pere at hungry.com>
=====================================
debian/tests/control
=====================================
@@ -0,0 +1,2 @@
+Tests: validate-xmls-lint validate-html-lint
+Depends: libxml2-utils
=====================================
debian/tests/validate-html-lint
=====================================
@@ -0,0 +1,22 @@
+#!/bin/bash
+
+dir_name=$(dirname $0)
+. ${dir_name}/xmllint-functions
+
+XML_FILE_PATTERN="*.html"
+XML_LINT_SUMMARY="html-lint-summary.csv"
+if [[ -n ${AUTOPKGTEST_ARTIFACTS} ]] ; then
+ XML_LINT_SUMMARY="${AUTOPKGTEST_ARTIFACTS}/${XML_LINT_SUMMARY}"
+fi
+
+
+xml_lint_command="lint_xmls ${XML_FILE_PATTERN} ${XML_LINT_SUMMARY}"
+echo "$0: running '${xml_lint_command}'..."
+${xml_lint_command}
+xml_lint_result=$?
+
+echo "$0: '${xml_lint_command}' returned ${xml_lint_result}"
+
+
+exit ${xml_lint_result}
+
=====================================
debian/tests/validate-xmls-lint
=====================================
@@ -0,0 +1,22 @@
+#!/bin/bash
+
+dir_name=$(dirname $0)
+. ${dir_name}/xmllint-functions
+
+XML_FILE_PATTERN="*.xml"
+XML_LINT_SUMMARY="xmls-lint-summary.csv"
+if [[ -n ${AUTOPKGTEST_ARTIFACTS} ]] ; then
+ XML_LINT_SUMMARY="${AUTOPKGTEST_ARTIFACTS}/${XML_LINT_SUMMARY}"
+fi
+
+
+xml_lint_command="lint_xmls ${XML_FILE_PATTERN} ${XML_LINT_SUMMARY}"
+echo "$0: running '${xml_lint_command}'..."
+${xml_lint_command}
+xml_lint_result=$?
+
+echo "$0: '${xml_lint_command}' returned ${xml_lint_result}"
+
+
+exit ${xml_lint_result}
+
=====================================
debian/tests/xmllint-functions
=====================================
@@ -0,0 +1,48 @@
+#!/bin/bash
+
+lint_xmls() {
+ local xml_file_pattern=$1
+ local xml_lint_summary=$2
+
+ if [ "$#" -ne 2 ] ; then
+ echo "$0: wrong number of arguments."
+ echo "Expected:"
+ echo " $0 xml_file_pattern summary_file_name"
+ return 255
+ fi
+
+ echo "Running xmllint for pattern '${xml_file_pattern}'"
+ echo "Current directory is '$(pwd)'"
+ echo "Result will be stored in ${xml_lint_summary}"
+ echo
+
+ echo "file,xmllint_status" > ${xml_lint_summary}
+
+ local files_list=$(find . -name "${xml_file_pattern}")
+ local nb_files=$(echo "${files_list}" | wc -l)
+ local nb_ok=0
+ local nb_errors=0
+
+ echo "${nb_files} files will be checked"
+
+ while IFS= read -d $'\n' -r xml_file ; do
+ xmllint --noout ${xml_file}
+ local xmllint_result=$?
+ echo "${xml_file},${xmllint_result}" >> ${xml_lint_summary}
+ if [ ${xmllint_result} -eq 0 ] ; then
+ echo "'${xml_file}' is OK"
+ ((nb_ok++))
+ else
+ echo "'${xml_file}' has errors"
+ ((nb_errors++))
+ fi
+ done <<< "${files_list}"
+
+ echo "Results of xmllint for pattern '${xml_file_pattern}'"
+ echo " Checked: ${nb_files}"
+ echo " OK: ${nb_ok}"
+ echo " Errors: ${nb_errors}"
+
+ return ${nb_errors}
+
+}
View it on GitLab: https://salsa.debian.org/debian-edu/debian-edu-doc/-/compare/4c9137e8173a0a178def680c999cd4925994eb88...5c62c10cfbdd62719aac3f390dc3a72a8abb4b54
--
View it on GitLab: https://salsa.debian.org/debian-edu/debian-edu-doc/-/compare/4c9137e8173a0a178def680c999cd4925994eb88...5c62c10cfbdd62719aac3f390dc3a72a8abb4b54
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-edu-commits/attachments/20211022/a1b1d9ba/attachment-0001.htm>
More information about the debian-edu-commits
mailing list