File opensuse-manuals_ru.spec of Package opensuse-manuals_ru

#
# spec file for package opensuse-manuals_ru
#
# Copyright (c) 2012 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/
#


Name:           opensuse-manuals_ru
%define my_lang ru
Version:        12.1.9028
Release:        0
Url:            http://ru.opensuse.org/openSUSE:Перевод_документации
#BREQ
Provides:       apparmor-admin_ru = %{version}
Provides:       locale(desktop-data-openSUSE:ru)
#OBS
Source:         %{name}-%{version}.tar.bz2
#Source01: opensuse-html_ru-graphics.tar.bz2
#SOURCES
Source901:      doc_pre_checkin.sh
Source903:      attributes
BuildRequires:  daps
BuildRequires:  suse-xsl-stylesheets
# Also buildrequire tools that susedoc does not pull in automatically ATM
BuildRequires:  poppler-tools
BuildRequires:  python-lxml
BuildRequires:  python-xml
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, Russian)
License:        GFDL-1.2
Group:          Documentation/SUSE
%define _defaultdocdir %{_datadir}/doc/manual
%define _docdir %{_datadir}/doc/manual

Obsoletes:      apparmor-admin_ru < 12.2

%description
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

* Tuning Guide

* KVM Guide

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

%description -n opensuse-startup_ru-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_ru-pdf
Summary:        openSUSE manual: Reference (PDF, Russian)
Group:          Documentation/SUSE
#Provides:    locale(desktop-data-openSUSE:ru)
###PDFOBS

%description -n opensuse-reference_ru-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_ru-pdf
Summary:        openSUSE manual: Security Guide (PDF, Russian)
Group:          Documentation/SUSE
#Provides:    locale(desktop-data-openSUSE:ru)
###PDFOBS

%description -n opensuse-security_ru-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_ru-pdf
Summary:        openSUSE manual: KVM Guide (PDF, Russian)
Group:          Documentation/SUSE
#Provides:    locale(desktop-data-openSUSE:ru)
###PDFOBS

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

%package -n opensuse-tuning_ru-pdf
Summary:        openSUSE manual: Tuning Guide (PDF, Russian)
Group:          Documentation/SUSE
#Provides:    locale(desktop-data-openSUSE:ru)
###PDFOBS

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

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

%build
#%%define my_all_dir  %{_builddir}/%{name}-%{version}/opensuse-html
#cd %{my_all_dir}
daps -d DC-opensuse-html html --static
echo "$(daps -d DC-opensuse-html html-dir-name)" > %{name}.filelist
daps -d DC-opensuse-html document-files-html
mkdir yelp desktop
sed "
# remove useless comments and search settings
/^Comment/d
/^X-DOC-Search/d
/^Categories=/d
/^Name *=/i\
DocPath=file://%{_defaultdocdir}/%{name}/manual/index.html\n\
DocType=text/html\n\
DocLang=%{my_lang}\n\
Icon=document2\n\
Categories=System;Core;Translation;Documentation
s/^X-DOC-Identifier=/DocIdentifier=com.suse./
s/^X-DOC-Weight/DocWeight/
" $(daps -d DC-opensuse-html document-files-dir-name | sed /^Hint.*/d)/index.html.document \
  > desktop/%{name}.desktop
sed "s/^[Desktop Entry]/[Document]/" desktop/%{name}.desktop \
  > yelp/%{name}.document
{ echo desktop/%{name}.desktop; echo yelp/%{name}.document; } >> %{name}.filelist

#MAKE_DOC
export XEP_LICENSE=/etc/xep/license.xml
export XEP_HOME=/usr/share/xep
# export FOP=fop
build_pdf () {
  daps --envfile DC-${1} pdf-color
  pdfname=$(daps --envfile DC-${1} pdf-color-name | sed /^Hint.*/d)
  echo "$pdfname" > ${1}_ru-pdf.filelist
  daps --envfile DC-${1} document-files-pdf
  sed "
# remove useless comments and search settings
/^Categories=/d
/^DocPath=/d
/^Name *=/i\
Categories=System;Core;Translation;Documentation\n\
DocPath=file://%{_defaultdocdir}/${1}_ru-pdf/${pdfname##*/}
" $(daps --envfile DC-$1 document-files-dir-name | sed /^Hint.*/d)/${1}_ru-pdf.document \
  > yelp/${1}_ru-pdf.document
  echo yelp/${1}_ru-pdf.document >> ${1}_ru-pdf.filelist
}
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

%install
#cd %{my_all_dir}
mkdir -p $RPM_BUILD_ROOT%{_defaultdocdir}
# product is name without language code
%define gnome_dir %{_datadir}/gnome/help/opensuse-manuals
install -d $RPM_BUILD_ROOT%{gnome_dir}
#
cp -a --dereference $(head -n 1 %{name}.filelist) \
  $RPM_BUILD_ROOT/%{_defaultdocdir}/%{name}
