Opened 17 years ago

Closed 17 years ago

Last modified 16 years ago

#12302 closed enhancement (fixed)

RFE: "platform" info target

Reported by: afb@… Owned by: macports-tickets@…
Priority: Normal Milestone: MacPorts 1.7.0
Component: base Version: 1.6.0
Keywords: Cc: jmpalacios (Juan Manuel Palacios)
Port:

Description

Similar to "port version", a "port platform" target to tell the current platform.

$ port platform
Platform: darwin 8 i386

Good for knowing what to put into Portfile platform variants, or for bug reports ?

Change History (9)

comment:1 Changed 17 years ago by afb@…

Not sure about the actual implementation, my Tcl skills failed me so I just hacked it:

proc action_platform { action portlist opts } {
#	global os.platform os.major os.arch 
#	puts "Platform: ${os.platform} ${os.major} ${os.arch}"
#	return 0

	global tcl_platform
	set os $tcl_platform(os)
	set platform [string tolower $os]
	set version $tcl_platform(osVersion)
	regexp {([0-9]*)[0-9\.]?} $version match major
	set arch $tcl_platform(machine)
	if {$arch == "Power Macintosh"} {
		set arch "powerpc"
	}
	if {$arch == "i686" || $arch == "x86"} {
		set arch "i386"
	}
	puts "Platform: $platform $major $arch"
	return 0
}

comment:2 Changed 17 years ago by jmpalacios (Juan Manuel Palacios)

Milestone: Needs developer reviewMacPorts base bugs

Milestone Needs developer review deleted

comment:3 Changed 17 years ago by nox@…

Milestone: MacPorts base bugsMacPorts base enhancements
Priority: ExpectedNormal
Summary: "platform" info targetRFE: "platform" info target

comment:4 Changed 17 years ago by afb@…

Version: 1.5.0

comment:5 Changed 17 years ago by afb@…

Cc: jmpp@… added

Did you have any feedback on this ? (especially changing i686 to i386)

comment:6 Changed 17 years ago by afb@…

Added i386 normalization in r28635...

comment:7 Changed 17 years ago by afb@…

Version: 1.6.0

Cleaned up version:

proc action_platform { action portlist opts } {
#	global os.platform os.major os.arch 
	global tcl_platform
	set os_platform [string tolower $tcl_platform(os)]
	set os_version $tcl_platform(osVersion)
	set os_arch $tcl_platform(machine)
	if {$os_arch == "Power Macintosh"} { set os_arch "powerpc" }
	if {$os_arch == "i586" || $os_arch == "i686"} { set os_arch "i386" }
	set os_major [lindex [split $tcl_platform(osVersion) .] 0]
#	puts "Platform: ${os.platform} ${os.major} ${os.arch}"
	puts "Platform: ${os_platform} ${os_major} ${os_arch}"
	return 0
}

comment:8 Changed 17 years ago by afb@…

Resolution: fixed
Status: newclosed

Added, r32724.

comment:9 Changed 16 years ago by blb@…

Milestone: MacPorts base enhancementsMacPorts 1.7.0
Note: See TracTickets for help on using tickets.