File opensuse-manuals_en.spec of Package opensuse-manuals_en.import5186

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

# norootforbuild


Name:           opensuse-manuals_en
%define my_lang en
%define my_book opensuse-html
Version:        11.4
Release:        6.<RELEASE12>
#BREQ
Provides:       locale(desktop-data-openSUSE:en)
#OBS
Source00:       opensuse-html_en.tar.bz2
Source01:       opensuse-html_en-graphics.tar.bz2
Source10:       opensuse-startup_en.tar.bz2
Source11:       opensuse-startup_en-graphics.tar.bz2
Source20:       opensuse-reference_en.tar.bz2
Source21:       opensuse-reference_en-graphics.tar.bz2
Source30:       opensuse-security_en.tar.bz2
Source31:       opensuse-security_en-graphics.tar.bz2
Source40:       opensuse-kvm_en.tar.bz2
Source41:       opensuse-kvm_en-graphics.tar.bz2
Source50:       opensuse-tuning_en.tar.bz2
Source51:       opensuse-tuning_en-graphics.tar.bz2
#SOURCES
Source901:      doc_pre_checkin.sh
Source903:      attributes
BuildRequires:  susedoc
# Also buildrequire tools that susedoc does not pull in automatically ATM
BuildRequires:  fam
BuildRequires:  poppler-tools python-lxml xerces-j2
BuildRequires:  python-xml
BuildRequires:  xmlgraphics-fop
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch
Group:          Documentation/SUSE
License:        GFDLv1.2
Summary:        Complete set of openSUSE Manuals (HTML, English)
%define _defaultdocdir %{_datadir}/doc/manual
%define _docdir %{_datadir}/doc/manual

%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_en-pdf
Group:          Documentation/SUSE
License:        GFDLv1.2
Summary:        openSUSE manual: Start-Up (PDF, English)
#Provides:    locale(desktop-data-openSUSE:en)
###PDFOBS

%description -n opensuse-startup_en-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_en-pdf
Group:          Documentation/SUSE
License:        GFDLv1.2
Summary:        openSUSE manual: Reference (PDF, English)
#Provides:    locale(desktop-data-openSUSE:en)
###PDFOBS

%description -n opensuse-reference_en-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_en-pdf
Group:          Documentation/SUSE
License:        GFDLv1.2
Summary:        openSUSE manual: Security Guide (PDF, English)
#Provides:    locale(desktop-data-openSUSE:en)
###PDFOBS

%description -n opensuse-security_en-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_en-pdf
Group:          Documentation/SUSE
License:        GFDLv1.2
Summary:        openSUSE manual: KVM Guide (PDF, English)
#Provides:    locale(desktop-data-openSUSE:en)
###PDFOBS

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

%package -n opensuse-tuning_en-pdf
Group:          Documentation/SUSE
License:        GFDLv1.2
Summary:        openSUSE manual: Tuning Guide (PDF, English)
#Provides:    locale(desktop-data-openSUSE:en)
###PDFOBS

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

%prep
#%%setup -c -q
%setup -c -q -n %{name}-%{version}/opensuse-html -a 01
%setup -c -q -T -n %{name}-%{version}/opensuse-startup -a 10 -a 11
%setup -c -q -T -n %{name}-%{version}/opensuse-reference -a 20 -a 21
%setup -c -q -T -n %{name}-%{version}/opensuse-security -a 30 -a 31
%setup -c -q -T -n %{name}-%{version}/opensuse-kvm -a 40 -a 41
%setup -c -q -T -n %{name}-%{version}/opensuse-tuning -a 50 -a 51
#PREP
%setup -c -q -T -D -n %{name}-%{version}
find -name '*.png' -o -name '*.svg' | xargs chmod 644 || :
#PDFPREP

