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

Revision 7145, 29.0 KB checked in by munepi, 11 years ago (diff)

TeX Live 2012

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