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 | |
---|
8 | Usage(){ |
---|
9 | cat<<EOF |
---|
10 | Usage: $(basename $0) [option] [pkgname] |
---|
11 | |
---|
12 | This script generates a rpm spec file for CTAN and collection-* packages of TeX Live. |
---|
13 | |
---|
14 | Options: |
---|
15 | --name: return [pkgname] |
---|
16 | --category: return the category of [pkgname] |
---|
17 | --revision: return the revision of [pkgname] |
---|
18 | --depend: return dependencies of [pkgname] |
---|
19 | --shortdesc: return the short description of [pkgname] |
---|
20 | --longdesc: return the description of [pkgname] |
---|
21 | --execute: return post processe of [pkgname] |
---|
22 | --catalogue-ctan: return the locate of [pkgname] |
---|
23 | --catalogue-date: return the last update of [pkgname] |
---|
24 | --catalogue-license: return the license of [pkgname] |
---|
25 | --catalogue-version: return the version of [pkgname] |
---|
26 | --filelist: return the filelist of [pkgname] |
---|
27 | --help: show this help |
---|
28 | |
---|
29 | Supoort collections-* packages: |
---|
30 | $(egrep "^name collection-" $TLPDB | sed -e "s,name ,,g") |
---|
31 | EOF |
---|
32 | } |
---|
33 | |
---|
34 | check-parameter(){ |
---|
35 | [ -z "$*" ] && Usage && return 1 |
---|
36 | |
---|
37 | while [ ! -z "$*" ]; do |
---|
38 | case $1 in |
---|
39 | --name|--category|--revision|--depend|--shortdesc|--longdesc|--execute|--catalogue-ctan|--catalogue-date|--catalogue-license|--catalogue-version|--filelist) |
---|
40 | [ $with_option -eq 1 ] && \ |
---|
41 | echo "E: you only give one option" && return 1 |
---|
42 | with_option=1 |
---|
43 | ;; |
---|
44 | --help) |
---|
45 | Usage |
---|
46 | return 1 |
---|
47 | ;; |
---|
48 | --minimal-collections|--standard-collections|--full-collections) |
---|
49 | [ ! -f /etc/vine-release ] && \ |
---|
50 | echo "E: support Vine Linux only" && return 1 |
---|
51 | ;; |
---|
52 | *) |
---|
53 | [ -z "$(egrep -n "^name $1$" $TLPDB)" ] && \ |
---|
54 | echo "E: unknown option or package: $1" && return 1 |
---|
55 | ;; |
---|
56 | esac |
---|
57 | shift |
---|
58 | done |
---|
59 | |
---|
60 | return 0 |
---|
61 | } |
---|
62 | |
---|
63 | |
---|
64 | ## tlpkg4a [--name|--category|--revision|--depend|--shortdesc|--longdesc|--execute|--catalogue-ctan|--catalogue-date|--catalogue-license|--catalogue-version|--filelist] [pkgname] |
---|
65 | tlpkg4a(){ |
---|
66 | [ $# -eq 2 ] || return 1 |
---|
67 | local opt=$1 |
---|
68 | local pkg=$2 |
---|
69 | local fieldname=$(echo $opt | sed -e "s,--,,") |
---|
70 | |
---|
71 | ## check param |
---|
72 | case $opt in |
---|
73 | --name|--category|--revision|--depend|--shortdesc|--longdesc|--execute|--catalogue-ctan|--catalogue-date|--catalogue-license|--catalogue-version|--filelist) |
---|
74 | ;; |
---|
75 | *) |
---|
76 | echo "E: unknown option: $opt" |
---|
77 | exit 1 |
---|
78 | ;; |
---|
79 | esac |
---|
80 | |
---|
81 | ## get the head line of $pkg record |
---|
82 | pkg_LINE=$(egrep -n "^name $pkg$" $TLPDB | cut -d":" -f 1) |
---|
83 | |
---|
84 | ## read tlpdb |
---|
85 | is_pkg=0 |
---|
86 | tail -n $(( $TLPDB_MAXLINE - $pkg_LINE + 1 )) $TLPDB | \ |
---|
87 | while read field; do |
---|
88 | ## find the record of $pkg |
---|
89 | echo "$field" | egrep -q "^name $pkg" && is_pkg=1 |
---|
90 | [ $is_pkg -eq 0 ] && continue |
---|
91 | |
---|
92 | ## return the values of its field name |
---|
93 | if [ "$opt" = "--filelist" ]; then |
---|
94 | ## NOTE: we only need texmf-dist directories |
---|
95 | echo "$field" | egrep "^texmf-dist" | \ |
---|
96 | sed -e "s, details=.*,," -e "s, language=.*,," |
---|
97 | else |
---|
98 | echo "$field" | egrep "^${fieldname} " | sed -e "s,${fieldname} ,," |
---|
99 | fi |
---|
100 | |
---|
101 | ## end of the record of $pkg |
---|
102 | echo "$field" | egrep -q "^[[:blank:]]*$" && break |
---|
103 | done |
---|
104 | |
---|
105 | return 0 |
---|
106 | } |
---|
107 | |
---|
108 | ## tlpkg2speclicense [pkgname] |
---|
109 | tlpkg2speclicense(){ |
---|
110 | [ $# -eq 1 ] || return 1 |
---|
111 | local pkg=$1 |
---|
112 | |
---|
113 | case $(tlpkg4a --catalogue-license $pkg) in |
---|
114 | gpl3) echo "GPLv3+";; |
---|
115 | gpl2) echo "GPLv2+";; |
---|
116 | gpl) echo "GPL+";; |
---|
117 | lppl|lppl1.2|lppl1.3) echo "LPPL";; |
---|
118 | other-free) echo "Freely redistributable without restriction";; |
---|
119 | pd) echo "Public Domain";; |
---|
120 | noinfo) echo "No Info";; |
---|
121 | lgpl) echo "LGPLv2+";; |
---|
122 | gfsl) echo "LPPL";; |
---|
123 | bsd) echo "BSD";; |
---|
124 | knuth) echo "Knuth";; |
---|
125 | unknown) echo "Unknown";; |
---|
126 | gfl) echo "LPPL";; |
---|
127 | artistic2) echo "Artistic 2.0";; |
---|
128 | fdl) echo "GFDL";; |
---|
129 | collection) echo "Public Domain";; |
---|
130 | artistic) echo "Artistic";; |
---|
131 | other) echo "Other";; |
---|
132 | ofl) echo "OFSFLD";; |
---|
133 | apache2) echo "ASL 2.0";; |
---|
134 | nosource) echo "No Source";; |
---|
135 | nosell) echo "No Sell";; |
---|
136 | nocommercial) echo "Non-commercial";; |
---|
137 | *) return 1;; |
---|
138 | esac |
---|
139 | return 0 |
---|
140 | } |
---|
141 | |
---|
142 | ## tlpkg2manifest [pkgname] |
---|
143 | tlpkg2manifest(){ |
---|
144 | [ $# -eq 1 ] || return 1 |
---|
145 | local pkg=$1 |
---|
146 | local pkgdeps="$(tlpkg4a --depend $pkg)" |
---|
147 | local i= |
---|
148 | |
---|
149 | tlpkg4a --filelist $pkg || return 1 |
---|
150 | |
---|
151 | ## if $pkg is not collection-*, only return the filelist of $pkg |
---|
152 | echo $pkg | egrep -q "^collection-" || return 0 |
---|
153 | |
---|
154 | ##!! we need pure filelist of $pkg; remove collection-* |
---|
155 | pkgdeps=$(echo $pkgdeps | sed -e "s,collection-[-A-Za-z0-9]*,,g") |
---|
156 | |
---|
157 | [ -z "$pkgdeps" ] && return 0 |
---|
158 | for i in $pkgdeps; do |
---|
159 | tlpkg4a --filelist $i || return 1 |
---|
160 | done |
---|
161 | |
---|
162 | return 0 |
---|
163 | } |
---|
164 | |
---|
165 | ## tlpkg2maplist [pkgname] |
---|
166 | tlpkg2maplist(){ |
---|
167 | [ $# -eq 1 ] || return 1 |
---|
168 | local pkg=$1 |
---|
169 | local pkgdeps="$(tlpkg4a --depend $pkg)" |
---|
170 | local i= |
---|
171 | |
---|
172 | tlpkg4a --execute $pkg | grep -e "Map" | sed -e "s,^add,,g" |
---|
173 | |
---|
174 | ##!! we need pure filelist of $pkg; remove collection-* |
---|
175 | pkgdeps=$(echo $pkgdeps | sed -e "s,collection-[-A-Za-z0-9]*,,g") |
---|
176 | |
---|
177 | [ -z "$pkgdeps" ] && return 0 |
---|
178 | for i in $pkgdeps; do |
---|
179 | tlpkg4a --execute $i | grep -e "Map" | sed -e "s,^add,,g" |
---|
180 | done |
---|
181 | |
---|
182 | return 0 |
---|
183 | } |
---|
184 | |
---|
185 | ## tlpkg2inilist [pkgname] |
---|
186 | tlpkg2inilist(){ |
---|
187 | [ $# -eq 1 ] || return 1 |
---|
188 | local pkg=$1 |
---|
189 | local pkgdeps="$(tlpkg4a --depend $pkg)" |
---|
190 | local i= |
---|
191 | |
---|
192 | ## search AddFormat, AddHypen |
---|
193 | tlpkg4a --execute $pkg | grep -e "Add" |
---|
194 | |
---|
195 | ##!! we need pure filelist of $pkg; remove collection-* |
---|
196 | pkgdeps=$(echo $pkgdeps | sed -e "s,collection-[-A-Za-z0-9]*,,g") |
---|
197 | |
---|
198 | [ -z "$pkgdeps" ] && return 0 |
---|
199 | for i in $pkgdeps; do |
---|
200 | tlpkg4a --execute $i | grep -e "Add" |
---|
201 | done |
---|
202 | |
---|
203 | return 0 |
---|
204 | } |
---|
205 | |
---|
206 | ## mkrpmspec [pkgname] |
---|
207 | mkrpmspec(){ |
---|
208 | [ $# -eq 1 ] || return 1 |
---|
209 | local pkg=$1 |
---|
210 | local i= |
---|
211 | |
---|
212 | RPM_SUMMARY="TeX Live: $(tlpkg4a --shortdesc $pkg)" |
---|
213 | |
---|
214 | ## Requires tag for texlive |
---|
215 | RPM_REQUIRES=$(for i in $(tlpkg4a --depend $pkg | egrep "^collection-" | egrep -v "^collection-documentation"); do echo "Requires: texlive-$i = %{version}"; done) |
---|
216 | |
---|
217 | ## License tag |
---|
218 | RPM_LICENSE="$(tlpkg2speclicense $pkg)," |
---|
219 | for i in $(tlpkg4a --depend $pkg | egrep -v "^collection-"); do |
---|
220 | tmp=$(tlpkg2speclicense $i) |
---|
221 | echo "$RPM_LICENSE" | grep -q "${tmp}," |
---|
222 | [ $? -eq 1 ] && RPM_LICENSE="${RPM_LICENSE} ${tmp}," |
---|
223 | done |
---|
224 | RPM_LICENSE=$(echo "$RPM_LICENSE" | sed -e "s/,$//" | sed -e "s/^, //") |
---|
225 | [ -z "$RPM_LICENSE" ] && RPM_LICENSE=distributable |
---|
226 | |
---|
227 | PKG_SHORTDESC=$(tlpkg4a --shortdesc $pkg) |
---|
228 | PKG_LONGDESC=$(tlpkg4a --longdesc $pkg) |
---|
229 | |
---|
230 | PKG_CTANPKGSLIST=$(for i in $(tlpkg4a --depend $pkg); do \ |
---|
231 | if [ -z "$(echo "$i" | grep "collection-")" ]; then \ |
---|
232 | echo -n "$i: "; \ |
---|
233 | tmp=$(tlpkg4a --shortdesc $i); \ |
---|
234 | [ -z "${tmp}" ] && echo || echo "$tmp"; \ |
---|
235 | fi |
---|
236 | done) |
---|
237 | |
---|
238 | PKG_MANIFEST=$(tlpkg2manifest $pkg) |
---|
239 | [ -z "${PKG_MANIFEST}" ] && \ |
---|
240 | echo "W: empty manifest: $pkg" && return 1 |
---|
241 | |
---|
242 | with_docpkg=0 |
---|
243 | [ -z "$(echo $pkg | grep "collection-documentation")" ] && \ |
---|
244 | [ ! -z "$(echo "${PKG_MANIFEST}" | grep texmf-dist/doc/)" ] && \ |
---|
245 | with_docpkg=1 |
---|
246 | |
---|
247 | with_maplist=0 |
---|
248 | MAPLIST="$(tlpkg2maplist $pkg)" |
---|
249 | [ ! -z "$MAPLIST" ] && with_maplist=1 |
---|
250 | ##echo $with_maplist && echo "$MAPLIST" && exit |
---|
251 | |
---|
252 | with_inilist=0 |
---|
253 | INILIST="$(tlpkg2inilist $pkg)" |
---|
254 | [ ! -z "$INILIST" ] && with_inilist=1 |
---|
255 | ##echo $with_inilist && echo "$INILIST" && exit |
---|
256 | |
---|
257 | cat<<EOF |
---|
258 | ## -*- coding: utf-8-unix -*- |
---|
259 | ## NOTE: This spec file is generated by $(basename $0) ${VERSION}-${RELEASE}: |
---|
260 | ## $(basename $0) $pkg |
---|
261 | |
---|
262 | %bcond_with firstbuild |
---|
263 | |
---|
264 | %define tex_destdir %{_datadir} |
---|
265 | %define texmf %{tex_destdir}/texmf |
---|
266 | %define texlive_src %{tex_destdir}/texlive-sources |
---|
267 | %define build_tex_destdir %{buildroot}%{tex_destdir} |
---|
268 | %define build_texmf %{buildroot}%{texmf} |
---|
269 | |
---|
270 | %define exec_mktexlsr [ -x %{_bindir}/texconfig-sys ] && PATH=%{_bindir}:\$PATH %{_bindir}/texconfig-sys rehash |
---|
271 | %define exec_texhash [ -x %{_bindir}/texhash ] && PATH=%{_bindir}:\$PATH %{_bindir}/texhash |
---|
272 | %define exec_updmap [ -x %{_bindir}/updmap-sys ] && PATH=%{_bindir}:\$PATH %{_bindir}/updmap-sys --nostop |
---|
273 | %define exec_fmtutil [ -x %{_bindir}/fmtutil-sys ] && PATH=%{_bindir}:\$PATH %{_bindir}/fmtutil-sys --all >/dev/null 2>&1 |
---|
274 | %define exec_upddeffont [ -x %{_sbindir}/update-defaultfont ] && %{_sbindir}/update-defaultfont 2> /dev/null |
---|
275 | %define vartexfonts %{_var}/lib/texmf |
---|
276 | |
---|
277 | %define __find_provides %{nil} |
---|
278 | %define __find_requires %{nil} |
---|
279 | %define __perl_provides %{nil} |
---|
280 | %define __perl_requires %{nil} |
---|
281 | |
---|
282 | Autoreq: 0 |
---|
283 | |
---|
284 | Summary: ${RPM_SUMMARY} |
---|
285 | Summary(ja): ${RPM_SUMMARY} |
---|
286 | Name: texlive-$pkg |
---|
287 | Version: ${VERSION} |
---|
288 | Release: ${RELEASE}%{?_dist_release} |
---|
289 | License: ${RPM_LICENSE} |
---|
290 | Group: Applications/Publishing |
---|
291 | URL:http://www.tug.org/texlive/ |
---|
292 | |
---|
293 | Requires: texlive = %{version} |
---|
294 | $RPM_REQUIRES |
---|
295 | |
---|
296 | Requires(post): texlive = %{version} |
---|
297 | Requires(postun): texlive = %{version} |
---|
298 | BuildRequires: texlive-sources = %{version} |
---|
299 | |
---|
300 | BuildArch: noarch |
---|
301 | Buildroot: %{_tmppath}/%{name}-%{version}-root |
---|
302 | |
---|
303 | Vendor: ${RPM_VENDOR} |
---|
304 | Distribution: ${RPM_DISTRIBUTION} |
---|
305 | Packager: ${RPM_PACKAGER} |
---|
306 | |
---|
307 | %description |
---|
308 | The TeX Live software distribution offers a complete TeX system for a |
---|
309 | variety of Unix, Macintosh, Windows and other platforms. It |
---|
310 | encompasses programs for editing, typesetting, previewing and printing |
---|
311 | of TeX documents in many different languages, and a large collection |
---|
312 | of TeX macros and font libraries. |
---|
313 | |
---|
314 | The distribution includes extensive general documentation about TeX, |
---|
315 | as well as the documentation for the included software packages. |
---|
316 | |
---|
317 | This package is a collection of ${PKG_SHORTDESC}: |
---|
318 | ${PKG_LONGDESC} |
---|
319 | |
---|
320 | This package contains the following CTAN packages: |
---|
321 | ${PKG_CTANPKGSLIST} |
---|
322 | |
---|
323 | %description -l ja |
---|
324 | TeX Live ソフトウェアディストリビューションは、 |
---|
325 | さまざまな Unix, Macintosh, Windows、および |
---|
326 | 他のプラットホームに対して完全な TeX システムを提供します。 |
---|
327 | 多くの異なった言語を含む TeX ドキュメントの |
---|
328 | 編集、組版、閲覧、印刷するためのプログラム、 |
---|
329 | そして、TeX マクロやフォントライブラリの大きなコレクションを |
---|
330 | 同梱しています。 |
---|
331 | |
---|
332 | このディストリビューションは |
---|
333 | 同梱しているソフトウェアパッケージのためのドキュメントばかりでなく、 |
---|
334 | TeX に関するたくさんの一般的なドキュメントを含んでいます。 |
---|
335 | |
---|
336 | このパッケージは以下のようなパッケージ集です。 |
---|
337 | ${PKG_SHORTDESC}: |
---|
338 | ${PKG_LONGDESC} |
---|
339 | |
---|
340 | このパッケージは以下の CTAN パッケージを含んでいます: |
---|
341 | ${PKG_CTANPKGSLIST} |
---|
342 | |
---|
343 | EOF |
---|
344 | |
---|
345 | ## subpackage: %{name}-doc |
---|
346 | if [ $with_docpkg -eq 1 ]; then |
---|
347 | cat<<EOF |
---|
348 | %package doc |
---|
349 | Summary: TeX Live: Documentation files of %{name} |
---|
350 | Group: Applications/Publishing |
---|
351 | Requires: %{name} = %{version}-%{release} |
---|
352 | |
---|
353 | %description doc |
---|
354 | This package contains documentation files of %{name}. |
---|
355 | |
---|
356 | EOF |
---|
357 | fi |
---|
358 | |
---|
359 | cat<<EOF |
---|
360 | %prep |
---|
361 | |
---|
362 | %build |
---|
363 | |
---|
364 | %install |
---|
365 | [ -n "%{buildroot}" -a "%{buildroot}" != / ] && %__rm -rf %{buildroot} |
---|
366 | |
---|
367 | PREF=%{buildroot}%{tex_destdir} |
---|
368 | |
---|
369 | manifest=( |
---|
370 | ${PKG_MANIFEST} |
---|
371 | ) |
---|
372 | |
---|
373 | %__mkdir_p \${PREF}/texmf-dist |
---|
374 | for i in "\${manifest[@]}"; do |
---|
375 | %__install -D %{texlive_src}/\$i \${PREF}/\$i |
---|
376 | done |
---|
377 | |
---|
378 | ## info |
---|
379 | %__rm -f %{buildroot}%{_infodir}/dir |
---|
380 | %__gzip -9nf %{buildroot}%{_infodir}/*info* ||: |
---|
381 | |
---|
382 | ## man |
---|
383 | ## man t1* files are provided by t1utils |
---|
384 | for i in t1ascii t1asm t1binary t1disasm t1mac t1unmac; do |
---|
385 | %__rm %{buildroot}%{_mandir}/man*/\${i}.* ||: |
---|
386 | done |
---|
387 | |
---|
388 | ## man some files are provided by psutils |
---|
389 | for i in epsffit extractres fixdlsrps fixfmps fixmacps fixpsditps fixpspps fixscribeps fixtpps fixwfwps fixwpps fixwwps getafm includeres psbook psmerge psnup psresize psselect pstops; do |
---|
390 | %__rm %{buildroot}%{_mandir}/man*/\${i}.* ||: |
---|
391 | done |
---|
392 | |
---|
393 | ## fix perl path |
---|
394 | for i in source/metapost/expressg/expressg.dtx \\ |
---|
395 | doc/metapost/expressg/n2mpsprl.prl \\ |
---|
396 | doc/latex/songbook/contrib/crd2sb/crd2sb; do |
---|
397 | [ -f %{build_texmf}-dist/\${i} ] && \\ |
---|
398 | %__sed -i -e "s|^#!/usr/local/bin/perl|#!%{__perl}|" %{build_texmf}-dist/\${i} |
---|
399 | done |
---|
400 | |
---|
401 | ## remove asymptote directries, which provides asymptote package |
---|
402 | find %{buildroot} -regex ".*asymptote.*" | xargs %__rm -rf |
---|
403 | # find %{buildroot} -name "Makefile" | xargs %__rm -f |
---|
404 | |
---|
405 | # ## remove xindy |
---|
406 | # find %{buildroot} -regex ".*xindy.*" | xargs %__rm -rf |
---|
407 | |
---|
408 | # ## remove tex4ht |
---|
409 | # find %{buildroot} -regex ".*tex4ht.*" | xargs %__rm -rf |
---|
410 | |
---|
411 | ## remove arch dependent binaries |
---|
412 | %__rm -f %{build_texmf}-dist/source/latex/splitindex/splitindex-{OpenBSD,Linux}-i386 |
---|
413 | |
---|
414 | ## remove unpackaging files |
---|
415 | find %{buildroot} | %__grep -e "\\.\(la\|a\)\$" | xargs %__rm -f |
---|
416 | find %{buildroot} | %__grep -e "\\.\(diff\|patch\)\$" | xargs %__rm -f |
---|
417 | |
---|
418 | ## Files list |
---|
419 | find %{buildroot} -type f -or -type l | \\ |
---|
420 | %__sed -e "s|%{buildroot}||g" > filelist.full |
---|
421 | |
---|
422 | find %{buildroot}%{texmf}-dist -type d | \\ |
---|
423 | %__sed -e "s|^%{buildroot}|%dir |" \\ |
---|
424 | -e "s|\$|/|" >> filelist.full |
---|
425 | |
---|
426 | EOF |
---|
427 | |
---|
428 | ## subpackage: %{name}-doc |
---|
429 | if [ $with_docpkg -eq 1 ]; then |
---|
430 | cat<<EOF |
---|
431 | ## subpackages |
---|
432 | grep "/texmf-dist/doc/" filelist.full > filelist.doc |
---|
433 | cat filelist.doc filelist.full | sort | uniq -u > filelist.tmp |
---|
434 | %__mv -f filelist.tmp filelist.full |
---|
435 | |
---|
436 | EOF |
---|
437 | fi |
---|
438 | |
---|
439 | cat<<EOF |
---|
440 | %clean |
---|
441 | %__rm -rf %{buildroot} |
---|
442 | |
---|
443 | %post |
---|
444 | %{exec_texhash} |
---|
445 | |
---|
446 | EOF |
---|
447 | |
---|
448 | ## Running updmap |
---|
449 | if [ $with_maplist -eq 1 ]; then |
---|
450 | cat<<EOF |
---|
451 | [ -f %{texmf}/web2c/updmap.cfg ] || exit 0 |
---|
452 | |
---|
453 | $(echo "$MAPLIST" | while read maptype map; do \ |
---|
454 | cat<<EOT |
---|
455 | %{exec_updmap} --listmaps 2>/dev/null | egrep -q "^#! ${maptype} ${map}" && \\ |
---|
456 | echo -n " " && \\ |
---|
457 | echo -n "Running updmap: enable ${map} ... " && \\ |
---|
458 | %{exec_updmap} --nomkmap --enable ${maptype} ${map} >/dev/null 2>&1 && \\ |
---|
459 | echo "done." |
---|
460 | EOT |
---|
461 | done) |
---|
462 | echo -n " " && \\ |
---|
463 | echo -n "Running updmap: recreate map files ... " && \\ |
---|
464 | %{exec_updmap} >/dev/null 2>&1 && \\ |
---|
465 | echo "done." |
---|
466 | |
---|
467 | EOF |
---|
468 | fi |
---|
469 | |
---|
470 | ## Running fmtutil |
---|
471 | if [ $with_inilist -eq 1 ]; then |
---|
472 | cat<<EOF |
---|
473 | echo -n " " |
---|
474 | echo -n "Running fmtutil ... " && %{exec_fmtutil} && echo "done." |
---|
475 | |
---|
476 | EOF |
---|
477 | fi |
---|
478 | |
---|
479 | cat<<EOF |
---|
480 | exit 0 |
---|
481 | |
---|
482 | |
---|
483 | %postun |
---|
484 | if [ "\$1" = 0 ]; then |
---|
485 | %{exec_texhash} |
---|
486 | |
---|
487 | EOF |
---|
488 | |
---|
489 | ## Running updmap |
---|
490 | if [ $with_maplist -eq 1 ]; then |
---|
491 | cat<<EOF |
---|
492 | [ -f %{texmf}/web2c/updmap.cfg ] || exit 0 |
---|
493 | |
---|
494 | $(echo "$MAPLIST" | while read maptype map; do \ |
---|
495 | cat<<EOT |
---|
496 | %{exec_updmap} --listmaps 2>/dev/null | egrep -q "^${maptype} ${map}" && \\ |
---|
497 | echo -n " " && \\ |
---|
498 | echo -n "Running updmap: disable ${map} ... " && \\ |
---|
499 | %{exec_updmap} --nomkmap --disable ${map} >/dev/null 2>&1 && \\ |
---|
500 | echo "done." |
---|
501 | EOT |
---|
502 | done) |
---|
503 | echo -n " " && \\ |
---|
504 | echo -n "Running updmap: recreate map files ... " && \\ |
---|
505 | %{exec_updmap} >/dev/null 2>&1 && \\ |
---|
506 | echo "done." |
---|
507 | |
---|
508 | EOF |
---|
509 | fi |
---|
510 | |
---|
511 | cat<<EOF |
---|
512 | fi |
---|
513 | |
---|
514 | exit 0 |
---|
515 | |
---|
516 | %files -f filelist.full |
---|
517 | %defattr(-,root,root) |
---|
518 | |
---|
519 | EOF |
---|
520 | ## subpackage: %{name}-doc |
---|
521 | if [ $with_docpkg -eq 1 ]; then |
---|
522 | cat<<EOF |
---|
523 | %files -f filelist.doc doc |
---|
524 | %defattr(-,root,root) |
---|
525 | |
---|
526 | EOF |
---|
527 | fi |
---|
528 | |
---|
529 | cat<<EOF |
---|
530 | %changelog |
---|
531 | * $(LANG=C date +%a) $(LANG=C date +%b) $(date +%d) $(date +%Y) ${RPM_GPG_NAME} ${VERSION}-${RELEASE} |
---|
532 | - generated by $(basename $0) ${VERSION}-${RELEASE}: $(basename $0) $(echo $*) |
---|
533 | - removed arch dependent binaries (texlive-collection-latexextra) |
---|
534 | - fixed perl path |
---|
535 | - improved updmap process in %%post and %%postun |
---|
536 | |
---|
537 | * Sat Aug 07 2010 Munehiro Yamamoto <munepi@vinelinux.org> 2009-1 |
---|
538 | - generated by tlpdb2rpmspec 2009-1: tlpdb2rpmspec $(echo $*) |
---|
539 | EOF |
---|
540 | |
---|
541 | return 0 |
---|
542 | } |
---|
543 | |
---|
544 | ## mkrpmcollection [--minimal-collections|--standard-collections|--full-collections] |
---|
545 | mkrpmcollection(){ |
---|
546 | local category=$(echo $1 | sed -e "s/--\([a-z]*\)-collections/\1/") |
---|
547 | local category_pkglist= |
---|
548 | local i= |
---|
549 | |
---|
550 | case $category in |
---|
551 | minimal|standard) |
---|
552 | category_pkglist=$(grep -e "${category}," $CATEGORYLIST | sed -e "s/${category},//g" | sed -e "s/,$//g") |
---|
553 | ;; |
---|
554 | full) |
---|
555 | category_pkglist=$(Usage | egrep "^collection-") |
---|
556 | ;; |
---|
557 | *) |
---|
558 | echo "E: unknown category: $category" |
---|
559 | return 1 |
---|
560 | ;; |
---|
561 | esac |
---|
562 | |
---|
563 | for i in ${category_pkglist}; do |
---|
564 | mkrpmspec $i > texlive-${i}-vl.spec |
---|
565 | if [ $? -eq 1 ]; then |
---|
566 | echo "texlive-${i}-vl.spec: " |
---|
567 | cat texlive-${i}-vl.spec |
---|
568 | rm -f texlive-${i}-vl.spec |
---|
569 | continue |
---|
570 | fi |
---|
571 | rpmbuild -ba texlive-${i}-vl.spec || return 1 |
---|
572 | done |
---|
573 | |
---|
574 | return 0 |
---|
575 | } |
---|
576 | |
---|
577 | setup-tlpdb2rpmspec(){ |
---|
578 | ## load your .vtlpkg.conf |
---|
579 | if [ -f ${HOME}/.vtlpkg.conf ]; then |
---|
580 | . ${HOME}/.vtlpkg.conf |
---|
581 | else |
---|
582 | echo "E: ${HOME}/.vtlpkg.conf: No such file" |
---|
583 | return 1 |
---|
584 | fi |
---|
585 | |
---|
586 | [ -z "$RPM_VENDOR" ] && \ |
---|
587 | echo "E: \$RPM_VENDOR is empty" && exit 1 |
---|
588 | [ -z "$RPM_DISTRIBUTION" ] && \ |
---|
589 | echo "E: \$RPM_DISTRIBUTION is empty" && exit 1 |
---|
590 | [ -z "$RPM_GPG_NAME" ] && \ |
---|
591 | echo "E: \$RPM_GPG_NAME is empty" && exit 1 |
---|
592 | [ -z "$RPM_PACKAGER" ] && \ |
---|
593 | echo "E: \$RPM_PACKAGER is empty" && exit 1 |
---|
594 | |
---|
595 | ## setup configurations |
---|
596 | VERSION=@@VTLPKG_VERSION@@ |
---|
597 | RELEASE=@@VTLPKG_RELEASE@@ |
---|
598 | |
---|
599 | ## set a tlpdb file for TeX Live, which is a package database file. |
---|
600 | TLPDB=@@VTLPKG_TLPDB@@ |
---|
601 | TLPDB_MAXLINE=$(wc -l $TLPDB | cut -d" " -f 1) |
---|
602 | |
---|
603 | ## category of collection-* |
---|
604 | CATEGORYLIST=@@VTLPKG_CATEGORYLIST@@ |
---|
605 | |
---|
606 | ## set some booleans |
---|
607 | with_option=0 |
---|
608 | } |
---|
609 | |
---|
610 | ############################################################################## |
---|
611 | |
---|
612 | setup-tlpdb2rpmspec || exit 1 |
---|
613 | |
---|
614 | check-parameter $* || exit 1 |
---|
615 | |
---|
616 | case $1 in |
---|
617 | --name|--category|--revision|--depend|--shortdesc|--longdesc|--execute|--catalogue-ctan|--catalogue-date|--catalogue-license|--catalogue-version|--filelist) |
---|
618 | tlpkg4a $1 $2 || exit 1 |
---|
619 | ;; |
---|
620 | --minimal-collections|--standard-collections|--full-collections) |
---|
621 | mkrpmcollection $1 || exit 1 |
---|
622 | ;; |
---|
623 | *) |
---|
624 | mkrpmspec $1 || exit 1 |
---|
625 | ;; |
---|
626 | esac |
---|
627 | |
---|
628 | exit |
---|
629 | |
---|
630 | ### end of file |
---|