source: projects/texlive-vtlpkg/trunk/tlpdb2rpmspec.sh.in @ 5242

Revision 5242, 27.0 KB checked in by munepi, 12 years ago (diff)

updated tlpdb2rpmspec.sh.in and dot.vtlpkg.conf.in

  • Property svn:executable set to *
RevLine 
[1476]1#!/bin/bash
2# tlpdb2rpmspec
3#
4# Copyright 2010 Munehiro Yamamoto <munepi@vinelinux.org>
5# This file is licensed under the GNU General Public License version 2
6# or any later version.
7
8Usage(){
9    cat<<EOF
[5075]10$(basename $0) @@VTLPKG_VERSION@@
[1476]11Usage:  $(basename $0) [option] [pkgname]
12
[5075]13TeX Live Package Database (a file named texlive.tlpdb) to RPM spec converter
14This script generates a RPM spec file of CTAN and collection-* packages
15contained in TeX Live @@VTLPKG_VERSION@@.
[1476]16
17Options:
18        --name:                 return [pkgname]
19        --category:             return the category of [pkgname]
20        --revision:             return the revision of [pkgname]
21        --depend:               return dependencies of [pkgname]
22        --shortdesc:            return the short description of [pkgname]
23        --longdesc:             return the description of [pkgname]
24        --execute:              return post processe of [pkgname]
25        --catalogue-ctan:       return the locate of [pkgname]
26        --catalogue-date:       return the last update of [pkgname]
27        --catalogue-license:    return the license of [pkgname]
28        --catalogue-version:    return the version of [pkgname]
29        --filelist:             return the filelist of [pkgname]
30        --help:                 show this help
31
[5080]32Supoort collection-* packages:
[1476]33$(egrep "^name collection-" $TLPDB | sed -e "s,name ,,g")
34EOF
35}
36
37check-parameter(){
38    [ -z "$*" ] && Usage && return 1
39
40    while [ ! -z "$*" ]; do
41        case $1 in
[1521]42            --name|--category|--revision|--depend|--shortdesc|--longdesc|--execute|--catalogue-ctan|--catalogue-date|--catalogue-license|--catalogue-version|--filelist)
[1476]43                [ $with_option -eq 1 ] && \
[5075]44                    $__echo "E: you only give one option" && return 1
[1476]45                with_option=1
46                ;;
47            --help)
48                Usage
49                return 1
50                ;;
[1521]51            --minimal-collections|--standard-collections|--full-collections)
52                [ ! -f /etc/vine-release ] && \
[5075]53                    $__echo "E: support Vine Linux only" && return 1
[1521]54                ;;
55            *)
[1784]56                [ -z "$(egrep -n "^name $1$" $TLPDB)" ] && \
[5075]57                    $__echo "E: unknown option or package: $1" && return 1
[1476]58                ;;
59        esac
60        shift
61    done
62
63    return 0
64}
65
66
67## tlpkg4a [--name|--category|--revision|--depend|--shortdesc|--longdesc|--execute|--catalogue-ctan|--catalogue-date|--catalogue-license|--catalogue-version|--filelist] [pkgname]
68tlpkg4a(){
69    [ $# -eq 2 ] || return 1
70    local opt=$1
71    local pkg=$2
[5075]72    local fieldname=$($__echo $opt | sed -e "s,--,,")
[1476]73
74    ## check param
75    case $opt in
76        --name|--category|--revision|--depend|--shortdesc|--longdesc|--execute|--catalogue-ctan|--catalogue-date|--catalogue-license|--catalogue-version|--filelist)
77            ;;
78        *)
[5075]79            $__echo "E: unknown option: $opt"
[1476]80            exit 1
81            ;;
82    esac
83
84    ## get the head line of $pkg record
85    pkg_LINE=$(egrep -n "^name $pkg$" $TLPDB | cut -d":" -f 1)
86
87    ## read tlpdb
[1496]88    is_pkg=0
[2975]89    (
90        [ "$opt" = "--filelist" ] && \
91            tail -n $(( $TLPDB_MAXLINE - $pkg_LINE + 1 )) $TLPDB || \
92            tail -n $(( $TLPDB_MAXLINE - $pkg_LINE + 1 )) $TLPDB | egrep -v -e "^ "
93    ) | \
[1476]94        while read field; do
95            ## find the record of $pkg
[5075]96            $__echo "$field" | egrep -q "^name $pkg" && is_pkg=1
[1496]97            [ $is_pkg -eq 0 ] && continue
[1476]98           
99            ## return the values of its field name
100            if [ "$opt" = "--filelist" ]; then
101            ## NOTE: we only need texmf-dist directories
[5075]102            ##       we replace RELOC with texmf-dist
103                $__echo "$field" | \
[5192]104                    egrep -e "^texmf-dist/" -e "^RELOC/" | \
[5075]105                    sed -e "s,^RELOC,texmf-dist," \
106                        -e "s, details=.*,," -e "s, language=.*,,"
[1476]107            else
[5075]108                $__echo "$field" | \
109                    egrep "^${fieldname} " | \
110                    sed -e "s,${fieldname} ,,"
[1476]111            fi
112           
113            ## end of the record of $pkg
[5075]114            $__echo "$field" | egrep -q "^[[:blank:]]*$" && break
[1476]115        done
116   
117    return 0
118}
119
120## tlpkg2speclicense [pkgname]
121tlpkg2speclicense(){
122    [ $# -eq 1 ] || return 1
123    local pkg=$1
124
125    case $(tlpkg4a --catalogue-license $pkg) in
[5075]126        gpl3) $__echo "GPLv3+";;
127        gpl2) $__echo "GPLv2+";;
128        gpl) $__echo "GPL+";;
[5078]129        lppl|lppl1|lppl1.2|lppl1.3) $__echo "LPPL";;
[5075]130        other-free) $__echo "Freely redistributable without restriction";;
131        pd) $__echo "Public Domain";;
132        noinfo) $__echo "No Info";;
133        lgpl|lgpl2.1) $__echo "LGPLv2+";;
134        gfsl) $__echo "LPPL";;
135        bsd) $__echo "BSD";;
136        knuth) $__echo "Knuth";;
137        unknown) $__echo "Unknown";;
138        gfl) $__echo "LPPL";;
139        artistic2) $__echo "Artistic 2.0";;
140        fdl) $__echo "GFDL";;
141        collection) $__echo "Public Domain";;
142        artistic) $__echo "Artistic";;
143        other-nonfree) $__echo "Other";;
144        other) $__echo "Other";;
145        ofl) $__echo "OFSFLD";;
146        apache2) $__echo "ASL 2.0";;
147        nosource) $__echo "No Source";;
148        nosell) $__echo "No Sell";;
149        nocommercial) $__echo "Non-commercial";;
[1476]150        *) return 1;;
151    esac
152    return 0
153}
154
155## tlpkg2manifest [pkgname]
156tlpkg2manifest(){
157    [ $# -eq 1 ] || return 1
158    local pkg=$1
159    local pkgdeps="$(tlpkg4a --depend $pkg)"
[1521]160    local i=
[1476]161
162    tlpkg4a --filelist $pkg || return 1
163
[1496]164    ## if $pkg is not collection-*, only return the filelist of $pkg
[5075]165    $__echo $pkg | egrep -q "^collection-" || return 0
[1496]166
[1476]167    ##!! we need pure filelist of $pkg; remove collection-*
[5075]168    pkgdeps=$($__echo $pkgdeps | sed -e "s,collection-[-A-Za-z0-9]*,,g")
[1476]169
170    [ -z "$pkgdeps" ] && return 0
171    for i in $pkgdeps; do
172        tlpkg4a --filelist $i || return 1
173    done
174
175    return 0
176}
177
178## tlpkg2maplist [pkgname]
179tlpkg2maplist(){
180    [ $# -eq 1 ] || return 1
181    local pkg=$1
182    local pkgdeps="$(tlpkg4a --depend $pkg)"
[1521]183    local i=
[1476]184
185    tlpkg4a --execute $pkg | grep -e "Map" | sed -e "s,^add,,g"
186
187    ##!! we need pure filelist of $pkg; remove collection-*
[5075]188    pkgdeps=$($__echo $pkgdeps | sed -e "s,collection-[-A-Za-z0-9]*,,g")
[1476]189
190    [ -z "$pkgdeps" ] && return 0
191    for i in $pkgdeps; do
192        tlpkg4a --execute $i | grep -e "Map" | sed -e "s,^add,,g"
193    done
194
195    return 0
196}
197
[1496]198## tlpkg2inilist [pkgname]
199tlpkg2inilist(){
200    [ $# -eq 1 ] || return 1
201    local pkg=$1
202    local pkgdeps="$(tlpkg4a --depend $pkg)"
[1521]203    local i=
[1476]204
[1496]205    ## search AddFormat, AddHypen
206    tlpkg4a --execute $pkg | grep -e "Add"
207
208    ##!! we need pure filelist of $pkg; remove collection-*
[5075]209    pkgdeps=$($__echo $pkgdeps | sed -e "s,collection-[-A-Za-z0-9]*,,g")
[1496]210
211    [ -z "$pkgdeps" ] && return 0
212    for i in $pkgdeps; do
213        tlpkg4a --execute $i | grep -e "Add"
214    done
215
216    return 0
217}
218
[1476]219## mkrpmspec [pkgname]
220mkrpmspec(){
221    [ $# -eq 1 ] || return 1
222    local pkg=$1
[1521]223    local i=
[1476]224
225    RPM_SUMMARY="TeX Live: $(tlpkg4a --shortdesc $pkg)"
226
227    ## Requires tag for texlive
[5078]228    RPM_REQUIRES=$(for i in $(tlpkg4a --depend $pkg | egrep "^collection-" | egrep -v "^collection-documentation"); do \
229        $__echo "Requires: texlive-$i = %{version}"; \
230        done)
[1476]231
[5242]232    ## Requires tag for external dependencies
233    [ ! -z "$DETEX_PACKAGE" ] && \
234        [ ! -z "$(tlpdb2rpmspec --depend $pkg | egrep "^detex")" ] && \
235        RPM_REQUIRES="${RPM_REQUIRES}
236Requires: $DETEX_PACKAGE"
237    [ ! -z "$DVIPNG_PACKAGE" ] && \
238        [ ! -z "$(tlpdb2rpmspec --depend $pkg | egrep "^dvipng")" ] && \
239        RPM_REQUIRES="${RPM_REQUIRES}
240Requires: $DVIPNG_PACKAGE"
241    [ ! -z "$LATEXMK_PACKAGE" ] && \
242        [ ! -z "$(tlpdb2rpmspec --depend $pkg | egrep "^latexmk")" ] && \
243        RPM_REQUIRES="${RPM_REQUIRES}
244Requires: $LATEXMK_PACKAGE"
245    [ ! -z "$LCDF_TYPETOOLS_PACKAGE" ] && \
246        [ ! -z "$(tlpdb2rpmspec --depend $pkg | egrep "^lcdftypetools")" ] && \
247        RPM_REQUIRES="${RPM_REQUIRES}
248Requires: $LCDF_TYPETOOLS_PACKAGE"
249    [ ! -z "$PSUTILS_PACKAGE" ] && \
250        [ ! -z "$(tlpdb2rpmspec --depend $pkg | egrep "^psutils")" ] && \
251        RPM_REQUIRES="${RPM_REQUIRES}
252Requires: $PSUTILS_PACKAGE"
253    [ ! -z "$T1UTILS_PACKAGE" ] && \
254        [ ! -z "$(tlpdb2rpmspec --depend $pkg | egrep "^t1utils")" ] && \
255        RPM_REQUIRES="${RPM_REQUIRES}
256Requires: $T1UTILS_PACKAGE"
257
[1476]258    ## License tag
259    RPM_LICENSE="$(tlpkg2speclicense $pkg),"
260    for i in $(tlpkg4a --depend $pkg | egrep -v "^collection-"); do
261        tmp=$(tlpkg2speclicense $i)
[5075]262        $__echo "$RPM_LICENSE" | grep -q "${tmp},"
[1476]263        [ $? -eq 1 ] && RPM_LICENSE="${RPM_LICENSE} ${tmp},"
264    done
[5075]265    RPM_LICENSE=$($__echo "$RPM_LICENSE" | sed -e "s/,$//" | sed -e "s/^, //")
[1476]266    [ -z "$RPM_LICENSE" ] && RPM_LICENSE=distributable
267
[1499]268    PKG_SHORTDESC=$(tlpkg4a --shortdesc $pkg)
269    PKG_LONGDESC=$(tlpkg4a --longdesc $pkg)
270
271    PKG_CTANPKGSLIST=$(for i in $(tlpkg4a --depend $pkg); do \
[5075]272        if [ -z "$($__echo "$i" | grep "collection-")" ]; then \
273            $__echo -n "$i: "; \
[1499]274            tmp=$(tlpkg4a --shortdesc $i); \
[5075]275            [ -z "${tmp}" ] && $__echo || $__echo "$tmp"; \
[1499]276        fi
277        done)
278
279    PKG_MANIFEST=$(tlpkg2manifest $pkg)
[1521]280    [ -z "${PKG_MANIFEST}" ] && \
[5080]281        $__echo "W: empty manifest: $pkg" >&2
[1499]282
[5078]283    ## check to need the subpackage %{name}-doc
[1476]284    with_docpkg=0
[5078]285    if [ -z "$($__echo $pkg | grep "collection-documentation")" ]; then
286        for i in ${PKG_MANIFEST}; do
287            [ ! -z "$($__echo "$i" | grep texmf-dist/doc/)" ] && \
288                with_docpkg=1 && break
289        done
290    fi
[1476]291
[1496]292    with_maplist=0
293    MAPLIST="$(tlpkg2maplist $pkg)"
294    [ ! -z "$MAPLIST" ] && with_maplist=1
[5075]295    ##$__echo $with_maplist && $__echo "$MAPLIST" && exit
[1496]296
297    with_inilist=0
298    INILIST="$(tlpkg2inilist $pkg)"
299    [ ! -z "$INILIST" ] && with_inilist=1
[5075]300    ##$__echo $with_inilist && $__echo "$INILIST" && exit
[1496]301
[1476]302cat<<EOF
303## -*- coding: utf-8-unix -*-
[1709]304## NOTE: This spec file is generated by $(basename $0) ${VERSION}-${RELEASE}:
305## $(basename $0) $pkg
[1476]306
[5075]307%global _use_internal_dependency_generator 0
308%global __find_provides %{nil}
309%global __find_requires %{nil}
310
[1476]311%bcond_with firstbuild
312
313%define tex_destdir     %{_datadir}
314%define texmf           %{tex_destdir}/texmf
315%define texlive_src     %{tex_destdir}/texlive-sources
316%define build_tex_destdir       %{buildroot}%{tex_destdir}
317%define build_texmf     %{buildroot}%{texmf}
318
319%define exec_mktexlsr  [ -x %{_bindir}/texconfig-sys ] && PATH=%{_bindir}:\$PATH %{_bindir}/texconfig-sys rehash
320%define exec_texhash  [ -x %{_bindir}/texhash ] && PATH=%{_bindir}:\$PATH %{_bindir}/texhash
[5198]321%define exec_updmap   [ -x %{_bindir}/updmap-sys ] && PATH=%{_bindir}:\$PATH %{_bindir}/updmap-sys
[1476]322%define exec_fmtutil  [ -x %{_bindir}/fmtutil-sys ] && PATH=%{_bindir}:\$PATH %{_bindir}/fmtutil-sys --all >/dev/null 2>&1
323%define exec_upddeffont    [ -x %{_sbindir}/update-defaultfont ] && %{_sbindir}/update-defaultfont 2> /dev/null
[5198]324%define vartexfonts %{_var}/lib/texmf/fonts
[1476]325
326Summary: ${RPM_SUMMARY}
[1499]327Summary(ja): ${RPM_SUMMARY}
[1476]328Name: texlive-$pkg
329Version: ${VERSION}
[1915]330Release: ${RELEASE}%{?_dist_release}
[1476]331License: ${RPM_LICENSE}
332Group: Applications/Publishing
333URL:http://www.tug.org/texlive/
334
335Requires: texlive = %{version}
336$RPM_REQUIRES
337
338Requires(post):         texlive = %{version}
339Requires(postun):       texlive = %{version}
340BuildRequires:          texlive-sources = %{version}
341
342BuildArch:      noarch
343Buildroot:      %{_tmppath}/%{name}-%{version}-root
344
345Vendor:         ${RPM_VENDOR}
346Distribution:   ${RPM_DISTRIBUTION}
347Packager:       ${RPM_PACKAGER}
348
349%description
350The TeX Live software distribution offers a complete TeX system for a
351variety of Unix, Macintosh, Windows and other platforms. It
352encompasses programs for editing, typesetting, previewing and printing
353of TeX documents in many different languages, and a large collection
354of TeX macros and font libraries.
355
356The distribution includes extensive general documentation about TeX,
357as well as the documentation for the included software packages.
358
[1499]359This package is a collection of ${PKG_SHORTDESC}:
360${PKG_LONGDESC}
[1476]361
362This package contains the following CTAN packages:
[1499]363${PKG_CTANPKGSLIST}
[1476]364
[1499]365%description -l ja
366TeX Live ソフトウェアディストリビューションは、
367さまざまな Unix, Macintosh, Windows、および
368他のプラットホームに対して完全な TeX システムを提供します。
369多くの異なった言語を含む TeX ドキュメントの
370編集、組版、閲覧、印刷するためのプログラム、
371そして、TeX マクロやフォントライブラリの大きなコレクションを
372同梱しています。
373
374このディストリビューションは
375同梱しているソフトウェアパッケージのためのドキュメントばかりでなく、
376TeX に関するたくさんの一般的なドキュメントを含んでいます。
377
378このパッケージは以下のようなパッケージ集です。
379${PKG_SHORTDESC}:
380${PKG_LONGDESC}
381
382このパッケージは以下の CTAN パッケージを含んでいます:
383${PKG_CTANPKGSLIST}
384
[1476]385EOF
386
387## subpackage: %{name}-doc
388if [ $with_docpkg -eq 1 ]; then
389    cat<<EOF
390%package doc
391Summary: TeX Live: Documentation files of %{name}
392Group: Applications/Publishing
393Requires: %{name} = %{version}-%{release}
394
395%description doc
396This package contains documentation files of %{name}.
397
398EOF
399fi
400
401cat<<EOF
402%prep
403
404%build
405
406%install
407[ -n "%{buildroot}" -a "%{buildroot}" != / ] && %__rm -rf %{buildroot}
408
409PREF=%{buildroot}%{tex_destdir}
410
411manifest=(
[1499]412${PKG_MANIFEST}
[1476]413)
414
415%__mkdir_p \${PREF}/texmf-dist
416for i in "\${manifest[@]}"; do
[5075]417    %__install -m \$(stat -c %a %{texlive_src}/\$i) -p -D %{texlive_src}/\$i \${PREF}/\$i
[1476]418done
[3943]419EOF
[1476]420
[5194]421cat<<EOF
422## make symlinks of core script utils
423mk_symlinks=(
424texlive-collection-bibtexextra,/usr/bin/bibexport,/usr/share/texmf-dist/scripts/bibexport/bibexport.sh
425texlive-collection-binextra,/usr/bin/arlatex,/usr/share/texmf-dist/scripts/bundledoc/arlatex
426texlive-collection-binextra,/usr/bin/bundledoc,/usr/share/texmf-dist/scripts/bundledoc/bundledoc
427texlive-collection-binextra,/usr/bin/de-macro,/usr/share/texmf-dist/scripts/de-macro/de-macro
428texlive-collection-binextra,/usr/bin/dviasm,/usr/share/texmf-dist/scripts/dviasm/dviasm.py
429texlive-collection-binextra,/usr/bin/findhyph,/usr/share/texmf-dist/scripts/findhyph/findhyph
430texlive-collection-binextra,/usr/bin/fragmaster,/usr/share/texmf-dist/scripts/fragmaster/fragmaster.pl
431texlive-collection-binextra,/usr/bin/installfont-tl,/usr/share/texmf-dist/scripts/installfont/installfont-tl
432texlive-collection-binextra,/usr/bin/latex2man,/usr/share/texmf-dist/scripts/latex2man/latex2man
433texlive-collection-binextra,/usr/bin/latexdiff,/usr/share/texmf-dist/scripts/latexdiff/latexdiff.pl
434texlive-collection-binextra,/usr/bin/latexdiff-vc,/usr/share/texmf-dist/scripts/latexdiff/latexdiff-vc.pl
435texlive-collection-binextra,/usr/bin/latexmk,/usr/share/texmf-dist/scripts/latexmk/latexmk.pl
436texlive-collection-binextra,/usr/bin/latexrevise,/usr/share/texmf-dist/scripts/latexdiff/latexrevise.pl
437texlive-collection-binextra,/usr/bin/listings-ext.sh,/usr/share/texmf-dist/scripts/listings-ext/listings-ext.sh
438texlive-collection-binextra,/usr/bin/mkjobtexmf,/usr/share/texmf-dist/scripts/mkjobtexmf/mkjobtexmf.pl
439texlive-collection-binextra,/usr/bin/pdf180,/usr/share/texmf-dist/scripts/pdfjam/pdf180
440texlive-collection-binextra,/usr/bin/pdf270,/usr/share/texmf-dist/scripts/pdfjam/pdf270
441texlive-collection-binextra,/usr/bin/pdf90,/usr/share/texmf-dist/scripts/pdfjam/pdf90
442texlive-collection-binextra,/usr/bin/pdfbook,/usr/share/texmf-dist/scripts/pdfjam/pdfbook
443texlive-collection-binextra,/usr/bin/pdfcrop,/usr/share/texmf-dist/scripts/pdfcrop/pdfcrop.pl
444texlive-collection-binextra,/usr/bin/pdfflip,/usr/share/texmf-dist/scripts/pdfjam/pdfflip
445texlive-collection-binextra,/usr/bin/pdfjam,/usr/share/texmf-dist/scripts/pdfjam/pdfjam
446texlive-collection-binextra,/usr/bin/pdfjam-pocketmod,/usr/share/texmf-dist/scripts/pdfjam/pdfjam-pocketmod
447texlive-collection-binextra,/usr/bin/pdfjam-slides3up,/usr/share/texmf-dist/scripts/pdfjam/pdfjam-slides3up
448texlive-collection-binextra,/usr/bin/pdfjam-slides6up,/usr/share/texmf-dist/scripts/pdfjam/pdfjam-slides6up
449texlive-collection-binextra,/usr/bin/pdfjoin,/usr/share/texmf-dist/scripts/pdfjam/pdfjoin
450texlive-collection-binextra,/usr/bin/pdfnup,/usr/share/texmf-dist/scripts/pdfjam/pdfnup
451texlive-collection-binextra,/usr/bin/pdfpun,/usr/share/texmf-dist/scripts/pdfjam/pdfpun
452texlive-collection-binextra,/usr/bin/pkfix,/usr/share/texmf-dist/scripts/pkfix/pkfix.pl
453texlive-collection-binextra,/usr/bin/pkfix-helper,/usr/share/texmf-dist/scripts/pkfix-helper/pkfix-helper
454texlive-collection-binextra,/usr/bin/purifyeps,/usr/share/texmf-dist/scripts/purifyeps/purifyeps
455texlive-collection-binextra,/usr/bin/sty2dtx,/usr/share/texmf-dist/scripts/sty2dtx/sty2dtx.pl
456texlive-collection-binextra,/usr/bin/texcount,/usr/share/texmf-dist/scripts/texcount/texcount.pl
457texlive-collection-binextra,/usr/bin/texdef,/usr/share/texmf-dist/scripts/texdef/texdef.pl
458texlive-collection-binextra,/usr/bin/texdiff,/usr/share/texmf-dist/scripts/texdiff/texdiff
459texlive-collection-binextra,/usr/bin/texdirflatten,/usr/share/texmf-dist/scripts/texdirflatten/texdirflatten
460texlive-collection-binextra,/usr/bin/texloganalyser,/usr/share/texmf-dist/scripts/texloganalyser/texloganalyser
461texlive-collection-fontutils,/usr/bin/afm2afm,/usr/share/texmf-dist/scripts/fontools/afm2afm
462texlive-collection-fontutils,/usr/bin/autoinst,/usr/share/texmf-dist/scripts/fontools/autoinst
463texlive-collection-fontutils,/usr/bin/cmap2enc,/usr/share/texmf-dist/scripts/fontools/cmap2enc
464texlive-collection-fontutils,/usr/bin/epstopdf,/usr/share/texmf-dist/scripts/epstopdf/epstopdf.pl
465texlive-collection-fontutils,/usr/bin/font2afm,/usr/share/texmf-dist/scripts/fontools/font2afm
466texlive-collection-fontutils,/usr/bin/mkt1font,/usr/share/texmf-dist/scripts/accfonts/mkt1font
467texlive-collection-fontutils,/usr/bin/ot2kpx,/usr/share/texmf-dist/scripts/fontools/ot2kpx
468texlive-collection-fontutils,/usr/bin/pfm2kpx,/usr/share/texmf-dist/scripts/fontools/pfm2kpx
469texlive-collection-fontutils,/usr/bin/showglyphs,/usr/share/texmf-dist/scripts/fontools/showglyphs
470texlive-collection-fontutils,/usr/bin/vpl2ovp,/usr/share/texmf-dist/scripts/accfonts/vpl2ovp
471texlive-collection-fontutils,/usr/bin/vpl2vpl,/usr/share/texmf-dist/scripts/accfonts/vpl2vpl
472texlive-collection-htmlxml,/usr/bin/ht,/usr/share/texmf-dist/scripts/tex4ht/ht.sh
473texlive-collection-htmlxml,/usr/bin/htcontext,/usr/share/texmf-dist/scripts/tex4ht/htcontext.sh
474texlive-collection-htmlxml,/usr/bin/htlatex,/usr/share/texmf-dist/scripts/tex4ht/htlatex.sh
475texlive-collection-htmlxml,/usr/bin/htmex,/usr/share/texmf-dist/scripts/tex4ht/htmex.sh
476texlive-collection-htmlxml,/usr/bin/httex,/usr/share/texmf-dist/scripts/tex4ht/httex.sh
477texlive-collection-htmlxml,/usr/bin/httexi,/usr/share/texmf-dist/scripts/tex4ht/httexi.sh
478texlive-collection-htmlxml,/usr/bin/htxelatex,/usr/share/texmf-dist/scripts/tex4ht/htxelatex.sh
479texlive-collection-htmlxml,/usr/bin/htxetex,/usr/share/texmf-dist/scripts/tex4ht/htxetex.sh
480texlive-collection-htmlxml,/usr/bin/mk4ht,/usr/share/texmf-dist/scripts/tex4ht/mk4ht.pl
481texlive-collection-langgreek,/usr/bin/mkgrkindex,/usr/share/texmf-dist/scripts/mkgrkindex/mkgrkindex
482texlive-collection-langindic,/usr/bin/ebong,/usr/share/texmf-dist/scripts/ebong/ebong.py
483texlive-collection-latex,/usr/bin/mptopdf,/usr/share/texmf-dist/scripts/context/perl/mptopdf.pl
484texlive-collection-latex,/usr/bin/pdfatfi,/usr/share/texmf-dist/scripts/oberdiek/pdfatfi.pl
485texlive-collection-latexextra,/usr/bin/authorindex,/usr/share/texmf-dist/scripts/authorindex/authorindex
486texlive-collection-latexextra,/usr/bin/makeglossaries,/usr/share/texmf-dist/scripts/glossaries/makeglossaries
487texlive-collection-latexextra,/usr/bin/pdfannotextractor,/usr/share/texmf-dist/scripts/pax/pdfannotextractor.pl
488texlive-collection-latexextra,/usr/bin/pdfthumb,/usr/share/texmf-dist/scripts/ppower4/pdfthumb.tlu
489texlive-collection-latexextra,/usr/bin/perltex,/usr/share/texmf-dist/scripts/perltex/perltex.pl
490texlive-collection-latexextra,/usr/bin/ppower4,/usr/share/texmf-dist/scripts/ppower4/ppower4.tlu
491texlive-collection-latexextra,/usr/bin/ps4pdf,/usr/share/texmf-dist/scripts/pst-pdf/ps4pdf
492texlive-collection-latexextra,/usr/bin/splitindex,/usr/share/texmf-dist/scripts/splitindex/perl/splitindex.pl
493texlive-collection-latexextra,/usr/bin/svn-multi,/usr/share/texmf-dist/scripts/svn-multi/svn-multi.pl
494texlive-collection-latexextra,/usr/bin/vpe,/usr/share/texmf-dist/scripts/vpe/vpe.pl
495texlive-collection-latexrecommended,/usr/bin/thumbpdf,/usr/share/texmf-dist/scripts/thumbpdf/thumbpdf.pl
496texlive-collection-luatex,/usr/bin/mkluatexfontdb,/usr/share/texmf-dist/scripts/luaotfload/mkluatexfontdb.lua
497texlive-collection-music,/usr/bin/musixflx,/usr/share/texmf-dist/scripts/musixtex/musixflx.lua
498texlive-collection-music,/usr/bin/musixtex,/usr/share/texmf-dist/scripts/musixtex/musixtex.lua
499texlive-collection-pictures,/usr/bin/cachepic,/usr/share/texmf-dist/scripts/cachepic/cachepic.tlu
500texlive-collection-pictures,/usr/bin/epspdf,/usr/share/texmf-dist/scripts/epspdf/epspdf.rb
501texlive-collection-pictures,/usr/bin/epspdftk,/usr/share/texmf-dist/scripts/epspdf/epspdftk.tcl
502texlive-collection-pictures,/usr/bin/fig4latex,/usr/share/texmf-dist/scripts/fig4latex/fig4latex
503texlive-collection-pictures,/usr/bin/mathspic,/usr/share/texmf-dist/scripts/mathspic/mathspic.pl
504texlive-collection-pstricks,/usr/bin/pst2pdf,/usr/share/texmf-dist/scripts/pst2pdf/pst2pdf
505texlive-collection-science,/usr/bin/ulqda,/usr/share/texmf-dist/scripts/ulqda/ulqda.pl
506)
507%__mkdir_p %{buildroot}%{_bindir}
508pushd %{buildroot}%{_bindir}
509    for i in "\${mk_symlinks[@]}"; do
510        tlc=\$(echo \$i | cut -f 1 -d",")
511        lnk=\$(echo \$i | cut -f 2 -d"," | %__sed -e "s|/usr/bin/||")
512        rlnk=\$(echo \$i | cut -f 3 -d"," | %__sed -e "s|/usr/|../|")
[3943]513
[5194]514        [ "%{name}" = "\$tlc" ] || continue
515        [ -f \$rlnk ] || exit 1
516        %__ln_s \$rlnk \$lnk || exit 1
517    done
518popd
519EOF
[3943]520
[5242]521## external dependencies
522if [ ! -z "$LATEXMK_PACKAGE" -a \
523    ! -z "$(tlpdb2rpmspec --depend $pkg | egrep "^latexmk")" ]; then
[3943]524cat<<EOF
[5242]525## use external packages
526%__rm %{buildroot}/usr/bin/latexmk || exit 1
527
528EOF
529fi
530
531cat<<EOF
[1476]532## Files list
533find %{buildroot} -type f -or -type l | \\
534    %__sed -e "s|%{buildroot}||g" > filelist.full
535
536find %{buildroot}%{texmf}-dist -type d | \\
537    %__sed -e "s|^%{buildroot}|%dir |" \\
538           -e "s|\$|/|"             >> filelist.full
539
540EOF
541
542## subpackage: %{name}-doc
543if [ $with_docpkg -eq 1 ]; then
544    cat<<EOF
545## subpackages
546grep "/texmf-dist/doc/" filelist.full > filelist.doc
547cat filelist.doc filelist.full | sort | uniq -u > filelist.tmp
548%__mv -f filelist.tmp filelist.full
549
550EOF
551fi
552
553cat<<EOF
554%clean
555%__rm -rf %{buildroot}
556
557%post
558%{exec_texhash}
[1496]559
560EOF
561
562## Running updmap
563if [ $with_maplist -eq 1 ]; then
564    cat<<EOF
[1498]565[ -f %{texmf}/web2c/updmap.cfg ] || exit 0
566
[2499]567updmap_lock=%{texmf}/updmap.lock
[5075]568$($__echo "$MAPLIST" | while read maptype map; do \
[1496]569    cat<<EOT
[2499]570%{exec_updmap} --listmaps 2>/dev/null | egrep -q "^#! ${maptype} ${map}" && \\
571    echo -n "    " && \\
572    echo -n "Running updmap: enable ${map} ... " && \\
573    %{exec_updmap} --nomkmap --enable ${maptype} ${map} >/dev/null 2>&1 && \\
574    echo "done." && \\
575    touch \${updmap_lock}
[1496]576EOT
577done)
[2499]578
579rpm -q --quiet texlive-common || exit 0
580
581[ -f \${updmap_lock} ] && \\
582    echo -n "    " && \\
[1915]583    echo -n "Running updmap: recreate map files ... " && \\
584    %{exec_updmap} >/dev/null 2>&1 && \\
[2499]585    echo "done." && \\
586    rm -f \${updmap_lock}
[1496]587
588EOF
[1476]589fi
590
[1496]591## Running fmtutil
592if [ $with_inilist -eq 1 ]; then
593    cat<<EOF
[2499]594rpm -q --quiet texlive-common || exit 0
595
[1496]596echo -n "    "
597echo -n "Running fmtutil ... " && %{exec_fmtutil} && echo "done."
598
599EOF
[1476]600fi
601
[1496]602cat<<EOF
[1476]603exit 0
604
605
606%postun
607if [ "\$1" = 0 ]; then
608    %{exec_texhash}
[1496]609
610EOF
611
612## Running updmap
613if [ $with_maplist -eq 1 ]; then
614    cat<<EOF
[1498]615    [ -f %{texmf}/web2c/updmap.cfg ] || exit 0
616
[5075]617$($__echo "$MAPLIST" | while read maptype map; do \
[1496]618    cat<<EOT
[1499]619    %{exec_updmap} --listmaps 2>/dev/null | egrep -q "^${maptype} ${map}" && \\
620        echo -n "    " && \\
621        echo -n "Running updmap: disable ${map} ... " && \\
[1915]622        %{exec_updmap} --nomkmap --disable ${map} >/dev/null 2>&1 && \\
[1496]623        echo "done."
624EOT
625done)
[2499]626    echo -n "    " && \\
627        echo -n "Running updmap: recreate map files ... " && \\
628        %{exec_updmap} >/dev/null 2>&1 && \\
629        echo "done."
[1496]630
631EOF
[1476]632fi
633
[1496]634cat<<EOF
635fi
636
[1476]637exit 0
638
639%files -f filelist.full
[5075]640%defattr(-,root,root,-)
[1476]641
642EOF
643## subpackage: %{name}-doc
644if [ $with_docpkg -eq 1 ]; then
645    cat<<EOF
646%files -f filelist.doc doc
[5075]647%defattr(-,root,root,-)
[1476]648
649EOF
650fi
651
652cat<<EOF
653%changelog
[5242]654* Sat Dec  3 2011 Munehiro Yamamoto <munepi@vinelinux.org> 2011-2
655- generated by $(basename $0) 2011-2: $(basename $0) $($__echo $*)
656- set external dependencies (texlive-collection-binextra,
657  texlive-collection-fontutils)
658
[5075]659* Sun Oct 30 2011 Munehiro Yamamoto <munepi@vinelinux.org> 2011-1
660- generated by $(basename $0) 2011-1: $(basename $0) $($__echo $*)
661
[3943]662* Mon Mar 23 2011 Munehiro Yamamoto <munepi@vinelinux.org> 2009-4
[5075]663- generated by $(basename $0) 2009-4: $(basename $0) $($__echo $*)
[3943]664- make symlinks of core script utils (texlive-collection-binextra,
665  texlive-collection-context, texlive-collection-fontutils,
666  texlive-collection-langgreek, texlive-collection-langindic,
667  texlive-collection-latex, texlive-collection-latexextra,
668  texlive-collection-latexrecommended, texlive-collection-pictures,
669  texlive-collection-pstricks, texlive-collection-science)
[3329]670
671* Fri Jan 14 2011 Munehiro Yamamoto <munepi@vinelinux.org> 2009-3
[5075]672- generated by $(basename $0) 2009-3: $(basename $0) $($__echo $*)
[2499]673- improved %%post
674
675* Fri Oct 01 2010 Munehiro Yamamoto <munepi@vinelinux.org> 2009-2
[5075]676- generated by $(basename $0) 2009-2: $(basename $0) $($__echo $*)
[1968]677- removed arch dependent binaries (texlive-collection-latexextra)
678- fixed perl path
[1915]679- improved updmap process in %%post and %%postun
680
681* Sat Aug 07 2010 Munehiro Yamamoto <munepi@vinelinux.org> 2009-1
[5075]682- generated by $(basename $0) 2009-1: $(basename $0) $($__echo $*)
[1476]683EOF
684
685    return 0
686}
687
[1521]688## mkrpmcollection [--minimal-collections|--standard-collections|--full-collections]
689mkrpmcollection(){
[5075]690    local category=$($__echo $1 | sed -e "s/--\([a-z]*\)-collections/\1/")
[1521]691    local category_pkglist=
692    local i=
693
694    case $category in
695        minimal|standard)
696            category_pkglist=$(grep -e "${category}," $CATEGORYLIST | sed -e "s/${category},//g" | sed -e "s/,$//g")
697            ;;
698        full)
699            category_pkglist=$(Usage | egrep "^collection-")
700            ;;
701        *)
[5075]702            $__echo "E: unknown category: $category"
[1521]703            return 1
704            ;;
705    esac
706
707    for i in ${category_pkglist}; do
708        mkrpmspec $i > texlive-${i}-vl.spec
[1918]709        if [ $? -eq 1 ]; then
[5075]710            $__echo "texlive-${i}-vl.spec: "
[1918]711            cat texlive-${i}-vl.spec
712            rm -f texlive-${i}-vl.spec
713            continue
714        fi
[1521]715        rpmbuild -ba texlive-${i}-vl.spec || return 1
716    done
717
718    return 0
719}
720
[1476]721setup-tlpdb2rpmspec(){
[5075]722    __echo=$(which echo 2>/dev/null)
723    [ ! -f $__echo ] && return 1
724
[5242]725    ## set external dependencies
726    DETEX_PACKAGE=
727    DVIPNG_PACKAGE=
728    LATEXMK_PACKAGE=
729    LCDF_TYPETOOLS_PACKAGE=
730    PSUTILS_PACKAGE=
731    T1UTILS_PACKAGE=
732
[1476]733    ## load your .vtlpkg.conf
734    if [ -f ${HOME}/.vtlpkg.conf ]; then
735        . ${HOME}/.vtlpkg.conf
736    else
[5075]737        $__echo "E: ${HOME}/.vtlpkg.conf: No such file"
[1476]738        return 1
739    fi
740
741    [ -z "$RPM_VENDOR" ] && \
[5075]742        $__echo "E: \$RPM_VENDOR is empty" && return 1
[1476]743    [ -z "$RPM_DISTRIBUTION" ] && \
[5075]744        $__echo "E: \$RPM_DISTRIBUTION is empty" && return 1
[1476]745    [ -z "$RPM_GPG_NAME" ] && \
[5075]746        $__echo "E: \$RPM_GPG_NAME is empty" && return 1
[1476]747    [ -z "$RPM_PACKAGER" ] && \
[5075]748        $__echo "E: \$RPM_PACKAGER is empty" && return 1
[1476]749
750    ## setup configurations
751    VERSION=@@VTLPKG_VERSION@@
752    RELEASE=@@VTLPKG_RELEASE@@
753
754    ## set a tlpdb file for TeX Live, which is a package database file.
755    TLPDB=@@VTLPKG_TLPDB@@
[5075]756    TLPDB_MAXLINE=$(wc -l $TLPDB | awk '{print $1}')
[1476]757
[1521]758    ## category of collection-*
759    CATEGORYLIST=@@VTLPKG_CATEGORYLIST@@
760
[1476]761    ## set some booleans
762    with_option=0
763}
764
765##############################################################################
766
767setup-tlpdb2rpmspec || exit 1
768
769check-parameter $* || exit 1
770
771case $1 in
772    --name|--category|--revision|--depend|--shortdesc|--longdesc|--execute|--catalogue-ctan|--catalogue-date|--catalogue-license|--catalogue-version|--filelist)
773        tlpkg4a $1 $2 || exit 1
774        ;;
[1521]775    --minimal-collections|--standard-collections|--full-collections)
776        mkrpmcollection $1 || exit 1
[1476]777        ;;
778    *)
779        mkrpmspec $1 || exit 1
780        ;;
781esac
782
783exit
784
785### end of file
Note: See TracBrowser for help on using the repository browser.