File opensuse-manuals_de.spec of Package opensuse-manuals_de

# spec file for package opensuse-manuals_de
# 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

%bcond_without PDF
Name:           opensuse-manuals_de
%define my_lang de
%define my_book opensuse-html
Version:        12.3
Release:        0
Provides:       locale(desktop-data-openSUSE:de)
Source:         opensuse-html_de_src_set.tar.bz2
Source903:      attributes
BuildRequires:  daps
BuildRequires:  fdupes
BuildRequires:  suse-xsl-stylesheets >= 1.9.18
# Also buildrequire tools that susedoc does not pull in automatically ATM
# BuildRequires:  python-xml
# BuildRequires:  python-lxml
# BuildRequires:  poppler-tools
BuildRequires:  update-desktop-files
# BuildRequires:  xerces-j2
# %%if 0%%{?suse_version} >= 1140
# BuildRequires:  xmlgraphics-fop
# %%else
# BuildRequires:  fop
# %%endif
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch
Summary:        Complete set of openSUSE Manuals (HTML, German)
License:        GFDL-1.2
Group:          Documentation/SUSE
%define _defaultdocdir %{_datadir}/doc/manual
%define _docdir %{_datadir}/doc/manual

Contains the complete official openSUSE documentation in HTML
format. It can be accessed via the Desktop's help centers. 
The following manuals are included:

* Start-Up

* Reference

* Security Guide (English)

* Tuning Guide (English)

* KVM Guide (English)

%package -n opensuse-startup_de-pdf
Summary:        openSUSE manual: Start-Up (PDF, German)
Group:          Documentation/SUSE
#Provides:    locale(desktop-data-openSUSE:de)

%description -n opensuse-startup_de-pdf
Guides you through the installation and basic configuration of your
system. For newcomers, the manual also introduces basic Linux concepts
such as the file system, the user concept and access permissions and
gives an overview of the features the system offers to support
mobile computing. Provides help and advice in troubleshooting.

%package -n opensuse-reference_de-pdf
Summary:        openSUSE manual: Reference (PDF, German)
Group:          Documentation/SUSE
#Provides:    locale(desktop-data-openSUSE:de)

%description -n opensuse-reference_de-pdf
This guide gives you a general understanding of your system and
covers advanced system administration tasks. It is intended
mainly for system administrators and home users with basic system
administration knowledge. It provides detailed information about
advanced deployment scenarios, administration of your system,
the interaction of key system components and the set-up of
various network and file services.

%package -n opensuse-security_de-pdf
Summary:        openSUSE manual: Security Guide (PDF, German)
Group:          Documentation/SUSE
#Provides:    locale(desktop-data-openSUSE:de)

%description -n opensuse-security_de-pdf
This guide introduces basic concepts of system security, covering
both local and network security aspects. Shows how to make use of
the product inherent security software like AppArmor (which lets
you specify per program which files the program may read, write,
and execute) or the auditing system that reliably collects
information about any security-relevant events.

%package -n opensuse-kvm_de-pdf
Summary:        openSUSE manual: KVM Guide (PDF, English)
Group:          Documentation/SUSE
#Provides:    locale(desktop-data-openSUSE:de)

%description -n opensuse-kvm_de-pdf
This guide introduces basic concepts of virtualization with KVM.

%package -n opensuse-tuning_de-pdf
Summary:        openSUSE manual: Tuning Guide (PDF, English)
Group:          Documentation/SUSE
#Provides:    locale(desktop-data-openSUSE:de)

%description -n opensuse-tuning_de-pdf
This guide introduces basic concepts of system tuning.

#%%setup -c -q
%setup -c -q -n %{name}-%{version}/opensuse-html
%setup -c -q -T -D -n %{name}-%{version}
find -name '*.png' -o -name '*.svg' | xargs chmod 644 || :

