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

Revision 7146, 28.8 KB checked in by munepi, 11 years ago (diff)

improve %post/%postun

  • Property svn:executable set to *
RevLine 
[1476]1#!/bin/bash
2# tlpdb2rpmspec
3#
[6698]4# Copyright 2010-2012 Munehiro Yamamoto <munepi@vinelinux.org>
[1476]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+";;
[7145]129        lppl1.3) $__echo "LPPL 1.3";;
130        lppl1.2) $__echo "LPPL 1.2";;
131        lppl|lppl1) $__echo "LPPL";;
[5075]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";;
[1476]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)"
[1521]162    local i=
[1476]163
164    tlpkg4a --filelist $pkg || return 1
165
[1496]166    ## if $pkg is not collection-*, only return the filelist of $pkg
[5075]167    $__echo $pkg | egrep -q "^collection-" || return 0
[1496]168
[1476]169    ##!! we need pure filelist of $pkg; remove collection-*
[5075]170    pkgdeps=$($__echo $pkgdeps | sed -e "s,collection-[-A-Za-z0-9]*,,g")
[1476]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)"
[1521]185    local i=
[1476]186
187    tlpkg4a --execute $pkg | grep -e "Map" | sed -e "s,^add,,g"
188
189    ##!! we need pure filelist of $pkg; remove collection-*
[5075]190    pkgdeps=$($__echo $pkgdeps | sed -e "s,collection-[-A-Za-z0-9]*,,g")
[1476]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
[1496]200## tlpkg2inilist [pkgname]
201tlpkg2inilist(){
202    [ $# -eq 1 ] || return 1
203    local pkg=$1
204    local pkgdeps="$(tlpkg4a --depend $pkg)"
[1521]205    local i=
[1476]206
[1496]207    ## search AddFormat, AddHypen
208    tlpkg4a --execute $pkg | grep -e "Add"
209
210    ##!! we need pure filelist of $pkg; remove collection-*
[5075]211    pkgdeps=$($__echo $pkgdeps | sed -e "s,collection-[-A-Za-z0-9]*,,g")
[1496]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
[1476]221## mkrpmspec [pkgname]
222mkrpmspec(){
223    [ $# -eq 1 ] || return 1
224    local pkg=$1
[1521]225    local i=
[1476]226
227    RPM_SUMMARY="TeX Live: $(tlpkg4a --shortdesc $pkg)"
228
229    ## Requires tag for texlive
[5078]230    RPM_REQUIRES=$(for i in $(tlpkg4a --depend $pkg | egrep "^collection-" | egrep -v "^collection-documentation"); do \
231        $__echo "Requires: texlive-$i = %{version}"; \
232        done)
[1476]233
[5242]234    ## Requires tag for external dependencies
[5246]235    [ ! -z "$ASYMPTOTE_PACKAGE" ] && \
236        [ ! -z "$(tlpdb2rpmspec --depend $pkg | egrep "^asymptote")" ] && \
237        RPM_REQUIRES="${RPM_REQUIRES}
238Requires: $ASYMPTOTE_PACKAGE"
[5242]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
[1476]264    ## License tag
265    RPM_LICENSE="$(tlpkg2speclicense $pkg),"
266    for i in $(tlpkg4a --depend $pkg | egrep -v "^collection-"); do
267        tmp=$(tlpkg2speclicense $i)
[5075]268        $__echo "$RPM_LICENSE" | grep -q "${tmp},"
[1476]269        [ $? -eq 1 ] && RPM_LICENSE="${RPM_LICENSE} ${tmp},"
270    done
[5075]271    RPM_LICENSE=$($__echo "$RPM_LICENSE" | sed -e "s/,$//" | sed -e "s/^, //")
[1476]272    [ -z "$RPM_LICENSE" ] && RPM_LICENSE=distributable
273
[1499]274    PKG_SHORTDESC=$(tlpkg4a --shortdesc $pkg)
275    PKG_LONGDESC=$(tlpkg4a --longdesc $pkg)
276
277    PKG_CTANPKGSLIST=$(for i in $(tlpkg4a --depend $pkg); do \
[5075]278        if [ -z "$($__echo "$i" | grep "collection-")" ]; then \
279            $__echo -n "$i: "; \
[1499]280            tmp=$(tlpkg4a --shortdesc $i); \
[5075]281            [ -z "${tmp}" ] && $__echo || $__echo "$tmp"; \
[1499]282        fi
283        done)
284
285    PKG_MANIFEST=$(tlpkg2manifest $pkg)
[1521]286    [ -z "${PKG_MANIFEST}" ] && \
[5080]287        $__echo "W: empty manifest: $pkg" >&2
[1499]288
[5078]289    ## check to need the subpackage %{name}-doc
[1476]290    with_docpkg=0
[5078]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
[1476]297
[1496]298    with_maplist=0
299    MAPLIST="$(tlpkg2maplist $pkg)"
300    [ ! -z "$MAPLIST" ] && with_maplist=1
[5075]301    ##$__echo $with_maplist && $__echo "$MAPLIST" && exit
[1496]302
303    with_inilist=0
304    INILIST="$(tlpkg2inilist $pkg)"
305    [ ! -z "$INILIST" ] && with_inilist=1
[5075]306    ##$__echo $with_inilist && $__echo "$INILIST" && exit
[1496]307
[1476]308cat<<EOF
309## -*- coding: utf-8-unix -*-
[1709]310## NOTE: This spec file is generated by $(basename $0) ${VERSION}-${RELEASE}:
311## $(basename $0) $pkg
[1476]312
[5075]313%global _use_internal_dependency_generator 0
314%global __find_provides %{nil}
315%global __find_requires %{nil}
316
[7145]317%define aliasttfdir     %{texmfsysvar}/fonts/truetype/vine
318%define texmfsysconfig  %{_sysconfdir}/texmf
319%define texmfsysvar     %{_var}/lib/texmf
320%define vartexfonts     %{texmfsysvar}/fonts
[1476]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
[7145]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;
[1476]354
355Summary: ${RPM_SUMMARY}
[1499]356Summary(ja): ${RPM_SUMMARY}
[1476]357Name: texlive-$pkg
358Version: ${VERSION}
[1915]359Release: ${RELEASE}%{?_dist_release}
[1476]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}
[7145]369#BuildRequires:         texlive-sources = %{version}
[1476]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
[1499]388This package is a collection of ${PKG_SHORTDESC}:
389${PKG_LONGDESC}
[1476]390
391This package contains the following CTAN packages:
[1499]392${PKG_CTANPKGSLIST}
[1476]393
[1499]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
[1476]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=(
[1499]441${PKG_MANIFEST}
[1476]442)
443
444%__mkdir_p \${PREF}/texmf-dist
445for i in "\${manifest[@]}"; do
[5075]446    %__install -m \$(stat -c %a %{texlive_src}/\$i) -p -D %{texlive_src}/\$i \${PREF}/\$i
[1476]447done
[3943]448EOF
[1476]449
[5194]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
[7145]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
[5194]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
[7145]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
[5194]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
[7145]468texlive-collection-binextra,/usr/bin/latexfileversion,/usr/share/texmf-dist/scripts/latexfileversion/latexfileversion
[5194]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
[7145]472texlive-collection-binextra,/usr/bin/match_parens,/usr/share/texmf-dist/scripts/match_parens/match_parens
[5194]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
[7145]495texlive-collection-binextra,/usr/bin/texliveonfly,/usr/share/texmf-dist/scripts/texliveonfly/texliveonfly.py
[5194]496texlive-collection-binextra,/usr/bin/texloganalyser,/usr/share/texmf-dist/scripts/texloganalyser/texloganalyser
[7145]497texlive-collection-binextra,/usr/bin/typeoutfileinfo,/usr/share/texmf-dist/scripts/typeoutfileinfo/typeoutfileinfo.sh
[5194]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
[7145]500texlive-collection-fontutils,/usr/bin/dosepsbin,/usr/share/texmf-dist/scripts/dosepsbin/dosepsbin.pl
[5194]501texlive-collection-fontutils,/usr/bin/epstopdf,/usr/share/texmf-dist/scripts/epstopdf/epstopdf.pl
[7145]502texlive-collection-fontutils,/usr/bin/mf2pt1,/usr/share/texmf-dist/scripts/mf2pt1/mf2pt1.pl
[5194]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
[7145]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
[5194]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
[7145]523texlive-collection-latexextra,/usr/bin/exceltex,/usr/share/texmf-dist/scripts/exceltex/exceltex
[5194]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
[7145]532texlive-collection-luatex,/usr/bin/checkcites,/usr/share/texmf-dist/scripts/checkcites/checkcites.lua
[5194]533texlive-collection-luatex,/usr/bin/mkluatexfontdb,/usr/share/texmf-dist/scripts/luaotfload/mkluatexfontdb.lua
[7145]534texlive-collection-music,/usr/bin/m-tx,/usr/share/texmf-dist/scripts/m-tx/m-tx.lua
[5194]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
[7145]537texlive-collection-music,/usr/bin/pmx2pdf,/usr/share/texmf-dist/scripts/pmx/pmx2pdf.lua
[5194]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
[7145]543texlive-collection-pstricks,/usr/bin/pedigree,/usr/share/texmf-dist/scripts/pedigree-perl/pedigree.pl
[5194]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
[6698]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/|../|")
[3943]553
[5194]554        [ "%{name}" = "\$tlc" ] || continue
555        [ -f \$rlnk ] || exit 1
556        %__ln_s \$rlnk \$lnk || exit 1
557    done
558popd
559EOF
[3943]560
[5242]561## external dependencies
562if [ ! -z "$LATEXMK_PACKAGE" -a \
563    ! -z "$(tlpdb2rpmspec --depend $pkg | egrep "^latexmk")" ]; then
[3943]564cat<<EOF
[5242]565## use external packages
566%__rm %{buildroot}/usr/bin/latexmk || exit 1
567
568EOF
569fi
570
571cat<<EOF
[1476]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
[7145]598%touch_run texhash
599%touch_run mtxrun
[1496]600
601EOF
602
603## Running updmap
604if [ $with_maplist -eq 1 ]; then
605    cat<<EOF
[7145]606[ -f %{texmfsysconfig}/web2c/updmap.cfg ] || exit 0
[1498]607
[5075]608$($__echo "$MAPLIST" | while read maptype map; do \
[1496]609    cat<<EOT
[7146]610%{_bindir}/updmap-sys --nomkmap --nohash --quiet --enable ${maptype} ${map} >/dev/null 2>&1 && %touch_run updmap
[1496]611EOT
612done)
[2499]613
[1496]614EOF
[1476]615fi
616
[1496]617## Running fmtutil
618if [ $with_inilist -eq 1 ]; then
619    cat<<EOF
[7145]620%touch_run fmtutil
[2499]621
[1496]622EOF
[1476]623fi
624
[1496]625cat<<EOF
[1476]626exit 0
627
628
629%postun
630if [ "\$1" = 0 ]; then
[7145]631    %touch_run texhash
[1496]632
633EOF
634
635## Running updmap
636if [ $with_maplist -eq 1 ]; then
637    cat<<EOF
[7145]638    [ -f %{texmfsysconfig}/web2c/updmap.cfg ] || exit 0
[1498]639
[5075]640$($__echo "$MAPLIST" | while read maptype map; do \
[1496]641    cat<<EOT
[7146]642    %{_bindir}/updmap-sys --nomkmap --nohash --quiet --disable ${map} >/dev/null 2>&1 && %touch_run updmap
[1496]643EOT
644done)
645
646EOF
[1476]647fi
648
[1496]649cat<<EOF
650fi
651
[1476]652exit 0
653
[7145]654%posttrans
655%{exec_texhash}
656%{exec_mtxrun}
657%{exec_updmap}
658%{exec_fmtutil}
659exit 0
660
661
[1476]662%files -f filelist.full
[5075]663%defattr(-,root,root,-)
[1476]664
665EOF
666## subpackage: %{name}-doc
667if [ $with_docpkg -eq 1 ]; then
668    cat<<EOF
669%files -f filelist.doc doc
[5075]670%defattr(-,root,root,-)
[1476]671
672EOF
673fi
674
675cat<<EOF
676%changelog
[7146]677* Fri Nov 23 2012 Munehiro Yamamoto <munepi@vinelinux.org> 2012-1
[6698]678- generated by $(basename $0) 2012-1: $(basename $0) $($__echo $*)
679
[5242]680* Sat Dec  3 2011 Munehiro Yamamoto <munepi@vinelinux.org> 2011-2
681- generated by $(basename $0) 2011-2: $(basename $0) $($__echo $*)
682- set external dependencies (texlive-collection-binextra,
683  texlive-collection-fontutils)
684
[5075]685* Sun Oct 30 2011 Munehiro Yamamoto <munepi@vinelinux.org> 2011-1
686- generated by $(basename $0) 2011-1: $(basename $0) $($__echo $*)
687
[3943]688* Mon Mar 23 2011 Munehiro Yamamoto <munepi@vinelinux.org> 2009-4
[5075]689- generated by $(basename $0) 2009-4: $(basename $0) $($__echo $*)
[3943]690- make symlinks of core script utils (texlive-collection-binextra,
691  texlive-collection-context, texlive-collection-fontutils,
692  texlive-collection-langgreek, texlive-collection-langindic,
693  texlive-collection-latex, texlive-collection-latexextra,
694  texlive-collection-latexrecommended, texlive-collection-pictures,
695  texlive-collection-pstricks, texlive-collection-science)
[3329]696
697* Fri Jan 14 2011 Munehiro Yamamoto <munepi@vinelinux.org> 2009-3
[5075]698- generated by $(basename $0) 2009-3: $(basename $0) $($__echo $*)
[2499]699- improved %%post
700
701* Fri Oct 01 2010 Munehiro Yamamoto <munepi@vinelinux.org> 2009-2
[5075]702- generated by $(basename $0) 2009-2: $(basename $0) $($__echo $*)
[1968]703- removed arch dependent binaries (texlive-collection-latexextra)
704- fixed perl path
[1915]705- improved updmap process in %%post and %%postun
706
707* Sat Aug 07 2010 Munehiro Yamamoto <munepi@vinelinux.org> 2009-1
[5075]708- generated by $(basename $0) 2009-1: $(basename $0) $($__echo $*)
[1476]709EOF
710
711    return 0
712}
713
[1521]714## mkrpmcollection [--minimal-collections|--standard-collections|--full-collections]
715mkrpmcollection(){
[5075]716    local category=$($__echo $1 | sed -e "s/--\([a-z]*\)-collections/\1/")
[1521]717    local category_pkglist=
718    local i=
719
720    case $category in
721        minimal|standard)
722            category_pkglist=$(grep -e "${category}," $CATEGORYLIST | sed -e "s/${category},//g" | sed -e "s/,$//g")
723            ;;
724        full)
725            category_pkglist=$(Usage | egrep "^collection-")
726            ;;
727        *)
[5075]728            $__echo "E: unknown category: $category"
[1521]729            return 1
730            ;;
731    esac
732
733    for i in ${category_pkglist}; do
734        mkrpmspec $i > texlive-${i}-vl.spec
[1918]735        if [ $? -eq 1 ]; then
[5075]736            $__echo "texlive-${i}-vl.spec: "
[1918]737            cat texlive-${i}-vl.spec
738            rm -f texlive-${i}-vl.spec
739            continue
740        fi
[1521]741        rpmbuild -ba texlive-${i}-vl.spec || return 1
742    done
743
744    return 0
745}
746
[1476]747setup-tlpdb2rpmspec(){
[5075]748    __echo=$(which echo 2>/dev/null)
749    [ ! -f $__echo ] && return 1
750
[5242]751    ## set external dependencies
[5246]752    ASYMPTOTE_PACKAGE=
[5242]753    DETEX_PACKAGE=
754    DVIPNG_PACKAGE=
755    LATEXMK_PACKAGE=
756    LCDF_TYPETOOLS_PACKAGE=
757    PSUTILS_PACKAGE=
758    T1UTILS_PACKAGE=
759
[1476]760    ## load your .vtlpkg.conf
761    if [ -f ${HOME}/.vtlpkg.conf ]; then
762        . ${HOME}/.vtlpkg.conf
763    else
[5075]764        $__echo "E: ${HOME}/.vtlpkg.conf: No such file"
[1476]765        return 1
766    fi
767
768    [ -z "$RPM_VENDOR" ] && \
[5075]769        $__echo "E: \$RPM_VENDOR is empty" && return 1
[1476]770    [ -z "$RPM_DISTRIBUTION" ] && \
[5075]771        $__echo "E: \$RPM_DISTRIBUTION is empty" && return 1
[1476]772    [ -z "$RPM_GPG_NAME" ] && \
[5075]773        $__echo "E: \$RPM_GPG_NAME is empty" && return 1
[1476]774    [ -z "$RPM_PACKAGER" ] && \
[5075]775        $__echo "E: \$RPM_PACKAGER is empty" && return 1
[1476]776
777    ## setup configurations
778    VERSION=@@VTLPKG_VERSION@@
779    RELEASE=@@VTLPKG_RELEASE@@
780
781    ## set a tlpdb file for TeX Live, which is a package database file.
782    TLPDB=@@VTLPKG_TLPDB@@
[5075]783    TLPDB_MAXLINE=$(wc -l $TLPDB | awk '{print $1}')
[1476]784
[1521]785    ## category of collection-*
786    CATEGORYLIST=@@VTLPKG_CATEGORYLIST@@
787
[1476]788    ## set some booleans
789    with_option=0
790}
791
792##############################################################################
793
794setup-tlpdb2rpmspec || exit 1
795
796check-parameter $* || exit 1
797
798case $1 in
799    --name|--category|--revision|--depend|--shortdesc|--longdesc|--execute|--catalogue-ctan|--catalogue-date|--catalogue-license|--catalogue-version|--filelist)
800        tlpkg4a $1 $2 || exit 1
801        ;;
[1521]802    --minimal-collections|--standard-collections|--full-collections)
803        mkrpmcollection $1 || exit 1
[1476]804        ;;
805    *)
806        mkrpmspec $1 || exit 1
807        ;;
808esac
809
810exit
811
812### end of file
Note: See TracBrowser for help on using the repository browser.