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