Advertisement
kaiw

Houdini 11.1 Ebuild v1

Dec 20th, 2011
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 6.84 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. #Based on Houdini 8.x ebuild by NTmatter (http://code.google.com/p/houdini-ebuild/)
  6. #Updating for H11/HQueue done by Kai Wohlfahrt (kai.scorpio@gmail.com)
  7. EAPI=4
  8.  
  9. PYTHON_DEPEND="hqueue? 2:2.5:2.6"
  10. inherit eutils python # distutils
  11.  
  12. # Short one-line description of this package.
  13. DESCRIPTION="A professional procedural 3D program."
  14.  
  15. # Homepage, not used by Portage directly but handy for developer reference
  16. HOMEPAGE="http://www.sidefx.com"
  17.  
  18. # Point to any required sources; these will be automatically downloaded by
  19. # Portage.
  20. FILE_NAME="${P}-linux_x86_64_gcc4.4"
  21. SRC_URI="http://www.sidefx.com/index.php?option=com_download&Itemid=208&page=license&version=11.1&build=146&platform=linux_x86_64_gcc4.4&format=tar.gz \
  22.             -> ${FILE_NAME}.tar.gz"
  23.  
  24. LICENSE="SESI"
  25. SLOT="0"
  26. KEYWORDS="amd64"
  27. IUSE="-hqueue -keep-hqueue-db +license-server"
  28. RESTRICT="fetch strip test"
  29.  
  30. DEPEND="x11-base/xorg-server
  31.         sys-apps/sed
  32.         app-arch/tar
  33.         hqueue? ( app-arch/unzip
  34.             dev-python/virtualenv )"
  35. RDEPEND=${DEPEND}
  36.  
  37. S=${WORKDIR}/${FILE_NAME}
  38.  
  39. pkg_nofetch(){
  40.     einfo "Please register at ${HOMEPAGE} and download the appropriate files"
  41.     einfo "for your architecture. Place archive at ${DISTDIR}/${A}."
  42. }
  43.  
  44. pkg_setup(){
  45.     if use hqueue && use keep-hqueue-db; then
  46.         die "Maintaining hqueue MYSQL database not supported. Request at kai.scorpio@gmail.com"
  47.     fi
  48.  
  49.     if [ -e "/usr/bin/python2.6" ]; then
  50.         python_set_active_version 2.6
  51.     else
  52.         python_set_active_version 2.5
  53.     fi
  54.     python_pkg_setup
  55.     einfo "Using python version: ${PYTHON_ABI}"
  56. }
  57.  
  58. src_unpack(){
  59.     einfo "Extracting outer houdini package..."
  60.     unpack ${A}
  61.  
  62.     if use hqueue; then
  63.         ebegin "Extracting HQueue setup files"
  64.             tar --no-same-permission --no-same-owner -xzf ${WORKDIR}/${FILE_NAME}/hqueue.tar.gz -C ${WORKDIR} || die
  65.         eend $? || die
  66.     fi
  67.  
  68. }
  69.  
  70. pkg_preinst(){
  71.     if [ -d "${ROOT}${LIC_DIR}" ]; then
  72.         ewarn "${LIC_DIR} already exists. Licenses may be from previous version. Check license administrator for details."
  73.     fi
  74.     einfo "Copying image to live file system..."
  75. }
  76.  
  77. src_install() {
  78.     HFS=/opt/sesi/hfs-${PV}
  79.     HQ_FS=/opt/sesi/hqueue
  80.     SRV_FS=/opt/sesi/license_server
  81.     LIC_DIR=/usr/lib/sesi
  82.  
  83.     ebegin "Extracting houdini files to image directory"
  84.         dodir ${HFS}
  85.         tar --no-same-permission --no-same-owner -xzf ${WORKDIR}/${FILE_NAME}/houdini.tar.gz -C ${D}${HFS}
  86.     eend $? || die
  87.  
  88.     if use license-server; then
  89.         ebegin "Making home for license files"
  90.             dodir ${LIC_DIR}
  91.         eend $? || die
  92.  
  93.         ebegin "Installing sesinetd daemon"
  94.             sed -i "s@/usr/lib/sesi@${SRV_FS}@g" ${D}${HFS}/houdini/sbin/sesinetd.startup
  95.             newinitd ${D}${HFS}/houdini/sbin/sesinetd.startup sesinetd
  96.             dodir ${SRV_FS}
  97.             exeinto ${SRV_FS}
  98.             doexe ${D}${HFS}/houdini/sbin/sesi*
  99.         eend $? || die
  100.     fi
  101.  
  102.     ebegin "Installing helper bin files from template"
  103.         dodir /usr/bin
  104.         for i in mplay gplay hkey houdini hescape vcc; do
  105.             cat ${FILESDIR}/houdini_template.sh \
  106.                 | sed -e 's@REPLACE-ME-WITH-HFS@'"${HFS}"'@g' \
  107.                 | sed -e "s/REPLACE-ME-WITH-PROGRAM/${i}/g" \
  108.                 > ${D}/usr/bin/${i};
  109.             chmod 755 ${D}/usr/bin/${i}
  110.             chown root:root ${D}/usr/bin/${i}
  111.         done
  112.     eend $? || die
  113.  
  114.     ebegin "Installing menu items"
  115.         cd ${S}/desktop
  116.         for i in gplay hescape hkey hmaster mplay; do
  117.             sed -i 's@${HFS}@'"${HFS}"'@g' ${WORKDIR}/${FILE_NAME}/desktop/sesi_${i}.desktop
  118.             sed -i 's@${VER.*BUILD}@'"${PVR}"'@g' ${WORKDIR}/${FILE_NAME}/desktop/sesi_${i}.desktop
  119.         done
  120.         domenu sesi_gplay.desktop sesi_hescape.desktop sesi_hkey.desktop \
  121.         sesi_hmaster.desktop sesi_mplay.desktop
  122.     eend $? || die
  123.  
  124.     if use hqueue; then
  125.         einfo "Installing HQueue"
  126.         dodir ${HQ_FS}
  127.  
  128.         ebegin "Copying scripts"
  129.             exeinto ${HQ_FS}/scripts
  130.             doexe ${WORKDIR}/hqueue/scripts/*
  131.         eend $? || die
  132.  
  133.         ebegin "Creating python virtual environment"
  134.             cd ${WORKDIR}/hqueue/deps/python${PYTHON_ABI}
  135.             unzip -q virtualenv-*.egg
  136.             python virtualenv.py ${D}${HQ_FS}
  137.             virtualenv --python=python${PYTHON_ABI} --relocatable ${D}${HQ_FS} > /dev/null
  138.         eend $? || die
  139.  
  140.         ebegin "Copying setuptools"
  141.             cd ${WORKDIR}/hqueue/deps/python${PYTHON_ABI}
  142.             unzip -oq setuptools-*.egg
  143.         eend $? || die
  144.  
  145.         ebegin "Installing version-independent python"
  146.             cd ${WORKDIR}/hqueue
  147.             insinto ${HQ_FS}/lib/python${PYTHON_ABI}/site-packages
  148.             doins -r deps/indep/*
  149.             ${D}${HQ_FS}/bin/python -m compileall ${D}${HQ_FS}/lib/python${PYTHON_ABI}/site-packages > /dev/null
  150.         eend $? || die
  151.  
  152.         python_enable_pyc #necessary for installing eggs. Alternatively PYTHONDONTWRITEBYTECODE= {cmd}
  153.         ebegin "Installing 3rd-party python-${PYTHON_ABI} scripts"
  154.             cd ${WORKDIR}/hqueue/
  155.             mkdir ${WORKDIR}/hqueue/egg_build
  156.             EGGS=`ls deps/python${PYTHON_ABI}/*.egg`
  157.             for egg in ${EGGS}; do
  158.                 einfo "Installing ${egg}"
  159.                 ${D}${HQ_FS}/bin/python ${WORKDIR}/hqueue/deps/python${PYTHON_ABI}/easy_install.py \
  160.                 --prefix ${D}${HQ_FS} -N ${egg} > /dev/null || die
  161.             done
  162.         eend $? || die
  163.  
  164.         ebegin "Installing HQueueServer"
  165.             cd ${WORKDIR}/hqueue/
  166.             ${D}${HQ_FS}/bin/python ${WORKDIR}/hqueue/deps/python${PYTHON_ABI}/easy_install.py \
  167.             --prefix ${D}${HQ_FS} -N hqserver-${PV}-py${PYTHON_ABI}.egg || die
  168.             virtualenv --python=python${PYTHON_ABI} --relocatable ${D}${HQ_FS}
  169.         eend $? || die
  170.  
  171.         ebegin "Installing hqserverd init script."
  172.         sed -i "s@%%INSTALL_DIR%%@\'${HQ_FS}\'@g" ${D}${HQ_FS}/scripts/hqserverd
  173.             doinitd ${D}${HQ_FS}/scripts/hqserverd || die
  174.         eend $? || die
  175.  
  176.         #Log and database dirs.
  177.         dodir ${HQ_FS}/job_logs
  178.         dodir ${HQ_FS}/db
  179.  
  180.         ewarn "HQueue known to have runtime errors. This is also the case with"
  181.         ewarn "the SESI install script, so probably an upstream bug (or my test"
  182.         ewarn "system is messed up)"
  183.     fi
  184. }
  185.  
  186. pkg_postinst(){
  187.     if use hqueue; then
  188.         elog "To learn about HQueue, go to http://localhost:5000/gettingstarted/index"
  189.  
  190.         cd ${HQ_FS}
  191.         if [ -f "hqserver.ini" ]; then
  192.             mv -f hqserver.ini hqserver.ini.backup
  193.             ewarn "Old config file found, moving to ${HQ_FS}/hqserver.ini.backup"
  194.         fi
  195.         ebegin "Generating config file"
  196. #           sed -i "s@${D}@${ROOT}@g" bin/*
  197.             bin/paster make-config hqserver hqserver.ini
  198.         eend $? || die
  199.         if use !keep-hqueue-db; then
  200.             einfo "Clearing HQueue database."
  201.                 bin/paster setup-app hqserver.ini
  202.         fi
  203.         /etc/init.d/hqserverd restart
  204.     fi
  205.  
  206.     elog "${PF} installed to ${HFS}"
  207.     if use hqueue; then elog "HQueue installed to ${HQ_FS}"; fi;
  208.     if use license-server; then elog "License Server installed to ${SRV_FS}. Licenses in ${LIC_DIR}"; fi;
  209. }
  210.  
  211. pkg_prerm(){
  212.     einfo "Shutting down Houdini License Server"
  213.     /etc/init.d/sesinetd stop
  214.     einfo "Shutting down HQueue Server"
  215.     /etc/init.d/hqserverd stop
  216. }
  217. pkg_postrm(){
  218.     if [ -d "${ROOT}${LIC_DIR}" ]; then
  219.         ewarn "Some license files have not been removed from ${LIC_DIR}. These must be removed manually"
  220.     fi
  221. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement