File its-schema.spec of Package its-schema

#
# spec file for package its-schema
#
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


%define its_dir           %{_datadir}/xml/its
%define its_schema_dir    %{its_dir}/schema
%define its_rng_dir       %{its_schema_dir}/rng
%define its_nvdl_dir      %{its_schema_dir}/nvdl
%define its_sch_dir       %{its_schema_dir}/sch
%define its_xsd_dir       %{its_schema_dir}/xsd
%define its_version       2.0
#
%define xml_sysconf_dir   %{_sysconfdir}/xml
%define xml_catalogd_dir  %{xml_sysconf_dir}/catalog.d
#
Name:           its-schema
Version:        2.0
Release:        0
Summary:        Internationalization Tag Set (ITS) Version 2.0
License:        W3C
Group:          Productivity/Publishing/XML
URL:            https://www.w3.org/TR/its
#
Source0:        https://www.w3.org/TR/its/itstagset20.zip
Source10:       its20.xml.in
BuildRequires:  sgml-skel
BuildRequires:  unzip
Requires:       sgml-skel >= 0.7
Requires(post): sgml-skel >= 0.7
Requires(postun): sgml-skel >= 0.7
BuildArch:      noarch

%description
The Internationalization Tag Set (ITS) is a set of attributes and
elements designed to provide internationalization and localization
support in XML documents.

https://github.com/w3c/its-2.0-testsuite

# ---------------------------------
%prep
%setup -q -c

%build
ITSRNG="%{its_rng_dir}/%{its_version}/its20-elements.rng"
CATALOG=$(basename -s .in %{SOURCE10})

# Replace placeholder with path to RNG schema:
cat %{SOURCE10} | sed "s=@RNG@=$ITSRNG=g" > ${CATALOG}

# Fix path in NVDL schema:
sed -i 's=its20-=../../rng/2.0/its20-=g' itstagset20/schemas/its20.nvdl

%install
CATALOG=$(basename -s .in %{SOURCE10})
mkdir -p %{buildroot}%{its_rng_dir}/%{its_version} \
         %{buildroot}%{its_nvdl_dir}/%{its_version} \
         %{buildroot}%{its_sch_dir}/%{its_version} \
         %{buildroot}%{its_xsd_dir}/%{its_version} \
         %{buildroot}%{xml_catalogd_dir}

cp -vi ${CATALOG} %{buildroot}%{xml_catalogd_dir}

cp -vi itstagset20/schemas/*.rn? %{buildroot}%{its_rng_dir}/%{its_version}
cp -vi itstagset20/schemas/*.nvdl %{buildroot}%{its_nvdl_dir}/%{its_version}
cp -vi itstagset20/schemas/*.sch %{buildroot}%{its_sch_dir}/%{its_version}
cp -vi itstagset20/schemas/*.xsd %{buildroot}%{its_xsd_dir}/%{its_version}


%post
update-xml-catalog

%postun
update-xml-catalog

%files
%config %{xml_sysconf_dir}/catalog.d/its20.xml
%dir %{its_dir}
%dir %{its_schema_dir}
%dir %{its_rng_dir}
%dir %{its_rng_dir}/%{its_version}
%dir %{its_nvdl_dir}
%dir %{its_nvdl_dir}/%{its_version}
%dir %{its_sch_dir}
%dir %{its_sch_dir}/%{its_version}
%dir %{its_xsd_dir}
%dir %{its_xsd_dir}/%{its_version}
%{its_rng_dir}/%{its_version}/*
%{its_sch_dir}/%{its_version}/*
%{its_xsd_dir}/%{its_version}/*
%{its_nvdl_dir}/%{its_version}/*

%changelog