From: Donnie Berkholz <dberkholz@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Subject: [gentoo-dev] x-modular.eclass: A modified approach to EAPI support
Date: Fri, 6 Mar 2009 12:57:29 -0800 [thread overview]
Message-ID: <20090306205729.GC22566@comet> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 1022 bytes --]
I decided to try something a little different because I had some ideas
for improving the existing EAPI patches I've seen going into other
eclasses. So here is my patch for x-modular.eclass. I tested it with
ebuilds using EAPIs 0, 1, and 2, and it appeared to work fine. It
already happened to have a function called src_configure, so that
doesn't appear in the patch.
One thing I see as an improvement is a lack of EAPI value checks
throughout the ebuild to avoid repetition between the function export
and the function call. Things just check whether a function was
exported, which is the only place where EAPI value checks happen.
Additionally, the fallback in case statements is "I don't know what to
do" and supported EAPIs are explicitly defined. This will make it
obvious when the eclass doesn't support a new EAPI instead of it
randomly failing after you try it.
Any thoughts?
--
Thanks,
Donnie
Donnie Berkholz
Developer, Gentoo Linux
Blog: http://dberkholz.wordpress.com
[-- Attachment #1.2: x-modular.eclass.diff --]
[-- Type: text/plain, Size: 1638 bytes --]
--- /home/donnie/src/gentoo-x86/eclass/x-modular.eclass 2009-03-06 12:11:38.000000000 -0800
+++ x-modular.eclass 2009-03-06 12:16:25.000000000 -0800
@@ -26,6 +26,21 @@
# there. You may also want to change the SLOT.
XDIR="/usr"
+EXPORTED_FUNCTIONS="src_unpack src_compile src_install pkg_preinst pkg_postinst pkg_postrm"
+
+case "${EAPI:-0}" in
+ 0|1)
+ ;;
+ 2)
+ EXPORTED_FUNCTIONS="${EXPORTED_FUNCTIONS} src_prepare src_configure"
+ ;;
+ *)
+ die "Unknown EAPI ${EAPI}"
+ ;;
+esac
+
+EXPORT_FUNCTIONS ${EXPORTED_FUNCTIONS}
+
IUSE=""
HOMEPAGE="http://xorg.freedesktop.org/"
@@ -297,6 +312,15 @@
elibtoolize
}
+# @FUNCTION: x-modular_src_prepare
+# @USAGE:
+# @DESCRIPTION:
+# Prepare a package after unpacking, performing all X-related tasks.
+x-modular_src_prepare() {
+ x-modular_patch_source
+ x-modular_reconf_source
+}
+
# @FUNCTION: x-modular_src_unpack
# @USAGE:
# @DESCRIPTION:
@@ -306,8 +330,7 @@
x-modular_server_supports_drivers_check
x-modular_dri_check
x-modular_unpack_source
- x-modular_patch_source
- x-modular_reconf_source
+ has src_prepare ${EXPORTED_FUNCTIONS} || x-modular_src_prepare
}
# @FUNCTION: x-modular_font_configure
@@ -390,7 +413,7 @@
# @DESCRIPTION:
# Compile a package, performing all X-related tasks.
x-modular_src_compile() {
- x-modular_src_configure
+ has src_configure ${EXPORTED_FUNCTIONS} || x-modular_src_configure
x-modular_src_make
}
@@ -645,5 +668,3 @@
create_font_cache() {
font_pkg_postinst
}
-
-EXPORT_FUNCTIONS src_unpack src_compile src_install pkg_preinst pkg_postinst pkg_postrm
[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]
next reply other threads:[~2009-03-06 20:57 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-06 20:57 Donnie Berkholz [this message]
2009-03-06 21:37 ` [gentoo-dev] Re: x-modular.eclass: A modified approach to EAPI support Christian Faulhammer
2009-03-06 22:33 ` [gentoo-dev] " Petteri Räty
2009-03-07 7:58 ` Rémi Cardona
2009-03-07 9:50 ` Ulrich Mueller
2009-03-07 10:06 ` Nirbheek Chauhan
2009-03-08 20:23 ` Alistair Bush
2009-03-08 5:22 ` Donnie Berkholz
2009-03-08 10:38 ` David Leverton
2009-03-08 22:38 ` Zac Medico
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090306205729.GC22566@comet \
--to=dberkholz@gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox