New more QA prone be-9999.ebuild.
authorEnrico Tagliavini <enrico.tagliavini@gmail.com>
Thu, 26 Aug 2010 13:46:08 +0000 (09:46 -0400)
committerW. Trevor King <wking@drexel.edu>
Thu, 26 Aug 2010 13:46:08 +0000 (09:46 -0400)
From http://bugs.gentoo.org/show_bug.cgi?id=303867#c9

On 2010-05-03 15:20:06, Enrico Tagliavini wrote:
> I used be today and i got the time to improve the ebuild, making it
> respecting more QA and using the distutils eclass. Yeah i know i'm
> using also python.eclass but since distutils inherit it, and this
> will unlikely change i left it as is. I added the ~amd64 keyword
> since it works on amd64 here.
>
> Hope it will be usefull :)

dev-util/be/be-9999.ebuild

index 24dd8bbfb4cc07e536831ee61222779f18f315f5..d96806670531650859c0dc9c923fa4ac8b2907c8 100644 (file)
@@ -1,10 +1,12 @@
-# Copyright 1999-2009 Gentoo Foundation
+# Copyright 1999-2010 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 # $Header: $
 
 EAPI="2"
+NEED_PYTHON=2.6
+SUPPORT_PYTHON_ABIS="1"
 
-inherit eutils
+inherit eutils distutils
 
 if [[ ${PV} == "9999" ]] ; then
        EBZR_REPO_URI="http://bzr.bugseverywhere.org/${PN}"
@@ -19,13 +21,13 @@ HOMEPAGE="http://bugseverywhere.org/"
 
 LICENSE="GPL-2"
 SLOT="0"
-KEYWORDS="x86"
+KEYWORDS="~amd64 ~x86"
 IUSE=""
 
 RDEPEND="dev-lang/python
        dev-python/pyyaml"
 DEPEND="${RDEPEND}
-       dev-util/bzr
+       dev-vcs/bzr
        app-text/docbook-sgml-utils"
 
 src_unpack() {
@@ -35,29 +37,42 @@ src_unpack() {
                unpack ${A}
        fi
        cd "${S}"
-       epatch ${FILESDIR}/${P}-install-dir.patch
-       epatch ${FILESDIR}/${P}-version.patch
-       epatch ${FILESDIR}/${P}-docbook2man.patch
 }
 
-if [[ ${PV} == "9999" ]] ; then
-       src_prepare() {
+src_prepare() {
+       epatch "${FILESDIR}/${P}"-install-dir.patch
+       epatch "${FILESDIR}/${P}"-version.patch
+       epatch "${FILESDIR}/${P}"-docbook2man.patch
+       if [[ ${PV} == "9999" ]] ; then
                bzr_src_prepare || die
                EBZR_BRANCH_DIR="${EBZR_STORE_DIR}/${EBZR_CACHE_DIR}"
                bzr version-info --format python "${EBZR_BRANCH_DIR}" > \
                        "${S}/libbe/_version.py" \
                        || die "Unable to make _verison.py from ${EBZR_BRANCH_DIR}"
-       }
-fi
+       fi
+       distutils_src_prepare
+}
 
 src_compile() {
-       emake || die
+       distutils_src_compile
+       docbook2man -o doc doc/be.1.sgml || die "docbook2man failed"
+       mv doc/BE.1 doc/be.1 || die "mv failed"
 }
 
 src_install() {
-       emake DESTDIR="${D}" install || die
-       dodoc AUTHORS NEWS README
+       distutils_src_install
+       dodoc AUTHORS NEWS README || die "dodoc failed"
        if [[ ${PV} != "9999" ]] ; then
-               dodoc ChangeLog
+               dodoc ChangeLog || die "dodoc failed"
        fi
 }
+
+pkg_postinst() {
+       python_mod_optimize lib${PN}
+       python_mod_optimize ${PN}commands
+}
+
+pkg_postrm() {
+       python_mod_cleanup lib${PN}
+       python_mod_cleanup ${PN}commands
+}