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

Revision 7768, 20.0 KB checked in by munepi, 11 years ago (diff)

added some improvements

  • Property svn:executable set to *
RevLine 
[1476]1#!/bin/bash
2# tlpdb2rpmspec
3#
[7764]4# Copyright 2010-2013 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:
[7764]33$(egrep "^name collection-" $TLPDB | sed -e "s,name ,,g" | grep -v -e "texworks" -e "wintools")
[1476]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                ;;
53            *)
[1784]54                [ -z "$(egrep -n "^name $1$" $TLPDB)" ] && \
[5075]55                    $__echo "E: unknown option or package: $1" && return 1
[1476]56                ;;
57        esac
58        shift
59    done
60
61    return 0
62}
63
64
65## tlpkg4a [--name|--category|--revision|--depend|--shortdesc|--longdesc|--execute|--catalogue-ctan|--catalogue-date|--catalogue-license|--catalogue-version|--filelist] [pkgname]
66tlpkg4a(){
67    [ $# -eq 2 ] || return 1
68    local opt=$1
69    local pkg=$2
[5075]70    local fieldname=$($__echo $opt | sed -e "s,--,,")
[1476]71
72    ## check param
73    case $opt in
74        --name|--category|--revision|--depend|--shortdesc|--longdesc|--execute|--catalogue-ctan|--catalogue-date|--catalogue-license|--catalogue-version|--filelist)
75            ;;
76        *)
[5075]77            $__echo "E: unknown option: $opt"
[1476]78            exit 1
79            ;;
80    esac
81
82    ## get the head line of $pkg record
83    pkg_LINE=$(egrep -n "^name $pkg$" $TLPDB | cut -d":" -f 1)
84
85    ## read tlpdb
[1496]86    is_pkg=0
[2975]87    (
88        [ "$opt" = "--filelist" ] && \
89            tail -n $(( $TLPDB_MAXLINE - $pkg_LINE + 1 )) $TLPDB || \
90            tail -n $(( $TLPDB_MAXLINE - $pkg_LINE + 1 )) $TLPDB | egrep -v -e "^ "
91    ) | \
[1476]92        while read field; do
93            ## find the record of $pkg
[5075]94            $__echo "$field" | egrep -q "^name $pkg" && is_pkg=1
[1496]95            [ $is_pkg -eq 0 ] && continue
[1476]96           
97            ## return the values of its field name
98            if [ "$opt" = "--filelist" ]; then
99            ## NOTE: we only need texmf-dist directories
[5075]100            ##       we replace RELOC with texmf-dist
101                $__echo "$field" | \
[5192]102                    egrep -e "^texmf-dist/" -e "^RELOC/" | \
[5075]103                    sed -e "s,^RELOC,texmf-dist," \
104                        -e "s, details=.*,," -e "s, language=.*,,"
[1476]105            else
[5075]106                $__echo "$field" | \
107                    egrep "^${fieldname} " | \
108                    sed -e "s,${fieldname} ,,"
[1476]109            fi
110           
111            ## end of the record of $pkg
[5075]112            $__echo "$field" | egrep -q "^[[:blank:]]*$" && break
[1476]113        done
114   
115    return 0
116}
117
118## tlpkg2speclicense [pkgname]
119tlpkg2speclicense(){
120    [ $# -eq 1 ] || return 1
121    local pkg=$1
122
123    case $(tlpkg4a --catalogue-license $pkg) in
[5075]124        gpl3) $__echo "GPLv3+";;
125        gpl2) $__echo "GPLv2+";;
126        gpl) $__echo "GPL+";;
[7145]127        lppl1.3) $__echo "LPPL 1.3";;
128        lppl1.2) $__echo "LPPL 1.2";;
129        lppl|lppl1) $__echo "LPPL";;
[5075]130        other-free) $__echo "Freely redistributable without restriction";;
131        pd) $__echo "Public Domain";;
132        noinfo) $__echo "No Info";;
133        lgpl|lgpl2.1) $__echo "LGPLv2+";;
134        gfsl) $__echo "LPPL";;
135        bsd) $__echo "BSD";;
136        knuth) $__echo "Knuth";;
137        unknown) $__echo "Unknown";;
138        gfl) $__echo "LPPL";;
139        artistic2) $__echo "Artistic 2.0";;
140        fdl) $__echo "GFDL";;
141        collection) $__echo "Public Domain";;
142        artistic) $__echo "Artistic";;
143        other-nonfree) $__echo "Other";;
144        other) $__echo "Other";;
145        ofl) $__echo "OFSFLD";;
146        apache2) $__echo "ASL 2.0";;
147        nosource) $__echo "No Source";;
148        nosell) $__echo "No Sell";;
149        nocommercial) $__echo "Non-commercial";;
[1476]150        *) return 1;;
151    esac
152    return 0
153}
154
[7764]155## tlpkg2archivelist [pkgname]
156tlpkg2archivelist(){
157    [ $# -eq 1 ] || return 1
158    local pkg=$1
159    local pkgdeps="$(tlpkg4a --depend $pkg)"
160    local i=
161
162    ## if $pkg is not collection-*, only return the filelist of $pkg
163    $__echo $pkg | egrep -q "^collection-" || return 0
164
165    ##!! we need pure filelist of $pkg; remove collection-*
166    pkgdeps=$($__echo $pkgdeps | sed -e "s,collection-[-A-Za-z0-9]*,,g")
167
168    [ -z "$pkgdeps" ] && return 0
169    for i in $pkgdeps; do
170        ls ${TLNETROOT}/archive/${i}.tar.xz ${TLNETROOT}/archive/${i}.*.tar.xz 2>/dev/null | grep -v -e alpha-linux -e amd64-freebsd -e amd64-kfreebsd -e amd64-netbsd -e armel-linux -e armhf-linux -e i386-cygwin -e i386-freebsd -e i386-kfreebsd -e i386-linux -e i386-netbsd -e i386-solaris -e mips-irix -e mipsel-linux -e powerpc-linux -e sparc-solaris -e universal-darwin -e win32 -e x86_64-darwin -e x86_64-linux -e x86_64-solaris | sed -e "s,.*/,,g"
171    done
172
173    return 0
174}
175
[1476]176## tlpkg2manifest [pkgname]
177tlpkg2manifest(){
178    [ $# -eq 1 ] || return 1
179    local pkg=$1
180    local pkgdeps="$(tlpkg4a --depend $pkg)"
[1521]181    local i=
[1476]182
183    tlpkg4a --filelist $pkg || return 1
184
[1496]185    ## if $pkg is not collection-*, only return the filelist of $pkg
[5075]186    $__echo $pkg | egrep -q "^collection-" || return 0
[1496]187
[1476]188    ##!! we need pure filelist of $pkg; remove collection-*
[5075]189    pkgdeps=$($__echo $pkgdeps | sed -e "s,collection-[-A-Za-z0-9]*,,g")
[1476]190
191    [ -z "$pkgdeps" ] && return 0
192    for i in $pkgdeps; do
193        tlpkg4a --filelist $i || return 1
194    done
195
196    return 0
197}
198
199## tlpkg2maplist [pkgname]
200tlpkg2maplist(){
201    [ $# -eq 1 ] || return 1
202    local pkg=$1
203    local pkgdeps="$(tlpkg4a --depend $pkg)"
[1521]204    local i=
[1476]205
206    tlpkg4a --execute $pkg | grep -e "Map" | sed -e "s,^add,,g"
207
208    ##!! we need pure filelist of $pkg; remove collection-*
[5075]209    pkgdeps=$($__echo $pkgdeps | sed -e "s,collection-[-A-Za-z0-9]*,,g")
[1476]210
211    [ -z "$pkgdeps" ] && return 0
212    for i in $pkgdeps; do
213        tlpkg4a --execute $i | grep -e "Map" | sed -e "s,^add,,g"
214    done
215
216    return 0
217}
218
[1496]219## tlpkg2inilist [pkgname]
220tlpkg2inilist(){
221    [ $# -eq 1 ] || return 1
222    local pkg=$1
223    local pkgdeps="$(tlpkg4a --depend $pkg)"
[1521]224    local i=
[1476]225
[1496]226    ## search AddFormat, AddHypen
227    tlpkg4a --execute $pkg | grep -e "Add"
228
229    ##!! we need pure filelist of $pkg; remove collection-*
[5075]230    pkgdeps=$($__echo $pkgdeps | sed -e "s,collection-[-A-Za-z0-9]*,,g")
[1496]231
232    [ -z "$pkgdeps" ] && return 0
233    for i in $pkgdeps; do
234        tlpkg4a --execute $i | grep -e "Add"
235    done
236
237    return 0
238}
239
[1476]240## mkrpmspec [pkgname]
241mkrpmspec(){
242    [ $# -eq 1 ] || return 1
243    local pkg=$1
[1521]244    local i=
[1476]245
246    RPM_SUMMARY="TeX Live: $(tlpkg4a --shortdesc $pkg)"
247
248    ## Requires tag for texlive
[7764]249    RPM_REQUIRES=$(for i in $(tlpkg4a --depend $pkg | egrep "^collection-"); do \
[5078]250        $__echo "Requires: texlive-$i = %{version}"; \
251        done)
[1476]252
[5242]253    ## Requires tag for external dependencies
[5246]254    [ ! -z "$ASYMPTOTE_PACKAGE" ] && \
[7764]255        [ ! -z "$(tlpdb2rpmspec --depend $pkg | egrep "^asymptote$")" ] && \
[5246]256        RPM_REQUIRES="${RPM_REQUIRES}
257Requires: $ASYMPTOTE_PACKAGE"
[5242]258    [ ! -z "$DETEX_PACKAGE" ] && \
[7764]259        [ ! -z "$(tlpdb2rpmspec --depend $pkg | egrep "^detex$")" ] && \
[5242]260        RPM_REQUIRES="${RPM_REQUIRES}
261Requires: $DETEX_PACKAGE"
262    [ ! -z "$DVIPNG_PACKAGE" ] && \
[7764]263        [ ! -z "$(tlpdb2rpmspec --depend $pkg | egrep "^dvipng$")" ] && \
[5242]264        RPM_REQUIRES="${RPM_REQUIRES}
265Requires: $DVIPNG_PACKAGE"
266    [ ! -z "$LATEXMK_PACKAGE" ] && \
[7764]267        [ ! -z "$(tlpdb2rpmspec --depend $pkg | egrep "^latexmk$")" ] && \
[5242]268        RPM_REQUIRES="${RPM_REQUIRES}
269Requires: $LATEXMK_PACKAGE"
270    [ ! -z "$LCDF_TYPETOOLS_PACKAGE" ] && \
[7764]271        [ ! -z "$(tlpdb2rpmspec --depend $pkg | egrep "^lcdftypetools$")" ] && \
[5242]272        RPM_REQUIRES="${RPM_REQUIRES}
273Requires: $LCDF_TYPETOOLS_PACKAGE"
274    [ ! -z "$PSUTILS_PACKAGE" ] && \
[7764]275        [ ! -z "$(tlpdb2rpmspec --depend $pkg | egrep "^psutils$")" ] && \
[5242]276        RPM_REQUIRES="${RPM_REQUIRES}
277Requires: $PSUTILS_PACKAGE"
278    [ ! -z "$T1UTILS_PACKAGE" ] && \
[7764]279        [ ! -z "$(tlpdb2rpmspec --depend $pkg | egrep "^t1utils$")" ] && \
[5242]280        RPM_REQUIRES="${RPM_REQUIRES}
281Requires: $T1UTILS_PACKAGE"
282
[1476]283    ## License tag
284    RPM_LICENSE="$(tlpkg2speclicense $pkg),"
285    for i in $(tlpkg4a --depend $pkg | egrep -v "^collection-"); do
286        tmp=$(tlpkg2speclicense $i)
[5075]287        $__echo "$RPM_LICENSE" | grep -q "${tmp},"
[1476]288        [ $? -eq 1 ] && RPM_LICENSE="${RPM_LICENSE} ${tmp},"
289    done
[5075]290    RPM_LICENSE=$($__echo "$RPM_LICENSE" | sed -e "s/,$//" | sed -e "s/^, //")
[1476]291    [ -z "$RPM_LICENSE" ] && RPM_LICENSE=distributable
292
[1499]293    PKG_SHORTDESC=$(tlpkg4a --shortdesc $pkg)
294    PKG_LONGDESC=$(tlpkg4a --longdesc $pkg)
295
296    PKG_CTANPKGSLIST=$(for i in $(tlpkg4a --depend $pkg); do \
[5075]297        if [ -z "$($__echo "$i" | grep "collection-")" ]; then \
298            $__echo -n "$i: "; \
[1499]299            tmp=$(tlpkg4a --shortdesc $i); \
[5075]300            [ -z "${tmp}" ] && $__echo || $__echo "$tmp"; \
[1499]301        fi
302        done)
303
[7764]304    PKG_ARCHIVELIST=$(tlpkg2archivelist $pkg)
305    [ -z "${PKG_ARCHIVELIST}" ] && \
306        $__echo "W: empty archive list: $pkg" >&2
[1499]307
[5078]308    ## check to need the subpackage %{name}-doc
[1476]309    with_docpkg=0
[7764]310    for i in ${PKG_ARCHIVELIST}; do
311        [ ! -z "$($__echo "$i" | egrep "\.doc\.")" ] && \
312            with_docpkg=1 && break
313    done
[1476]314
[1496]315    with_maplist=0
316    MAPLIST="$(tlpkg2maplist $pkg)"
317    [ ! -z "$MAPLIST" ] && with_maplist=1
[5075]318    ##$__echo $with_maplist && $__echo "$MAPLIST" && exit
[1496]319
320    with_inilist=0
321    INILIST="$(tlpkg2inilist $pkg)"
322    [ ! -z "$INILIST" ] && with_inilist=1
[5075]323    ##$__echo $with_inilist && $__echo "$INILIST" && exit
[1496]324
[1476]325cat<<EOF
326## -*- coding: utf-8-unix -*-
[1709]327## NOTE: This spec file is generated by $(basename $0) ${VERSION}-${RELEASE}:
328## $(basename $0) $pkg
[1476]329
[5075]330%global _use_internal_dependency_generator 0
331%global __find_provides %{nil}
332%global __find_requires %{nil}
333
[1476]334Summary: ${RPM_SUMMARY}
[1499]335Summary(ja): ${RPM_SUMMARY}
[1476]336Name: texlive-$pkg
337Version: ${VERSION}
[1915]338Release: ${RELEASE}%{?_dist_release}
[1476]339License: ${RPM_LICENSE}
340Group: Applications/Publishing
341URL:http://www.tug.org/texlive/
342
[7764]343$(x=(${PKG_ARCHIVELIST}); for (( i=0; i < ${#x[@]}; ++i )); do echo Source${i}: ${x[$i]}; done)
344
[1476]345Requires: texlive = %{version}
346$RPM_REQUIRES
347
348Requires(post):         texlive = %{version}
349Requires(postun):       texlive = %{version}
350
351BuildArch:      noarch
352Buildroot:      %{_tmppath}/%{name}-%{version}-root
353
354Vendor:         ${RPM_VENDOR}
355Distribution:   ${RPM_DISTRIBUTION}
356Packager:       ${RPM_PACKAGER}
357
358%description
359The TeX Live software distribution offers a complete TeX system for a
360variety of Unix, Macintosh, Windows and other platforms. It
361encompasses programs for editing, typesetting, previewing and printing
362of TeX documents in many different languages, and a large collection
363of TeX macros and font libraries.
364
365The distribution includes extensive general documentation about TeX,
366as well as the documentation for the included software packages.
367
[1499]368This package is a collection of ${PKG_SHORTDESC}:
369${PKG_LONGDESC}
[1476]370
371This package contains the following CTAN packages:
[1499]372${PKG_CTANPKGSLIST}
[1476]373
[1499]374%description -l ja
375TeX Live ソフトウェアディストリビューションは、
376さまざまな Unix, Macintosh, Windows、および
377他のプラットホームに対して完全な TeX システムを提供します。
378多くの異なった言語を含む TeX ドキュメントの
379編集、組版、閲覧、印刷するためのプログラム、
380そして、TeX マクロやフォントライブラリの大きなコレクションを
381同梱しています。
382
383このディストリビューションは
384同梱しているソフトウェアパッケージのためのドキュメントばかりでなく、
385TeX に関するたくさんの一般的なドキュメントを含んでいます。
386
387このパッケージは以下のようなパッケージ集です。
388${PKG_SHORTDESC}:
389${PKG_LONGDESC}
390
391このパッケージは以下の CTAN パッケージを含んでいます:
392${PKG_CTANPKGSLIST}
393
[1476]394EOF
395
396## subpackage: %{name}-doc
397if [ $with_docpkg -eq 1 ]; then
398    cat<<EOF
399%package doc
400Summary: TeX Live: Documentation files of %{name}
401Group: Applications/Publishing
402Requires: %{name} = %{version}-%{release}
403
404%description doc
405This package contains documentation files of %{name}.
406
407EOF
408fi
409
410cat<<EOF
411%prep
[7764]412%setup -c -n %{name}-%{version}
413$(x=(${PKG_ARCHIVELIST}); for (( i=1; i < ${#x[@]}; ++i )); do echo %__tar -xvf %{SOURCE${i}}; done)
[1476]414
415%build
416
417%install
418[ -n "%{buildroot}" -a "%{buildroot}" != / ] && %__rm -rf %{buildroot}
419
[7764]420%__mkdir_p %{buildroot}%{_datadir}
[1476]421
[7764]422## move texmf-dist to /usr/share/texmf-dist
423[ -d texmf-dist ] && %__mv texmf-dist %{buildroot}%{_tl_texmfdist}/ ||:
[1476]424
[7764]425## move texmf to /usr/share/texmf
426[ -d texmf ] && %__mv texmf %{buildroot}%{_tl_texmfmain}/ ||:
[1476]427
[7764]428## move tlpkg to /usr/share/tlpkg
429[ -d tlpkg ] && %__mv tlpkg %{buildroot}%{_datadir}/ ||:
[3943]430
[7764]431## move all non-arch binaries to /usr/bin
432[ -d bin ] && %__mv bin %{buildroot}%{_prefix}/ ||:
[3943]433
[7764]434## move others into /usr/share/texmf-dist
435%__mkdir_p %{buildroot}%{_tl_texmfdist}
436%__cp -a * %{buildroot}%{_tl_texmfdist}/ ||:
437%__rm -rf * ||:
[5242]438
[7764]439
440## remove duplicated files between texlive and texlive-collection-*
441## NOTE: We provides texmf.cnf and updmap{-hdr,}.cfg from texlive
[7768]442## remove unpacked files
[7764]443x=(
444texconfig/tcfmgr
445texconfig/tcfmgr.map
446web2c/fmtutil.cnf
447web2c/mktex.opt
448web2c/mktexdir
449web2c/mktexdir.opt
450web2c/mktexnam
451web2c/mktexnam.opt
452web2c/mktexupd
453web2c/texmf.cnf
454web2c/updmap.cfg
455web2c/updmap-hdr.cfg
456doc/chktex/ChkTeX.pdf
[7768]457install-tl
[7764]458)
459if [ -d %{buildroot}%{_tl_texmfdist} ]; then
460pushd %{buildroot}%{_tl_texmfdist}
461%__rm -f \${x[@]} ||:
462popd
[5242]463fi
464
[7764]465EOF
466
[5242]467cat<<EOF
[1476]468## Files list
469find %{buildroot} -type f -or -type l | \\
470    %__sed -e "s|%{buildroot}||g" > filelist.full
471
[7764]472find %{buildroot}%{_tl_texmfdist} -type d | \\
[1476]473    %__sed -e "s|^%{buildroot}|%dir |" \\
474           -e "s|\$|/|"             >> filelist.full
475
476EOF
477
478## subpackage: %{name}-doc
479if [ $with_docpkg -eq 1 ]; then
480    cat<<EOF
481## subpackages
482grep "/texmf-dist/doc/" filelist.full > filelist.doc
483cat filelist.doc filelist.full | sort | uniq -u > filelist.tmp
484%__mv -f filelist.tmp filelist.full
485
486EOF
487fi
488
489cat<<EOF
490%clean
491%__rm -rf %{buildroot}
492
493%post
[7764]494%_tl_touch_run texhash
495%_tl_touch_run mtxrun
[1496]496
497EOF
498
499## Running updmap
500if [ $with_maplist -eq 1 ]; then
501    cat<<EOF
[7764]502[ -f %{_tl_texmfdist}/web2c/updmap.cfg ] || exit 0
[1498]503
[5075]504$($__echo "$MAPLIST" | while read maptype map; do \
[1496]505    cat<<EOT
[7764]506    %_tl_enable_map ${maptype} ${map}
[1496]507EOT
508done)
[2499]509
[1496]510EOF
[1476]511fi
512
[1496]513## Running fmtutil
514if [ $with_inilist -eq 1 ]; then
515    cat<<EOF
[7764]516%_tl_touch_run fmtutil
[2499]517
[1496]518EOF
[1476]519fi
520
[1496]521cat<<EOF
[1476]522exit 0
523
524
525%postun
526if [ "\$1" = 0 ]; then
[7764]527    %_tl_touch_run texhash
[1496]528
529EOF
530
531## Running updmap
532if [ $with_maplist -eq 1 ]; then
533    cat<<EOF
[7764]534    [ -f %{_tl_texmfdist}/web2c/updmap.cfg ] || exit 0
[1498]535
[5075]536$($__echo "$MAPLIST" | while read maptype map; do \
[1496]537    cat<<EOT
[7764]538    %_tl_disable_map ${map}
[1496]539EOT
540done)
541
542EOF
[1476]543fi
544
[1496]545cat<<EOF
546fi
547
[1476]548exit 0
549
[7145]550%posttrans
[7764]551%{_tl_exec_texhash}
552%{_tl_exec_mtxrun}
553%{_tl_exec_updmap}
554%{_tl_exec_fmtutil}
[7145]555exit 0
556
557
[1476]558%files -f filelist.full
[5075]559%defattr(-,root,root,-)
[1476]560
561EOF
562## subpackage: %{name}-doc
563if [ $with_docpkg -eq 1 ]; then
564    cat<<EOF
565%files -f filelist.doc doc
[5075]566%defattr(-,root,root,-)
[1476]567
568EOF
569fi
570
571cat<<EOF
572%changelog
[7764]573* Fri Aug 23 2013 Munehiro Yamamoto <munepi@vinelinux.org> 2013-1
574- generated by $(basename $0) 2013-1: $(basename $0) $($__echo $*)
575- TLNET 20130823
576
[7146]577* Fri Nov 23 2012 Munehiro Yamamoto <munepi@vinelinux.org> 2012-1
[6698]578- generated by $(basename $0) 2012-1: $(basename $0) $($__echo $*)
579
[5242]580* Sat Dec  3 2011 Munehiro Yamamoto <munepi@vinelinux.org> 2011-2
581- generated by $(basename $0) 2011-2: $(basename $0) $($__echo $*)
582- set external dependencies (texlive-collection-binextra,
583  texlive-collection-fontutils)
584
[5075]585* Sun Oct 30 2011 Munehiro Yamamoto <munepi@vinelinux.org> 2011-1
586- generated by $(basename $0) 2011-1: $(basename $0) $($__echo $*)
587
[7764]588* Wed Mar 23 2011 Munehiro Yamamoto <munepi@vinelinux.org> 2009-4
[5075]589- generated by $(basename $0) 2009-4: $(basename $0) $($__echo $*)
[3943]590- make symlinks of core script utils (texlive-collection-binextra,
591  texlive-collection-context, texlive-collection-fontutils,
592  texlive-collection-langgreek, texlive-collection-langindic,
593  texlive-collection-latex, texlive-collection-latexextra,
594  texlive-collection-latexrecommended, texlive-collection-pictures,
595  texlive-collection-pstricks, texlive-collection-science)
[3329]596
597* Fri Jan 14 2011 Munehiro Yamamoto <munepi@vinelinux.org> 2009-3
[5075]598- generated by $(basename $0) 2009-3: $(basename $0) $($__echo $*)
[2499]599- improved %%post
600
601* Fri Oct 01 2010 Munehiro Yamamoto <munepi@vinelinux.org> 2009-2
[5075]602- generated by $(basename $0) 2009-2: $(basename $0) $($__echo $*)
[1968]603- removed arch dependent binaries (texlive-collection-latexextra)
604- fixed perl path
[1915]605- improved updmap process in %%post and %%postun
606
607* Sat Aug 07 2010 Munehiro Yamamoto <munepi@vinelinux.org> 2009-1
[5075]608- generated by $(basename $0) 2009-1: $(basename $0) $($__echo $*)
[1476]609EOF
610
611    return 0
612}
613
[1521]614## mkrpmcollection [--minimal-collections|--standard-collections|--full-collections]
615mkrpmcollection(){
[5075]616    local category=$($__echo $1 | sed -e "s/--\([a-z]*\)-collections/\1/")
[1521]617    local category_pkglist=
[7764]618    local macro_sourcedir="%_sourcedir ${TLNETROOT}/archive"
[1521]619    local i=
620
621    case $category in
622        minimal|standard)
623            category_pkglist=$(grep -e "${category}," $CATEGORYLIST | sed -e "s/${category},//g" | sed -e "s/,$//g")
624            ;;
625        full)
626            category_pkglist=$(Usage | egrep "^collection-")
627            ;;
628        *)
[5075]629            $__echo "E: unknown category: $category"
[1521]630            return 1
631            ;;
632    esac
633
634    for i in ${category_pkglist}; do
[7764]635        $__echo "making texlive-${i} ..."
636        if [ -f texlive-${i}-${RPM_SPEC_SUFFIX}.spec ]; then
637            rpm -q --specfile --changelog texlive-${i}-${RPM_SPEC_SUFFIX}.spec >/dev/null 2>&1
638            if [ $? -eq 0 ]; then
639                $__echo "W: already exists: texlive-${i}-${RPM_SPEC_SUFFIX}.spec" >&2
640                continue
641            fi
642        fi
643        mkrpmspec $i > texlive-${i}-${RPM_SPEC_SUFFIX}.spec
[1918]644        if [ $? -eq 1 ]; then
[7764]645            $__echo "texlive-${i}-${RPM_SPEC_SUFFIX}.spec: "
646            cat texlive-${i}-${RPM_SPEC_SUFFIX}.spec
647            rm -f texlive-${i}-${RPM_SPEC_SUFFIX}.spec
[1918]648            continue
649        fi
[7764]650        rpmbuild -ba --define="${macro_sourcedir}" texlive-${i}-${RPM_SPEC_SUFFIX}.spec || return 1
[1521]651    done
652
653    return 0
654}
655
[1476]656setup-tlpdb2rpmspec(){
[5075]657    __echo=$(which echo 2>/dev/null)
658    [ ! -f $__echo ] && return 1
659
[5242]660    ## set external dependencies
[5246]661    ASYMPTOTE_PACKAGE=
[5242]662    DETEX_PACKAGE=
663    DVIPNG_PACKAGE=
664    LATEXMK_PACKAGE=
665    LCDF_TYPETOOLS_PACKAGE=
666    PSUTILS_PACKAGE=
667    T1UTILS_PACKAGE=
668
[7764]669    ## set local tlnet
670    TLNETROOT=@@VTLPKG_TLNETROOT@@
671    TLPDB=@@VTLPKG_TLPDB@@
672
[1476]673    ## load your .vtlpkg.conf
674    if [ -f ${HOME}/.vtlpkg.conf ]; then
675        . ${HOME}/.vtlpkg.conf
676    else
[5075]677        $__echo "E: ${HOME}/.vtlpkg.conf: No such file"
[1476]678        return 1
679    fi
680
[7764]681    [ -z "$RPM_SPEC_SUFFIX" ] && \
682        $__echo "E: \$RPM_SPEC_SUFFIX is empty" && return 1
[1476]683    [ -z "$RPM_VENDOR" ] && \
[5075]684        $__echo "E: \$RPM_VENDOR is empty" && return 1
[1476]685    [ -z "$RPM_DISTRIBUTION" ] && \
[5075]686        $__echo "E: \$RPM_DISTRIBUTION is empty" && return 1
[1476]687    [ -z "$RPM_GPG_NAME" ] && \
[5075]688        $__echo "E: \$RPM_GPG_NAME is empty" && return 1
[1476]689    [ -z "$RPM_PACKAGER" ] && \
[5075]690        $__echo "E: \$RPM_PACKAGER is empty" && return 1
[1476]691
692    ## setup configurations
693    VERSION=@@VTLPKG_VERSION@@
694    RELEASE=@@VTLPKG_RELEASE@@
695
[7764]696    ## check texlive.tlpdb
697    [ ! -f $TLPDB ] && \
698        $__echo "E: \$TLPDB: No such file" && return 1
[5075]699    TLPDB_MAXLINE=$(wc -l $TLPDB | awk '{print $1}')
[1476]700
[1521]701    ## category of collection-*
702    CATEGORYLIST=@@VTLPKG_CATEGORYLIST@@
703
[1476]704    ## set some booleans
705    with_option=0
706}
707
708##############################################################################
709
710setup-tlpdb2rpmspec || exit 1
711
712check-parameter $* || exit 1
713
714case $1 in
715    --name|--category|--revision|--depend|--shortdesc|--longdesc|--execute|--catalogue-ctan|--catalogue-date|--catalogue-license|--catalogue-version|--filelist)
716        tlpkg4a $1 $2 || exit 1
717        ;;
[1521]718    --minimal-collections|--standard-collections|--full-collections)
719        mkrpmcollection $1 || exit 1
[1476]720        ;;
721    *)
722        mkrpmspec $1 || exit 1
723        ;;
724esac
725
726exit
727
728### end of file
Note: See TracBrowser for help on using the repository browser.