public inbox for gentoo-devhelp@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-devhelp]  Calling the default implementation of a function
@ 2009-10-31 15:47 Nikos Chantziaras
  2009-10-31 17:46 ` Thomas Sachau
  2009-10-31 21:37 ` [gentoo-devhelp] " Mike Frysinger
  0 siblings, 2 replies; 8+ messages in thread
From: Nikos Chantziaras @ 2009-10-31 15:47 UTC (permalink / raw
  To: gentoo-devhelp

Is there a way to call the default implementation of a function inside 
the ebuild-specified one?

What I mean is:

src_prepare() {
	if [ "$PV" == "9999" ]; then
		./autogen.sh
	else
		src_prepare() # Default from eclass.
	fi
}

Possible?




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [gentoo-devhelp]  Calling the default implementation of a function
  2009-10-31 15:47 [gentoo-devhelp] Calling the default implementation of a function Nikos Chantziaras
@ 2009-10-31 17:46 ` Thomas Sachau
  2009-10-31 18:06   ` [gentoo-devhelp] " Nikos Chantziaras
  2009-10-31 21:37 ` [gentoo-devhelp] " Mike Frysinger
  1 sibling, 1 reply; 8+ messages in thread
From: Thomas Sachau @ 2009-10-31 17:46 UTC (permalink / raw
  To: Nikos Chantziaras; +Cc: gentoo-devhelp

[-- Attachment #1: Type: text/plain, Size: 535 bytes --]

Nikos Chantziaras schrieb:
> Is there a way to call the default implementation of a function inside
> the ebuild-specified one?
> 
> What I mean is:
> 
> src_prepare() {
>     if [ "$PV" == "9999" ]; then
>         ./autogen.sh
>     else
>         src_prepare() # Default from eclass.
>     fi
> }
> 
> Possible?
> 
> 
> 

1. i suggest to use eautoreconf instead of those homegrown scripts.

2. <eclass>_src_prepare will call the src_prepare phase from <eclass>

-- 
Thomas Sachau

Gentoo Linux Developer


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 316 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [gentoo-devhelp]  Re: Calling the default implementation of a function
  2009-10-31 17:46 ` Thomas Sachau
@ 2009-10-31 18:06   ` Nikos Chantziaras
  2009-10-31 18:22     ` Thomas Sachau
  0 siblings, 1 reply; 8+ messages in thread
From: Nikos Chantziaras @ 2009-10-31 18:06 UTC (permalink / raw
  To: gentoo-devhelp

On 10/31/2009 07:46 PM, Thomas Sachau wrote:
> Nikos Chantziaras schrieb:
>> Is there a way to call the default implementation of a function inside
>> the ebuild-specified one?
>>
>> What I mean is:
>>
>> src_prepare() {
>>      if [ "$PV" == "9999" ]; then
>>          ./autogen.sh
>>      else
>>          src_prepare() # Default from eclass.
>>      fi
>> }
>>
>> Possible?
>>
>>
>>
>
> 1. i suggest to use eautoreconf instead of those homegrown scripts.

I know, but it doesn't work in this case.  In short: doesn't work :P  In 
long: This is a dual ebuild (can be used as live as well as regular) for 
app-misc/mc, and mc really needs its own autogen.sh; it does weird stuff 
in there, much more than what eautoreconf does.


> 2.<eclass>_src_prepare will call the src_prepare phase from<eclass>

Thanks.  What's the default eclass of ebuilds that don't have any 
"inherit" line in them?




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [gentoo-devhelp]  Re: Calling the default implementation of a function
  2009-10-31 18:06   ` [gentoo-devhelp] " Nikos Chantziaras
@ 2009-10-31 18:22     ` Thomas Sachau
  0 siblings, 0 replies; 8+ messages in thread
From: Thomas Sachau @ 2009-10-31 18:22 UTC (permalink / raw
  To: gentoo-devhelp


[-- Attachment #1.1: Type: text/plain, Size: 1250 bytes --]

Nikos Chantziaras schrieb:
> On 10/31/2009 07:46 PM, Thomas Sachau wrote:
>> Nikos Chantziaras schrieb:
>>> Is there a way to call the default implementation of a function inside
>>> the ebuild-specified one?
>>>
>>> What I mean is:
>>>
>>> src_prepare() {
>>>      if [ "$PV" == "9999" ]; then
>>>          ./autogen.sh
>>>      else
>>>          src_prepare() # Default from eclass.
>>>      fi
>>> }
>>>
>>> Possible?
>>>
>>>
>>>
>>
>> 1. i suggest to use eautoreconf instead of those homegrown scripts.
> 
> I know, but it doesn't work in this case.  In short: doesn't work :P  In
> long: This is a dual ebuild (can be used as live as well as regular) for
> app-misc/mc, and mc really needs its own autogen.sh; it does weird stuff
> in there, much more than what eautoreconf does.
> 
> 
>> 2.<eclass>_src_prepare will call the src_prepare phase from<eclass>
> 
> Thanks.  What's the default eclass of ebuilds that don't have any
> "inherit" line in them?

No inherit => no eclass, simple as that ;-)

In that case, you can call the default function with just "default". But there is no need for that
for the default src_prepare since its empty by default.

-- 
Thomas Sachau

Gentoo Linux Developer



[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 317 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 316 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [gentoo-devhelp]  Calling the default implementation of a function
  2009-10-31 15:47 [gentoo-devhelp] Calling the default implementation of a function Nikos Chantziaras
  2009-10-31 17:46 ` Thomas Sachau
@ 2009-10-31 21:37 ` Mike Frysinger
  2009-11-01 19:34   ` [gentoo-devhelp] " Nikos Chantziaras
  1 sibling, 1 reply; 8+ messages in thread
From: Mike Frysinger @ 2009-10-31 21:37 UTC (permalink / raw
  To: gentoo-devhelp; +Cc: Nikos Chantziaras

[-- Attachment #1: Type: Text/Plain, Size: 458 bytes --]

On Saturday 31 October 2009 11:47:54 Nikos Chantziaras wrote:
> Is there a way to call the default implementation of a function inside
> the ebuild-specified one?
> 
> What I mean is:
> 
> src_prepare() {
> 	if [ "$PV" == "9999" ]; then
> 		./autogen.sh
> 	else
> 		src_prepare() # Default from eclass.
> 	fi
> }
> 
> Possible?

better to wrap the func definition:
if [[ ${PV} == "9999" ]] ; then
src_prepare() { eautoreconf; }
fi
-mike

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [gentoo-devhelp] Re: Calling the default implementation of a function
  2009-10-31 21:37 ` [gentoo-devhelp] " Mike Frysinger
@ 2009-11-01 19:34   ` Nikos Chantziaras
  2009-11-01 20:03     ` Mike Frysinger
  0 siblings, 1 reply; 8+ messages in thread
From: Nikos Chantziaras @ 2009-11-01 19:34 UTC (permalink / raw
  To: Mike Frysinger; +Cc: gentoo-devhelp

On 10/31/2009 11:37 PM, Mike Frysinger wrote:
> On Saturday 31 October 2009 11:47:54 Nikos Chantziaras wrote:
>> Is there a way to call the default implementation of a function inside
>> the ebuild-specified one?
>>
>> What I mean is:
>>
>> src_prepare() {
>> 	if [ "$PV" == "9999" ]; then
>> 		./autogen.sh
>> 	else
>> 		src_prepare() # Default from eclass.
>> 	fi
>> }
>>
>> Possible?
>
> better to wrap the func definition:
> if [[ ${PV} == "9999" ]] ; then
> src_prepare() { eautoreconf; }
> fi

/usr/local/portage/app-misc/mc/mc-9999.ebuild: line 49: syntax error 
near unexpected token `fi'
/usr/local/portage/app-misc/mc/mc-9999.ebuild: line 49: `fi'
  * ERROR: app-misc/mc-9999 failed:
  *   error sourcing ebuild



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [gentoo-devhelp] Re: Calling the default implementation of a function
  2009-11-01 19:34   ` [gentoo-devhelp] " Nikos Chantziaras
@ 2009-11-01 20:03     ` Mike Frysinger
  2009-11-01 20:17       ` Nikos Chantziaras
  0 siblings, 1 reply; 8+ messages in thread
From: Mike Frysinger @ 2009-11-01 20:03 UTC (permalink / raw
  To: gentoo-devhelp; +Cc: Nikos Chantziaras

[-- Attachment #1: Type: Text/Plain, Size: 1077 bytes --]

On Sunday 01 November 2009 14:34:04 Nikos Chantziaras wrote:
> On 10/31/2009 11:37 PM, Mike Frysinger wrote:
> > On Saturday 31 October 2009 11:47:54 Nikos Chantziaras wrote:
> >> Is there a way to call the default implementation of a function inside
> >> the ebuild-specified one?
> >>
> >> What I mean is:
> >>
> >> src_prepare() {
> >> 	if [ "$PV" == "9999" ]; then
> >> 		./autogen.sh
> >> 	else
> >> 		src_prepare() # Default from eclass.
> >> 	fi
> >> }
> >>
> >> Possible?
> >
> > better to wrap the func definition:
> > if [[ ${PV} == "9999" ]] ; then
> > src_prepare() { eautoreconf; }
> > fi
> 
> /usr/local/portage/app-misc/mc/mc-9999.ebuild: line 49: syntax error
> near unexpected token `fi'
> /usr/local/portage/app-misc/mc/mc-9999.ebuild: line 49: `fi'
>   * ERROR: app-misc/mc-9999 failed:
>   *   error sourcing ebuild

works fine for me.  either you copied it wrong, or your ebuild has an error in 
it unrelated to this, or you're using a bash version older than stable which 
has a parsing bug and thus i dont care ;).
-mike

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [gentoo-devhelp] Re: Calling the default implementation of a function
  2009-11-01 20:03     ` Mike Frysinger
@ 2009-11-01 20:17       ` Nikos Chantziaras
  0 siblings, 0 replies; 8+ messages in thread
From: Nikos Chantziaras @ 2009-11-01 20:17 UTC (permalink / raw
  To: Mike Frysinger; +Cc: gentoo-devhelp

On 11/01/2009 10:03 PM, Mike Frysinger wrote:
> On Sunday 01 November 2009 14:34:04 Nikos Chantziaras wrote:
>> On 10/31/2009 11:37 PM, Mike Frysinger wrote:
>>> On Saturday 31 October 2009 11:47:54 Nikos Chantziaras wrote:
>>>> Is there a way to call the default implementation of a function inside
>>>> the ebuild-specified one?
>>>>
>>>> What I mean is:
>>>>
>>>> src_prepare() {
>>>> 	if [ "$PV" == "9999" ]; then
>>>> 		./autogen.sh
>>>> 	else
>>>> 		src_prepare() # Default from eclass.
>>>> 	fi
>>>> }
>>>>
>>>> Possible?
>>>
>>> better to wrap the func definition:
>>> if [[ ${PV} == "9999" ]] ; then
>>> src_prepare() { eautoreconf; }
>>> fi
>>
>> /usr/local/portage/app-misc/mc/mc-9999.ebuild: line 49: syntax error
>> near unexpected token `fi'
>> /usr/local/portage/app-misc/mc/mc-9999.ebuild: line 49: `fi'
>>    * ERROR: app-misc/mc-9999 failed:
>>    *   error sourcing ebuild
>
> works fine for me.  either you copied it wrong, or your ebuild has an error in
> it unrelated to this, or you're using a bash version older than stable which
> has a parsing bug and thus i dont care ;).
> -mike

Correct, I forgot the semicolon after ./autogen.sh.  Thanks for this 
tip, didn't know it was possible (I'm not that fluid in Bash, my mind is 
too much C-oriented :P)



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2009-11-01 20:17 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-31 15:47 [gentoo-devhelp] Calling the default implementation of a function Nikos Chantziaras
2009-10-31 17:46 ` Thomas Sachau
2009-10-31 18:06   ` [gentoo-devhelp] " Nikos Chantziaras
2009-10-31 18:22     ` Thomas Sachau
2009-10-31 21:37 ` [gentoo-devhelp] " Mike Frysinger
2009-11-01 19:34   ` [gentoo-devhelp] " Nikos Chantziaras
2009-11-01 20:03     ` Mike Frysinger
2009-11-01 20:17       ` Nikos Chantziaras

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox