git.schokokeks.org
Repositories
Help
Report an Issue
keks-overlay.git
Code
Commits
Branches
Tags
Suche
Strukturansicht:
2295c1c
Branches
Tags
master
keks-overlay.git
eclass
pytransport.eclass
Fixing SVN URI
Lars Strojny
commited
2295c1c
at 2007-03-18 16:47:39
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 src_unpack pkg_postinst MY_PN=${PN/-svn/} MY_PV=${PV} MY_P=${MY_PN}-${MY_PV} LICENSE="GPL-2" pytransport_is_subversion() { [[ "${PN}" =~ "^py[a-z]+-t-svn$" ]] && 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/${MY_PN}/trunk" SRC_URI="" else SRC_URI="http://www.blathersource.org/download.php/${PN}/${MY_P}.tar.gz" fi HOMEPAGE="http://${MY_PN}.blathersource.org/" DEPEND=">=net-im/jabber-base-0.0 >=dev-lang/python-2.3" RDEPEND=">=dev-python/twisted-1.3.0 >=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.4.1 <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 "${MY_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" } 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 } pytransport_get_python_version() { [ -z "${PYVER}" ] && python_version echo "${PYVER}" } 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 } pytransport_install_config() { insinto /etc/jabber newins "${PYTRANSPORT_CONFIG}" ${PN}.xml fperms 600 /etc/jabber/${PN}.xml || die "Could not adjust perms" fowners jabber:jabber /etc/jabber/${PN}.xml || die "Could not adjust perms" return 0 } 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 \$? } 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 \$? }" } pytransport_src_unpack() { if pytransport_is_subversion; then subversion_src_unpack || die else unpack ${A} fi } 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." }