Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Copyright 1999-2011 Gentoo Foundation
- # Distributed under the terms of the GNU General Public License v2
- # $Header: $
- #Based on Houdini 8.x ebuild by NTmatter (http://code.google.com/p/houdini-ebuild/)
- #Updating for H11/HQueue done by Kai Wohlfahrt (kai.scorpio@gmail.com)
- EAPI=4
- PYTHON_DEPEND="hqueue? 2:2.5:2.6"
- inherit eutils python # distutils
- # Short one-line description of this package.
- DESCRIPTION="A professional procedural 3D program."
- # Homepage, not used by Portage directly but handy for developer reference
- HOMEPAGE="http://www.sidefx.com"
- # Point to any required sources; these will be automatically downloaded by
- # Portage.
- FILE_NAME="${P}-linux_x86_64_gcc4.4"
- 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 \
- -> ${FILE_NAME}.tar.gz"
- LICENSE="SESI"
- SLOT="0"
- KEYWORDS="amd64"
- IUSE="-hqueue -keep-hqueue-db +license-server"
- RESTRICT="fetch strip test"
- DEPEND="x11-base/xorg-server
- sys-apps/sed
- app-arch/tar
- hqueue? ( app-arch/unzip
- dev-python/virtualenv )"
- RDEPEND=${DEPEND}
- S=${WORKDIR}/${FILE_NAME}
- pkg_nofetch(){
- einfo "Please register at ${HOMEPAGE} and download the appropriate files"
- einfo "for your architecture. Place archive at ${DISTDIR}/${A}."
- }
- pkg_setup(){
- if use hqueue && use keep-hqueue-db; then
- die "Maintaining hqueue MYSQL database not supported. Request at kai.scorpio@gmail.com"
- fi
- if [ -e "/usr/bin/python2.6" ]; then
- python_set_active_version 2.6
- else
- python_set_active_version 2.5
- fi
- python_pkg_setup
- einfo "Using python version: ${PYTHON_ABI}"
- }
- src_unpack(){
- einfo "Extracting outer houdini package..."
- unpack ${A}
- if use hqueue; then
- ebegin "Extracting HQueue setup files"
- tar --no-same-permission --no-same-owner -xzf ${WORKDIR}/${FILE_NAME}/hqueue.tar.gz -C ${WORKDIR} || die
- eend $? || die
- fi
- }
- pkg_preinst(){
- if [ -d "${ROOT}${LIC_DIR}" ]; then
- ewarn "${LIC_DIR} already exists. Licenses may be from previous version. Check license administrator for details."
- fi
- einfo "Copying image to live file system..."
- }
- src_install() {
- HFS=/opt/sesi/hfs-${PV}
- HQ_FS=/opt/sesi/hqueue
- SRV_FS=/opt/sesi/license_server
- LIC_DIR=/usr/lib/sesi
- ebegin "Extracting houdini files to image directory"
- dodir ${HFS}
- tar --no-same-permission --no-same-owner -xzf ${WORKDIR}/${FILE_NAME}/houdini.tar.gz -C ${D}${HFS}
- eend $? || die
- if use license-server; then
- ebegin "Making home for license files"
- dodir ${LIC_DIR}
- eend $? || die
- ebegin "Installing sesinetd daemon"
- sed -i "s@/usr/lib/sesi@${SRV_FS}@g" ${D}${HFS}/houdini/sbin/sesinetd.startup
- newinitd ${D}${HFS}/houdini/sbin/sesinetd.startup sesinetd
- dodir ${SRV_FS}
- exeinto ${SRV_FS}
- doexe ${D}${HFS}/houdini/sbin/sesi*
- eend $? || die
- fi
- ebegin "Installing helper bin files from template"
- dodir /usr/bin
- for i in mplay gplay hkey houdini hescape vcc; do
- cat ${FILESDIR}/houdini_template.sh \
- | sed -e 's@REPLACE-ME-WITH-HFS@'"${HFS}"'@g' \
- | sed -e "s/REPLACE-ME-WITH-PROGRAM/${i}/g" \
- > ${D}/usr/bin/${i};
- chmod 755 ${D}/usr/bin/${i}
- chown root:root ${D}/usr/bin/${i}
- done
- eend $? || die
- ebegin "Installing menu items"
- cd ${S}/desktop
- for i in gplay hescape hkey hmaster mplay; do
- sed -i 's@${HFS}@'"${HFS}"'@g' ${WORKDIR}/${FILE_NAME}/desktop/sesi_${i}.desktop
- sed -i 's@${VER.*BUILD}@'"${PVR}"'@g' ${WORKDIR}/${FILE_NAME}/desktop/sesi_${i}.desktop
- done
- domenu sesi_gplay.desktop sesi_hescape.desktop sesi_hkey.desktop \
- sesi_hmaster.desktop sesi_mplay.desktop
- eend $? || die
- if use hqueue; then
- einfo "Installing HQueue"
- dodir ${HQ_FS}
- ebegin "Copying scripts"
- exeinto ${HQ_FS}/scripts
- doexe ${WORKDIR}/hqueue/scripts/*
- eend $? || die
- ebegin "Creating python virtual environment"
- cd ${WORKDIR}/hqueue/deps/python${PYTHON_ABI}
- unzip -q virtualenv-*.egg
- python virtualenv.py ${D}${HQ_FS}
- virtualenv --python=python${PYTHON_ABI} --relocatable ${D}${HQ_FS} > /dev/null
- eend $? || die
- ebegin "Copying setuptools"
- cd ${WORKDIR}/hqueue/deps/python${PYTHON_ABI}
- unzip -oq setuptools-*.egg
- eend $? || die
- ebegin "Installing version-independent python"
- cd ${WORKDIR}/hqueue
- insinto ${HQ_FS}/lib/python${PYTHON_ABI}/site-packages
- doins -r deps/indep/*
- ${D}${HQ_FS}/bin/python -m compileall ${D}${HQ_FS}/lib/python${PYTHON_ABI}/site-packages > /dev/null
- eend $? || die
- python_enable_pyc #necessary for installing eggs. Alternatively PYTHONDONTWRITEBYTECODE= {cmd}
- ebegin "Installing 3rd-party python-${PYTHON_ABI} scripts"
- cd ${WORKDIR}/hqueue/
- mkdir ${WORKDIR}/hqueue/egg_build
- EGGS=`ls deps/python${PYTHON_ABI}/*.egg`
- for egg in ${EGGS}; do
- einfo "Installing ${egg}"
- ${D}${HQ_FS}/bin/python ${WORKDIR}/hqueue/deps/python${PYTHON_ABI}/easy_install.py \
- --prefix ${D}${HQ_FS} -N ${egg} > /dev/null || die
- done
- eend $? || die
- ebegin "Installing HQueueServer"
- cd ${WORKDIR}/hqueue/
- ${D}${HQ_FS}/bin/python ${WORKDIR}/hqueue/deps/python${PYTHON_ABI}/easy_install.py \
- --prefix ${D}${HQ_FS} -N hqserver-${PV}-py${PYTHON_ABI}.egg || die
- virtualenv --python=python${PYTHON_ABI} --relocatable ${D}${HQ_FS}
- eend $? || die
- ebegin "Installing hqserverd init script."
- sed -i "s@%%INSTALL_DIR%%@\'${HQ_FS}\'@g" ${D}${HQ_FS}/scripts/hqserverd
- doinitd ${D}${HQ_FS}/scripts/hqserverd || die
- eend $? || die
- #Log and database dirs.
- dodir ${HQ_FS}/job_logs
- dodir ${HQ_FS}/db
- ewarn "HQueue known to have runtime errors. This is also the case with"
- ewarn "the SESI install script, so probably an upstream bug (or my test"
- ewarn "system is messed up)"
- fi
- }
- pkg_postinst(){
- if use hqueue; then
- elog "To learn about HQueue, go to http://localhost:5000/gettingstarted/index"
- cd ${HQ_FS}
- if [ -f "hqserver.ini" ]; then
- mv -f hqserver.ini hqserver.ini.backup
- ewarn "Old config file found, moving to ${HQ_FS}/hqserver.ini.backup"
- fi
- ebegin "Generating config file"
- # sed -i "s@${D}@${ROOT}@g" bin/*
- bin/paster make-config hqserver hqserver.ini
- eend $? || die
- if use !keep-hqueue-db; then
- einfo "Clearing HQueue database."
- bin/paster setup-app hqserver.ini
- fi
- /etc/init.d/hqserverd restart
- fi
- elog "${PF} installed to ${HFS}"
- if use hqueue; then elog "HQueue installed to ${HQ_FS}"; fi;
- if use license-server; then elog "License Server installed to ${SRV_FS}. Licenses in ${LIC_DIR}"; fi;
- }
- pkg_prerm(){
- einfo "Shutting down Houdini License Server"
- /etc/init.d/sesinetd stop
- einfo "Shutting down HQueue Server"
- /etc/init.d/hqserverd stop
- }
- pkg_postrm(){
- if [ -d "${ROOT}${LIC_DIR}" ]; then
- ewarn "Some license files have not been removed from ${LIC_DIR}. These must be removed manually"
- fi
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement