On Wed, Sep 24, 2008 at 4:51 AM, Bo Ørsted Andresen <[EMAIL PROTECTED]> wrote:
> On Tuesday 23 September 2008 21:39:52 Thomas Sachau wrote:
>> default_src_install() {
>> if [ -f Makefile -o -f GNUmakefile -o -f makefile ]; then
>> if emake DESTDIR="${D} install || einstall ; then
>> die "install failed"
>> else
>> if [[ -n ${DOCS} ]]; then
>> dodoc ${DOCS} || die "dodoc failed"
>> fi
>> fi
>> fi
>> }
>>
>> Any more comments? Good? Bad? Interested?
>
> Now figure out the four flaws in the above code.
Even though IMO that comment is quite condescending, I'll list out the
flaws in that code:
>> if [ -f Makefile -o -f GNUmakefile -o -f makefile ]; then
[...]
>> fi
- So if those makefiles don't exist, the package should just carry on
without installing anything?
>> if emake DESTDIR="${D} install || einstall ; then
>> die "install failed"
- It is quite useless to run *both* emake install and einstall.
Default are not supposed to be lazy-maintainer-proof. The maintainer
should make sure that the ebuild works with emake install, and *if* it
doesn't, use einstall
- The above code will cause a die when either one of emake install or
einstall are *successful*. The opposite behaviour is desired.
>> else
>> if [[ -n ${DOCS} ]]; then
>> dodoc ${DOCS} || die "dodoc failed"
>> fi
- So, if emake install || einstall fails, one should just install the
docs? The opposite behaviour is desired.
If a default src_install is desired, it should cater to the most
common use-cases and leave it to the maintainer to override it if
desired.
default_src_install() {
emake DESTDIR="${D}" install || die "emake install failed"
if [ -n "${DOCS}" ]; then
dodoc ${DOCS} || die "dodoc failed"
else
# No die here because we don't know if any of these exist
dodoc AUTHORS ChangeLog NEWS README
fi
}
--
~Nirbheek Chauhan