public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] Re: [gentoo-commits] gentoo-x86 commit in www-apps/dspam-web: dspam-web-3.8.0.ebuild ChangeLog
       [not found] <E1IZuje-0005z7-Vf@stork.gentoo.org>
@ 2007-09-25  0:39 ` Donnie Berkholz
  2007-09-25  2:47   ` Mike Frysinger
  0 siblings, 1 reply; 3+ messages in thread
From: Donnie Berkholz @ 2007-09-25  0:39 UTC (permalink / raw
  To: gentoo-dev; +Cc: mrness

On 20:40 Mon 24 Sep     , Alin Nastac (mrness) wrote:
> mrness      07/09/24 20:40:54
> 
>   Modified:             dspam-web-3.8.0.ebuild ChangeLog
>   Log:
>   Die in pkg_setup if dev-perl/GD has been installed without png USE flag (#193662). Update patches tarball to match the one used in latest mail-filter/dspam version.
>   (Portage version: 2.1.3.9)

> -	mirror://gentoo/dspam-${PV}-patches-20070624.tar.gz"
> +	mirror://gentoo/dspam-${PV}-patches-20070909.tar.gz"

It might increase readability and decrease maintenance to pull this date 
out into a separate variable.

> +	local use_errors=0
> +	if built_with_use "mail-filter/dspam" user-homedirs; then
> +		echo
> +		eerror "The DSPAM web interface requires that mail-filter/dspam be installed without user-homedirs USE flag."
>  		eerror "Please disable this flag and re-emerge dspam."
> -		die "Incompatible mail-filter/dspam installation"
> +		use_errors=$[${use_errors} + 1]
> +	fi
> +	if ! built_with_use "dev-perl/GD" png; then
> +		echo
> +		eerror "The DSPAM web interface requires that dev-perl/GD be installed with png USE flag."
> +		eerror "Please enable this flag and re-emerge GD."
> +		use_errors=$[${use_errors} + 1]
>  	fi
> +	[ ${use_errors} -gt 0 ] && die "Dependency installed with incompatible USE flags"

You could use C-style syntax here:

(( use_errors++ ))

I find it a bit more readable.

Thanks,
Donnie
-- 
gentoo-dev@gentoo.org mailing list



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

* Re: [gentoo-dev] Re: [gentoo-commits] gentoo-x86 commit in www-apps/dspam-web: dspam-web-3.8.0.ebuild ChangeLog
  2007-09-25  0:39 ` [gentoo-dev] Re: [gentoo-commits] gentoo-x86 commit in www-apps/dspam-web: dspam-web-3.8.0.ebuild ChangeLog Donnie Berkholz
@ 2007-09-25  2:47   ` Mike Frysinger
  2007-09-26  8:33     ` [gentoo-dev] " Steve Long
  0 siblings, 1 reply; 3+ messages in thread
From: Mike Frysinger @ 2007-09-25  2:47 UTC (permalink / raw
  To: gentoo-dev; +Cc: Donnie Berkholz, mrness

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

On Monday 24 September 2007, Donnie Berkholz wrote:
> On 20:40 Mon 24 Sep     , Alin Nastac (mrness) wrote:
> >   Modified:             dspam-web-3.8.0.ebuild ChangeLog
> >
> > +	local use_errors=0
> > +	if built_with_use "mail-filter/dspam" user-homedirs; then
> > +		echo
> > +		eerror "The DSPAM web interface requires that mail-filter/dspam be
> > installed without user-homedirs USE flag." eerror "Please disable this
> > flag and re-emerge dspam."
> > -		die "Incompatible mail-filter/dspam installation"
> > +		use_errors=$[${use_errors} + 1]
> > +	fi
> > +	if ! built_with_use "dev-perl/GD" png; then
> > +		echo
> > +		eerror "The DSPAM web interface requires that dev-perl/GD be installed
> > with png USE flag." +		eerror "Please enable this flag and re-emerge GD."
> > +		use_errors=$[${use_errors} + 1]
> >  	fi
> > +	[ ${use_errors} -gt 0 ] && die "Dependency installed with incompatible
> > USE flags"
>
> You could use C-style syntax here:
>
> (( use_errors++ ))
>
> I find it a bit more readable.

i like to get anal and use ((++use_errors))

then again, it may also be more readable like so:
use_errors=false
if ... ; then
	...
	use_errors=true
fi
if ... ; then
	...
	use_errors=true
fi
${use_errors} && die "..."
-mike

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

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

* [gentoo-dev]  Re: Re: [gentoo-commits] gentoo-x86 commit in www-apps/dspam-web: dspam-web-3.8.0.ebuild ChangeLog
  2007-09-25  2:47   ` Mike Frysinger
@ 2007-09-26  8:33     ` Steve Long
  0 siblings, 0 replies; 3+ messages in thread
From: Steve Long @ 2007-09-26  8:33 UTC (permalink / raw
  To: gentoo-dev

Mike Frysinger wrote:

> On Monday 24 September 2007, Donnie Berkholz wrote:
>>
>> You could use C-style syntax here:
>>
>> (( use_errors++ ))
>>
>> I find it a bit more readable.
> 
> i like to get anal and use ((++use_errors))
> 
> then again, it may also be more readable like so:
> use_errors=false
> if ... ; then
> ...
> use_errors=true
> fi
> if ... ; then
> ...
> use_errors=true
> fi
> ${use_errors} && die "..."
> -mike

Integer arithmetic is generally quicker:
((use_errors++)) [or: use_errors=1 ]
..
((use_errors)) && die 'meh'
 -- although true and false are builtins in this case.
For stuff like for ((i=0;i<n;i++)) arithmetical context[1] is significantly
quicker than for i in {0..15} say, and more flexible (variable bound and
step-size, if desired.)

The boolean test on an integer eg ((use_errors)) is a metaphor I use a lot,
eg: ((quiet)) || echo oops; ((verbose>1)) && echo blah

It's handy as unset vars test to false, and also as the usual boolean values
apply, ie 0 is false, anything else is true. (Outside this context 0 is
true [success from cmd] and anything else is false [error code].) And ofc,
you don't need to put $ in front of your standard variables in this
context.

[1] http://wooledge.org/mywiki/ArithmeticExpression


-- 
gentoo-dev@gentoo.org mailing list



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

end of thread, other threads:[~2007-09-26  8:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <E1IZuje-0005z7-Vf@stork.gentoo.org>
2007-09-25  0:39 ` [gentoo-dev] Re: [gentoo-commits] gentoo-x86 commit in www-apps/dspam-web: dspam-web-3.8.0.ebuild ChangeLog Donnie Berkholz
2007-09-25  2:47   ` Mike Frysinger
2007-09-26  8:33     ` [gentoo-dev] " Steve Long

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