LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File pre_checkin.sh of Package calligra-l10n (Project openSUSE:Factory)

#! /bin/sh

nr="0"

cp calligra-l10n.spec.in calligra-l10n.spec

for lang in `ls -1 calligra-l10n*tar.bz2 | sed -n 's,calligra-l10n-\([^-]*\)-.*,\1,p'`; do
  languages="$languages $lang"
done

languages="`echo $languages | sed \"s,hne ,,"`"

echo "languages are $languages"
for lang in $languages; do

 if [ $nr -lt "10" ]; then
        sed -e "s,#@SOURCES@,Source$nr:        ftp://ftp.kde.org/pub/kde/stable/calligra-%{version}/calligra-l10n/%{name}-$lang-%{version}.tar.bz2\n#@SOURCES@," calligra-l10n.spec > calligra-l10n.spec.tmp && mv calligra-l10n.spec.tmp calligra-l10n.spec
 elif [ $nr -ge "10" ]; then
        sed -e "s,#@SOURCES@,Source$nr:       ftp://ftp.kde.org/pub/kde/stable/calligra-%{version}/calligra-l10n/%{name}-$lang-%{version}.tar.bz2\n#@SOURCES@," calligra-l10n.spec > calligra-l10n.spec.tmp && mv calligra-l10n.spec.tmp calligra-l10n.spec
 fi

 plang=$lang
 if test "$lang" = "sr@Latn"; then
	lang=srLatn
        plang=sr
 fi

 splitdoc=

 if test "$lang" = "ca" -o "$lang" = "de" -o "$lang" = "es" -o "$lang" = "et" -o "$lang" = "fr" -o "$lang" = "gl" -o "$lang" = "it" -o "$lang" = "nl" -o "$lang" = "pt_BR" -o "$lang" = "ru" -o "$lang" = "sv" -o "$lang" = "uk"; then
        splitdoc=true
 fi

 text="%package $lang\nSummary:        Calligra Suite Translations for $lang\nLicense:        GPL-2.0+\nGroup:          System/GUI/KDE\nProvides:       locale(calligra:$plang)\n\n%description $lang\n$lang\n"

 if test $splitdoc; then
        text="$text\n%package $lang-doc\nSummary:        Calligra Suite Manuals in $lang\nLicense:        GPL-2.0+\nGroup:          System/GUI/KDE\nProvides:       locale(calligra:$plang)\n\n%description $lang-doc\n$lang\n"
 fi

 sed -e "s,#@PACKAGES@,$text\n#@PACKAGES@," calligra-l10n.spec > calligra-l10n.spec.tmp && mv calligra-l10n.spec.tmp calligra-l10n.spec

 if test $splitdoc; then
        sed -e "s,#@FILES@,%files $lang -f ../files.$lang\n\n%files $lang-doc -f ../files.doc.$lang\n\n#@FILES@," calligra-l10n.spec > calligra-l10n.spec.tmp && mv calligra-l10n.spec.tmp calligra-l10n.spec
 else
        if test "$lang" = "hne"; then
           sed -e "s,#@FILES@,%files $lang -f ../files.both.$lang\n#@FILES@\n%if %suse_version<1120\n%defattr\(-\,root\,root\,-\)\n%dir /usr/share/locale/hne\n%dir /usr/share/locale/hne/LC_MESSAGES\n%endif," calligra-l10n.spec > calligra-l10n.spec.tmp && mv calligra-l10n.spec.tmp calligra-l10n.spec
        else
           sed -e "s,#@FILES@,%files $lang -f ../files.both.$lang\n\n#@FILES@," calligra-l10n.spec > calligra-l10n.spec.tmp && mv calligra-l10n.spec.tmp calligra-l10n.spec
        fi
 fi

 nr=$(( $nr + 1 ))
done

while [ $nr != "0" ]; do
  nr=$(( $nr - 1 ))
  extract="-b $nr $extract"
done
sed -e "s,@EXTRACT@,$extract," calligra-l10n.spec > calligra-l10n.spec.tmp && mv calligra-l10n.spec.tmp calligra-l10n.spec
sed -e "s,@LANGUAGES@,$languages," calligra-l10n.spec > calligra-l10n.spec.tmp && mv calligra-l10n.spec.tmp calligra-l10n.spec

perl update_spec.pl calligra-l10n.spec attributes > calligra-l10n.spec.tmp && mv calligra-l10n.spec.tmp calligra-l10n.spec