Created attachment 351060 [details] Modified layman ebuild to support zsh-completion Hi, I wondered why there was so few ebuilds with zsh-completion USE flag. The ebuild zsh-completion provides few functions for portage associated commands, it could be better to remove this ebuild, and add the zsh-completion functions by ebuild. For example, the ebuild layman would have a USE flag zsh-completion which brings the functions needed. Itβs a way to avoid useless functions and have something more adaptive. Find an example of the layman ebuild modified attached.
Created attachment 351088 [details] _layman functions from app-shells/zsh-completion
Comment on attachment 351060 [details] Modified layman ebuild to support zsh-completion --- layman-2.0.0.ebuild 2013-06-18 14:43:44.539473456 +0200 +++ - 2013-06-18 14:45:18.617303670 +0200 @@ -1,13 +1,14 @@ # Copyright 1999-2013 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/app-portage/layman/layman-2.0.0.ebuild,v 1.13 2013/06/17 04:27:34 dolsen Exp $ +# $Header: /var/cvsroot/gentoo-x86/app-portage/layman/layman-2.0.0.ebuild,v 1.11 2013/01/22 15:48:01 jer Exp $ -EAPI="5" +EAPI="4" +SUPPORT_PYTHON_ABIS="1" +PYTHON_DEPEND="2:2.6" +RESTRICT_PYTHON_ABIS="2.4 3.*" +PYTHON_USE_WITH="xml(+)" -PYTHON_COMPAT=( python{2_6,2_7} ) -PYTHON_REQ_USE="xml" - -inherit eutils distutils-r1 prefix +inherit eutils distutils prefix DESCRIPTION="Tool to manage Gentoo overlays" HOMEPAGE="http://layman.sourceforge.net/" @@ -16,11 +17,12 @@ LICENSE="GPL-2" SLOT="0" KEYWORDS="alpha amd64 arm hppa ia64 ~mips ppc ppc64 sparc x86 ~ppc-aix ~amd64-fbsd ~x86-fbsd ~hppa-hpux ~ia64-hpux ~x86-interix ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~x64-solaris ~x86-solaris" -IUSE="bazaar cvs darcs +git mercurial subversion test" - -DEPEND="test? ( dev-vcs/subversion )" +IUSE="bazaar cvs darcs +git mercurial subversion test zsh-completion" -RDEPEND=" +COMMON_DEPS="dev-lang/python" +DEPEND="${COMMON_DEPS} + test? ( dev-vcs/subversion )" +RDEPEND="${COMMON_DEPS} bazaar? ( dev-vcs/bzr ) cvs? ( dev-vcs/cvs ) darcs? ( dev-vcs/darcs ) @@ -32,36 +34,44 @@ >=dev-vcs/subversion-1.5.4[webdav-serf] ) ) - virtual/python-argparse[${PYTHON_USEDEP}] - " + zsh-completion? ( app-shells/zsh )" -python_prepare_all() { - python_export_best +src_prepare() { eprefixify etc/layman.cfg layman/config.py epatch "${FILESDIR}"/layman-2.0.0.doctest.patch } -python_test() { - for suite in layman/tests/{dtest,external}.py ; do - PYTHONPATH="." "${PYTHON}" ${suite} \ - || die "test suite '${suite}' failed" - done +src_test() { + testing() { + for suite in layman/tests/{dtest,external}.py ; do + PYTHONPATH="." "$(PYTHON)" ${suite} \ + || die "test suite '${suite}' failed" + done + } + python_execute_function testing } -python_install_all() { - distutils-r1_python_install_all +src_install() { + distutils_src_install insinto /etc/layman - doins etc/layman.cfg + doins etc/layman.cfg || die doman doc/layman.8 dohtml doc/layman.8.html keepdir /var/lib/layman keepdir /etc/layman/overlays + + if use zsh-completion ; then + insinto /usr/share/zsh/site-functions + doins _layman + fi } pkg_postinst() { + distutils_pkg_postinst + # now run layman's update utility einfo "Running layman-updater..." "${EROOT}"/usr/bin/layman-updater
See the recent discussion on -dev ML. Small text files such as shell completion functions should be installed unconditionally and without dependency on the package which will use the completions.