Don't print messages inside platform directives

Ryan Schmidt ryandesign at macports.org
Fri May 25 16:18:55 PDT 2007


On May 25, 2007, at 16:44, Ryan Schmidt wrote:

> sysutils/sockstat does this:
>
> 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"
> }
>
> I don't think we should be outputting any messages of any kind in  
> platform variants which MacPorts auto-selects, because they get  
> executed at all sorts of times where outputting messages is not  
> appropriate. Instead, I believe the port should do something like  
> this if it wants to output a message:
>
> 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"
> 	}
> }
>
> I'm also concerned that the port would output a message saying that  
> the port is not compatible with Tiger, yet not prevent installation  
> on Tiger. It should exit after printing that message. Well, the  
> message should be reworded too, since it's not a forgone conclusion  
> that the user already has sockstat installed at the point that they  
> see the message. The user may be trying to install it for the first  
> time, in which case an uninstall is not necessary or possible.

Several other ports have the same problem and should be corrected.  
Looks like this mechanism is really only used to say to the user that  
a port is not supported on a particular OS version. There's also a  
few ports where we need to do similar for ports that only work on  
PowerPC or Intel but not the other. Do we have a better way that we  
could handle this at the MacPorts level -- a way to indicate which  
kinds of darwin platforms a port works with? I know we can already  
say "platforms darwin" but can we say something like "platforms  
darwin_8_ppc"?

Maybe we even need to mechanisms: one to specify OS versions / CPU  
architectures on which the port works, and another to specify OS  
versions / CPU architectures where the port does not work, and the  
port could choose one or the other as appropriate. For example, a  
port that works on 10.2 but not 10.3 or later would choose the former  
and would specify only 10.2. A port that works with 10.4 or later  
would use the latter and would specify that 10.2 and 10.3 don't work.  
And MacPorts would have friendly and consistent messages to the user.


gwright: ghc:

platform darwin 6 {
		ui_msg "GHC is not supported on Jaguar (OS X 10.2.x)"
		exit 1
	}


mww: hugs98:

platform darwin 6 { ui_msg "Hugs is not supported on Jaguar (10.2.x).  
Sorry."
		    exit 0
		}


nomaintainer: clips:

platform darwin 6 {
		ui_msg "clisp is not supported on Jaguar (OS X 10.2.x)"
		exit 1
		}


nomaintainer: cln:

platform darwin 6 {
		ui_msg "cln is not supported on Jaguar (OS X 10.2.x)"
		exit 1
		}

platform darwin 7 {
		ui_msg "cln is not supported on Panther (OS X 10.3.x)"
		exit 1
		}


nomaintainer: kdelibs3:

platform darwin 6 {
		ui_msg "Sorry, your platform is no longer supported."
		exit 1
}


nomaintainer: qt3:

platform darwin 6 {
		ui_msg "Sorry, your platform is no longer supported."
		exit 1
}


nomaintainer: xloops:

platform darwin 6 {
		ui_msg "xloops is not supported on Jaguar (OS X 10.2.x)"
		exit 1
}




More information about the macports-dev mailing list