Changeset 81754
- Timestamp:
- 08/04/11 10:48:47 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/gsoc11-rev-upgrade/base/src/macports1.0/macports.tcl
r81686 r81754 3808 3808 set i 1 3809 3809 foreach b $binaries { 3810 ui_debug " Scanning binary $i of[llength $binaries]: [$b path]"3810 ui_debug "$i/[llength $binaries]: [$b path]" 3811 3811 incr i 3812 3812 … … 3816 3816 3817 3817 if {$returncode != $machista::SUCCESS} { 3818 ui_info "Error parsing file [$b path]: [machista::strerror $returncode]" 3818 if {$returncode == $machista::EMAGIC} { 3819 # not a Mach-O file 3820 ui_debug "Error parsing file [$b path]: [machista::strerror $returncode]" 3821 } else { 3822 ui_warn "Error parsing file [$b path]: [machista::strerror $returncode]" 3823 } 3819 3824 continue; 3820 3825 } … … 3825 3830 3826 3831 while {$loadcommand != "NULL"} { 3827 set libresultlist [machista::parse_file $handle [$loadcommand cget -mlt_install_name]] 3832 if {0 != [catch {set filepath [revupgrade_handle_special_paths [$b path] [$loadcommand cget -mlt_install_name]]}]} { 3833 set loadcommand [$loadcommand cget -next] 3834 continue; 3835 } 3836 3837 set libresultlist [machista::parse_file $handle $filepath] 3828 3838 set libreturncode [lindex $libresultlist 0] 3829 3839 set libresult [lindex $libresultlist 1] … … 3831 3841 # if {[string first "/usr/" [$loadcommand cget -mlt_install_name]] == 0} { 3832 3842 # # TODO: Filter whitelist 3833 # ui_warn "File links against /usr/*: `[$b path]' links against `[$loadcommand cget -mlt_install_name]'"3843 # ui_warn "File links against /usr/*: [$b path] links against [$loadcommand cget -mlt_install_name]" 3834 3844 # } 3835 3845 3836 3846 if {$libreturncode != $machista::SUCCESS} { 3837 ui_ info "Could not open `[$loadcommand cget -mlt_install_name]': [machista::strerror $libreturncode]"3847 ui_warn "Could not open $filepath: [machista::strerror $libreturncode]" 3838 3848 if {$libreturncode == $machista::EFILE} { 3849 ui_debug "Marking [$b path] as broken" 3839 3850 lappend broken_files [$b path] 3840 3851 } … … 3852 3863 3853 3864 if {[$loadcommand cget -mlt_version] != [$libarchitecture cget -mat_version] && [$loadcommand cget -mlt_comp_version] != [$libarchitecture cget -mat_comp_version]} { 3854 ui_info "Incompatible library version of file `[$loadcommand cget -mlt_install_name]': Expected [$loadcommand cget -mlt_comp_version], but got [$libarchitecture cget -mat_comp_version]" 3855 lappend broken_files [$architecture cget -mat_install_name] 3865 ui_warn "Incompatible library version of file [$loadcommand cget -mlt_install_name]: Expected [$loadcommand cget -mlt_comp_version], but got [$libarchitecture cget -mat_comp_version]" 3866 ui_debug "Marking [$b path] as broken" 3867 lappend broken_files [$b path] 3856 3868 } 3857 3869 … … 3861 3873 3862 3874 if {$libarch_found == false} { 3863 ui_info "Missing architecture [$architecture cget -mat_arch] in file `[$loadcommand cget -mlt_install_name]'" 3864 lappend broken_files [$architecture cget -mat_install_name] 3875 ui_debug "Missing architecture [$architecture cget -mat_arch] in file $filepath" 3876 if {[path_is_in_prefix $filepath]} { 3877 ui_debug "Marking [$b path] as broken" 3878 lappend broken_files [$b path] 3879 } else { 3880 ui_warn "Missing architecture [$architecture cget -mat_arch] in file outside prefix referenced from [$b path]" 3881 ui_warn " How did you get that compiled anyway?" 3882 } 3865 3883 } 3866 3884 set loadcommand [$loadcommand cget -next] … … 3882 3900 set port [registry::entry owner $file] 3883 3901 if {$port == ""} { 3884 ui_error "Broken file `$file'doesn't belong to any port."3902 ui_error "Broken file $file doesn't belong to any port." 3885 3903 } 3886 3904 lappend broken_ports $port … … 3988 4006 } 3989 4007 4008 # Return whether a path is in the macports prefix 4009 # Usage: path_is_in_prefix path_to_test 4010 # Returns true if the path is in the prefix, false otherwise 4011 proc path_is_in_prefix {path} { 4012 return [string first $macports::prefix $path] == 0 || [string first $macports::applications_dir $path] == 0 4013 } 4014 4015 # Function to replace macros in loadcommand paths with their proper values (which are usually determined at load time) 4016 # Usage: revupgrade_handle_special_paths name_of_file path_from_loadcommand 4017 # Returns the corrected path on success or an error in case of failure. 4018 # Note that we can't reliably replace @executable_path, because it's only clear when executing a file where it was executed from. 4019 # Replacing @rpath does not work yet, but it might be possible to get it working using the rpath attribute in the file containing the 4020 # loadcommand 4021 proc revupgrade_handle_special_paths {fname path} { 4022 set corrected_path $path 4023 4024 set loaderpath_idx [string first "@loader_path" $corrected_path] 4025 if {$loaderpath_idx != -1} { 4026 set corrected_path [string replace $corrected_path $loaderpath_idx $loaderpath_idx+11 [file dirname $fname]] 4027 } 4028 4029 set executablepath_idx [string first "@executable_path" $corrected_path] 4030 if {$executablepath_idx != -1} { 4031 ui_warn "Ignoring loadcommand containing @exectuable_path in $fname" 4032 error "@exectuable_path in loadcommand" 4033 } 4034 4035 set rpath_idx [string first "@rpath" $corrected_path] 4036 if {$rpath_idx != -1} { 4037 ui_warn "Ignoring loadcommand containing @rpath in $fname" 4038 error "@rpath in loadcommand" 4039 } 4040 4041 return $corrected_path 4042 } 4043 4044 # Recursively build the dependency graph between broken ports 4045 # Usage: revupgrade_buildgraph start_port name_of_stack name_of_adjacency_list name_of_reverse_adjacency_list name_of_visited_map 3990 4046 proc revupgrade_buildgraph {port stackname adjlistname revadjlistname visitedname} { 3991 4047 upvar $stackname stack
Note: See TracChangeset
for help on using the changeset viewer.