%define my_all_dir  %{_builddir}/%{name}-%{version}/opensuse-html
cd %{my_all_dir}
# e.g., /usr/share/help/C/gnome-help/
# Produce .document files for HTML
package_dir=$(daps -d DC-opensuse-html package-html --documentfiles --pagefiles)
tar xvf $package_dir/opensuse-html_%{my_lang}-html.tar.bz2
echo opensuse-html > %{name}.filelist
# ls -l build/%my_book/package
# copy .page file
cp $document_files_dir/*.page
sed -i "
s|^\(Name.*=.*\)|\1 (%{my_lang})|
" $document_files_dir/index.html.document
mkdir yelp desktop
sed "
# remove useless comments and search settings
/^Name *=/i\
# for KDE:\n\
" $document_files_dir/index.html.document > desktop/%{name}.desktop 
# FIXME: check whether it is still needed (move to daps?)
sed "s/^[Desktop Entry]/[Document]/" desktop/%{name}.desktop \
  > yelp/%{name}.document
{ echo desktop/%{name}.desktop; echo yelp/%{name}.document; } >> %{name}.filelist

export XEP_LICENSE=/etc/xep/license.xml
export XEP_HOME=/usr/share/xep
# see
export XEP_OPTIONS="-valid"
# export FOP=fop
export FOP_STACK="-Xss2048K"
build_pdf () {
%if %{with PDF}
  book=$(echo ${1} | tr [:upper:] [:lower:])
  if [ -x /usr/bin/xep ]; then
  if [ -z "$formatter" ]; then
    formatter=$(daps -d DC-${1} showvariable VARIABLE=FORMATTER)
#   if [ $formatter = fop ]; then
#     # bnc#778567
#     daps -v -d DC-${1} pdf-color --xsltparam "'--param hyphenate.verbatim 0'"
#   else
#     daps -v -d DC-${1} pdf-color --formatter=$formatter
#   fi
  # pdf-color-name does not support --formatter
  # pdfname=$(daps -d DC-${1} pdf-color-name | sed /^Hint.*/d)
  # echo "$pdfname" > ${1}_de-pdf.filelist
  if [ $formatter = fop ]; then
    # bnc#778567
    # right now, daps 1.1.2 does not support --xsltparam
    # FIXME: Tut so naed -- ask Magic
    pkg_pdf=$(daps -d DC-${1} package-pdf --formatter=$formatter --documentfiles XSLTPARAM='\\\"--param hyphenate.verbatim 0\\\"')
    daps -d DC-${1} package-pdf --formatter=$formatter
    pkg_pdf=$(daps -d DC-${1} package-pdf --formatter=$formatter --documentfiles)
  pdfname=$(find $pkg_pdf -name '*.pdf')
  docname=$(find $pkg_pdf -name '*.document')
  sed -i "
# remove useless comments and search settings
/^Name *=/i\
" $docname
    echo $pdfname
    echo $docname
  } > ${book}_de-pdf.filelist
: say build --with PDF
all_pdf_docs=" opensuse-startup opensuse-reference opensuse-security opensuse-kvm opensuse-tuning"
[ -n "$all_pdf_docs" ] && for b in $all_pdf_docs; do build_pdf $b; done

cd %{my_all_dir}
mkdir -p %{buildroot}%{_defaultdocdir}
# product is name without language code
%define gnome_dir %{_datadir}/gnome/help/opensuse-manuals
install -d %{buildroot}%{gnome_dir}
cp -a --dereference $(head -n 1 %{name}.filelist) \
mkdir -p %{buildroot}/%{_datadir}/kde4/apps/khelpcenter/plugins
cp desktop/%{name}.desktop \
%suse_update_desktop_file '%{name}'
if [ %{my_lang} = en ]; then
    echo "%dir $yelp_document_dir"
    echo "%dir $yelp_link_dir"
    echo "%dir $yelp_link_dir/%my_book"
    echo "%dir $gnome_help_dir"
  } > %name.filelist
    echo "%dir %{_datadir}/help/LOCALE"
    echo "%dir %{_datadir}/help/LOCALE/%{my_lang}"
    echo "%dir $yelp_document_dir"
    echo "%dir $yelp_link_dir/%my_book"
    echo "%dir $gnome_help_dir"
  } > %name.filelist
mkdir -p %{buildroot}$yelp_document_dir
cp yelp/%{name}.document %{buildroot}$yelp_document_dir
mkdir -p %{buildroot}$yelp_link_dir
pushd %{buildroot}$yelp_link_dir
ln -sf %{_defaultdocdir}/%name %my_book
mkdir -p %{buildroot}$gnome_help_dir
cp %{buildroot}$gnome_help_dir/
  echo "$yelp_document_dir/%{name}.document"
  echo "$gnome_help_dir/"
} >> %name.filelist

%if %{with PDF}
for f in *-pdf.filelist; do
  # cat $f
  mkdir %{buildroot}/%{_defaultdocdir}/${f%\.filelist}
  # PDF first
  cp -a --dereference $(head -n 1 $f) \
  # remove first line and append the new location
  sed -i 1d $f
  echo "%{_defaultdocdir}/${f%\.filelist}" >> $f
  # now .document
  doc=$(head -n 1 $f)
  cp $doc  %{buildroot}/%{_datadir}/help
  sed -i 1d $f
  echo "%{_datadir}/help/${doc##*/}" >> $f

%fdupes '%{buildroot}%{_docdir}'

%if %{with PDF}



%files -n opensuse-startup_de-pdf -f %{my_book}/opensuse-startup_de-pdf.filelist
%defattr(-, root, root)

%files -n opensuse-reference_de-pdf -f %{my_book}/opensuse-reference_de-pdf.filelist
%defattr(-, root, root)

%files -n opensuse-security_de-pdf -f %{my_book}/opensuse-security_de-pdf.filelist
%defattr(-, root, root)

%files -n opensuse-kvm_de-pdf -f %{my_book}/opensuse-kvm_de-pdf.filelist
%defattr(-, root, root)

%files -n opensuse-tuning_de-pdf -f %{my_book}/opensuse-tuning_de-pdf.filelist
%defattr(-, root, root)


%files -f %{my_book}/%{name}.filelist
%defattr(-, root, root)
%dir %{_defaultdocdir}
%dir %{_datadir}/kde4/apps/khelpcenter/plugins
%dir %{_datadir}/kde4/apps/khelpcenter
%dir %{_datadir}/kde4/apps
%dir %{_datadir}/kde4

openSUSE Build Service is sponsored by