Don't print messages inside platform directives

Ryan Schmidt ryandesign at macports.org
Fri May 25 15:14:22 PDT 2007


On May 25, 2007, at 16:49, N_Ox wrote:

> Le 25 mai 07 à 23:44, Ryan Schmidt a écrit :
>
>> platform darwin 8 {}
>> pre-fetch {
>> 	if { [variant_isset darwin_8] } {
>> 		ui_error "==== ATTENTION!!!! ===="
>> 		ui_error "Sockstat is not working under darwin 8 nor tiger.  
>> Please use"
>> 		ui_error "lsof -i6/lsof -i4/lsof -U instead."
>> 		ui_error "==== ATTENTION!!!! ===="
>> 		ui_error "Please sudo port uninstall sockstat"
>> 	}
>> }
>
> there's just something bothering me with platform/variant  
> directives i've seen here and there.
> Why do you use a dummy platform and use variant_isset in the stage  
> directive?
>
> From what i've seen (and coded, of course), every stage in every  
> activated variant/platform is executed.

If you don't declare "platform darwin 8" to be *something*, even an  
empty "{}", then "[variant_isset _darwin_8]" will be false and the  
message will not be printed. Try it out. I just did.

Further observation: the output from ui_error is not printed for  
example if I do "sudo port fetch sockstat"; it needs to be ui_msg  
instead.

Taking all of my observations into account, I propose the following  
patch to the sockstat portfile. Any comments? Maintainer?



Index: Portfile
===================================================================
--- Portfile    (revision 25597)
+++ Portfile    (working copy)
@@ -19,12 +19,21 @@
use_configure  no
-platform darwin 8 {
-       ui_error "==== ATTENTION!!!! ===="
-       ui_error "Sockstat is not working under darwin 8 nor tiger.  
Please use"
-       ui_error "lsof -i6/lsof -i4/lsof -U instead."
-       ui_error "==== ATTENTION!!!! ===="
-       ui_error "Please sudo port uninstall sockstat"
+platform darwin 8 {}
+platform darwin 9 {}
+pre-fetch {
+       if { [variant_isset darwin_8] } {
+               ui_msg "Sockstat does not work under Mac OS X 10.4  
Tiger. Please use"
+               ui_msg "lsof -i6/lsof -i4/lsof -U"
+               ui_msg "instead."
+               exit 1
+       }
+       if { [variant_isset darwin_9] } {
+               ui_msg "Sockstat does not work under Mac OS X 10.5  
Leopard. Please use"
+               ui_msg "lsof -i6/lsof -i4/lsof -U"
+               ui_msg "instead."
+               exit 1
+       }
}
destroot       {





More information about the macports-dev mailing list