[79647] branches/gsoc11-rev-upgrade/base/src/macports1.0/macports.tcl

cal at macports.org cal at macports.org
Wed Jun 22 06:14:09 PDT 2011


Revision: 79647
          http://trac.macports.org/changeset/79647
Author:   cal at macports.org
Date:     2011-06-22 06:14:06 -0700 (Wed, 22 Jun 2011)
Log 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]

Modified Paths:
--------------
    branches/gsoc11-rev-upgrade/base/src/macports1.0/macports.tcl

Modified: branches/gsoc11-rev-upgrade/base/src/macports1.0/macports.tcl
===================================================================
--- branches/gsoc11-rev-upgrade/base/src/macports1.0/macports.tcl	2011-06-22 12:05:10 UTC (rev 79646)
+++ branches/gsoc11-rev-upgrade/base/src/macports1.0/macports.tcl	2011-06-22 13:14:06 UTC (rev 79647)
@@ -3560,10 +3560,10 @@
                 break;
             }
             if {1 == [regexp -nocase {\(architecture ([^\s]+)\)} $otool_line match arch]} {
-                switch $arch {
+                switch -glob $arch {
                     x86_64 {}
                     i386 {}
-                    # todo: what are the correct string reported by otool -arch all -L for the PPC archs?
+                    ppc* {}
                     default {
                         ui_warn "Unknown architecture $arch"
                     }
@@ -3580,25 +3580,33 @@
                     continue;
                 }
                 ui_debug "Linked against: $file, architecture $arch, version $curr_version, compatibility version $comp_version"
-                set lib_found false
-                if {[catch {set lib_otool_output [exec /usr/bin/otool -arch $arch -L $file]}] == 0} {
-                    set lib_otool_lines [split $lib_otool_output "\n"]
-                    foreach lib_otool_line $lib_otool_lines {
-                        if {1 == [regexp -nocase {^\t([^\s]+) \(compatibility version ([^,]+), current version ([^)]+)\)} $lib_otool_line match lib_file lib_comp_version lib_curr_version]} {
-                            if {$file == $lib_file} {
-                                set lib_found true
-                                if {$curr_version != $lib_curr_version} {
-                                    if {$comp_version != $lib_comp_version} {
-                                        ui_warn "Incompatible library version of $file: Expected $comp_version, but $lib_comp_version is installed!"
+                if {[file exists $file]} {
+                    set lib_found false
+                    if {[catch {set lib_install_name [exec /usr/bin/otool -arch $arch -X -D $file]}] == 0} {
+                        if {[catch {set lib_otool_output [exec /usr/bin/otool -arch $arch -X -L $file]}] == 0} {
+                            set lib_otool_lines [split $lib_otool_output "\n"]
+                            foreach lib_otool_line $lib_otool_lines {
+                                if {1 == [regexp -nocase {^\t([^\s]+) \(compatibility version ([^,]+), current version ([^)]+)\)} $lib_otool_line match lib_file lib_comp_version lib_curr_version]} {
+                                    # call with -D to get install name, search for install name in -L output
+                                    if {$lib_install_name == $lib_file} {
+                                        set lib_found true
+                                        if {$curr_version != $lib_curr_version} {
+                                            if {$comp_version != $lib_comp_version} {
+                                                ui_warn "Incompatible library version of $file: Expected $comp_version, but $lib_comp_version is installed!"
+                                            }
+                                        }
+                                        break;
                                     }
                                 }
                             }
                         }
                     }
+                    if {$lib_found == false} {
+                        ui_warn "Missing architecture in file: $arch in $file!"
+                    }
+                } else {
+                    ui_warn "Missing dependency: $file!"
                 }
-                if {$lib_found == false} {
-                    ui_warn "Missing dependency $file!"
-                }
                 continue;
             }
             ui_warn "Unparsable line in otool output: $otool_line"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20110622/8eb558c9/attachment-0001.html>


More information about the macports-changes mailing list