Zoadian

Untitled

Sep 27th, 2011
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.65 KB | None | 0 0
  1. # Copyright 1999-2011 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. # $Header: $
  4.  
  5. EAPI=3
  6.  
  7. inherit base eutils python systemd
  8.  
  9. if [[ ${PV} == *9999 ]]; then
  10. EHG_REPO_URI="http://bitbucket.org/spoob/pyload/"
  11. inherit mercurial
  12. fi
  13.  
  14. PYTHON_DEPEND="2"
  15. PYTHON_USE_WITH="sqlite"
  16.  
  17. DESCRIPTION=""
  18. HOMEPAGE="http://www.pyload.org"
  19. LICENSE="GPL-3"
  20. SLOT="0"
  21.  
  22. if [[ ${PV} == *9999 ]]; then
  23. KEYWORDS="~amd64 ~x86"
  24. SRC_URI=""
  25. else
  26. KEYWORDS="amd64 x86"
  27. SRC_URI="http://get.pyload.org/static/pyload-src-v${PV}.zip"
  28. fi
  29.  
  30. IUSE="captcha clicknload container curl qt4 ssl systemd"
  31.  
  32. RDEPEND="
  33. dev-python/beautifulsoup
  34. dev-python/beaker
  35. dev-python/feedparser
  36. dev-python/simplejson
  37. captcha? (
  38. dev-python/imaging
  39. app-text/tesseract[linguas_en]
  40. )
  41. clicknload? (
  42. || (
  43. dev-lang/spidermonkey
  44. dev-java/rhino
  45. )
  46. )
  47. container? (
  48. dev-python/pycrypto
  49. )
  50. curl? (
  51. dev-python/pycurl
  52. )
  53. qt4? (
  54. dev-python/PyQt4
  55. )
  56. ssl? (
  57. dev-python/pycrypto
  58. dev-python/pyopenssl
  59. )
  60. "
  61. #clicknload? ( || ( ... ossp-js pyv8 ) )
  62.  
  63. S=${WORKDIR}/${PN}
  64.  
  65. PYLOAD_WORKDIR="/var/lib/pyload" # (/var/lib/ in lack of a better place)
  66.  
  67. pkg_setup() {
  68. python_pkg_setup
  69.  
  70. # enewuser "pyload" -1 -1 "${PYLOAD_WORKDIR}"
  71. }
  72.  
  73. src_unpack() {
  74. if [[ ${PV} == *9999 ]]; then
  75. mercurial_src_unpack
  76. else
  77. default
  78. #base_src_unpack
  79. fi
  80. }
  81.  
  82. src_prepare() {
  83. # fix pidfile
  84. sed -i -e 's:self.pidfile = "pyload.pid":self.pidfile = "/var/run/pyload.pid":' ${S}/pyLoadCore.py
  85.  
  86. # fix workdir
  87. echo "${PYLOAD_WORKDIR}" > ${S}/module/config/configdir
  88.  
  89. # replace some shipped dependencies with the system libraries
  90. rm -r \
  91. ${S}/module/lib/BeautifulSoup.py \
  92. ${S}/module/lib/beaker \
  93. ${S}/module/lib/feedparser.py \
  94. ${S}/module/lib/simplejson
  95.  
  96. find ${S}/module/ -name "*.py" -type f -print0 | xargs -0 \
  97. sed -i \
  98. -e 's:from module.lib.BeautifulSoup:from BeautifulSoup:' \
  99. -e 's:from module.lib \(import feedparser.*\):\1:' \
  100. -e 's:from module.lib.simplejson:from simplejson:' \
  101. #${S}/module/**/*.py # globbing not working -> find
  102.  
  103.  
  104. if ! use qt4; then
  105. rm -r ${S}/module/gui
  106. fi
  107. }
  108. src_configure() {
  109. :
  110. }
  111.  
  112. src_compile() {
  113. :
  114. }
  115.  
  116. src_install() {
  117. insinto "/opt/${PN}"
  118. doins -r ${S}/locale
  119. doins -r ${S}/module
  120. doins -r ${S}/scripts
  121. doins ${S}/pyLoadCore.py
  122. doins ${S}/pyLoadCli.py
  123.  
  124. make_wrapper "pyloadcli" "/opt/${PN}/pyLoadCli.py"
  125.  
  126. if use qt4; then
  127. doins -r ${S}/icons
  128. make_wrapper pyloadgui "/opt/${PN}/pyLoadGui.py"
  129. fi
  130.  
  131. dodir "${PYLOAD_WORKDIR}"
  132. cp "${S}/module/config/default.conf" "${D}/${PYLOAD_WORKDIR}/pyload.conf"
  133. #fix tmpdir
  134. ln -sf "/tmp" "${D}/${PYLOAD_WORKDIR}/tmp"
  135.  
  136. newinitd "${FILESDIR}/pyload" "pyload"
  137.  
  138. if use systemd; then
  139. systemd_dounit "${FILESDIR}/pyload.service"
  140. fi
  141. }
  142.  
  143. pkg_postinst() {
  144. if use ssl && ! test -f "${PYLOAD_WORKDIR}/ssl.key"; then
  145. einfo "If you want to use pyLoad's XML-RPC via SSL have to create a key in pyloads work directory"
  146. echo
  147. einfo "cd ${PYLOAD_WORKDIR}"
  148. einfo "openssl genrsa 1024 > ssl.key"
  149. einfo "openssl req -new -key ssl.key -out ssl.csr"
  150. einfo "openssl req -days 36500 -x509 -key ssl.key -in ssl.csr > ssl.crt"
  151. fi
  152. }
  153.  
Advertisement
Add Comment
Please, Sign In to add comment