Re: [gentoo-dev] Re: RFC: leechcraft.eclass

2011-08-18 Thread Fabian Groffen
On 18-08-2011 21:41:47 +0200, Michał Górny wrote:
> On Thu, 18 Aug 2011 20:43:59 +0200
> Fabian Groffen  wrote:
> 
> > On 18-08-2011 20:42:23 +0200, Michał Górny wrote:
> > > > elif [[ ${PN} != "leechcraft-core" ]]; then
> > > > CAKE_USE_DIR="${S}"/src/plugins/${PN#leechcraft-}
> > > 
> > > Don't quote that. It looks bad that the left-side is unquoted and
> > > right side is quoted.
> > 
> > it's a string, what's the problem?
> 
> It's just a matter of taste. I think it looks better if both sides are
> quoted, or neither is.

Right, it's a matter of taste, so the snippet is fine as-is.

Commenting on code is fine, Just don't present your taste as if it is
the only right thing to do.


-- 
Fabian Groffen
Gentoo on a different level



Re: [gentoo-dev] Re: RFC: leechcraft.eclass

2011-08-18 Thread Ulrich Mueller
> On Thu, 18 Aug 2011, Michał Górny wrote:

> On Thu, 18 Aug 2011 20:43:59 +0200
> Fabian Groffen  wrote:

>> > > elif [[ ${PN} != "leechcraft-core" ]]; then
>> > >  CAKE_USE_DIR="${S}"/src/plugins/${PN#leechcraft-}
>> > 
>> > Don't quote that. It looks bad that the left-side is unquoted and
>> > right side is quoted.
>> 
>> it's a string, what's the problem?

> It's just a matter of taste. I think it looks better if both sides
> are quoted, or neither is.

But both sides of [[ ]] aren't symmetric, in the first place:

# When the == and != operators are used, the string to the right of
# the operator is considered a pattern and matched according to the
# rules described below under Pattern Matching.

So there's almost never a reason for quoting the left-hand side, while
on the right-hand side quotes will suppress pattern matching.

(Of course, in the example above it doesn't matter, because the string
doesn't contain any special characters.)

Ulrich



Re: [gentoo-dev] Re: RFC: leechcraft.eclass

2011-08-18 Thread Michał Górny
On Thu, 18 Aug 2011 20:43:59 +0200
Fabian Groffen  wrote:

> On 18-08-2011 20:42:23 +0200, Michał Górny wrote:
> > > elif [[ ${PN} != "leechcraft-core" ]]; then
> > >   CAKE_USE_DIR="${S}"/src/plugins/${PN#leechcraft-}
> > 
> > Don't quote that. It looks bad that the left-side is unquoted and
> > right side is quoted.
> 
> it's a string, what's the problem?

It's just a matter of taste. I think it looks better if both sides are
quoted, or neither is.

-- 
Best regards,
Michał Górny


signature.asc
Description: PGP signature


Re: [gentoo-dev] Re: RFC: leechcraft.eclass

2011-08-18 Thread Fabian Groffen
On 18-08-2011 20:42:23 +0200, Michał Górny wrote:
> > elif [[ ${PN} != "leechcraft-core" ]]; then
> > CAKE_USE_DIR="${S}"/src/plugins/${PN#leechcraft-}
> 
> Don't quote that. It looks bad that the left-side is unquoted and right
> side is quoted.

it's a string, what's the problem?



-- 
Fabian Groffen
Gentoo on a different level



Re: [gentoo-dev] Re: RFC: leechcraft.eclass

2011-08-18 Thread Michał Górny
On Thu, 18 Aug 2011 22:33:15 +0400
Maxim Koltsov  wrote:

> if [[ -z "${LEECHCRAFT_PACKAGE_CATEGORY}" ]]; then
>   
> CMAKE_USE_DIR="${S}"/src/plugins/${LEECHCRAFT_PACKAGE_CATEGORY}/${PN#leechcraft-}

Dude, that's the opposite.

> elif [[ ${PN} != "leechcraft-core" ]]; then
>   CAKE_USE_DIR="${S}"/src/plugins/${PN#leechcraft-}

Don't quote that. It looks bad that the left-side is unquoted and right
side is quoted.

-- 
Best regards,
Michał Górny


signature.asc
Description: PGP signature


Re: [gentoo-dev] Re: RFC: leechcraft.eclass

2011-08-18 Thread Maxim Koltsov
2011/8/18 Michał Górny :
> On Thu, 18 Aug 2011 19:30:29 +0400
> Maxim Koltsov  wrote:
>
>> if [ "${LEECHCRAFT_PACKAGE_CATEGORY+x}" != "x" ]; then
>>       
>> CMAKE_USE_DIR="${S}/src/plugins/${LEECHCRAFT_PACKAGE_CATEGORY}/${PN#leechcraft-}"
>> elif [ ${PN} != "leechcraft-core" ]; then
>>               CMAKE_USE_DIR="${S}/src/plugins/${PN#leechcraft-}"
>
> [[ ]] is better here because it's a bash builtin. And you don't need
> quotes there.
>
> What should happen if LEECHCRAFT_PACKAGE_CATEGORY is set to ''?

Fixed, i think. In this version empty variable will be handled correctly.

-- 
Regards, Maxim.


leechcraft.eclass
Description: Binary data


Re: [gentoo-dev] Re: RFC: leechcraft.eclass

2011-08-18 Thread Michał Górny
On Thu, 18 Aug 2011 19:30:29 +0400
Maxim Koltsov  wrote:

> if [ "${LEECHCRAFT_PACKAGE_CATEGORY+x}" != "x" ]; then
>   
> CMAKE_USE_DIR="${S}/src/plugins/${LEECHCRAFT_PACKAGE_CATEGORY}/${PN#leechcraft-}"
> elif [ ${PN} != "leechcraft-core" ]; then
>   CMAKE_USE_DIR="${S}/src/plugins/${PN#leechcraft-}"

[[ ]] is better here because it's a bash builtin. And you don't need
quotes there.

What should happen if LEECHCRAFT_PACKAGE_CATEGORY is set to ''?

-- 
Best regards,
Michał Górny


signature.asc
Description: PGP signature


Re: [gentoo-dev] Re: RFC: leechcraft.eclass

2011-08-18 Thread Maxim Koltsov
2011/8/18 Fabian Groffen :
>> > if [ "${LC_PCAT+x}" != "x" ]; then
>> >     CMAKE_USE_DIR="${S}/src/plugins/${LC_PCAT}/${PN#leechcraft-}"
>> > else
>> >     if [[ ${PN} != "leechcraft-core" ]]; then
>> >             CMAKE_USE_DIR="${S}/src/plugins/${PN#leechcraft-}"
>> >     else
>> >             CMAKE_USE_DIR="${S}/src"
>> >     fi
>> > fi
>>
>> if-elif-else-fi.
>
> This sounds like a kind of bogus suggestion to me.  Mixing use of [ and
> [[, on the other hand, is more what deserves attention here.

'elif' seems more convenient here, i just forgot about it :)

-- 
Regards, Maxim.



Re: [gentoo-dev] Re: RFC: leechcraft.eclass

2011-08-18 Thread Maxim Koltsov
2011/8/18 Michał Górny :
> On Thu, 18 Aug 2011 14:38:01 +0400
> Maxim Koltsov  wrote:
>
>
>>       0|1) die "EAPI not supported, bug ebuild mantainer" ;;
>>       *) die "Unknown EAPI, Bug eclass maintainers." ;;
>
> I think I already mentioned that. Keep consistent case, and in this
> case lowercase 'bug' is correct'.

Sorry, i lost fixed version and forgot to correct this in new one :(

>> # @ECLASS-VARIABLE: LC_PCAT
>> # @DESCRIPTION:
>> # Set this to the category of the plugin, if any.
>> : ${LC_PCAT:=}
>
> Please use verbose variable names, and prefix them with eclass
> filename; e.g. LEECHCRAFT_PLUGIN_CATEGORY.
>
> And I think @DEFAULT_UNSET may be of interest too.
done

> if-elif-else-fi.
done

> And I think you dropped gentoo-dev@ from recipients a few mails ago.
Yes, added it now.

-- 
Regards, Maxim.


leechcraft.eclass
Description: Binary data


Re: [gentoo-dev] Re: RFC: leechcraft.eclass

2011-08-18 Thread Alec Warner
On Thu, Aug 18, 2011 at 8:27 AM, Fabian Groffen  wrote:
> On 18-08-2011 16:57:59 +0200, Michał Górny wrote:
>> > # @ECLASS-VARIABLE: LC_PCAT
>> > # @DESCRIPTION:
>> > # Set this to the category of the plugin, if any.
>> > : ${LC_PCAT:=}
>>
>> Please use verbose variable names, and prefix them with eclass
>> filename; e.g. LEECHCRAFT_PLUGIN_CATEGORY.
>
> Really?  The python eclass is full of such awkward overly verbose names.
> One can also exaggerate...

python.eclass, perhaps not the best style to use as a defense ;)

-A

>
>> > if [ "${LC_PCAT+x}" != "x" ]; then
>> >     CMAKE_USE_DIR="${S}/src/plugins/${LC_PCAT}/${PN#leechcraft-}"
>> > else
>> >     if [[ ${PN} != "leechcraft-core" ]]; then
>> >             CMAKE_USE_DIR="${S}/src/plugins/${PN#leechcraft-}"
>> >     else
>> >             CMAKE_USE_DIR="${S}/src"
>> >     fi
>> > fi
>>
>> if-elif-else-fi.
>
> This sounds like a kind of bogus suggestion to me.  Mixing use of [ and
> [[, on the other hand, is more what deserves attention here.
>
>
>
> --
> Fabian Groffen
> Gentoo on a different level
>
>



Re: [gentoo-dev] Re: RFC: leechcraft.eclass

2011-08-18 Thread Fabian Groffen
On 18-08-2011 16:57:59 +0200, Michał Górny wrote:
> > # @ECLASS-VARIABLE: LC_PCAT
> > # @DESCRIPTION:
> > # Set this to the category of the plugin, if any.
> > : ${LC_PCAT:=}
> 
> Please use verbose variable names, and prefix them with eclass
> filename; e.g. LEECHCRAFT_PLUGIN_CATEGORY.

Really?  The python eclass is full of such awkward overly verbose names.
One can also exaggerate...

> > if [ "${LC_PCAT+x}" != "x" ]; then
> > CMAKE_USE_DIR="${S}/src/plugins/${LC_PCAT}/${PN#leechcraft-}"
> > else
> > if [[ ${PN} != "leechcraft-core" ]]; then
> > CMAKE_USE_DIR="${S}/src/plugins/${PN#leechcraft-}"
> > else
> > CMAKE_USE_DIR="${S}/src"
> > fi
> > fi
> 
> if-elif-else-fi.

This sounds like a kind of bogus suggestion to me.  Mixing use of [ and
[[, on the other hand, is more what deserves attention here.



-- 
Fabian Groffen
Gentoo on a different level



Re: [gentoo-dev] Re: RFC: leechcraft.eclass

2011-08-18 Thread Michał Górny
On Thu, 18 Aug 2011 14:38:01 +0400
Maxim Koltsov  wrote:

> We've fixed all the problems with eclass. Please review it and give OK
> for commit, i plan to do it this night.

>   0|1) die "EAPI not supported, bug ebuild mantainer" ;;
>   *) die "Unknown EAPI, Bug eclass maintainers." ;;

I think I already mentioned that. Keep consistent case, and in this
case lowercase 'bug' is correct'.

> # @ECLASS-VARIABLE: LC_PCAT
> # @DESCRIPTION:
> # Set this to the category of the plugin, if any.
> : ${LC_PCAT:=}

Please use verbose variable names, and prefix them with eclass
filename; e.g. LEECHCRAFT_PLUGIN_CATEGORY.

And I think @DEFAULT_UNSET may be of interest too.

> 
> if [ "${LC_PCAT+x}" != "x" ]; then
>   CMAKE_USE_DIR="${S}/src/plugins/${LC_PCAT}/${PN#leechcraft-}"
> else
>   if [[ ${PN} != "leechcraft-core" ]]; then
>   CMAKE_USE_DIR="${S}/src/plugins/${PN#leechcraft-}"
>   else
>   CMAKE_USE_DIR="${S}/src"
>   fi
> fi

if-elif-else-fi.

And I think you dropped gentoo-dev@ from recipients a few mails ago.

-- 
Best regards,
Michał Górny


signature.asc
Description: PGP signature


Re: [gentoo-dev] Re: RFC: leechcraft.eclass

2011-07-22 Thread Michał Górny
On Fri, 22 Jul 2011 14:57:08 +0400
Maxim Koltsov  wrote:

> Sorry, forgot the eclass. Attaching it here...
> P.S. Email of author: 0xd34df...@gmail.com

Then you should CC him (like I did now).

> # Original author: 0xd34df00d <0xd34df...@gmail.com> and
> #Andrian Nord 
> 
> # Commiter: A.Vinogradov aka slepnoga 

Use eclassdoc.

> case ${EAPI:-0} in
> 4|3|2) ;;
>   0|1) die "EAPI not supported, bug ebuild mantainer" ;;
>   *) die "Unknown EAPI, Bug eclass maintainers." ;;
> esac

Don't mix space and tab indent.

> if [[ "${PV}" == "" ]]; then

Needs not to be quoted.

>   EGIT_PROJECT="leechcraft-${PV}"

What's the reasoning for this?

>   KEYWORDS=""

Keywords must not be set by an eclass. Package managers will complain
about this.

>   MY_P='leechcraft'

Usually, ${MY_P} stands for [alternate PN]-[PV]. MY_PN's what you're
referring to here.

>   S="${WORKDIR}/${MY_P}-${PV}"

You seem not to be using ${MY_P} anywhere else. Just put
'leechcraft-${PV}' there then, don't pollute the environment.

>   KEYWORDS="~amd64 ~x86"

As above, completely illegal.

> DEPEND="${DEPEND}
>   !www-client/leechcraft"

What's this and why is that?

> SLOT="0"

SLOTs don't fit eclasses too, unless special use. Eclass is no excuse
to avoid declaring standard variables in ebuilds.

> # @FUNCTION:leechcraft_src_unpack
> # @DESCRIPTION:
> # Standart src_unpack live ebuild
> 
> leechcraft_src_unpack() {
>   git-2_src_unpack
> 
>   cd "${S}"
> }

What's the point of redeclaring this? Inheriting git-2 should do
the same, wouldn't it?

> # @FUNCTION: leechcraft_src_configure
> # @DESCRIPTION:
> # Use for configure leechcraft source.
> # Build_type is magic :)

That's not an useful description.

> # @FUNCTION: leechcraft_src_install
> # @DESCRIPTION:
> # Call cmake-utils_src_install :)
> 
> leechcraft_src_install() {
>   cmake-utils_src_install
> }

Once again, inheriting cmake-utils should do that.

-- 
Best regards,
Michał Górny


signature.asc
Description: PGP signature