New Ticket     Tickets     Wiki     Browse Source     Timeline     Roadmap     Ticket Reports     Search

Changeset 79647


Ignore:
Timestamp:
06/22/11 06:14:06 (4 years ago)
Author:
cal@…
Message:

rev-upgrade:

  • match all ppc architectures by using -glob option to switch
  • strip header from otool output where not needed using -X switch
  • search for library install name obtained by otool -D in otool -L output (this slows down the whole thing considerably)
  • optimize looping through otool output by stopping after having found the correct line
  • distinguish between missing file and missing architecture in existing file using a call to [file exists]
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/gsoc11-rev-upgrade/base/src/macports1.0/macports.tcl

    r79637 r79647  
    35613561            } 
    35623562            if {1 == [regexp -nocase {\(architecture ([^\s]+)\)} $otool_line match arch]} { 
    3563                 switch $arch { 
     3563                switch -glob $arch { 
    35643564                    x86_64 {} 
    35653565                    i386 {} 
    3566                     # todo: what are the correct string reported by otool -arch all -L for the PPC archs? 
     3566                    ppc* {} 
    35673567                    default { 
    35683568                        ui_warn "Unknown architecture $arch" 
     
    35813581                } 
    35823582                ui_debug "Linked against: $file, architecture $arch, version $curr_version, compatibility version $comp_version" 
    3583                 set lib_found false 
    3584                 if {[catch {set lib_otool_output [exec /usr/bin/otool -arch $arch -L $file]}] == 0} { 
    3585                     set lib_otool_lines [split $lib_otool_output "\n"] 
    3586                     foreach lib_otool_line $lib_otool_lines { 
    3587                         if {1 == [regexp -nocase {^\t([^\s]+) \(compatibility version ([^,]+), current version ([^)]+)\)} $lib_otool_line match lib_file lib_comp_version lib_curr_version]} { 
    3588                             if {$file == $lib_file} { 
    3589                                 set lib_found true 
    3590                                 if {$curr_version != $lib_curr_version} { 
    3591                                     if {$comp_version != $lib_comp_version} { 
    3592                                         ui_warn "Incompatible library version of $file: Expected $comp_version, but $lib_comp_version is installed!" 
     3583                if {[file exists $file]} { 
     3584                    set lib_found false 
     3585                    if {[catch {set lib_install_name [exec /usr/bin/otool -arch $arch -X -D $file]}] == 0} { 
     3586                        if {[catch {set lib_otool_output [exec /usr/bin/otool -arch $arch -X -L $file]}] == 0} { 
     3587                            set lib_otool_lines [split $lib_otool_output "\n"] 
     3588                            foreach lib_otool_line $lib_otool_lines { 
     3589                                if {1 == [regexp -nocase {^\t([^\s]+) \(compatibility version ([^,]+), current version ([^)]+)\)} $lib_otool_line match lib_file lib_comp_version lib_curr_version]} { 
     3590                                    # call with -D to get install name, search for install name in -L output 
     3591                                    if {$lib_install_name == $lib_file} { 
     3592                                        set lib_found true 
     3593                                        if {$curr_version != $lib_curr_version} { 
     3594                                            if {$comp_version != $lib_comp_version} { 
     3595                                                ui_warn "Incompatible library version of $file: Expected $comp_version, but $lib_comp_version is installed!" 
     3596                                            } 
     3597                                        } 
     3598                                        break; 
    35933599                                    } 
    35943600                                } 
     
    35963602                        } 
    35973603                    } 
    3598                 } 
    3599                 if {$lib_found == false} { 
    3600                     ui_warn "Missing dependency $file!" 
     3604                    if {$lib_found == false} { 
     3605                        ui_warn "Missing architecture in file: $arch in $file!" 
     3606                    } 
     3607                } else { 
     3608                    ui_warn "Missing dependency: $file!" 
    36013609                } 
    36023610                continue; 
Note: See TracChangeset for help on using the changeset viewer.