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

Revision 5198, 25.4 KB checked in by munepi, 13 years ago (diff)

updated tlpdb2rpmspec.sh.in: the option --nostop of updmap is obsolete

  • Property svn:executable set to *
Line 
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
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        lppl|lppl1|lppl1.2|lppl1.3) $__echo "LPPL";;
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";;
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)"
160    local i=
161
162    tlpkg4a --filelist $pkg || return 1
163
164    ## if $pkg is not collection-*, only return the filelist of $pkg
165    $__echo $pkg | egrep -q "^collection-" || return 0
166
167    ##!! we need pure filelist of $pkg; remove collection-*
168    pkgdeps=$($__echo $pkgdeps | sed -e "s,collection-[-A-Za-z0-9]*,,g")
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)"
183    local i=
184
185    tlpkg4a --execute $pkg | grep -e "Map" | sed -e "s,^add,,g"
186
187    ##!! we need pure filelist of $pkg; remove collection-*
188    pkgdeps=$($__echo $pkgdeps | sed -e "s,collection-[-A-Za-z0-9]*,,g")
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
198## tlpkg2inilist [pkgname]
199tlpkg2inilist(){
200    [ $# -eq 1 ] || return 1
201    local pkg=$1
202    local pkgdeps="$(tlpkg4a --depend $pkg)"
203    local i=
204
205    ## search AddFormat, AddHypen
206    tlpkg4a --execute $pkg | grep -e "Add"
207
208    ##!! we need pure filelist of $pkg; remove collection-*
209    pkgdeps=$($__echo $pkgdeps | sed -e "s,collection-[-A-Za-z0-9]*,,g")
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
219## mkrpmspec [pkgname]
220mkrpmspec(){
221    [ $# -eq 1 ] || return 1
222    local pkg=$1
223    local i=
224
225    RPM_SUMMARY="TeX Live: $(tlpkg4a --shortdesc $pkg)"
226
227    ## Requires tag for texlive
228    RPM_REQUIRES=$(for i in $(tlpkg4a --depend $pkg | egrep "^collection-" | egrep -v "^collection-documentation"); do \
229        $__echo "Requires: texlive-$i = %{version}"; \
230        done)
231
232    ## License tag
233    RPM_LICENSE="$(tlpkg2speclicense $pkg),"
234    for i in $(tlpkg4a --depend $pkg | egrep -v "^collection-"); do
235        tmp=$(tlpkg2speclicense $i)
236        $__echo "$RPM_LICENSE" | grep -q "${tmp},"
237        [ $? -eq 1 ] && RPM_LICENSE="${RPM_LICENSE} ${tmp},"
238    done
239    RPM_LICENSE=$($__echo "$RPM_LICENSE" | sed -e "s/,$//" | sed -e "s/^, //")
240    [ -z "$RPM_LICENSE" ] && RPM_LICENSE=distributable
241
242    PKG_SHORTDESC=$(tlpkg4a --shortdesc $pkg)
243    PKG_LONGDESC=$(tlpkg4a --longdesc $pkg)
244
245    PKG_CTANPKGSLIST=$(for i in $(tlpkg4a --depend $pkg); do \
246        if [ -z "$($__echo "$i" | grep "collection-")" ]; then \
247            $__echo -n "$i: "; \
248            tmp=$(tlpkg4a --shortdesc $i); \
249            [ -z "${tmp}" ] && $__echo || $__echo "$tmp"; \
250        fi
251        done)
252
253    PKG_MANIFEST=$(tlpkg2manifest $pkg)
254    [ -z "${PKG_MANIFEST}" ] && \
255        $__echo "W: empty manifest: $pkg" >&2
256
257    ## check to need the subpackage %{name}-doc
258    with_docpkg=0
259    if [ -z "$($__echo $pkg | grep "collection-documentation")" ]; then
260        for i in ${PKG_MANIFEST}; do
261            [ ! -z "$($__echo "$i" | grep texmf-dist/doc/)" ] && \
262                with_docpkg=1 && break
263        done
264    fi
265
266    with_maplist=0
267    MAPLIST="$(tlpkg2maplist $pkg)"
268    [ ! -z "$MAPLIST" ] && with_maplist=1
269    ##$__echo $with_maplist && $__echo "$MAPLIST" && exit
270
271    with_inilist=0
272    INILIST="$(tlpkg2inilist $pkg)"
273    [ ! -z "$INILIST" ] && with_inilist=1
274    ##$__echo $with_inilist && $__echo "$INILIST" && exit
275
276cat<<EOF
277## -*- coding: utf-8-unix -*-
278## NOTE: This spec file is generated by $(basename $0) ${VERSION}-${RELEASE}:
279## $(basename $0) $pkg
280
281%global _use_internal_dependency_generator 0
282%global __find_provides %{nil}
283%global __find_requires %{nil}
284
285%bcond_with firstbuild
286
287%define tex_destdir     %{_datadir}
288%define texmf           %{tex_destdir}/texmf
289%define texlive_src     %{tex_destdir}/texlive-sources
290%define build_tex_destdir       %{buildroot}%{tex_destdir}
291%define build_texmf     %{buildroot}%{texmf}
292
293%define exec_mktexlsr  [ -x %{_bindir}/texconfig-sys ] && PATH=%{_bindir}:\$PATH %{_bindir}/texconfig-sys rehash
294%define exec_texhash  [ -x %{_bindir}/texhash ] && PATH=%{_bindir}:\$PATH %{_bindir}/texhash
295%define exec_updmap   [ -x %{_bindir}/updmap-sys ] && PATH=%{_bindir}:\$PATH %{_bindir}/updmap-sys
296%define exec_fmtutil  [ -x %{_bindir}/fmtutil-sys ] && PATH=%{_bindir}:\$PATH %{_bindir}/fmtutil-sys --all >/dev/null 2>&1
297%define exec_upddeffont    [ -x %{_sbindir}/update-defaultfont ] && %{_sbindir}/update-defaultfont 2> /dev/null
298%define vartexfonts %{_var}/lib/texmf/fonts
299
300Summary: ${RPM_SUMMARY}
301Summary(ja): ${RPM_SUMMARY}
302Name: texlive-$pkg
303Version: ${VERSION}
304Release: ${RELEASE}%{?_dist_release}
305License: ${RPM_LICENSE}
306Group: Applications/Publishing
307URL:http://www.tug.org/texlive/
308
309Requires: texlive = %{version}
310$RPM_REQUIRES
311
312Requires(post):         texlive = %{version}
313Requires(postun):       texlive = %{version}
314BuildRequires:          texlive-sources = %{version}
315
316BuildArch:      noarch
317Buildroot:      %{_tmppath}/%{name}-%{version}-root
318
319Vendor:         ${RPM_VENDOR}
320Distribution:   ${RPM_DISTRIBUTION}
321Packager:       ${RPM_PACKAGER}
322
323%description
324The TeX Live software distribution offers a complete TeX system for a
325variety of Unix, Macintosh, Windows and other platforms. It
326encompasses programs for editing, typesetting, previewing and printing
327of TeX documents in many different languages, and a large collection
328of TeX macros and font libraries.
329
330The distribution includes extensive general documentation about TeX,
331as well as the documentation for the included software packages.
332
333This package is a collection of ${PKG_SHORTDESC}:
334${PKG_LONGDESC}
335
336This package contains the following CTAN packages:
337${PKG_CTANPKGSLIST}
338
339%description -l ja
340TeX Live ソフトウェアディストリビューションは、
341さまざまな Unix, Macintosh, Windows、および
342他のプラットホームに対して完全な TeX システムを提供します。
343多くの異なった言語を含む TeX ドキュメントの
344編集、組版、閲覧、印刷するためのプログラム、
345そして、TeX マクロやフォントライブラリの大きなコレクションを
346同梱しています。
347
348このディストリビューションは
349同梱しているソフトウェアパッケージのためのドキュメントばかりでなく、
350TeX に関するたくさんの一般的なドキュメントを含んでいます。
351
352このパッケージは以下のようなパッケージ集です。
353${PKG_SHORTDESC}:
354${PKG_LONGDESC}
355
356このパッケージは以下の CTAN パッケージを含んでいます:
357${PKG_CTANPKGSLIST}
358
359EOF
360
361## subpackage: %{name}-doc
362if [ $with_docpkg -eq 1 ]; then
363    cat<<EOF
364%package doc
365Summary: TeX Live: Documentation files of %{name}
366Group: Applications/Publishing
367Requires: %{name} = %{version}-%{release}
368
369%description doc
370This package contains documentation files of %{name}.
371
372EOF
373fi
374
375cat<<EOF
376%prep
377
378%build
379
380%install
381[ -n "%{buildroot}" -a "%{buildroot}" != / ] && %__rm -rf %{buildroot}
382
383PREF=%{buildroot}%{tex_destdir}
384
385manifest=(
386${PKG_MANIFEST}
387)
388
389%__mkdir_p \${PREF}/texmf-dist
390for i in "\${manifest[@]}"; do
391    %__install -m \$(stat -c %a %{texlive_src}/\$i) -p -D %{texlive_src}/\$i \${PREF}/\$i
392done
393EOF
394
395cat<<EOF
396## make symlinks of core script utils
397mk_symlinks=(
398texlive-collection-bibtexextra,/usr/bin/bibexport,/usr/share/texmf-dist/scripts/bibexport/bibexport.sh
399texlive-collection-binextra,/usr/bin/arlatex,/usr/share/texmf-dist/scripts/bundledoc/arlatex
400texlive-collection-binextra,/usr/bin/bundledoc,/usr/share/texmf-dist/scripts/bundledoc/bundledoc
401texlive-collection-binextra,/usr/bin/de-macro,/usr/share/texmf-dist/scripts/de-macro/de-macro
402texlive-collection-binextra,/usr/bin/dviasm,/usr/share/texmf-dist/scripts/dviasm/dviasm.py
403texlive-collection-binextra,/usr/bin/findhyph,/usr/share/texmf-dist/scripts/findhyph/findhyph
404texlive-collection-binextra,/usr/bin/fragmaster,/usr/share/texmf-dist/scripts/fragmaster/fragmaster.pl
405texlive-collection-binextra,/usr/bin/installfont-tl,/usr/share/texmf-dist/scripts/installfont/installfont-tl
406texlive-collection-binextra,/usr/bin/latex2man,/usr/share/texmf-dist/scripts/latex2man/latex2man
407texlive-collection-binextra,/usr/bin/latexdiff,/usr/share/texmf-dist/scripts/latexdiff/latexdiff.pl
408texlive-collection-binextra,/usr/bin/latexdiff-vc,/usr/share/texmf-dist/scripts/latexdiff/latexdiff-vc.pl
409texlive-collection-binextra,/usr/bin/latexmk,/usr/share/texmf-dist/scripts/latexmk/latexmk.pl
410texlive-collection-binextra,/usr/bin/latexrevise,/usr/share/texmf-dist/scripts/latexdiff/latexrevise.pl
411texlive-collection-binextra,/usr/bin/listings-ext.sh,/usr/share/texmf-dist/scripts/listings-ext/listings-ext.sh
412texlive-collection-binextra,/usr/bin/mkjobtexmf,/usr/share/texmf-dist/scripts/mkjobtexmf/mkjobtexmf.pl
413texlive-collection-binextra,/usr/bin/pdf180,/usr/share/texmf-dist/scripts/pdfjam/pdf180
414texlive-collection-binextra,/usr/bin/pdf270,/usr/share/texmf-dist/scripts/pdfjam/pdf270
415texlive-collection-binextra,/usr/bin/pdf90,/usr/share/texmf-dist/scripts/pdfjam/pdf90
416texlive-collection-binextra,/usr/bin/pdfbook,/usr/share/texmf-dist/scripts/pdfjam/pdfbook
417texlive-collection-binextra,/usr/bin/pdfcrop,/usr/share/texmf-dist/scripts/pdfcrop/pdfcrop.pl
418texlive-collection-binextra,/usr/bin/pdfflip,/usr/share/texmf-dist/scripts/pdfjam/pdfflip
419texlive-collection-binextra,/usr/bin/pdfjam,/usr/share/texmf-dist/scripts/pdfjam/pdfjam
420texlive-collection-binextra,/usr/bin/pdfjam-pocketmod,/usr/share/texmf-dist/scripts/pdfjam/pdfjam-pocketmod
421texlive-collection-binextra,/usr/bin/pdfjam-slides3up,/usr/share/texmf-dist/scripts/pdfjam/pdfjam-slides3up
422texlive-collection-binextra,/usr/bin/pdfjam-slides6up,/usr/share/texmf-dist/scripts/pdfjam/pdfjam-slides6up
423texlive-collection-binextra,/usr/bin/pdfjoin,/usr/share/texmf-dist/scripts/pdfjam/pdfjoin
424texlive-collection-binextra,/usr/bin/pdfnup,/usr/share/texmf-dist/scripts/pdfjam/pdfnup
425texlive-collection-binextra,/usr/bin/pdfpun,/usr/share/texmf-dist/scripts/pdfjam/pdfpun
426texlive-collection-binextra,/usr/bin/pkfix,/usr/share/texmf-dist/scripts/pkfix/pkfix.pl
427texlive-collection-binextra,/usr/bin/pkfix-helper,/usr/share/texmf-dist/scripts/pkfix-helper/pkfix-helper
428texlive-collection-binextra,/usr/bin/purifyeps,/usr/share/texmf-dist/scripts/purifyeps/purifyeps
429texlive-collection-binextra,/usr/bin/sty2dtx,/usr/share/texmf-dist/scripts/sty2dtx/sty2dtx.pl
430texlive-collection-binextra,/usr/bin/texcount,/usr/share/texmf-dist/scripts/texcount/texcount.pl
431texlive-collection-binextra,/usr/bin/texdef,/usr/share/texmf-dist/scripts/texdef/texdef.pl
432texlive-collection-binextra,/usr/bin/texdiff,/usr/share/texmf-dist/scripts/texdiff/texdiff
433texlive-collection-binextra,/usr/bin/texdirflatten,/usr/share/texmf-dist/scripts/texdirflatten/texdirflatten
434texlive-collection-binextra,/usr/bin/texloganalyser,/usr/share/texmf-dist/scripts/texloganalyser/texloganalyser
435texlive-collection-fontutils,/usr/bin/afm2afm,/usr/share/texmf-dist/scripts/fontools/afm2afm
436texlive-collection-fontutils,/usr/bin/autoinst,/usr/share/texmf-dist/scripts/fontools/autoinst
437texlive-collection-fontutils,/usr/bin/cmap2enc,/usr/share/texmf-dist/scripts/fontools/cmap2enc
438texlive-collection-fontutils,/usr/bin/epstopdf,/usr/share/texmf-dist/scripts/epstopdf/epstopdf.pl
439texlive-collection-fontutils,/usr/bin/font2afm,/usr/share/texmf-dist/scripts/fontools/font2afm
440texlive-collection-fontutils,/usr/bin/mkt1font,/usr/share/texmf-dist/scripts/accfonts/mkt1font
441texlive-collection-fontutils,/usr/bin/ot2kpx,/usr/share/texmf-dist/scripts/fontools/ot2kpx
442texlive-collection-fontutils,/usr/bin/pfm2kpx,/usr/share/texmf-dist/scripts/fontools/pfm2kpx
443texlive-collection-fontutils,/usr/bin/showglyphs,/usr/share/texmf-dist/scripts/fontools/showglyphs
444texlive-collection-fontutils,/usr/bin/vpl2ovp,/usr/share/texmf-dist/scripts/accfonts/vpl2ovp
445texlive-collection-fontutils,/usr/bin/vpl2vpl,/usr/share/texmf-dist/scripts/accfonts/vpl2vpl
446texlive-collection-htmlxml,/usr/bin/ht,/usr/share/texmf-dist/scripts/tex4ht/ht.sh
447texlive-collection-htmlxml,/usr/bin/htcontext,/usr/share/texmf-dist/scripts/tex4ht/htcontext.sh
448texlive-collection-htmlxml,/usr/bin/htlatex,/usr/share/texmf-dist/scripts/tex4ht/htlatex.sh
449texlive-collection-htmlxml,/usr/bin/htmex,/usr/share/texmf-dist/scripts/tex4ht/htmex.sh
450texlive-collection-htmlxml,/usr/bin/httex,/usr/share/texmf-dist/scripts/tex4ht/httex.sh
451texlive-collection-htmlxml,/usr/bin/httexi,/usr/share/texmf-dist/scripts/tex4ht/httexi.sh
452texlive-collection-htmlxml,/usr/bin/htxelatex,/usr/share/texmf-dist/scripts/tex4ht/htxelatex.sh
453texlive-collection-htmlxml,/usr/bin/htxetex,/usr/share/texmf-dist/scripts/tex4ht/htxetex.sh
454texlive-collection-htmlxml,/usr/bin/mk4ht,/usr/share/texmf-dist/scripts/tex4ht/mk4ht.pl
455texlive-collection-langgreek,/usr/bin/mkgrkindex,/usr/share/texmf-dist/scripts/mkgrkindex/mkgrkindex
456texlive-collection-langindic,/usr/bin/ebong,/usr/share/texmf-dist/scripts/ebong/ebong.py
457texlive-collection-latex,/usr/bin/mptopdf,/usr/share/texmf-dist/scripts/context/perl/mptopdf.pl
458texlive-collection-latex,/usr/bin/pdfatfi,/usr/share/texmf-dist/scripts/oberdiek/pdfatfi.pl
459texlive-collection-latexextra,/usr/bin/authorindex,/usr/share/texmf-dist/scripts/authorindex/authorindex
460texlive-collection-latexextra,/usr/bin/makeglossaries,/usr/share/texmf-dist/scripts/glossaries/makeglossaries
461texlive-collection-latexextra,/usr/bin/pdfannotextractor,/usr/share/texmf-dist/scripts/pax/pdfannotextractor.pl
462texlive-collection-latexextra,/usr/bin/pdfthumb,/usr/share/texmf-dist/scripts/ppower4/pdfthumb.tlu
463texlive-collection-latexextra,/usr/bin/perltex,/usr/share/texmf-dist/scripts/perltex/perltex.pl
464texlive-collection-latexextra,/usr/bin/ppower4,/usr/share/texmf-dist/scripts/ppower4/ppower4.tlu
465texlive-collection-latexextra,/usr/bin/ps4pdf,/usr/share/texmf-dist/scripts/pst-pdf/ps4pdf
466texlive-collection-latexextra,/usr/bin/splitindex,/usr/share/texmf-dist/scripts/splitindex/perl/splitindex.pl
467texlive-collection-latexextra,/usr/bin/svn-multi,/usr/share/texmf-dist/scripts/svn-multi/svn-multi.pl
468texlive-collection-latexextra,/usr/bin/vpe,/usr/share/texmf-dist/scripts/vpe/vpe.pl
469texlive-collection-latexrecommended,/usr/bin/thumbpdf,/usr/share/texmf-dist/scripts/thumbpdf/thumbpdf.pl
470texlive-collection-luatex,/usr/bin/mkluatexfontdb,/usr/share/texmf-dist/scripts/luaotfload/mkluatexfontdb.lua
471texlive-collection-music,/usr/bin/musixflx,/usr/share/texmf-dist/scripts/musixtex/musixflx.lua
472texlive-collection-music,/usr/bin/musixtex,/usr/share/texmf-dist/scripts/musixtex/musixtex.lua
473texlive-collection-pictures,/usr/bin/cachepic,/usr/share/texmf-dist/scripts/cachepic/cachepic.tlu
474texlive-collection-pictures,/usr/bin/epspdf,/usr/share/texmf-dist/scripts/epspdf/epspdf.rb
475texlive-collection-pictures,/usr/bin/epspdftk,/usr/share/texmf-dist/scripts/epspdf/epspdftk.tcl
476texlive-collection-pictures,/usr/bin/fig4latex,/usr/share/texmf-dist/scripts/fig4latex/fig4latex
477texlive-collection-pictures,/usr/bin/mathspic,/usr/share/texmf-dist/scripts/mathspic/mathspic.pl
478texlive-collection-pstricks,/usr/bin/pst2pdf,/usr/share/texmf-dist/scripts/pst2pdf/pst2pdf
479texlive-collection-science,/usr/bin/ulqda,/usr/share/texmf-dist/scripts/ulqda/ulqda.pl
480)
481%__mkdir_p %{buildroot}%{_bindir}
482pushd %{buildroot}%{_bindir}
483    for i in "\${mk_symlinks[@]}"; do
484        tlc=\$(echo \$i | cut -f 1 -d",")
485        lnk=\$(echo \$i | cut -f 2 -d"," | %__sed -e "s|/usr/bin/||")
486        rlnk=\$(echo \$i | cut -f 3 -d"," | %__sed -e "s|/usr/|../|")
487
488        [ "%{name}" = "\$tlc" ] || continue
489        [ -f \$rlnk ] || exit 1
490        %__ln_s \$rlnk \$lnk || exit 1
491    done
492popd
493EOF
494
495cat<<EOF
496## Files list
497find %{buildroot} -type f -or -type l | \\
498    %__sed -e "s|%{buildroot}||g" > filelist.full
499
500find %{buildroot}%{texmf}-dist -type d | \\
501    %__sed -e "s|^%{buildroot}|%dir |" \\
502           -e "s|\$|/|"             >> filelist.full
503
504EOF
505
506## subpackage: %{name}-doc
507if [ $with_docpkg -eq 1 ]; then
508    cat<<EOF
509## subpackages
510grep "/texmf-dist/doc/" filelist.full > filelist.doc
511cat filelist.doc filelist.full | sort | uniq -u > filelist.tmp
512%__mv -f filelist.tmp filelist.full
513
514EOF
515fi
516
517cat<<EOF
518%clean
519%__rm -rf %{buildroot}
520
521%post
522%{exec_texhash}
523
524EOF
525
526## Running updmap
527if [ $with_maplist -eq 1 ]; then
528    cat<<EOF
529[ -f %{texmf}/web2c/updmap.cfg ] || exit 0
530
531updmap_lock=%{texmf}/updmap.lock
532$($__echo "$MAPLIST" | while read maptype map; do \
533    cat<<EOT
534%{exec_updmap} --listmaps 2>/dev/null | egrep -q "^#! ${maptype} ${map}" && \\
535    echo -n "    " && \\
536    echo -n "Running updmap: enable ${map} ... " && \\
537    %{exec_updmap} --nomkmap --enable ${maptype} ${map} >/dev/null 2>&1 && \\
538    echo "done." && \\
539    touch \${updmap_lock}
540EOT
541done)
542
543rpm -q --quiet texlive-common || exit 0
544
545[ -f \${updmap_lock} ] && \\
546    echo -n "    " && \\
547    echo -n "Running updmap: recreate map files ... " && \\
548    %{exec_updmap} >/dev/null 2>&1 && \\
549    echo "done." && \\
550    rm -f \${updmap_lock}
551
552EOF
553fi
554
555## Running fmtutil
556if [ $with_inilist -eq 1 ]; then
557    cat<<EOF
558rpm -q --quiet texlive-common || exit 0
559
560echo -n "    "
561echo -n "Running fmtutil ... " && %{exec_fmtutil} && echo "done."
562
563EOF
564fi
565
566cat<<EOF
567exit 0
568
569
570%postun
571if [ "\$1" = 0 ]; then
572    %{exec_texhash}
573
574EOF
575
576## Running updmap
577if [ $with_maplist -eq 1 ]; then
578    cat<<EOF
579    [ -f %{texmf}/web2c/updmap.cfg ] || exit 0
580
581$($__echo "$MAPLIST" | while read maptype map; do \
582    cat<<EOT
583    %{exec_updmap} --listmaps 2>/dev/null | egrep -q "^${maptype} ${map}" && \\
584        echo -n "    " && \\
585        echo -n "Running updmap: disable ${map} ... " && \\
586        %{exec_updmap} --nomkmap --disable ${map} >/dev/null 2>&1 && \\
587        echo "done."
588EOT
589done)
590    echo -n "    " && \\
591        echo -n "Running updmap: recreate map files ... " && \\
592        %{exec_updmap} >/dev/null 2>&1 && \\
593        echo "done."
594
595EOF
596fi
597
598cat<<EOF
599fi
600
601exit 0
602
603%files -f filelist.full
604%defattr(-,root,root,-)
605
606EOF
607## subpackage: %{name}-doc
608if [ $with_docpkg -eq 1 ]; then
609    cat<<EOF
610%files -f filelist.doc doc
611%defattr(-,root,root,-)
612
613EOF
614fi
615
616cat<<EOF
617%changelog
618* Sun Oct 30 2011 Munehiro Yamamoto <munepi@vinelinux.org> 2011-1
619- generated by $(basename $0) 2011-1: $(basename $0) $($__echo $*)
620
621* Mon Mar 23 2011 Munehiro Yamamoto <munepi@vinelinux.org> 2009-4
622- generated by $(basename $0) 2009-4: $(basename $0) $($__echo $*)
623- make symlinks of core script utils (texlive-collection-binextra,
624  texlive-collection-context, texlive-collection-fontutils,
625  texlive-collection-langgreek, texlive-collection-langindic,
626  texlive-collection-latex, texlive-collection-latexextra,
627  texlive-collection-latexrecommended, texlive-collection-pictures,
628  texlive-collection-pstricks, texlive-collection-science)
629
630* Fri Jan 14 2011 Munehiro Yamamoto <munepi@vinelinux.org> 2009-3
631- generated by $(basename $0) 2009-3: $(basename $0) $($__echo $*)
632- improved %%post
633
634* Fri Oct 01 2010 Munehiro Yamamoto <munepi@vinelinux.org> 2009-2
635- generated by $(basename $0) 2009-2: $(basename $0) $($__echo $*)
636- removed arch dependent binaries (texlive-collection-latexextra)
637- fixed perl path
638- improved updmap process in %%post and %%postun
639
640* Sat Aug 07 2010 Munehiro Yamamoto <munepi@vinelinux.org> 2009-1
641- generated by $(basename $0) 2009-1: $(basename $0) $($__echo $*)
642EOF
643
644    return 0
645}
646
647## mkrpmcollection [--minimal-collections|--standard-collections|--full-collections]
648mkrpmcollection(){
649    local category=$($__echo $1 | sed -e "s/--\([a-z]*\)-collections/\1/")
650    local category_pkglist=
651    local i=
652
653    case $category in
654        minimal|standard)
655            category_pkglist=$(grep -e "${category}," $CATEGORYLIST | sed -e "s/${category},//g" | sed -e "s/,$//g")
656            ;;
657        full)
658            category_pkglist=$(Usage | egrep "^collection-")
659            ;;
660        *)
661            $__echo "E: unknown category: $category"
662            return 1
663            ;;
664    esac
665
666    for i in ${category_pkglist}; do
667        mkrpmspec $i > texlive-${i}-vl.spec
668        if [ $? -eq 1 ]; then
669            $__echo "texlive-${i}-vl.spec: "
670            cat texlive-${i}-vl.spec
671            rm -f texlive-${i}-vl.spec
672            continue
673        fi
674        rpmbuild -ba texlive-${i}-vl.spec || return 1
675    done
676
677    return 0
678}
679
680setup-tlpdb2rpmspec(){
681    __echo=$(which echo 2>/dev/null)
682    [ ! -f $__echo ] && return 1
683
684    ## load your .vtlpkg.conf
685    if [ -f ${HOME}/.vtlpkg.conf ]; then
686        . ${HOME}/.vtlpkg.conf
687    else
688        $__echo "E: ${HOME}/.vtlpkg.conf: No such file"
689        return 1
690    fi
691
692    [ -z "$RPM_VENDOR" ] && \
693        $__echo "E: \$RPM_VENDOR is empty" && return 1
694    [ -z "$RPM_DISTRIBUTION" ] && \
695        $__echo "E: \$RPM_DISTRIBUTION is empty" && return 1
696    [ -z "$RPM_GPG_NAME" ] && \
697        $__echo "E: \$RPM_GPG_NAME is empty" && return 1
698    [ -z "$RPM_PACKAGER" ] && \
699        $__echo "E: \$RPM_PACKAGER is empty" && return 1
700
701    ## setup configurations
702    VERSION=@@VTLPKG_VERSION@@
703    RELEASE=@@VTLPKG_RELEASE@@
704
705    ## set a tlpdb file for TeX Live, which is a package database file.
706    TLPDB=@@VTLPKG_TLPDB@@
707    TLPDB_MAXLINE=$(wc -l $TLPDB | awk '{print $1}')
708
709    ## category of collection-*
710    CATEGORYLIST=@@VTLPKG_CATEGORYLIST@@
711
712    ## set some booleans
713    with_option=0
714}
715
716##############################################################################
717
718setup-tlpdb2rpmspec || exit 1
719
720check-parameter $* || exit 1
721
722case $1 in
723    --name|--category|--revision|--depend|--shortdesc|--longdesc|--execute|--catalogue-ctan|--catalogue-date|--catalogue-license|--catalogue-version|--filelist)
724        tlpkg4a $1 $2 || exit 1
725        ;;
726    --minimal-collections|--standard-collections|--full-collections)
727        mkrpmcollection $1 || exit 1
728        ;;
729    *)
730        mkrpmspec $1 || exit 1
731        ;;
732esac
733
734exit
735
736### end of file
Note: See TracBrowser for help on using the repository browser.