mkdir -p $RPM_BUILD_ROOT/%{_datadir}/kde4/apps/khelpcenter/plugins
mkdir $RPM_BUILD_ROOT/%{_datadir}/help
cp desktop/%{name}.desktop \
  $RPM_BUILD_ROOT/%{_datadir}/kde4/apps/khelpcenter/plugins
cp yelp/%{name}.document $RPM_BUILD_ROOT/%{_datadir}/help

for f in *-pdf.filelist; do
  mkdir $RPM_BUILD_ROOT/%{_defaultdocdir}/${f%\.filelist}
  cp -a --dereference $(head -n 1 $f) \
    $RPM_BUILD_ROOT/%{_defaultdocdir}/${f%\.filelist}
  sed -i 1d $f
  echo "%{_defaultdocdir}/${f%\.filelist}" >> $f
  cp $(head -n 1 $f) \
    $RPM_BUILD_ROOT/%{_datadir}/help
  sed -i 1d $f
  echo "%{_datadir}/help/${f%\.filelist}.document" >> $f
done

#PDFINST

%clean
rm -fr ${RPM_BUILD_ROOT}

#PDFXXX

%files -n opensuse-startup_ru-pdf -f opensuse-startup_ru-pdf.filelist
%defattr(-, root, root)
### %%doc build/opensuse-startup/package/pdf/opensuse-startup_en.pdf
### %%{_datadir}/help/opensuse-startup_en-pdf.document
### %%dir %%{_datadir}/kde4/apps/khelpcenter/plugins
### %%dir %%{_datadir}/kde4/apps/khelpcenter
### %%dir %%{_datadir}/kde4/apps
### %%dir %%{_datadir}/kde4
### %%{_datadir}/kde4/apps/khelpcenter/plugins/opensuse-startup_en-pdf.desktop
### 

%files -n opensuse-reference_ru-pdf -f opensuse-reference_ru-pdf.filelist
%defattr(-, root, root)
### %%doc build/opensuse-reference/package/pdf/opensuse-reference_en.pdf
### %%{_datadir}/help/opensuse-reference_en-pdf.document
### %%dir %%{_datadir}/kde4/apps/khelpcenter/plugins
### %%dir %%{_datadir}/kde4/apps/khelpcenter
### %%dir %%{_datadir}/kde4/apps
### %%dir %%{_datadir}/kde4
### %%{_datadir}/kde4/apps/khelpcenter/plugins/opensuse-reference_en-pdf.desktop
### 

%files -n opensuse-security_ru-pdf -f opensuse-security_ru-pdf.filelist
%defattr(-, root, root)
### %%doc build/opensuse-security/package/pdf/opensuse-security_en.pdf
### %%{_datadir}/help/opensuse-security_en-pdf.document
### %%dir %%{_datadir}/kde4/apps/khelpcenter/plugins
### %%dir %%{_datadir}/kde4/apps/khelpcenter
### %%dir %%{_datadir}/kde4/apps
### %%dir %%{_datadir}/kde4
### %%{_datadir}/kde4/apps/khelpcenter/plugins/opensuse-security_en-pdf.desktop
### 

%files -n opensuse-kvm_ru-pdf -f opensuse-kvm_ru-pdf.filelist
%defattr(-, root, root)
### %%doc build/opensuse-kvm/package/pdf/opensuse-kvm_en.pdf
### %%{_datadir}/help/opensuse-kvm_en-pdf.document
### %%dir %%{_datadir}/kde4/apps/khelpcenter/plugins
### %%dir %%{_datadir}/kde4/apps/khelpcenter
### %%dir %%{_datadir}/kde4/apps
### %%dir %%{_datadir}/kde4
### %%{_datadir}/kde4/apps/khelpcenter/plugins/opensuse-kvm_en-pdf.desktop
### 

%files -n opensuse-tuning_ru-pdf -f opensuse-tuning_ru-pdf.filelist
%defattr(-, root, root)
### %%doc build/opensuse-tuning/package/pdf/opensuse-tuning_en.pdf
### %%{_datadir}/help/opensuse-tuning_en-pdf.document
### %%dir %%{_datadir}/kde4/apps/khelpcenter/plugins
### %%dir %%{_datadir}/kde4/apps/khelpcenter
### %%dir %%{_datadir}/kde4/apps
### %%dir %%{_datadir}/kde4
### %%{_datadir}/kde4/apps/khelpcenter/plugins/opensuse-tuning_en-pdf.desktop
### 

#PDFFILES

%files
%defattr(-, root, root)
%dir %{_defaultdocdir}
%{_defaultdocdir}/%{name}
#GNOME
%dir %{_datadir}/help
%{_datadir}/help/%{name}.document
#KDE4
%dir %{_datadir}/kde4/apps/khelpcenter/plugins
%dir %{_datadir}/kde4/apps/khelpcenter
%dir %{_datadir}/kde4/apps
%dir %{_datadir}/kde4
%{_datadir}/kde4/apps/khelpcenter/plugins/%%{name}.desktop

%changelog
openSUSE Build Service is sponsored by