%build
export XEP_LICENSE=/etc/xep/license.xml
export XEP_HOME=/usr/share/xep
export FOP=fop
%define my_all_dir  %{_builddir}/%{name}-%{version}/opensuse-html
cd %{my_all_dir}
. ENV-opensuse-html
make validate
make %{?jobs:-j%jobs} html
make %{?jobs:-j%jobs} unpacked-desktop-files
pushd %{my_all_dir}
cp %{_builddir}/%{name}-%{version}/opensuse-startup/ENV-opensuse-startup .
. ENV-opensuse-startup
# # this causes trouble with file names, thus use make package-pdf...
# make validate
# make %%{?jobs:-j%%jobs} color-pdf
# make %%{?jobs:-j%%jobs} unpacked-document-files-pdf
make package-pdf
popd
pushd %{my_all_dir}
cp %{_builddir}/%{name}-%{version}/opensuse-reference/ENV-opensuse-reference .
. ENV-opensuse-reference
# # this causes trouble with file names, thus use make package-pdf...
# make validate
# make %%{?jobs:-j%%jobs} color-pdf
# make %%{?jobs:-j%%jobs} unpacked-document-files-pdf
make package-pdf
popd
pushd %{my_all_dir}
cp %{_builddir}/%{name}-%{version}/opensuse-security/ENV-opensuse-security .
. ENV-opensuse-security
# # this causes trouble with file names, thus use make package-pdf...
# make validate
# make %%{?jobs:-j%%jobs} color-pdf
# make %%{?jobs:-j%%jobs} unpacked-document-files-pdf
make package-pdf
popd
pushd %{my_all_dir}
cp %{_builddir}/%{name}-%{version}/opensuse-kvm/ENV-opensuse-kvm .
. ENV-opensuse-kvm
# # this causes trouble with file names, thus use make package-pdf...
# make validate
# make %%{?jobs:-j%%jobs} color-pdf
# make %%{?jobs:-j%%jobs} unpacked-document-files-pdf
make package-pdf
popd
pushd %{my_all_dir}
cp %{_builddir}/%{name}-%{version}/opensuse-tuning/ENV-opensuse-tuning .
. ENV-opensuse-tuning
# # this causes trouble with file names, thus use make package-pdf...
# make validate
# make %%{?jobs:-j%%jobs} color-pdf
# make %%{?jobs:-j%%jobs} unpacked-document-files-pdf
make package-pdf
popd
#MAKE_DOC

%install
cd %{my_all_dir}
for f in */*yelp.tar.bz2; do tar xvf $f; done
mkdir -p $RPM_BUILD_ROOT%{_defaultdocdir}
# is set for sles or sled as /sles or /sled
# mkdir -p  desktop/{startup,reference,application,apparmor-admin-guide}
###
# product is name without language code
%define gnome_dir %{_datadir}/gnome/help/opensuse-manuals
install -d $RPM_BUILD_ROOT%{gnome_dir}
#
if [ -d html/%my_book ]; then
mv html/%my_book html/manual
mkdir -p $RPM_BUILD_ROOT/%{_defaultdocdir}/%{name}
cp -a --dereference html/manual $RPM_BUILD_ROOT/%{_defaultdocdir}/%{name}
### handle desktop files
pushd desktop
# problem writing desktop files on 10.3
### CHECKIT: still necessary on 11.0?
if [ -d index.desktop ]; then
  for f in $(find index.desktop -mindepth 1 -maxdepth 1); do
    mv $f .
  done
  rmdir index.desktop
fi
### CHECKIT: can we fix this for 11.0?  Just avoid the subdir...
if [ ! -f .directory ]; then
  # stand-alone book, hidden in sub-directory
  dir=$(find . -maxdepth 1 -type d -name 'book_*')
  if [ -n "$dir" ]; then
    for f in $(find $dir -mindepth 1 -maxdepth 1); do
      mv $f .
    done
    rmdir $dir
  fi
fi
for d in $(find . -maxdepth 1 -type d -name 'book*'); do
  id=${d//\./}
  id=${id//\//}%{my_lang}
  pushd $d
  for f in $(find . -name '.directory'); do
    sed -i "s|@PATH@|%{_defaultdocdir}/%{name}/manual|
s/\[\]//
s|@id@|$id|" $f
    case $d in
      *_startup)
        [ $f = "./.directory" ] \
          && sed -i "s|^\(X-DOC-Weight\).*|\1=-10000|" $f ;;
    esac
  done
  popd
done
### remove it, only keep yelp and kde4 -- they depend on top-level
### .directory files...
# Probably useful for stand-alone books
for f in $(find . -name '*.directory'); do
  id=%{name}
  id=${id//_/}
  sed -i "s|@PATH@|%{_defaultdocdir}/%{name}/manual|
s/\[\]//
s|@id@|$id|" $f
  # Fix the index.html reference
  if [ $f = ./.directory ]; then
    sed -i 's:\(^DocPath.*/\).*:\1index.html:
