git.schokokeks.org
Repositories
Help
Report an Issue
keks-overlay.git
Code
Commits
Branches
Tags
Suche
Strukturansicht:
46e99a1
Branches
Tags
master
keks-overlay.git
eclass
pytransport.eclass
x
Lars Strojny
commited
46e99a1
at 2007-03-18 20:02:54
pytransport.eclass
Blame
History
Raw
# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ # # Original Author: Lars Strojny <lars@strojny.net> # Purpose: Providing macros to handle installation and setup of the py-transport # family # PYTRANSPORT_LIB_DIR=${PYTRANSPORT_LIB_DIR:=tools data src} inherit eutils python ECLASS="pytransport" INHERITED="$INHERITED $ECLASS" EXPORT_FUNCTIONS src_install pkg_postinst LICENSE="GPL-2" pytransport_is_subversion() { [[ "${PV}" = 9999 ]] && return 0 || return 1 } pytransport_is_subversion && S=${WORKDIR}/${PN} if pytransport_is_subversion; then inherit subversion [ -z "${ESVN_REPO_URI}" ] && ESVN_REPO_URI="http://svn.blathersource.org/${PN}/trunk" SRC_URI="" else SRC_URI="http://www.blathersource.org/download.php/${PN}/${P}.tar.gz" fi HOMEPAGE="http://${PN}.blathersource.org/" DEPEND=">=net-im/jabber-base-0.0 >=dev-lang/python-2.3" RDEPEND="<dev-python/twisted-2.4 >=dev-python/twisted-words-0.1.0 <dev-python/twisted-words-0.4 >=dev-python/twisted-xish-0.1.0 =dev-python/twisted-web-0.5* <dev-python/nevow-0.8 >=dev-python/imaging-1.1" PYTRANSPORT_CONFIG=config_example.xml # Create the minimal token name from the package name # # Example: pyicq-t-svn # pytransport_get_human_name() { echo "${PN}" \ | sed -e "s:^py\([a-z]*\)-t$:\1:g" \ | tr [:lower:] [:upper:] } # # Guess the script name # pytransport_get_script_name() { echo "Py$(pytransport_get_human_name ${PN})t.py" } # # Adjust configuration file defaults # pytransport_adjust_configfile() { local configfile="$1" dosed \ "s:<spooldir>[^\<]*</spooldir>:<spooldir>/var/spool/jabber/</spooldir>:" \ "${configfile}" || die "Could not sed ${configfile}" dosed \ "s:<pid>[^\<]*</pid>:<pid>/var/run/jabber/${PN}.pid</pid>:" \ "${configfile}" || die "Could not sed ${configfile}" return 0 } # # Get python version # pytransport_get_python_version() { [ -z "${PYVER}" ] && python_version echo "${PYVER}" } # # Install transport libraries # pytransport_install_libs() { insinto /usr/lib/python$(pytransport_get_python_version)/site-packages/${PN}/ doins -r ${PYTRANSPORT_LIB_DIR} || \ die "Could not install library" newins $(pytransport_get_script_name) ${PN}.py || \ die "Could not find initial .py-scripts" return 0 } # # Install configuration # pytransport_install_config() { insinto /etc/jabber newins "${PYTRANSPORT_CONFIG}" ${PN}.xml fperms 600 /etc/jabber/${PN}.xml || die "Could not adjust perms" pytransport_adjust_configfile /etc/jabber/${PN}.xml || die "Could not adjust config" fowners jabber:jabber /etc/jabber/${PN}.xml || die "Could not adjust perms" return 0 } # # Generate init.d-script # pytransport_generate_initd() { pytransport_is_subversion && local suffix=" (Subversion)" echo "#!/sbin/runscript depend() { need net use jabber-server } start() { ebegin \"Starting $(pytransport_get_human_name) Jabber Transport${suffix}\" start-stop-daemon --start --quiet \\ --background --name \"${PN}\" --chuid jabber:jabber \\ --exec /usr/bin/softlimit -- -r 100000 \\ /usr/bin/python$(pytransport_get_python_version) \\ /usr/lib/python$(pytransport_get_python_version)/site-packages/${PN}/${PN}.py \\ -c /etc/jabber/${PN}.xml \\ -l /var/log/jabber/${PN}.log eend 0 } stop() { ebegin \"Stopping $(pytransport_get_human_name) Jabber Transport${suffix}\" start-stop-daemon --stop --quiet --pidfile /var/run/jabber/pyicq-t-svn.pid sleep 3 eend \$? }" } # # Exported install function # pytransport_src_install() { einfo "Installing library files ..." pytransport_install_libs || die "Failed installing libs" einfo "Installing config file: /etc/jabber/${PN}.xml" pytransport_install_config || die "Failed installing configuration" einfo "Generating init script: /etc/init.d/${PN}" exeinto /etc/init.d pytransport_generate_initd > myinitd newexe myinitd ${PN} } pytransport_pkg_postinst() { einfo "A sample configuration file has been installed in /etc/jabber/${PN}.xml." einfo "Please edit it, and the configuration of you Jabber server to match." einfo "You also need to create a directory <host>.yourjabberhostname.tld in" einfo "/var/spool/jabber and chown it to jabber:jabber." }