File opensuse-manuals_hu.spec of Package opensuse-manuals_hu

#
# spec file for package opensuse-manuals_hu (Version 11.3)
#
# Copyright (c) 2010 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_hu
%define my_lang hu
%define my_book opensuse-html
Version:        11.3
Release:        1
Provides:       locale(desktop-data-openSUSE:hu)
Obsoletes:      opensuse-manual_hu < 11.2 opensuse-kdequick_hu < 11.1 opensuse-gnomequick_hu < 11.1 opensuse-gnomeuser_hu < 11.1 opensuse-kdeuser_hu < 11. opensuse-kde3user_hu < 11.1 apparmor-admin_hu < 11.1
Provides:       opensuse-manual_hu = %{version}-%{release} opensuse-kdequick_hu = %{version}-%{release} opensuse-gnomequick_hu = %{version}-%{release} opensuse-gnomeuser_hu = %{version}-%{release} opensuse-kdeuser_hu = %{version}-%{release} opensuse-kde3user_hu = %{version}-%{release} apparmor-admin_hu = %{version}-%{release}
Obsoletes:      opensuse-manual_hu-pdf < 11.2 opensuse-kde3user_hu-pdf < 11.1 opensuse-manuals_hu-pdf < 11.3 opensuse-apparmor-admin_hu-pdf < 11.3
Provides:       opensuse-manual_hu-pdf = %{version}-%{release} opensuse-kde3user_hu-pdf = %{version}-%{release} opensuse-manuals_hu-pdf = %{version}-%{release} opensuse-apparmor-admin_hu-pdf = %{version}-%{release}
#OBS
Source00:       opensuse-html_hu-html.tar.bz2
Source01:       opensuse-html_hu-desktop.tar.bz2
Source02:       opensuse-html_hu-graphics.tar.bz2
Source03:       opensuse-html_hu.tar.bz2
Source10:       opensuse-reference_hu.pdf
#Source11: opensuse-reference_hu-graphics.tar.bz2
#Source12: opensuse-reference_hu.tar.bz2
Source13:       opensuse-reference_hu-pdf-yelp.tar.bz2
#SOURCES
Source901:      doc_pre_checkin.sh
Source903:      attributes
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch
Group:          Documentation/SUSE
License:        GFDL 1.2
Summary:        Set of openSUSE Manuals (HTML, Hungarian)
%define _defaultdocdir %{_datadir}/doc/manual
%define _docdir %{_datadir}/doc/manual

%description
Set of openSUSE Manuals (HTML, Hungarian).

%package -n opensuse-reference_hu-pdf
Group:          Documentation/SUSE
License:        GFDLv1.2
Summary:        openSUSE manual: Reference (PDF, Hungarian)
#Provides:    locale(desktop-data-openSUSE:hu)
###PDFOBS

%description -n opensuse-reference_hu-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.

%prep
#%setup -c -q
%setup -c -q -a 01
#echo "This PDF package is empty.  Find the PDFs in sub-packages." >README-pdf
#PREP
find -name '*.png' -o -name '*.svg' | xargs chmod 644 || :
tar xvf %{S:13}
#PDFPREP

%build
# make sure index.html exists
for f in $(find html -type f -name 'book.*'); do
  pushd ${f%/*}
  [ -f index.html -o -L index.html ] || ln -sf ${f##*/} index.html
  popd
done

%install
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
### 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 yelp/*.document; do
    file=$(echo $f | tr [:upper:] [:lower:])
    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
# old stuff
# Link it into the Gnome help system (must be found by calling
# susehelp help://suselinux-manual/
pushd $RPM_BUILD_ROOT%{gnome_dir}
if [ %{my_lang} = "en" ]; then
  target=$RPM_BUILD_ROOT%{_defaultdocdir}/%{name}/manual
  install -d $target
  ln -sf %{_defaultdocdir}/%{name}/manual C
else
  target=$RPM_BUILD_ROOT%{_defaultdocdir}/%{name}/manual
  install -d $target
  ln -sf %{_defaultdocdir}/%{name}/manual %{my_lang}
fi
popd
else
# PDF only books
install -d html/manual
echo PDF only > html/manual/%{name}
fi
cp %{S:10} . 
mkdir opensuse-reference 

#PDFINST

%clean
rm -fr ${RPM_BUILD_ROOT}

#PDFXXX

%files -n opensuse-reference_hu-pdf
%defattr(-, root, root)
%doc opensuse-reference_hu.pdf
%{_datadir}/help/LOCALE/hu/opensuse-reference_hu-pdf.document

#PDFFILES

%files
%defattr(-, root, root)
%dir %{_defaultdocdir}
%doc html/manual
#GNOME -- probably obsolete now
%{gnome_dir}
%dir /usr/share/gnome
%dir /usr/share/gnome/help
#recent GNOME
%dir %{_datadir}/help
%dir %{_datadir}/help/LOCALE
%dir %{_datadir}/help/LOCALE/hu
%{_datadir}/help/LOCALE/hu/%{name}.document
#KDE4

%changelog
openSUSE Build Service is sponsored by