File docbook5-xsl-stylesheets.spec of Package docbook5-xsl-stylesheets

#
# spec file for package docbook5-xsl-stylesheets
#
# Copyright (c) 2013 SUSE LINUX Products 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 http://bugs.opensuse.org/
#


%define dbstyle_dir            %{_datadir}/xml/docbook/stylesheet/nwalsh5
%define dbstyle_catalog        %{name}.xml
%define suse_catalog           %{_sysconfdir}/xml/suse-catalog.xml
%define xmlcatalog             %{_bindir}/xmlcatalog
%define dbstyle_catalog_entry  for-catalog-%{name}-%{version}.xml

Name:           docbook5-xsl-stylesheets
Summary:        XSL Stylesheets for DocBook 5
License:        SUSE-Docbook-XSL and Apache-2.0 and MIT and EPL-1.0 and MPL-1.1 and BSD-3-Clause and HPND and Zlib and LGPL-2.1+
Group:          Productivity/Publishing/DocBook
BuildRequires:  fdupes
BuildRequires:  sgml-skel
BuildRequires:  unzip
BuildArch:      noarch
Requires:       docbook_5
Requires:       xmlcharent
PreReq:         sgml-skel %{_bindir}/xmlcatalog
Version:        1.78.1
Release:        0
Source0:        http://switch.dl.sourceforge.net/sourceforge/docbook/docbook-xsl-ns-%{version}.tar.bz2
Source1:        %{name}-rpmlintrc
# Patch0:        %%{name}-dbtoepub.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Url:            http://sourceforge.net/projects/docbook/

%description
These are the XSL stylesheets for DocBook. Generally, the stylesheets
are namespace aware and you should use these for DocBook 5 only. The
stylesheets transforms your DocBook 5 document into (X)HTML, Manpages,
XSL-FO (for PDF) and a some other formats. XSL is a standard W3C
stylesheet language for both print and online rendering. For more
information about XSL, see the XSL page at theW3C.


#--------------------------------------------------------------------------
%prep
%setup -q -n docbook-xsl-ns-%{version}
# %%patch0 -p1

# These scripts are available in the docbook-xsl-stylesheet-scripts subpackage
rm fo/pdf2index slides/images/callouts/gen.sh epub/bin/dbtoepub 

#--------------------------------------------------------------------------
%build

#
# Creating catalog entries
#

#
# /etc/xml/docbook-xsl-stylesheets.xml
#
%{xmlcatalog} --noout --create %{dbstyle_catalog}
%{xmlcatalog} --noout --add "rewriteSystem" \
 "http://docbook.sourceforge.net/release/xsl-ns/%{version}" \
 "file://%{dbstyle_dir}/%{version}" %{dbstyle_catalog}
%{xmlcatalog} --noout --add "rewriteURI" \
 "http://docbook.sourceforge.net/release/xsl-ns/%{version}" \
 "file://%{dbstyle_dir}/%{version}" %{dbstyle_catalog}
%{xmlcatalog} --noout --add "rewriteSystem" \
 "http://docbook.sourceforge.net/release/xsl-ns/current" \
 "file://%{dbstyle_dir}/%{version}" %{dbstyle_catalog}
%{xmlcatalog} --noout --add "rewriteURI" \
 "http://docbook.sourceforge.net/release/xsl-ns/current" \
 "file://%{dbstyle_dir}/%{version}" %{dbstyle_catalog}

#
# temporary file that is added to /etc/xml/suse-catalog.xml
# during post
#
%{xmlcatalog} --noout --create %{dbstyle_catalog_entry}
%{xmlcatalog} --noout --add "delegateSystem" \
  "http://docbook.sourceforge.net/release/xsl-ns/" \
  "file:///etc/xml/%{dbstyle_catalog}" %{dbstyle_catalog_entry}
%__sed -i -e '/<catalog/a\ <group id="%{name}">' \
       -e '/<\/catalog/i\ </group>' %{dbstyle_catalog_entry}

#--------------------------------------------------------------------------
%install

# Create directories
%__mkdir_p -m755 %{buildroot}%{_bindir}
%__mkdir_p -m755 %{buildroot}%{dbstyle_dir}/%{version}
%__mkdir_p -m755 %{buildroot}%{_defaultdocdir}/%{name}/html
%__mkdir_p -m755 %{buildroot}%{_sysconfdir}/xml

# Install scripts
# Don't install *any* scripts as these are located now in the 
# docbook-xsl-stylesheets-scripts subpackage

# VERSION.xsl
%__install -m644 VERSION.xsl %{buildroot}%{dbstyle_dir}/%{version}

# all the rest is located in subdirectories, exclude some subdirectories with
# stuff not needed
for DIR in $(find -maxdepth 1 -mindepth 1 -type d \( -name "tools" -o -name "doc" -o -name "docsrc" -o -name "tests" \) -prune -o -type d -print ); do
    %__tar c $DIR | (cd %{buildroot}%{dbstyle_dir}/%{version}; %__tar xp);
done
# fixing permission errors from sources
find %{buildroot}%{dbstyle_dir}/%{version} -type f -exec %__chmod 644 {} \;
find %{buildroot}%{dbstyle_dir}/%{version} -type d -exec %__chmod 755 {} \;
%__chmod 755 %{buildroot}%{dbstyle_dir}/%{version}/extensions/xslt.py

# create current link
# but not for snapshots
#
if ! echo %{S:0} | grep -q snapshot; then
    pushd %{buildroot}%{dbstyle_dir} >/dev/null
    ln -sf %{version} current
    popd >/dev/null
fi

# install the catalog files
#
%__install -m644 %{dbstyle_catalog} %{buildroot}%{_sysconfdir}/xml
%__install -m644 %{dbstyle_catalog_entry} %{buildroot}%{_sysconfdir}/xml

# the docs come last
#
# %%__tar c -C doc . | (cd %%{buildroot}%%{_defaultdocdir}/%%{name}/html; %%__tar xp);

%fdupes -s %{buildroot}

#--------------------------------------------------------------------------
%post
#
# XML Catalog entries for daps profiling
#
# remove existing entries first (if existing) - needed for
# zypper in, since it does not call postun
#
# delete ...
%{_bindir}/edit-xml-catalog --group --catalog %{suse_catalog} --del %{name}
# ... and add it again
%{_bindir}/edit-xml-catalog --group --catalog %{suse_catalog} \
  --add %{_sysconfdir}/xml/%{dbstyle_catalog_entry}

exit 0

#--------------------------------------------------------------------------
%postun
#
# delete catalog entry for daps profiling
# only run if package is really uninstalled ($1 = 0) and not
# in case of an update
#
if [ 0 = $1 ]; then 
    if [ -x %{_bindir}/edit-xml-catalog ] ; then
        %{_bindir}/edit-xml-catalog --group --catalog %{suse_catalog} --del %{name}
    fi
fi

exit 0

#--------------------------------------------------------------------------
%files
%defattr(-, root, root)

%dir %{_datadir}/xml/docbook/stylesheet
%dir %{dbstyle_dir}
%dir %{dbstyle_dir}/%{version}

%exclude %{dbstyle_dir}/%{version}/slides/slidy/.htaccess
%exclude %{dbstyle_dir}/%{version}/slides/slidy/*/.htaccess

%config %{_sysconfdir}/xml/*.xml

%doc BUGS NEWS README RELEASE-NOTES.txt TODO

# NO bindir
# %%{_bindir}/*
%{dbstyle_dir}/current
%{dbstyle_dir}/%{version}/*

%changelog
openSUSE Build Service is sponsored by