On Sat, Sep 6, 2008 at 9:00 PM, Alec Warner <[EMAIL PROTECTED]> wrote: > On Sat, Sep 6, 2008 at 10:36 AM, Thomas Anderson <[EMAIL PROTECTED]> wrote: >> Hi, >> Currently we have a lot of: >> src_configure() { >> econf $(use_enable dvdr) \ >> $(use_with ipv6 ssl) \ >> --with-system-zlib >> } >> >> Introducing(Idea shamelessly taken from Exherbo): >> DEFAULT_SRC_CONFIGURE_USE_{WITHS,ENABLES} >> DEFAULT_SRc_CONFIGURE_EXTRA_PARAMS >> >> The code from above could be rewritten like so: >> >> DEFAULT_SRC_CONFIGURE_USE_ENABLES=( 'dvdr' ) >> DEFAULT_SRC_CONFIGURE_USE_WITHS=( 'ipv6 ssl' ) >> DEFAULT_SRC_CONFIGURE_EXTRA_PARAMS=( '--with-system-zlib' ) >> >> That's much simpler. > > It saves you 1 line and reduces readability and intuitiveness by a > fair margin; how is it simpler? >
In the given example it's not a big deal. However, when you're dealing with more arguments it simplifies things. For example, this (based on an existing ebuild, but simplified a bit for brevity): -------------------------- src_compile() { local myconf=" --sysconfdir=/etc/${PN} --without-xgrid --enable-pretty-print-stacktrace --enable-orterun-prefix-by-default --without-slurm" if use threads; then myconf="${myconf} --enable-mpi-threads --with-progress-threads fi econf ${myconf} \ $(use_enable !nocxx mpi-cxx) \ $(use_enable romio io-romio) \ $(use_enable heterogeneous) \ $(use_with pbs tm) \ $(use_enable ipv6) \ || die "econf failed" emake || die "emake failed" } -------------------------- becomes -------------------------- SRC_DEFAULT_CONFIGURE_WITHS=( "pbs tm" "ipv6" "threads progress-threads" SRC_DEFAULT_CONFIGURE_ENABLES=( "cxx mpi-cxx" "romio io-romio" "heterogeneous" "threads mpi-threads" SRC_DEFAULT_CONFIGURE_EXTRA_PARAMS=( --sysconfdir=/etc/${PN} --without-xgrid --enable-pretty-print-stacktrace --enable-orterun-prefix-by-default --without-slurm ) -------------------------- You save some lines, but also you keep out all the use_* calls with their backslashes, myconf=$myconf crap, econf/emake || die... Regards, -- Santiago M. Mola Jabber ID: [EMAIL PROTECTED]