LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File susestudio-user_en.spec of Package susestudio-user_en (Project home:ctso)

# Automatically generated out of the docs SVN
# norootforbuild
Name: susestudio-user_en
%define my_lang en
%define my_book susestudio-user
Version:        1.1
Release:        1
Provides:       locale(desktop-data-openSUSE:en)
#OBS
Source0: susestudio-user_en-html.tar.bz2
Source01: susestudio-user_en-desktop.tar.bz2
Source02: susestudio-user_en-graphics.tar.bz2
Source03: susestudio-user_en.tar.bz2
Source4: susestudio-user_en.pdf
#Source5: susestudio-user_en-graphics.tar.bz2
#Source6: susestudio-user_en.tar.bz2
Source7: susestudio-user_en-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:        SUSE Studio Userguide (English)
%define _defaultdocdir %{_datadir}/doc/manual
%define _docdir %{_datadir}/doc/manual


%description
SUSE Studio Userguide (English).

%package -n susestudio-user_en-pdf
Group:        Documentation/SUSE
License:      GFDL 1.2
Summary:      SUSE Studio Userguide as PDF (English)
#Provides:    locale(desktop-data-openSUSE:en)
###PDFOBS


%description -n susestudio-user_en-pdf
PDF of SUSE Studio Userguide (English).

%prep
#%setup -c -q
%setup -c -q -a 1
#PREP
find -name '*.png' -o -name '*.svg' | xargs chmod 644 || :
tar xvf %{S:7}
#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/susestudio-user
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 *= *SUSESTUDIO' ../%{name}.document; then
      sed -i "
s/^\(Name.*\)=\(.*\)/\1=SUSESTUDIO \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:4} . 
mkdir susestudio-user 


#PDFINST

%clean
rm -fr ${RPM_BUILD_ROOT}

#PDFXXX

%files -n susestudio-user_en-pdf
%defattr(-, root, root)
%doc susestudio-user_en.pdf
%{_datadir}/help/susestudio-user_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/susestudio-user_en-pdf.desktop


#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
%{_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