Skip to content
Permalink
Browse files

compiler_blacklist_versions pg: use base support

Base has its own proc for getting the version of a compiler as of 2.6,
and the result is cached across different portfiles. This does remove
support for blacklisting particular versions of apple-gcc-4.2, but
nothing in the tree uses that, and nor should it really.
  • Loading branch information...
jmroot committed Oct 9, 2019
1 parent 3d7fa24 commit 9e40a5a4b0d4b5221b55a83642762cf613863ff6
Showing with 2 additions and 41 deletions.
  1. +2 −41 _resources/port1.0/group/compiler_blacklist_versions-1.0.tcl
@@ -45,7 +45,7 @@ proc compiler_blacklist_versions._set_compiler_blacklist {option action args} {
}
set compiler [lindex ${blacklist} 0]
set comparisons [lrange ${blacklist} 1 end]
set compiler_version [compiler_blacklist_versions._get_compiler_version ${compiler}]
set compiler_version [compiler.command_line_tools_version ${compiler}]
if {[compiler_blacklist_versions._matches_all_versions ${compiler} ${comparisons}]} {
if {${compiler_version} eq ""} {
ui_debug "compiler ${compiler} blacklisted because it's not installed or it doesn't work"
@@ -76,48 +76,9 @@ proc compiler_blacklist_versions._matches_all_versions {compiler comparisons} {
}

proc compiler_blacklist_versions._version_matches {compiler comparison_operator test_version} {
set actual_version [compiler_blacklist_versions._get_compiler_version ${compiler}]
set actual_version [compiler.command_line_tools_version ${compiler}]
if {${actual_version} eq ""} {
return 1
}
return [expr [vercmp ${actual_version} ${test_version}] ${comparison_operator} 0]
}

proc compiler_blacklist_versions._get_compiler_version {compiler} {
global compiler_blacklist_versions._compiler_versions os.major xcodeversion
if {[info exists compiler_blacklist_versions._compiler_versions(${compiler})]} {
return [set compiler_blacklist_versions._compiler_versions(${compiler})]
}
switch ${compiler} {
clang {
set re {clang(?:_.*)?-([0-9.]+)}
}
llvm-gcc-4.2 {
if {${os.major} > 12 || [vercmp $xcodeversion 5.0] >= 0 || [vercmp $xcodeversion 3.1] < 0} {
return ""
}
set re {LLVM build ([0-9.]+)}
}
gcc-4.2 {
if {${os.major} > 11 || [vercmp $xcodeversion 4.2] >= 0} {
return ""
}
set re {build ([0-9.]+)}
}
gcc-4.0 -
apple-gcc-4.2 {
set re {build ([0-9.]+)}
}
default {
return -code error "don't know how to determine build number of compiler \"${compiler}\""
}
}
set cc [portconfigure::configure_get_compiler cc ${compiler}]
if {![file exists ${cc}]} return
if {[catch {regexp ${re} [exec ${cc} -v 2>@1] -> compiler_version}]} return
if {![info exists compiler_version]} {
return -code error "couldn't determine build number of compiler \"${compiler}\""
}
set compiler_blacklist_versions._compiler_versions(${compiler}) ${compiler_version}
return ${compiler_version}
}

4 comments on commit 9e40a5a

@TP75

This comment has been minimized.

Copy link
Contributor

replied Oct 9, 2019

This does remove
support for blacklisting particular versions of apple-gcc-4.2, but
nothing in the tree uses that, and nor should it really.

Unfortunately, this breaks 'GIMP2' and especially 'libvpx' builds.

DEBUG: epoch: in tree: 0 installed: 0
DEBUG: libvpx 1.8.1_0 exists in the ports tree
DEBUG: libvpx 1.8.1_0  is the latest installed
DEBUG: libvpx 1.8.1_0  is active
DEBUG: Merging existing variants '' into variants
DEBUG: new fully merged portvariants: 
DEBUG: Changing to port directory: /opt/local/var/macports/sources/rsync.macports.org/macports/release/tarballs/ports/multimedia/libvpx
DEBUG: OS darwin/18.7.0 (macOS 10.14) arch i386
DEBUG: Sourcing PortGroup compiler_blacklist_versions 1.0 from /opt/local/var/macports/sources/rsync.macports.org/macports/release/tarballs/ports/_resources/port1.0/group/compiler_blacklist_versions-1.0.tcl
DEBUG: Reading variant descriptions from /opt/local/var/macports/sources/rsync.macports.org/macports/release/tarballs/ports/_resources/port1.0/variant_descriptions.conf
DEBUG: Sourcing PortGroup muniversal 1.0 from /opt/local/var/macports/sources/rsync.macports.org/macports/release/tarballs/ports/_resources/port1.0/group/muniversal-1.0.tcl
DEBUG: compiler clang 1100.0.33.8 not blacklisted because it doesn't match {clang < 800}
DEBUG: invalid command name "compiler_blacklist_versions._get_compiler_version"
    while executing
"compiler_blacklist_versions._get_compiler_version ${configure.compiler}"
    invoked from within
"if {[string match {macports-clang-3.[5-9]} ${configure.compiler}] ||
    [string match {macports-clang-[4-9].*} ${configure.compiler}] ||
    [string ..."
    (file "Portfile" line 96)
    invoked from within
"source Portfile"
    invoked from within
"$workername eval {source Portfile}"
    (procedure "mportopen" line 50)
    invoked from within
"mportopen $porturl [array get interp_options] [array get variations]"
Error: Unable to open port: invalid command name "compiler_blacklist_versions._get_compiler_version"
Error: Follow https://guide.macports.org/#project.tickets to report a bug.

Please note the error leads to hassle in handling the 'libpvx' Prtfile with usual 'port' commands in addition to the a.m. failure.

Please accept my apologies if this comment may be incompatible with bug reports.

@pdirmeyer

This comment has been minimized.

Copy link

replied Oct 9, 2019

Also finding this problem installing gimp or gimp2:

$ sudo port install gimp
---> Computing dependencies for gimpError: Unable to execute port: invalid command name "compiler_blacklist_versions._get_compiler_version"

@TP75

This comment has been minimized.

Copy link
Contributor

replied Oct 9, 2019

see my comment at the track ticket 59226 for further details

@jmroot

This comment has been minimized.

Copy link
Member Author

replied Oct 10, 2019

Ah. Well the leading underscore indicates that that proc was not part of the API, so ports technically should not have relied on it in the first place. But let's fix them up as quickly as possible.

Please sign in to comment.
You can’t perform that action at this time.