Revision: 81397 http://trac.macports.org/changeset/81397 Author: fotanus@macports.org Date: 2011-07-29 19:31:44 -0700 (Fri, 29 Jul 2011) Log Message: ----------- Moved whitelist configuration to .conf files also removed some orphaned functions and fixed a bug, pointed out in the review Modified Paths: -------------- branches/gsoc11-post-destroot/base/src/macports1.0/macports.tcl branches/gsoc11-post-destroot/base/src/port1.0/portcheckdestroot.tcl Modified: branches/gsoc11-post-destroot/base/src/macports1.0/macports.tcl =================================================================== --- branches/gsoc11-post-destroot/base/src/macports1.0/macports.tcl 2011-07-30 02:29:07 UTC (rev 81396) +++ branches/gsoc11-post-destroot/base/src/macports1.0/macports.tcl 2011-07-30 02:31:44 UTC (rev 81397) @@ -51,6 +51,7 @@ variable user_options "submitter_name submitter_email submitter_key" variable portinterp_options "\ portdbpath porturl portpath portbuildpath auto_path prefix prefix_frozen portsharepath \ + files_whitelist folders_whitelist \ registry.path registry.format \ portarchivetype archivefetch_pubkeys portautoclean porttrace keeplogs portverbose destroot_umask \ rsync_server rsync_options rsync_dir startupitem_type place_worksymlink macportsuser \ @@ -528,6 +529,20 @@ } } + # Read dynamic libraries whitelist config files + set whitelist_conf_files {folders_whitelist files_whitelist} + foreach whitelist $whitelist_conf_files { + set file "${macports_conf_path}/${whitelist}.conf" + if { [file exists $file] } { + set macports::${whitelist} {} + set fd [open $file] + while { [gets $fd line] >= 0 } { + lappend macports::${whitelist} $line + } + global macports::${whitelist} + } + } + # Process per-user only settings set per_user "${macports_user_dir}/user.conf" if [file exists $per_user] { Modified: branches/gsoc11-post-destroot/base/src/port1.0/portcheckdestroot.tcl =================================================================== --- branches/gsoc11-post-destroot/base/src/port1.0/portcheckdestroot.tcl 2011-07-30 02:29:07 UTC (rev 81396) +++ branches/gsoc11-post-destroot/base/src/port1.0/portcheckdestroot.tcl 2011-07-30 02:31:44 UTC (rev 81397) @@ -35,9 +35,6 @@ } } -# List contents for a given port. -proc portcheckdestroot::get_port_files {portname} { -} # escape chars in order to be usable as regexp. This function is for internal use. proc portcheckdestroot::escape_chars {str} { @@ -77,19 +74,6 @@ return $ret } -# Get files from a list. For internal use only -proc portcheckdestroot::get_files { list } { - set files {} - foreach element $list { - if { [regexp {^/?[A-Za-z0-9\.-]+(/[A-Za-z0-9\.-]+)*$} $element] } { - if { [file exists $element] } { - lappend files $element - } - } - } - return $files -} - # List dependencies from the current package proc portcheckdestroot::get_dependencies {} { global destroot destroot.depends_lib subport depends_lib @@ -219,12 +203,10 @@ # Check for dynamic links that aren't in the dependency list proc portcheckdestroot::checkdestroot_libs {} { global destroot prefix UI_PREFIX subport + global files_whitelist folders_whitelist + ui_notice "$UI_PREFIX Checking for wrong dynamic links" - #Folders that don't need to be alerted if not on dependencies. - set files_whitelist {libSystem.B.dylib} - set folders_whitelist {/System/Library} - #Get dependencies files list. set dep_files {} foreach dep [get_dependencies] { @@ -258,7 +240,7 @@ } if { ! $valid_lib } { foreach dep_folder $folders_whitelist { - if { [regexp "^$dep" [regsub $prefix $file_lib ""]] } { + if { [regexp "^$dep_folder" [regsub $prefix $file_lib ""]] } { ui_debug "$file_lib binary dependency folder is on whitelist" set valid_lib 1 break
participants (1)
-
fotanus@macports.org