[66771] trunk/base

Jeremy Huddleston jeremyhu at macports.org
Mon May 3 13:56:39 PDT 2010


This change causes an error when xcodeversion isn't defined in  
macports.conf

r66770 base works, r66771 causes this problem:

$ sudo port -v -p upgrade outdated
Error: Unable to upgrade port: can't read "xcodeversion": can't read  
"xcodeversion": no such variable
Error: Unable to upgrade port: can't read "xcodeversion": can't read  
"xcodeversion": no such variable
...

The error is coming from portutil.tcl's _check_xcode_version


On Apr 22, 2010, at 12:20, jmr at macports.org wrote:

> Revision: 66771
>          http://trac.macports.org/changeset/66771
> Author:   jmr at macports.org
> Date:     2010-04-22 12:20:19 -0700 (Thu, 22 Apr 2010)
> Log Message:
> -----------
> determine xcode version accurately, check when running appropriate  
> targets, warn or error out when old (#12794); remove pbx references  
> where possible; remove nonexistent destroot.type from portfile.7
>
> Modified Paths:
> --------------
>    trunk/base/doc/portfile.7
>    trunk/base/src/macports1.0/macports.tcl
>    trunk/base/src/port1.0/portbuild.tcl
>    trunk/base/src/port1.0/portutil.tcl
>
> Modified: trunk/base/doc/portfile.7
> ===================================================================
> --- trunk/base/doc/portfile.7	2010-04-22 18:54:47 UTC (rev 66770)
> +++ trunk/base/doc/portfile.7	2010-04-22 19:20:19 UTC (rev 66771)
> @@ -1188,15 +1188,18 @@
> .Em make
> .br
> .Sy Example:
> -.Dl build.cmd pbxbuild
> +.Dl build.cmd scons
> .It Ic build.type
> -Defines which 'make' is required, either 'gnu' or 'bsd'.
> +Defines which 'make' is required, either 'gnu' or 'bsd'. Can also  
> choose
> +'xcode' (or the deprecated synonym 'pbx'), however you should  
> generally use
> +the xcode PortGroup rather than setting this directly.
> Sets
> .Ic build.cmd
> to either
> -.Pa gnumake
> -or
> +.Pa gnumake,
> .Pa bsdmake
> +or
> +.Pa xcodebuild
> accordingly.
> .br
> .Sy Type:
> @@ -1235,25 +1238,7 @@
> .Em ${build.cmd}
> .br
> .Sy Example:
> -.Dl destroot.cmd pbxbuild
> -.It Ic destroot.type
> -Defines which 'make' is required, either 'gnu' or 'bsd'.
> -Sets
> -.Ic destroot.cmd
> -to either
> -.Pa gnumake
> -or
> -.Pa bsdmake
> -accordingly.
> -.br
> -.Sy Type:
> -.Em optional
> -.br
> -.Sy Default:
> -.Em ${build.type}
> -.br
> -.Sy Example:
> -.Dl destroot.type gnu
> +.Dl destroot.cmd scons
> .It Ic destroot.destdir
> Arguments passed to
> .Ic destroot.cmd
>
> Modified: trunk/base/src/macports1.0/macports.tcl
> ===================================================================
> --- trunk/base/src/macports1.0/macports.tcl	2010-04-22 18:54:47 UTC  
> (rev 66770)
> +++ trunk/base/src/macports1.0/macports.tcl	2010-04-22 19:20:19 UTC  
> (rev 66771)
> @@ -356,10 +356,27 @@
>     if {[catch {set xcodebuild [binaryInPath "xcodebuild"]}] == 0} {
>         if {![info exists xcodeversion]} {
>             # Determine xcode version (<= 2.0 or 2.1)
> -            if {[catch {set xcodebuildversion [exec xcodebuild - 
> version]}] == 0} {
> -                if {[regexp "DevToolsCore-(.*); DevToolsSupport- 
> (.*)" $xcodebuildversion devtoolscore_v devtoolssupport_v] == 1} {
> -                    if {$devtoolscore_v >= 620.0 &&  
> $devtoolssupport_v >= 610.0} {
> -                        # for now, we don't need to distinguish 2.1  
> from 2.1 or higher.
> +            if {[catch {set xcodebuildversion [exec $xcodebuild - 
> version]}] == 0} {
> +                if {[regexp {Xcode ([0-9.]+)} $xcodebuildversion -  
> xcode_v] == 1} {
> +                    set macports::xcodeversion $xcode_v
> +                } elseif {[regexp "DevToolsCore-(.*);"  
> $xcodebuildversion - devtoolscore_v] == 1} {
> +                    if {$devtoolscore_v >= 921.0} {
> +                        set macports::xcodeversion "3.0"
> +                    } elseif {$devtoolscore_v >= 798.0} {
> +                        set macports::xcodeversion "2.5"
> +                    } elseif {$devtoolscore_v >= 762.0} {
> +                        set macports::xcodeversion "2.4.1"
> +                    } elseif {$devtoolscore_v >= 757.0} {
> +                        set macports::xcodeversion "2.4"
> +                    } elseif {$devtoolscore_v > 650.0} {
> +                        # XXX find actual version corresponding to  
> 2.3
> +                        set macports::xcodeversion "2.3"
> +                    } elseif {$devtoolscore_v >= 650.0} {
> +                        set macports::xcodeversion "2.2.1"
> +                    } elseif {$devtoolscore_v > 620.0} {
> +                        # XXX find actual version corresponding to  
> 2.2
> +                        set macports::xcodeversion "2.2"
> +                    } elseif {$devtoolscore_v >= 620.0} {
>                         set macports::xcodeversion "2.1"
>                     } else {
>                         set macports::xcodeversion "2.0orlower"
> @@ -367,21 +384,11 @@
>                 } else {
>                     set macports::xcodeversion "2.0orlower"
>                 }
> -            } else {
> -                set macports::xcodeversion "2.0orlower"
>             }
>         }
> -
>         if {![info exists xcodebuildcmd]} {
> -            set macports::xcodebuildcmd "xcodebuild"
> +            set macports::xcodebuildcmd "$xcodebuild"
>         }
> -    } elseif {[catch {set pbxbuild [binaryInPath "pbxbuild"]}] ==  
> 0} {
> -        if {![info exists xcodeversion]} {
> -            set macports::xcodeversion "pb"
> -        }
> -        if {![info exists xcodebuildcmd]} {
> -            set macports::xcodebuildcmd "pbxbuild"
> -        }
>     } else {
>         if {![info exists xcodeversion]} {
>             set macports::xcodeversion "none"
> @@ -1532,6 +1539,11 @@
>         || $target == "rpm" || $target == "dpkg"
>         || $target == "srpm"|| $target == "portpkg" } {
>
> +        # possibly warn or error out depending on how old xcode is
> +        if {[$workername eval _check_xcode_version] != 0} {
> +            return 1
> +        }
> +
>         # upgrade dependencies that are already installed
>         if {![macports::global_option_isset ports_nodeps]} {
>             macports::_upgrade_mport_deps $mport $target
>
> Modified: trunk/base/src/port1.0/portbuild.tcl
> ===================================================================
> --- trunk/base/src/port1.0/portbuild.tcl	2010-04-22 18:54:47 UTC  
> (rev 66770)
> +++ trunk/base/src/port1.0/portbuild.tcl	2010-04-22 19:20:19 UTC  
> (rev 66771)
> @@ -82,17 +82,17 @@
>                 return [findBinary gmake  
> $portutil::autoconf::gnumake_path]
>             }
>         }
> -        pbx {
> +        pbx -
> +        xcode {
>             if {[option os.platform] != "darwin"} {
> -                return -code error "[format [msgcat::mc "This port  
> requires 'pbxbuild/xcodebuild', which is not available on %s."]  
> [option os.platform]]"
> +                return -code error "[format [msgcat::mc "This port  
> requires 'xcodebuild', which is not available on %s."] [option  
> os.platform]]"
>             }
>
> -            if {[catch {set xcodebuild [binaryInPath xcodebuild]}]  
> == 0} {
> -                return $xcodebuild
> -            } elseif {[catch {set pbxbuild [binaryInPath  
> pbxbuild]}] == 0} {
> -                return $pbxbuild
> +            global xcodebuildcmd
> +            if {$xcodebuildcmd != "none"} {
> +                return $xcodebuildcmd
>             } else {
> -                return -code error "Neither pbxbuild nor xcodebuild  
> were found on this system!"
> +                return -code error "xcodebuild was not found on  
> this system!"
>             }
>         }
>         default {
>
> Modified: trunk/base/src/port1.0/portutil.tcl
> ===================================================================
> --- trunk/base/src/port1.0/portutil.tcl	2010-04-22 18:54:47 UTC (rev  
> 66770)
> +++ trunk/base/src/port1.0/portutil.tcl	2010-04-22 19:20:19 UTC (rev  
> 66771)
> @@ -2568,3 +2568,37 @@
>         return ${os.arch}
>     }
> }
> +
> +# check if the installed xcode version is new enough
> +proc _check_xcode_version {} {
> +    global os.subplatform macosx_version xcodeversion
> +
> +    if {[info exists os.subplatform] && ${os.subplatform} ==  
> "macosx"} {
> +        switch $macosx_version {
> +            10.4 {
> +                set min 2.0
> +                set ok 2.4.1
> +                set rec 2.5
> +            }
> +            10.5 {
> +                set min 3.0
> +                set ok 3.1
> +                set rec 3.1.4
> +            }
> +            default {
> +                set min 3.2
> +                set ok 3.2
> +                set rec 3.2.2
> +            }
> +        }
> +        if {$xcodeversion == "none"} {
> +            ui_warn "Xcode does not appear to be installed; most  
> ports will likely fail to build."
> +        } elseif {[rpm-vercomp $xcodeversion $min] < 0} {
> +            ui_error "The installed version of Xcode ($ 
> {xcodeversion}) is too old to use on the installed OS version.  
> Version $rec or later is recommended on Mac OS X ${macosx_version}."
> +            return 1
> +        } elseif {[rpm-vercomp $xcodeversion $ok] < 0} {
> +            ui_warn "The installed version of Xcode ($ 
> {xcodeversion}) is known to cause problems. Version $rec or later is  
> recommended on Mac OS X ${macosx_version}."
> +        }
> +    }
> +    return 0
> +}
> _______________________________________________
> macports-changes mailing list
> macports-changes at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macports-changes

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5820 bytes
Desc: not available
URL: <http://lists.macosforge.org/pipermail/macports-dev/attachments/20100503/e50ff68f/attachment.bin>


More information about the macports-dev mailing list