#!/bin/bash # tlpdb2rpmspec # # Copyright 2010-2012 Munehiro Yamamoto # This file is licensed under the GNU General Public License version 2 # or any later version. Usage(){ cat<&2 ## check to need the subpackage %{name}-doc with_docpkg=0 if [ -z "$($__echo $pkg | grep "collection-documentation")" ]; then for i in ${PKG_MANIFEST}; do [ ! -z "$($__echo "$i" | grep texmf-dist/doc/)" ] && \ with_docpkg=1 && break done fi with_maplist=0 MAPLIST="$(tlpkg2maplist $pkg)" [ ! -z "$MAPLIST" ] && with_maplist=1 ##$__echo $with_maplist && $__echo "$MAPLIST" && exit with_inilist=0 INILIST="$(tlpkg2inilist $pkg)" [ ! -z "$INILIST" ] && with_inilist=1 ##$__echo $with_inilist && $__echo "$INILIST" && exit cat< /dev/null %define exec_texhash [ -e /var/run/texlive/run-texhash ] && ( \\\\\\ [ -x %{_bindir}/texhash ] && \\\\\\ echo -n " "; echo -n "Running texhash... "; \\\\\\ %{_bindir}/texhash 2> /dev/null; \\\\\\ echo "done." ) && %__rm -f /var/run/texlive/run-texhash; %define exec_mtxrun [ -e /var/run/texlive/run-mtxrun ] && ( \\\\\\ [ -x %{_bindir}/mtxrun ] && \\\\\\ echo -n " "; echo -n "Running mtxrun... "; \\\\\\ export TEXMF=%{texmf}-dist TEXMFCNF=%{texmf}/web2c TEXMFCACHE=%{texmfsysvar}; \\\\\\ %{_bindir}/mtxrun --generate &> /dev/null; \\\\\\ echo "done." ) && %__rm -f /var/run/texlive/run-mtxrun; %define exec_fmtutil [ -e /var/run/texlive/run-fmtutil ] && ( \\\\\\ [ -x %{_bindir}/fmtutil-sys ] && \\\\\\ echo -n " "; echo -n "Running fmtutil-sys... "; \\\\\\ %{_bindir}/fmtutil-sys --all &> /dev/null; \\\\\\ echo "done." ) && %__rm -f /var/run/texlive/run-fmtutil; %define exec_updmap [ -e /var/run/texlive/run-updmap ] && ( \\\\\\ [ -x %{_bindir}/updmap-sys ] && \\\\\\ echo -n " "; echo -n "Running updmap-sys... "; \\\\\\ %{_bindir}/updmap-sys --nohash --quiet &> /dev/null; \\\\\\ echo "done." ) && %__rm -f /var/run/texlive/run-updmap; Summary: ${RPM_SUMMARY} Summary(ja): ${RPM_SUMMARY} Name: texlive-$pkg Version: ${VERSION} Release: ${RELEASE}%{?_dist_release} License: ${RPM_LICENSE} Group: Applications/Publishing URL:http://www.tug.org/texlive/ Requires: texlive = %{version} $RPM_REQUIRES Requires(post): texlive = %{version} Requires(postun): texlive = %{version} #BuildRequires: texlive-sources = %{version} BuildArch: noarch Buildroot: %{_tmppath}/%{name}-%{version}-root Vendor: ${RPM_VENDOR} Distribution: ${RPM_DISTRIBUTION} Packager: ${RPM_PACKAGER} %description The TeX Live software distribution offers a complete TeX system for a variety of Unix, Macintosh, Windows and other platforms. It encompasses programs for editing, typesetting, previewing and printing of TeX documents in many different languages, and a large collection of TeX macros and font libraries. The distribution includes extensive general documentation about TeX, as well as the documentation for the included software packages. This package is a collection of ${PKG_SHORTDESC}: ${PKG_LONGDESC} This package contains the following CTAN packages: ${PKG_CTANPKGSLIST} %description -l ja TeX Live ソフトウェアディストリビューションは、 さまざまな Unix, Macintosh, Windows、および 他のプラットホームに対して完全な TeX システムを提供します。 多くの異なった言語を含む TeX ドキュメントの 編集、組版、閲覧、印刷するためのプログラム、 そして、TeX マクロやフォントライブラリの大きなコレクションを 同梱しています。 このディストリビューションは 同梱しているソフトウェアパッケージのためのドキュメントばかりでなく、 TeX に関するたくさんの一般的なドキュメントを含んでいます。 このパッケージは以下のようなパッケージ集です。 ${PKG_SHORTDESC}: ${PKG_LONGDESC} このパッケージは以下の CTAN パッケージを含んでいます: ${PKG_CTANPKGSLIST} EOF ## subpackage: %{name}-doc if [ $with_docpkg -eq 1 ]; then cat< filelist.full find %{buildroot}%{texmf}-dist -type d | \\ %__sed -e "s|^%{buildroot}|%dir |" \\ -e "s|\$|/|" >> filelist.full EOF ## subpackage: %{name}-doc if [ $with_docpkg -eq 1 ]; then cat< filelist.doc cat filelist.doc filelist.full | sort | uniq -u > filelist.tmp %__mv -f filelist.tmp filelist.full EOF fi cat</dev/null 2>&1 && %touch_run updmap EOT done) EOF fi ## Running fmtutil if [ $with_inilist -eq 1 ]; then cat</dev/null 2>&1 && %touch_run updmap EOT done) EOF fi cat< 2012-1 - generated by $(basename $0) 2012-1: $(basename $0) $($__echo $*) * Sat Dec 3 2011 Munehiro Yamamoto 2011-2 - generated by $(basename $0) 2011-2: $(basename $0) $($__echo $*) - set external dependencies (texlive-collection-binextra, texlive-collection-fontutils) * Sun Oct 30 2011 Munehiro Yamamoto 2011-1 - generated by $(basename $0) 2011-1: $(basename $0) $($__echo $*) * Mon Mar 23 2011 Munehiro Yamamoto 2009-4 - generated by $(basename $0) 2009-4: $(basename $0) $($__echo $*) - make symlinks of core script utils (texlive-collection-binextra, texlive-collection-context, texlive-collection-fontutils, texlive-collection-langgreek, texlive-collection-langindic, texlive-collection-latex, texlive-collection-latexextra, texlive-collection-latexrecommended, texlive-collection-pictures, texlive-collection-pstricks, texlive-collection-science) * Fri Jan 14 2011 Munehiro Yamamoto 2009-3 - generated by $(basename $0) 2009-3: $(basename $0) $($__echo $*) - improved %%post * Fri Oct 01 2010 Munehiro Yamamoto 2009-2 - generated by $(basename $0) 2009-2: $(basename $0) $($__echo $*) - removed arch dependent binaries (texlive-collection-latexextra) - fixed perl path - improved updmap process in %%post and %%postun * Sat Aug 07 2010 Munehiro Yamamoto 2009-1 - generated by $(basename $0) 2009-1: $(basename $0) $($__echo $*) EOF return 0 } ## mkrpmcollection [--minimal-collections|--standard-collections|--full-collections] mkrpmcollection(){ local category=$($__echo $1 | sed -e "s/--\([a-z]*\)-collections/\1/") local category_pkglist= local i= case $category in minimal|standard) category_pkglist=$(grep -e "${category}," $CATEGORYLIST | sed -e "s/${category},//g" | sed -e "s/,$//g") ;; full) category_pkglist=$(Usage | egrep "^collection-") ;; *) $__echo "E: unknown category: $category" return 1 ;; esac for i in ${category_pkglist}; do mkrpmspec $i > texlive-${i}-vl.spec if [ $? -eq 1 ]; then $__echo "texlive-${i}-vl.spec: " cat texlive-${i}-vl.spec rm -f texlive-${i}-vl.spec continue fi rpmbuild -ba texlive-${i}-vl.spec || return 1 done return 0 } setup-tlpdb2rpmspec(){ __echo=$(which echo 2>/dev/null) [ ! -f $__echo ] && return 1 ## set external dependencies ASYMPTOTE_PACKAGE= DETEX_PACKAGE= DVIPNG_PACKAGE= LATEXMK_PACKAGE= LCDF_TYPETOOLS_PACKAGE= PSUTILS_PACKAGE= T1UTILS_PACKAGE= ## load your .vtlpkg.conf if [ -f ${HOME}/.vtlpkg.conf ]; then . ${HOME}/.vtlpkg.conf else $__echo "E: ${HOME}/.vtlpkg.conf: No such file" return 1 fi [ -z "$RPM_VENDOR" ] && \ $__echo "E: \$RPM_VENDOR is empty" && return 1 [ -z "$RPM_DISTRIBUTION" ] && \ $__echo "E: \$RPM_DISTRIBUTION is empty" && return 1 [ -z "$RPM_GPG_NAME" ] && \ $__echo "E: \$RPM_GPG_NAME is empty" && return 1 [ -z "$RPM_PACKAGER" ] && \ $__echo "E: \$RPM_PACKAGER is empty" && return 1 ## setup configurations VERSION=@@VTLPKG_VERSION@@ RELEASE=@@VTLPKG_RELEASE@@ ## set a tlpdb file for TeX Live, which is a package database file. TLPDB=@@VTLPKG_TLPDB@@ TLPDB_MAXLINE=$(wc -l $TLPDB | awk '{print $1}') ## category of collection-* CATEGORYLIST=@@VTLPKG_CATEGORYLIST@@ ## set some booleans with_option=0 } ############################################################################## setup-tlpdb2rpmspec || exit 1 check-parameter $* || exit 1 case $1 in --name|--category|--revision|--depend|--shortdesc|--longdesc|--execute|--catalogue-ctan|--catalogue-date|--catalogue-license|--catalogue-version|--filelist) tlpkg4a $1 $2 || exit 1 ;; --minimal-collections|--standard-collections|--full-collections) mkrpmcollection $1 || exit 1 ;; *) mkrpmspec $1 || exit 1 ;; esac exit ### end of file