Accepting request 1070731 from Publishing

Automatic submission by obs-autosubmit

OBS-URL: https://build.opensuse.org/request/show/1070731
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/docbook_5?expand=0&rev=34
factory
Dominique Leuenberger 3 months ago committed by Git OBS Bridge
commit 94abff9abd

@ -0,0 +1,175 @@
#!/bin/bash
#
# Checks catalog URIs
#
# Dependencies:
# * xmlstarlet
#
# Copyright 2023 SUSE Linux Products GmbH
# Author: Tom Schraitle 2023
ME=${0##*/}
BUILDROOT=""
ERRORS=()
function usage()
{
cat << EOF
$ME [--buildroot=BUILDROOT] CATALOG_FILE
Checks catalog URIs
Options
--root Used when building a package, points
to the build root
Arguments
CATALOG_FILE XML catalog file with catalog entries
Return codes
0 everything fine. Celebrate! \o/
10 catalog file doesn't exist
100 some catalog error occured
EOF
}
function resolveuri() {
local catalog="$1"
local uri="$2"
xmlcatalog "$catalog" "$uri" 2>/dev/null
}
function xpathfromcatalog() {
local catalog="$1"
local xpath="$2"
local NS="urn:oasis:names:tc:entity:xmlns:xml:catalog"
xml sel --text -N c=$NS -t -v "$xpath" "$catalog"
}
# -- CLI parsing
ARGS=$(getopt -o h -l help,buildroot: -n "$ME" -- "$@")
eval set -- "$ARGS"
while true; do
case "$1" in
--help|-h)
usage
exit 0
;;
--buildroot)
# Ensure that path ends with "/"
BUILDROOT="${2%/}/"
shift 2
;;
--) shift ; break ;;
*) exit_on_error "Wrong parameter: $1" ;;
esac
done
CATALOG="$1"
if [ ! -e "$CATALOG" ]; then
printf "Catalog file '$CATALOG' doesn't exist" >/dev/stderr
exit 10
fi
declare -A TO_CHECK=(
#-------------
[5.0/nvdl]="docbook.nvdl"
[5.0/rng]="docbook.rnc docbook.rng docbookxi.rnc docbookxi.rng"
[5.0/sch]="docbook.sch"
[5.0/xsd]="docbook.xsd xlink.xsd xml.xsd"
#-------------
[5.1/nvdl]="docbook.nvdl"
[5.1/rng]="assembly.rnc assembly.rng dbits.rnc dbits.rng docbook.rnc docbook.rng docbookxi.rnc docbookxi.rng"
[5.1/sch]="assembly.sch dbits.sch docbook.sch docbookxi.sch"
#-------------
[5.2/nvdl]="assembly.nvdl dbits.nvdl docbook.nvdl"
[5.2/rng]="assembly.rnc assembly.rng assemblyxi.rnc assemblyxi.rng dbits.rnc dbits.rng dbitsxi.rnc dbitsxi.rng docbook.rnc docbook.rng docbookxi.rnc docbookxi.rng"
[5.2/sch]="assembly.sch assemblyxi.sch dbits.sch docbook.sch docbookxi.sch"
#-------------
)
SYSTEMS=$(xpathfromcatalog "$CATALOG" \
"//c:system/@systemId")
#
for uri in $SYSTEMS; do
next=$(( "${#ERRORS[@]}" + 1 ))
result=$(resolveuri "$CATALOG" "$uri")
if [[ $? -ne 0 ]]; then
result=""
ERRORS[next]="$uri"
else
result="${BUILDROOT}${result#file://*}"
if [[ $ret -ne 0 ]]; then
result=""
ERRORS[next]="$uri/$file"
elif [[ ! -e $result ]]; then
ERRORS[next]="$result"
fi
fi
done
REWRITESYSTEMS=$(xpathfromcatalog "$CATALOG" \
"//c:rewriteSystem/@systemIdStartString")
for uri in $REWRITESYSTEMS; do
result=$(resolveuri "$CATALOG" "$uri")
if [[ $? -ne 0 ]]; then
result=""
next=$(( ${#ERRORS[@]} + 1 ))
ERRORS[next]="$uri"
fi
# Check if we have after the release a format
if [[ $uri =~ ((5\.[0-9])/([^/]+))(/)? ]]; then
# If we have a match, we have:
# ${BASH_REMATCH[0]} => the complete match
# ${BASH_REMATCH[1]} => DocBook version + Format, e.g "5.0/rng"
# ${BASH_REMATCH[2]} => DocBook version only
# ${BASH_REMATCH[3]} => Format only
DBFORMAT=${BASH_REMATCH[1]}
FORMAT=${BASH_REMATCH[3]}
FILES="${TO_CHECK[$DBFORMAT]}"
# Remove "/" at end, if needed:
uri="${uri%/}"
# echo "To check $DBFORMAT: $FILES"
for file in $FILES; do
echo -en "Checking $uri/$file... =>"
next=$(( "$len" + 1 ))
result=$(resolveuri "$CATALOG" "${uri}/$file")
ret=$?
result="${BUILDROOT}${result#file://*}"
# We check the return value and _not_ the result string
if [[ $ret -ne 0 ]]; then
result=""
ERRORS[next]="$uri/$file"
echo -en " not resolvable\n"
elif [[ ! -e $result ]]; then
ERRORS[next]="$result"
echo -en " doesn't exist\n"
else
echo -en " ok\n"
fi
done
fi
done
echo "-----------------------------"
# make them unique:
ERRORS=($(for err in "${ERRORS[@]}"; do echo "${err}"; done | sort -u))
echo "Found ${#ERRORS[@]} errors".
if [ ${#ERRORS[@]} -ne 0 ]; then
for elem in "${!ERRORS[@]}"; do
echo "${elem}: ${ERRORS[${elem}]}"
done
exit 100
fi
exit 0

@ -1,3 +1,21 @@
-------------------------------------------------------------------
Fri Mar 3 06:54:34 UTC 2023 - Thomas Schraitle <thomas.schraitle@suse.com> - 5.2CR5
Only spec file changes
- Introduce check-catalog.sh script in %check section
This script tests the docbook_5.xml XML catalog, extracts entries, and checks
if the file exists.
- Add missing "/" in catalog file "docbook_5.xml"
In several rewritePrefix attributes the missing "/" leads to invalid local paths.
For example:
$ xmlcatalog /etc/xml/catalog https://cdn.docbook.org/schema/5.2/rng/assemblyxi.rnc
file:///usr/share/xml/docbook/schema/rng/5.2assemblyxi.rnc
The ".../5.2assemblyxi.rnc" part should be ".../5.2/assemblyxi.rnc".
-------------------------------------------------------------------
Thu Feb 9 12:39:46 UTC 2023 - Thomas Schraitle <thomas.schraitle@suse.com> - 5.2CR5

@ -33,6 +33,9 @@ Source2: %{name}-README.SUSE
Source3: docbook-5.0-docs.tar.bz2
Source4: docbook-5.1-docs.tar.bz2
Source6: Makefile
# For testing
Source10: check-catalog.sh
# DB 5.0
Source500: docbook-5.0.tar.bz2
# DB 5.1
@ -46,6 +49,7 @@ BuildRequires: fdupes
BuildRequires: libxml2-tools
BuildRequires: sgml-skel
BuildRequires: unzip
BuildRequires: xmlstarlet
Requires: sgml-skel >= 0.7
Requires(post): sgml-skel >= 0.7
Requires(postun):sgml-skel >= 0.7
@ -119,12 +123,10 @@ update-xml-catalog
%check
%define catalog %{buildroot}%{xml_sysconf_dir}/catalog.d/docbook_5.xml
if [ -e %{catalog} ]; then
xmlcatalog %{catalog} http://www.oasis-open.org/docbook/xml/5.2/rng/docbook.rnc
exit 0
else
exit 10
fi
cp -p %{SOURCE10} .
chmod +x check-catalog.sh
./check-catalog.sh --buildroot %{buildroot} "%{catalog}"
%files
%config %{xml_sysconf_dir}/catalog.d/docbook_5.xml

@ -1,16 +1,17 @@
<?xml version="1.0"?>
<!DOCTYPE catalog PUBLIC
<!-- <!DOCTYPE catalog PUBLIC
"-//OASIS//DTD Entity Resolution XML Catalog V1.0//EN"
"http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">
-->
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
<group id="docbook_5">
<!-- Version 5.0 -->
<public publicId="-//OASIS//DTD DocBook XML 5.0//EN" uri="file:///usr/share/xml/docbook/schema/dtd/5.0/docbook.dtd"/>
<rewriteSystem systemIdStartString="http://www.oasis-open.org/docbook/xml/5.0" rewritePrefix="file:///usr/share/xml/docbook/schema/dtd/5.0"/>
<rewriteSystem systemIdStartString="http://www.oasis-open.org/docbook/xml/5.0" rewritePrefix="file:///usr/share/xml/docbook/schema/dtd/5.0/"/>
<rewriteURI uriStartString="http://www.oasis-open.org/docbook/xml/5.0" rewritePrefix="file:///usr/share/xml/docbook/schema/dtd/5.0"/>
<rewriteURI uriStartString="http://www.oasis-open.org/docbook/xml/5.0" rewritePrefix="file:///usr/share/xml/docbook/schema/dtd/5.0/"/>
<rewriteSystem systemIdStartString="http://www.oasis-open.org/docbook/xml/5.0/rng/" rewritePrefix="file:///usr/share/xml/docbook/schema/rng/5.0/"/>
<rewriteURI uriStartString="http://www.oasis-open.org/docbook/xml/5.0/rng/" rewritePrefix="file:///usr/share/xml/docbook/schema/rng/5.0/"/>
<rewriteSystem systemIdStartString="http://www.oasis-open.org/docbook/xml/5.0/xsd/" rewritePrefix="file:///usr/share/xml/docbook/schema/xsd/5.0/"/>
@ -18,16 +19,16 @@
<rewriteSystem systemIdStartString="http://www.oasis-open.org/docbook/xml/5.0/sch/" rewritePrefix="file:///usr/share/xml/docbook/schema/sch/5.0/"/>
<rewriteURI uriStartString="http://www.oasis-open.org/docbook/xml/5.0/sch/" rewritePrefix="file:///usr/share/xml/docbook/schema/sch/5.0/"/>
<rewriteSystem systemIdStartString="http://www.docbook.org/xml/5.0" rewritePrefix="file:///usr/share/xml/docbook/schema/dtd/5.0"/>
<rewriteURI uriStartString="http://www.docbook.org/xml/5.0" rewritePrefix="file:///usr/share/xml/docbook/schema/dtd/5.0"/>
<rewriteSystem systemIdStartString="http://www.docbook.org/xml/5.0" rewritePrefix="file:///usr/share/xml/docbook/schema/dtd/5.0/"/>
<rewriteURI uriStartString="http://www.docbook.org/xml/5.0" rewritePrefix="file:///usr/share/xml/docbook/schema/dtd/5.0/"/>
<rewriteSystem systemIdStartString="http://www.docbook.org/xml/5.0/rng/" rewritePrefix="file:///usr/share/xml/docbook/schema/rng/5.0/"/>
<rewriteURI uriStartString="http://www.docbook.org/xml/5.0/rng/" rewritePrefix="file:///usr/share/xml/docbook/schema/rng/5.0/"/>
<rewriteSystem systemIdStartString="http://www.docbook.org/xml/5.0/xsd/" rewritePrefix="file:///usr/share/xml/docbook/schema/xsd/5.0/"/>
<rewriteURI uriStartString="http://www.docbook.org/xml/5.0/xsd/" rewritePrefix="file:///usr/share/xml/docbook/schema/xsd/5.0/"/>
<rewriteSystem systemIdStartString="http://www.docbook.org/xml/5.0/sch/" rewritePrefix="file:///usr/share/xml/docbook/schema/sch/5.0/"/>
<rewriteURI uriStartString="http://www.docbook.org/xml/5.0/sch/" rewritePrefix="file:///usr/share/xml/docbook/schema/sch/5.0/"/>
<rewriteSystem systemIdStartString="http://docbook.org/xml/5.0" rewritePrefix="file:///usr/share/xml/docbook/schema/dtd/5.0"/>
<rewriteURI uriStartString="http://docbook.org/xml/5.0" rewritePrefix="file:///usr/share/xml/docbook/schema/dtd/5.0"/>
<rewriteSystem systemIdStartString="http://docbook.org/xml/5.0" rewritePrefix="file:///usr/share/xml/docbook/schema/dtd/5.0/"/>
<rewriteURI uriStartString="http://docbook.org/xml/5.0" rewritePrefix="file:///usr/share/xml/docbook/schema/dtd/5.0/"/>
<rewriteSystem systemIdStartString="http://docbook.org/xml/5.0/rng/" rewritePrefix="file:///usr/share/xml/docbook/schema/rng/5.0/"/>
<rewriteURI uriStartString="http://docbook.org/xml/5.0/rng/" rewritePrefix="file:///usr/share/xml/docbook/schema/rng/5.0/"/>
<rewriteSystem systemIdStartString="http://docbook.org/xml/5.0/xsd/" rewritePrefix="file:///usr/share/xml/docbook/schema/xsd/5.0/"/>
@ -36,13 +37,13 @@
<rewriteURI uriStartString="http://docbook.org/xml/5.0/sch/" rewritePrefix="file:///usr/share/xml/docbook/schema/sch/5.0/"/>
<rewriteURI uriStartString="https://cdn.docbook.org/schema/5.0/dtd/" rewritePrefix="file:///usr/share/xml/docbook/schema/dtd/5.0/"/>
<rewriteSystem systemIdStartString="https://cdn.docbook.org/schema/5.0/dtd/" rewritePrefix="file:///usr/share/xml/docbook/schema/dtd/5.0"/>
<rewriteSystem systemIdStartString="https://cdn.docbook.org/schema/5.0/dtd/" rewritePrefix="file:///usr/share/xml/docbook/schema/dtd/5.0/"/>
<rewriteURI uriStartString="https://cdn.docbook.org/schema/5.0/rng/" rewritePrefix="file:///usr/share/xml/docbook/schema/rng/5.0/"/>
<rewriteSystem systemIdStartString="https://cdn.docbook.org/schema/5.0/rng/" rewritePrefix="file:///usr/share/xml/docbook/schema/rng/5.0"/>
<rewriteSystem systemIdStartString="https://cdn.docbook.org/schema/5.0/rng/" rewritePrefix="file:///usr/share/xml/docbook/schema/rng/5.0/"/>
<rewriteURI uriStartString="https://cdn.docbook.org/schema/5.0/sch/" rewritePrefix="file:///usr/share/xml/docbook/schema/sch/5.0/"/>
<rewriteSystem systemIdStartString="https://cdn.docbook.org/schema/5.0/sch/" rewritePrefix="file:///usr/share/xml/docbook/schema/sch/5.0"/>
<rewriteSystem systemIdStartString="https://cdn.docbook.org/schema/5.0/sch/" rewritePrefix="file:///usr/share/xml/docbook/schema/sch/5.0/"/>
<rewriteURI uriStartString="https://cdn.docbook.org/schema/5.0/xsd/" rewritePrefix="file:///usr/share/xml/docbook/schema/xsd/5.0/"/>
<rewriteSystem systemIdStartString="https://cdn.docbook.org/schema/5.0/xsd/" rewritePrefix="file:///usr/share/xml/docbook/schema/xsd/5.0"/>
<rewriteSystem systemIdStartString="https://cdn.docbook.org/schema/5.0/xsd/" rewritePrefix="file:///usr/share/xml/docbook/schema/xsd/5.0/"/>
<system systemId="http://www.oasis-open.org/docbook/xml/5.0/docbook.nvdl" uri="file:///usr/share/xml/docbook/schema/nvdl/5.0/docbook.nvdl"/>
<system systemId="http://docbook.org/xml/5.0/docbook.nvdl" uri="file:///usr/share/xml/docbook/schema/nvdl/5.0/docbook.nvdl"/>
@ -66,13 +67,13 @@
<rewriteURI uriStartString="http://docbook.org/xml/5.1/sch/" rewritePrefix="file:///usr/share/xml/docbook/schema/sch/5.1/"/>
<rewriteURI uriStartString="https://cdn.docbook.org/schema/5.1/dtd/" rewritePrefix="file:///usr/share/xml/docbook/schema/dtd/5.1/"/>
<rewriteSystem systemIdStartString="https://cdn.docbook.org/schema/5.1/dtd/" rewritePrefix="file:///usr/share/xml/docbook/schema/dtd/5.1"/>
<rewriteSystem systemIdStartString="https://cdn.docbook.org/schema/5.1/dtd/" rewritePrefix="file:///usr/share/xml/docbook/schema/dtd/5.1/"/>
<rewriteURI uriStartString="https://cdn.docbook.org/schema/5.1/rng/" rewritePrefix="file:///usr/share/xml/docbook/schema/rng/5.1/"/>
<rewriteSystem systemIdStartString="https://cdn.docbook.org/schema/5.1/rng/" rewritePrefix="file:///usr/share/xml/docbook/schema/rng/5.1"/>
<rewriteSystem systemIdStartString="https://cdn.docbook.org/schema/5.1/rng/" rewritePrefix="file:///usr/share/xml/docbook/schema/rng/5.1/"/>
<rewriteURI uriStartString="https://cdn.docbook.org/schema/5.1/sch/" rewritePrefix="file:///usr/share/xml/docbook/schema/sch/5.1/"/>
<rewriteSystem systemIdStartString="https://cdn.docbook.org/schema/5.1/sch/" rewritePrefix="file:///usr/share/xml/docbook/schema/sch/5.1"/>
<rewriteSystem systemIdStartString="https://cdn.docbook.org/schema/5.1/sch/" rewritePrefix="file:///usr/share/xml/docbook/schema/sch/5.1/"/>
<rewriteURI uriStartString="https://cdn.docbook.org/schema/5.1/xsd/" rewritePrefix="file:///usr/share/xml/docbook/schema/xsd/5.1/"/>
<rewriteSystem systemIdStartString="https://cdn.docbook.org/schema/5.1/xsd/" rewritePrefix="file:///usr/share/xml/docbook/schema/xsd/5.1"/>
<rewriteSystem systemIdStartString="https://cdn.docbook.org/schema/5.1/xsd/" rewritePrefix="file:///usr/share/xml/docbook/schema/xsd/5.1/"/>
<system systemId="http://www.oasis-open.org/docbook/xml/5.1/docbook.nvdl" uri="file:///usr/share/xml/docbook/schema/nvdl/5.1/docbook.nvdl"/>
<system systemId="http://docbook.org/xml/5.1/docbook.nvdl" uri="file:///usr/share/xml/docbook/schema/nvdl/5.1/docbook.nvdl"/>
@ -95,13 +96,13 @@
<rewriteURI uriStartString="http://docbook.org/xml/5.2/sch/" rewritePrefix="file:///usr/share/xml/docbook/schema/sch/5.2/"/>
<rewriteURI uriStartString="https://cdn.docbook.org/schema/5.2/dtd/" rewritePrefix="file:///usr/share/xml/docbook/schema/dtd/5.2/"/>
<rewriteSystem systemIdStartString="https://cdn.docbook.org/schema/5.2/dtd/" rewritePrefix="file:///usr/share/xml/docbook/schema/dtd/5.2"/>
<rewriteSystem systemIdStartString="https://cdn.docbook.org/schema/5.2/dtd/" rewritePrefix="file:///usr/share/xml/docbook/schema/dtd/5.2/"/>
<rewriteURI uriStartString="https://cdn.docbook.org/schema/5.2/rng/" rewritePrefix="file:///usr/share/xml/docbook/schema/rng/5.2/"/>
<rewriteSystem systemIdStartString="https://cdn.docbook.org/schema/5.2/rng/" rewritePrefix="file:///usr/share/xml/docbook/schema/rng/5.2"/>
<rewriteSystem systemIdStartString="https://cdn.docbook.org/schema/5.2/rng/" rewritePrefix="file:///usr/share/xml/docbook/schema/rng/5.2/"/>
<rewriteURI uriStartString="https://cdn.docbook.org/schema/5.2/sch/" rewritePrefix="file:///usr/share/xml/docbook/schema/sch/5.2/"/>
<rewriteSystem systemIdStartString="https://cdn.docbook.org/schema/5.2/sch/" rewritePrefix="file:///usr/share/xml/docbook/schema/sch/5.2"/>
<rewriteSystem systemIdStartString="https://cdn.docbook.org/schema/5.2/sch/" rewritePrefix="file:///usr/share/xml/docbook/schema/sch/5.2/"/>
<rewriteURI uriStartString="https://cdn.docbook.org/schema/5.2/xsd/" rewritePrefix="file:///usr/share/xml/docbook/schema/xsd/5.2/"/>
<rewriteSystem systemIdStartString="https://cdn.docbook.org/schema/5.2/xsd/" rewritePrefix="file:///usr/share/xml/docbook/schema/xsd/5.2"/>
<rewriteSystem systemIdStartString="https://cdn.docbook.org/schema/5.2/xsd/" rewritePrefix="file:///usr/share/xml/docbook/schema/xsd/5.2/"/>
<system systemId="http://www.oasis-open.org/docbook/xml/5.2/docbook.nvdl" uri="file:///usr/share/xml/docbook/schema/nvdl/5.2/docbook.nvdl"/>
<system systemId="http://docbook.org/xml/5.2/docbook.nvdl" uri="file:///usr/share/xml/docbook/schema/nvdl/5.2/docbook.nvdl"/>
@ -122,13 +123,13 @@
<rewriteURI uriStartString="http://docbook.org/xml/@VERSION@/sch/" rewritePrefix="file:///usr/share/xml/docbook/schema/sch/@VERSION@/"/>
<rewriteURI uriStartString="https://cdn.docbook.org/schema/@VERSION@/dtd/" rewritePrefix="file:///usr/share/xml/docbook/schema/dtd/@VERSION@/"/>
<rewriteSystem systemIdStartString="https://cdn.docbook.org/schema/@VERSION@/dtd/" rewritePrefix="file:///usr/share/xml/docbook/schema/dtd/@VERSION@"/>
<rewriteSystem systemIdStartString="https://cdn.docbook.org/schema/@VERSION@/dtd/" rewritePrefix="file:///usr/share/xml/docbook/schema/dtd/@VERSION@/"/>
<rewriteURI uriStartString="https://cdn.docbook.org/schema/@VERSION@/rng/" rewritePrefix="file:///usr/share/xml/docbook/schema/rng/@VERSION@/"/>
<rewriteSystem systemIdStartString="https://cdn.docbook.org/schema/@VERSION@/rng/" rewritePrefix="file:///usr/share/xml/docbook/schema/rng/@VERSION@"/>
<rewriteSystem systemIdStartString="https://cdn.docbook.org/schema/@VERSION@/rng/" rewritePrefix="file:///usr/share/xml/docbook/schema/rng/@VERSION@/"/>
<rewriteURI uriStartString="https://cdn.docbook.org/schema/@VERSION@/sch/" rewritePrefix="file:///usr/share/xml/docbook/schema/sch/@VERSION@/"/>
<rewriteSystem systemIdStartString="https://cdn.docbook.org/schema/@VERSION@/sch/" rewritePrefix="file:///usr/share/xml/docbook/schema/sch/@VERSION@"/>
<rewriteURI uriStartString="https://cdn.docbook.org/schema/@VERSION@/xsd/" rewritePrefix="file:///usr/share/xml/docbook/schema/xsd/@VERSION@/"/>
<rewriteSystem systemIdStartString="https://cdn.docbook.org/schema/@VERSION@/xsd/" rewritePrefix="file:///usr/share/xml/docbook/schema/xsd/@VERSION@"/>
<rewriteSystem systemIdStartString="https://cdn.docbook.org/schema/@VERSION@/xsd/" rewritePrefix="file:///usr/share/xml/docbook/schema/xsd/@VERSION@/"/>
<system systemId="http://www.oasis-open.org/docbook/xml/@VERSION@/docbook.nvdl" uri="file:///usr/share/xml/docbook/schema/nvdl/@VERSION@/docbook.nvdl"/>
<system systemId="http://docbook.org/xml/@VERSION@/docbook.nvdl" uri="file:///usr/share/xml/docbook/schema/nvdl/@VERSION@/docbook.nvdl"/>

Loading…
Cancel
Save