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