s/^\(Name\|Comment\)\(.*\)/\1\2 (%{my_lang})/' $f

    # write yelp / rarian file
    sed "
# remove useless comments and search settings
/^Comment/d
/^X-DOC-Search/d
s/^\[Desktop Entry\]/[Document]/
/^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.novell./
s/^X-DOC-Weight/DocWeight/
" $f > ../%{name}.document
# %{summary} is unreliable
#     my_title=$(echo "%{summary}" \
#       | sed 's/\(as \)*[Pp][Dd][Ff]//;s/ *(.*)//')
#     #if grep -s -q '^Name *= *$' ../%{name}.document; then
#     sed -i "
# s/^\(Name.*\)=\(.*\)/\1=$my_title \2/" ../%{name}.document
    # fi
    # if Name contains just "Documentation", add product info
    # FIXME: check this properly
    if ! grep -s -q '^Name *= *openSUSE' ../%{name}.document; then
      sed -i "
s/^\(Name.*\)=\(.*\)/\1=openSUSE \2/" ../%{name}.document
    fi
  fi
  # make sure to sort sles-startup guide first
  case %name in
    sles-startup*)
      [ $f = "./.directory" ] \
        && sed -i "s|^\(X-DOC-Weight\).*|\1=-2000|" $f ;;
  esac
done
popd
if [ -d yelp ]; then
  pushd yelp
  for f in *.document; do
    dir=${f%.document}
    pdf_file=${dir/-pdf/.pdf}
    dir=$(echo $dir | tr [:upper:] [:lower:])
    sed -i "s|^\(DocPath=\).*|\1/usr/share/doc/manual/$dir/$pdf_file|
s|^Categories=.*|Categories=System;Core;Translation;Documentation|
s|^\(Name.*\)|\1 (PDF)|" $f
  done
  popd
fi
if [ %{my_lang} = "en" ]; then
  mkdir -p $RPM_BUILD_ROOT%{_datadir}/help
  for f in *.document yelp/*.document; do
    file=$(echo $f | tr [:upper:] [:lower:])
    [ -f "$f" ] && cp $f $RPM_BUILD_ROOT%{_datadir}/help/${file#*/}
  done
  sed "s/Documentation *\(Documentation\)/\1/" %{name}.document \
    > $RPM_BUILD_ROOT%{_datadir}/help/%{name}.document
  # KDE4
  %define kdedir %{_datadir}/kde4/apps/khelpcenter/plugins
  mkdir -p $RPM_BUILD_ROOT/%kdedir
  pushd $RPM_BUILD_ROOT%{_datadir}/help
  for doc in *.document; do
    sed "\
s/\[Document\]/[Desktop Entry]/
" $doc >$RPM_BUILD_ROOT/%kdedir/${doc%\.document}.desktop
  done
  popd
else
  mkdir -p $RPM_BUILD_ROOT%{_datadir}/help/LOCALE/%{my_lang}
  for f in yelp/*.document; do
    file=$(echo $f | tr [:upper:] [:lower:])
    cp $f $RPM_BUILD_ROOT%{_datadir}/help/LOCALE/%{my_lang}/${file#*/}
  done
  sed "s/Documentation *\(Documentation\)/\1/" %{name}.document \
    > $RPM_BUILD_ROOT%{_datadir}/help/LOCALE/%{my_lang}/%{name}.document
fi
else
# PDF only books
install -d html/manual
echo PDF only > html/manual/%{name}
fi
#PDFINST

%clean
rm -fr ${RPM_BUILD_ROOT}

#PDFXXX

%files -n opensuse-startup_en-pdf
%defattr(-, root, root)
%doc */package-pdf-opensuse-startup/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_en-pdf
%defattr(-, root, root)
%doc */package-pdf-opensuse-reference/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_en-pdf
%defattr(-, root, root)
%doc */package-pdf-opensuse-security/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_en-pdf
%defattr(-, root, root)
%doc */package-pdf-opensuse-kvm/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_en-pdf
%defattr(-, root, root)
%doc */package-pdf-opensuse-tuning/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