actions.py 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. #!/usr/bin/python
  2. # -*- coding: utf-8 -*-
  3. #
  4. # Licensed under the GNU General Public License, version 3.
  5. # See the file https://www.gnu.org/licenses/gpl-3.0.txt
  6. from pisi.actionsapi import get
  7. from pisi.actionsapi import pisitools
  8. from pisi.actionsapi import shelltools
  9. WorkDir = "."
  10. revnr = get.srcVERSION().split(".")[1]
  11. def setup():
  12. # Unpack and prepare files
  13. for tar_file in shelltools.ls(get.workDIR()):
  14. if tar_file.endswith("xz"):
  15. shelltools.system("tar Jxfv %s" % tar_file)
  16. def build():
  17. for folder in ["doc", "source"]:
  18. shelltools.unlinkDir(folder)
  19. def install():
  20. # prepare and install installed packs list
  21. pisitools.dodir("/var/lib/texmf/pisilinux/installedpacks")
  22. pisitools.dosed("CONTENTS", "^#", deleteLine=True)
  23. pisitools.insinto("/var/lib/texmf/pisilinux/installedpacks", "CONTENTS", "%s_%s.list" % (get.srcNAME(), revnr))
  24. for i in shelltools.ls("texmf-dist"):
  25. shelltools.copytree("texmf-dist/%s/" % i, "%s/usr/share/texmf-dist/" % get.installDIR())
  26. shelltools.system("find texmf-dist -type f -executable -exec chmod 755 %s/usr/share/{} \;" % get.installDIR())
  27. # for i in shelltools.ls("."):
  28. # if shelltools.isDirectory(i) and not i.startswith("texmf"):
  29. # shelltools.copytree(i, "%s/usr/share/texmf-dist/" % get.installDIR())
  30. for i in ["tlpkg"]:
  31. shelltools.copytree("%s/" % i, "%s/usr/share/" % get.installDIR())
  32. for i in ["bibtex", "dvips", "fonts", "makeindex", "metafont", "metapost", "mft", "scripts", "tex"]:
  33. shelltools.system("find %s -type d -exec install -d -m755 %s/usr/share/texmf-dist/'{}' \;" % (i, get.installDIR()))
  34. shelltools.system("find %s -type f -exec install -m644 '{}' %s/usr/share/texmf-dist/'{}' \;" % (i, get.installDIR()))
  35. # clean config files
  36. pisitools.dosed("tex/generic/config", "DO NOT EDIT", deleteLine=True, filePattern="language\.d..$")
  37. pisitools.dosed("texmf-dist/web2c/updmap.cfg", "^(#!\s*)?(Map|MixedMap)", deleteLine=True)
  38. # pisitools.dosed("%s/usr/share/texmf-dist/fmtutil.cnf" % get.installDIR(), "aleph", deleteLine=True)
  39. # install config files
  40. cfs = ["chktex/chktexrc",
  41. "web2c/mktex.cnf",
  42. "web2c/updmap.cfg",
  43. "web2c/fmtutil.cnf",
  44. "dvips/config/config.ps",
  45. "dvipdfmx/dvipdfmx.cfg",
  46. "tex/generic/config/language.dat",
  47. "tex/generic/config/language.def",
  48. "tex/generic/tex-ini-files/pdftexconfig.tex",
  49. "ttf2pk/ttf2pk.cfg",
  50. "xdvi/XDvi"]
  51. for cf in cfs:
  52. d = "/".join(cf.split("/")[:-1])
  53. p = cf if shelltools.isFile(cf) else "texmf-dist/%s" % cf
  54. pisitools.insinto("/etc/texmf/%s" % d, p)
  55. #pisitools.dosym("/etc/texmf/web2c/texmf.cnf", "/usr/share/texmf-dist/web2c/texmf.cnf")
  56. # fix sandbox violations
  57. #pisitools.dosed("texmf-dist/scripts/texlive/texlinks.sh", '"\$symlinkdir', r'"%s/$symlinkdir' % get.installDIR())
  58. # create symlinks
  59. pisitools.dodir("/usr/bin")
  60. #shelltools.system("texmf-dist/scripts/texlive/texlinks.sh -f %s/usr/share/texmf-dist/web2c/fmtutil.cnf %s/usr/bin" % ((get.installDIR(), ) * 2))
  61. # remove upstream updmap.cfg: it contains too many maps
  62. # pisitools.remove("/usr/share/texmf-dist/updmap.cfg")
  63. # remove unneeded dir
  64. # pisitools.removeDir("/usr/share/texmf-dist/scripts/context/stubs/mswin")
  65. # pisitools.removeDir("/usr/share/texmf-dist/scripts/context/stubs/win64")
  66. # link programs from /usr/share/texmf-dist/scripts
  67. linked_scripts ="""
  68. a2ping/a2ping.pl
  69. accfonts/mkt1font
  70. accfonts/vpl2ovp
  71. accfonts/vpl2vpl
  72. adhocfilelist/adhocfilelist.sh
  73. arara/arara.sh
  74. attachfile2/pdfatfi.pl
  75. bundledoc/arlatex
  76. bundledoc/bundledoc
  77. checkcites/checkcites.lua
  78. checklistings/checklistings.sh
  79. chklref/chklref.pl
  80. chktex/chkweb.sh
  81. chktex/deweb.pl
  82. cjk-gs-integrate/cjk-gs-integrate.pl
  83. clojure-pamphlet/pamphletangler
  84. cluttex/cluttex.lua
  85. context/perl/mptopdf.pl
  86. context/stubs/unix/context
  87. context/stubs/unix/contextjit
  88. context/stubs/unix/luatools
  89. context/stubs/unix/mtxrun
  90. context/stubs/unix/mtxrunjit
  91. context/stubs/unix/texexec
  92. context/stubs/unix/texmfstart
  93. ctan-o-mat/ctan-o-mat.pl
  94. ctanbib/ctanbib
  95. ctanify/ctanify
  96. ctanupload/ctanupload.pl
  97. de-macro/de-macro
  98. dosepsbin/dosepsbin.pl
  99. dtxgen/dtxgen
  100. dviasm/dviasm.py
  101. dviinfox/dviinfox.pl
  102. epstopdf/epstopdf.pl
  103. findhyph/findhyph
  104. fontools/afm2afm
  105. fontools/autoinst
  106. fontools/ot2kpx
  107. fragmaster/fragmaster.pl
  108. installfont/installfont-tl
  109. jfmutil/jfmutil.pl
  110. ketcindy/ketcindy.sh
  111. latex-git-log/latex-git-log
  112. latex-papersize/latex-papersize.py
  113. latex2man/latex2man
  114. latex2nemeth/latex2nemeth
  115. latexdiff/latexdiff-vc.pl
  116. latexdiff/latexdiff.pl
  117. latexdiff/latexrevise.pl
  118. latexfileversion/latexfileversion
  119. latexindent/latexindent.pl
  120. latexmk/latexmk.pl
  121. latexpand/latexpand
  122. ltxfileinfo/ltxfileinfo
  123. ltximg/ltximg.pl
  124. luaotfload/luaotfload-tool.lua
  125. lwarp/lwarpmk.lua
  126. make4ht/make4ht
  127. match_parens/match_parens
  128. mf2pt1/mf2pt1.pl
  129. mkjobtexmf/mkjobtexmf.pl
  130. pdfbook2/pdfbook2
  131. pdfcrop/pdfcrop.pl
  132. pdfjam/pdfjam
  133. pdflatexpicscale/pdflatexpicscale.pl
  134. pdftex-quiet/pdftex-quiet
  135. pdfxup/pdfxup
  136. pfarrei/a5toa4.tlu
  137. pfarrei/pfarrei.tlu
  138. pkfix-helper/pkfix-helper
  139. pkfix/pkfix.pl
  140. ps2eps/ps2eps.pl
  141. purifyeps/purifyeps
  142. pythontex/depythontex.py
  143. pythontex/pythontex.py
  144. simpdftex/simpdftex
  145. srcredact/srcredact.pl
  146. sty2dtx/sty2dtx.pl
  147. tex4ebook/tex4ebook
  148. tex4ht/ht.sh
  149. tex4ht/htcontext.sh
  150. tex4ht/htlatex.sh
  151. tex4ht/htmex.sh
  152. tex4ht/httex.sh
  153. tex4ht/httexi.sh
  154. tex4ht/htxelatex.sh
  155. tex4ht/htxetex.sh
  156. tex4ht/mk4ht.pl
  157. tex4ht/xhlatex.sh
  158. texcount/texcount.pl
  159. texdef/texdef.pl
  160. texdiff/texdiff
  161. texdirflatten/texdirflatten
  162. texdoc/texdoc.tlu
  163. texdoctk/texdoctk.pl
  164. texfot/texfot.pl
  165. texlive-extra/allcm.sh
  166. texlive-extra/allneeded.sh
  167. texlive-extra/dvi2fax.sh
  168. texlive-extra/dvired.sh
  169. texlive-extra/e2pall.pl
  170. texlive-extra/fontinst.sh
  171. texlive-extra/kpsetool.sh
  172. texlive-extra/kpsewhere.sh
  173. texlive-extra/ps2frag.sh
  174. texlive-extra/pslatex.sh
  175. texlive-extra/texconfig-dialog.sh
  176. texlive-extra/texconfig-sys.sh
  177. texlive-extra/texconfig.sh
  178. texlive-extra/texlinks.sh
  179. texlive/fmtutil-sys.sh
  180. texlive/fmtutil-user.sh
  181. texlive/fmtutil.pl
  182. texlive/mktexlsr
  183. texlive/mktexmf
  184. texlive/mktexpk
  185. texlive/mktextfm
  186. texlive/rungs.tlu
  187. texlive/updmap-sys.sh
  188. texlive/updmap-user.sh
  189. texlive/updmap.pl
  190. texliveonfly/texliveonfly.py
  191. texloganalyser/texloganalyser
  192. texplate/texplate.sh
  193. thumbpdf/thumbpdf.pl
  194. typeoutfileinfo/typeoutfileinfo.sh
  195. xindex/xindex.lua
  196. xindy/texindy.pl
  197. xindy/xindy.pl
  198. """
  199. for p in linked_scripts.split():
  200. bn = shelltools.baseName(p).split(".")[0]
  201. if shelltools.isFile("%s/usr/share/texmf-dist/scripts/%s" % (get.installDIR(), p)):
  202. pisitools.dosym("/usr/share/texmf-dist/scripts/%s" % p, "/usr/bin/%s" % bn)
  203. pisitools.dosym("/usr/share/texmf-dist/scripts/listings-ext/listings-ext.sh", "/usr/bin/listings-ext.sh")
  204. # additional symlinks
  205. pisitools.dosym("allcm", "/usr/bin/allec")
  206. pisitools.dosym("cluttex", "/usr/bin/cllualatex")
  207. pisitools.dosym("cluttex", "/usr/bin/clxelatex")
  208. pisitools.dosym("epstopdf", "/usr/bin/repstopdf")
  209. pisitools.dosym("fmtutil", "/usr/bin/mktexfmt")
  210. pisitools.dosym("kpsetool", "/usr/bin/kpsepath")
  211. pisitools.dosym("kpsetool", "/usr/bin/kpsexpand")
  212. pisitools.dosym("luaotfload-tool", "/usr/bin/mkluatexfontdb")
  213. pisitools.dosym("mktexlsr", "/usr/bin/texhash")
  214. pisitools.dosym("pdfcrop", "/usr/bin/rpdfcrop")
  215. pisitools.dosym("texdef", "/usr/bin/latexdef")