[78955] branches/gsoc11-rev-upgrade/base/src/registry2.0
cal at macports.org
cal at macports.org
Fri May 27 16:33:26 PDT 2011
Revision: 78955
http://trac.macports.org/changeset/78955
Author: cal at macports.org
Date: 2011-05-27 16:33:25 -0700 (Fri, 27 May 2011)
Log Message:
-----------
rev-upgrade: resolve name conflicts between registry::file and ::file
Modified Paths:
--------------
branches/gsoc11-rev-upgrade/base/src/registry2.0/portimage.tcl
branches/gsoc11-rev-upgrade/base/src/registry2.0/portuninstall.tcl
branches/gsoc11-rev-upgrade/base/src/registry2.0/receipt_flat.tcl
Modified: branches/gsoc11-rev-upgrade/base/src/registry2.0/portimage.tcl
===================================================================
--- branches/gsoc11-rev-upgrade/base/src/registry2.0/portimage.tcl 2011-05-27 23:24:55 UTC (rev 78954)
+++ branches/gsoc11-rev-upgrade/base/src/registry2.0/portimage.tcl 2011-05-27 23:33:25 UTC (rev 78955)
@@ -81,7 +81,7 @@
if {[string equal ${macports::registry.format} "receipt_sqlite"]} {
set use_reg2 1
if {![info exists registry_open]} {
- registry::open [file join ${macports::registry.path} registry registry.db]
+ registry::open [::file join ${macports::registry.path} registry registry.db]
set registry_open yes
}
}
@@ -111,7 +111,7 @@
if { ![string equal [$requested installtype] "image"] } {
return -code error "Image error: ${name} @${version}_${revision}${variants} not installed as an image."
}
- if {![file isfile $location]} {
+ if {![::file isfile $location]} {
return -code error "Image error: Can't find image file $location"
}
if { [string equal [$requested state] "installed"] } {
@@ -152,7 +152,7 @@
return -code error "Image error: ${name} @${version}_${revision}${variants} not installed as an image."
}
set location [registry::property_retrieve $ref location]
- if {![file isfile $location]} {
+ if {![::file isfile $location]} {
return -code error "Image error: Can't find image file $location"
}
if { [registry::property_retrieve $ref active] != 0 } {
@@ -212,7 +212,7 @@
if {[string equal ${macports::registry.format} "receipt_sqlite"]} {
set use_reg2 1
if {![info exists registry_open]} {
- registry::open [file join ${macports::registry.path} registry registry.db]
+ registry::open [::file join ${macports::registry.path} registry registry.db]
set registry_open yes
}
}
@@ -369,22 +369,22 @@
## @param [in] dstfile path to activate file to
## @return 1 if file needs to be explicitly deleted if we have to roll back, 0 otherwise
proc _activate_file {srcfile dstfile} {
- switch [file type $srcfile] {
+ switch [::file type $srcfile] {
directory {
# Don't recursively copy directories
ui_debug "activating directory: $dstfile"
# Don't do anything if the directory already exists.
- if { ![file isdirectory $dstfile] } {
+ if { ![::file isdirectory $dstfile] } {
file mkdir $dstfile
# fix attributes on the directory.
if {[getuid] == 0} {
- eval file attributes {$dstfile} [file attributes $srcfile]
+ eval file attributes {$dstfile} [::file attributes $srcfile]
} else {
# not root, so can't set owner/group
- eval file attributes {$dstfile} -permissions [file attributes -permissions $srcfile]
+ eval file attributes {$dstfile} -permissions [::file attributes -permissions $srcfile]
}
# set mtime on installed element
- file mtime $dstfile [file mtime $srcfile]
+ file mtime $dstfile [::file mtime $srcfile]
}
return 0
}
@@ -399,7 +399,7 @@
# extract an archive to a temporary location
# returns: path to the extracted directory
proc extract_archive_to_tmpdir {location} {
- set extractdir [mkdtemp [file join [macports::gettmpdir] mpextractXXXXXXXX]]
+ set extractdir [mkdtemp [::file join [macports::gettmpdir] mpextractXXXXXXXX]]
try {
set startpwd [pwd]
@@ -414,7 +414,7 @@
set unarchive.pre_args {}
set unarchive.args {}
set unarchive.pipe_cmd ""
- set unarchive.type [file tail $location]
+ set unarchive.type [::file tail $location]
switch -regex ${unarchive.type} {
cp(io|gz) {
set pax "pax"
@@ -589,7 +589,7 @@
# if we're forcing the activation, then we move any existing
# files to a backup file, both in the filesystem and in the
# registry
- if { [file exists $file] } {
+ if { [::file exists $file] } {
set bakfile "${file}${baksuffix}"
ui_warn "File $file already exists. Moving to: $bakfile."
file rename -force -- $file $bakfile
@@ -619,10 +619,10 @@
# subpaths. We do need, nevertheless, all sub paths to make sure
# we'll set the directory attributes properly for all
# directories.
- set directory [file dirname $file]
+ set directory [::file dirname $file]
while { [lsearch -exact $files $directory] == -1 } {
lappend files $directory
- set directory [file dirname $directory]
+ set directory [::file dirname $directory]
}
# Also add the filename to the imagefile list.
@@ -719,13 +719,13 @@
if { $port != 0 && $force != 1 && $port != $name } {
file delete -force $extracted_dir
return -code error "Image error: $file is being used by the active $port port. Please deactivate this port first, or use 'port -f activate $name' to force the activation."
- } elseif { [file exists $file] && $force != 1 } {
+ } elseif { [::file exists $file] && $force != 1 } {
file delete -force $extracted_dir
return -code error "Image error: $file already exists and does not belong to a registered port. Unable to activate port $name. Use 'port -f activate $name' to force the activation."
- } elseif { $force == 1 && [file exists $file] || $port != 0 } {
+ } elseif { $force == 1 && [::file exists $file] || $port != 0 } {
set bakfile "${file}${baksuffix}"
- if {[file exists $file]} {
+ if {[::file exists $file]} {
ui_warn "File $file already exists. Moving to: $bakfile."
file rename -force -- $file $bakfile
lappend backups $file
@@ -734,7 +734,7 @@
if { $port != 0 } {
set bakport [registry::file_registered $file]
registry::unregister_file $file
- if {[file exists $bakfile]} {
+ if {[::file exists $bakfile]} {
registry::register_file $bakfile $bakport
}
}
@@ -746,10 +746,10 @@
# we don't need to have them sorted from root to subpaths. We do need,
# nevertheless, all sub paths to make sure we'll set the directory
# attributes properly for all directories.
- set directory [file dirname $file]
+ set directory [::file dirname $file]
while { [lsearch -exact $files $directory] == -1 } {
lappend files $directory
- set directory [file dirname $directory]
+ set directory [::file dirname $directory]
}
# Also add the filename to the imagefile list.
@@ -799,10 +799,10 @@
}
proc _deactivate_file {dstfile} {
- if { [file type $dstfile] == "link" } {
+ if { [::file type $dstfile] == "link" } {
ui_debug "deactivating link: $dstfile"
file delete -- $dstfile
- } elseif { [file isdirectory $dstfile] } {
+ } elseif { [::file isdirectory $dstfile] } {
# 0 item means empty.
if { [llength [readdir $dstfile]] == 0 } {
ui_debug "deactivating directory: $dstfile"
@@ -821,7 +821,7 @@
set files [list]
foreach file $imagefiles {
- if { [file exists $file] || (![catch {file type $file}] && [file type $file] == "link") } {
+ if { [::file exists $file] || (![catch {file type $file}] && [::file type $file] == "link") } {
# Normalize the file path to avoid removing the intermediate
# symlinks (remove the empty directories instead)
# Remark: paths in the registry may be not normalized.
@@ -832,14 +832,14 @@
# belong to any port.
# The custom realpath proc is necessary because file normalize
# does not resolve symlinks on OS X < 10.6
- set directory [realpath [file dirname $file]]
- lappend files [file join $directory [file tail $file]]
+ set directory [realpath [::file dirname $file]]
+ lappend files [::file join $directory [::file tail $file]]
# Split out the filename's subpaths and add them to the image list
# as well.
while { [lsearch -exact $files $directory] == -1 } {
lappend files $directory
- set directory [file dirname $directory]
+ set directory [::file dirname $directory]
}
} else {
ui_debug "$file does not exist."
Modified: branches/gsoc11-rev-upgrade/base/src/registry2.0/portuninstall.tcl
===================================================================
--- branches/gsoc11-rev-upgrade/base/src/registry2.0/portuninstall.tcl 2011-05-27 23:24:55 UTC (rev 78954)
+++ branches/gsoc11-rev-upgrade/base/src/registry2.0/portuninstall.tcl 2011-05-27 23:33:25 UTC (rev 78955)
@@ -307,7 +307,7 @@
file delete $imagefile
# Try to delete the port's image dir; will fail if there are more image
# files so just ignore the failure
- catch {file delete [file dirname $imagefile]}
+ catch {file delete [::file dirname $imagefile]}
if {$use_reg2} {
registry::entry delete $port
Modified: branches/gsoc11-rev-upgrade/base/src/registry2.0/receipt_flat.tcl
===================================================================
--- branches/gsoc11-rev-upgrade/base/src/registry2.0/receipt_flat.tcl 2011-05-27 23:24:55 UTC (rev 78954)
+++ branches/gsoc11-rev-upgrade/base/src/registry2.0/receipt_flat.tcl 2011-05-27 23:33:25 UTC (rev 78955)
@@ -74,7 +74,7 @@
# regex match case
if {$portversion == 0} {
- set x [glob -nocomplain -directory [file join ${macports::registry.path} receipts] -- ${portname}-*]
+ set x [glob -nocomplain -directory [::file join ${macports::registry.path} receipts] -- ${portname}-*]
if {[string length $x]} {
set matchfile [lindex $x 0]
# Remove trailing .bz2, if any.
@@ -83,7 +83,7 @@
set matchfile ""
}
} else {
- set matchfile [file join ${macports::registry.path} receipts ${portname}-${portversion}]
+ set matchfile [::file join ${macports::registry.path} receipts ${portname}-${portversion}]
}
# Might as well bail out early if no file to match
@@ -91,7 +91,7 @@
return ""
}
- if {[file exists $matchfile] || [file exists ${matchfile}.bz2]} {
+ if {[::file exists $matchfile] || [::file exists ${matchfile}.bz2]} {
return $matchfile
}
return ""
@@ -109,11 +109,11 @@
return $ref_index($name,$version,$revision,$variants)
}
- set receipt_path [file join ${macports::registry.path} receipts ${name}]
+ set receipt_path [::file join ${macports::registry.path} receipts ${name}]
# If the receipt path ${name} doesn't exist, then the receipt probably is
# in the old HEAD format.
- if { ![file isdirectory $receipt_path] } {
+ if { ![::file isdirectory $receipt_path] } {
set receipt_file [get_head_entry_receipt_path $name $version]
if {![string length $receipt_file]} {
@@ -126,7 +126,7 @@
# Extract the version from the path.
if { $version == "" } {
- set theFileName [file tail $receipt_file]
+ set theFileName [::file tail $receipt_file]
regexp "^$name-(.*)\$" $theFileName match version
}
} else {
@@ -136,7 +136,7 @@
# version given to us. How should we handle this?
set x [glob -nocomplain -directory ${receipt_path} *]
if { [string length $x] } {
- set v [lindex [file split [lindex $x 0]] end]
+ set v [lindex [::file split [lindex $x 0]] end]
regexp {([-_a-zA-Z0-9\.]+)_([0-9]*)([+-_a-zA-Z0-9]*)$} $v match version revision variants
} else {
return -code error "Registry error: ${name} not registered as installed."
@@ -147,15 +147,15 @@
return -code error "Registry error: ${name} @${version}_${revision}${variants} not registered as installed."
}
- set receipt_path [file join ${macports::registry.path} receipts ${name} ${version}_${revision}${variants}]
+ set receipt_path [::file join ${macports::registry.path} receipts ${name} ${version}_${revision}${variants}]
- set receipt_file [file join ${receipt_path} receipt]
+ set receipt_file [::file join ${receipt_path} receipt]
}
- if { [file exists ${receipt_file}.bz2] && [file exists ${registry::autoconf::bzip2_path}] } {
+ if { [::file exists ${receipt_file}.bz2] && [::file exists ${registry::autoconf::bzip2_path}] } {
set receipt_file ${receipt_file}.bz2
set receipt_contents [exec ${registry::autoconf::bzip2_path} -d -c ${receipt_file}]
- } elseif { [file exists ${receipt_file}] } {
+ } elseif { [::file exists ${receipt_file}] } {
set receipt_handle [open ${receipt_file} r]
set receipt_contents [read $receipt_handle]
close $receipt_handle
@@ -176,7 +176,7 @@
convert_entry_from_HEAD $name $version $revision $variants $receipt_contents $ref
# move the old receipt
- set convertedDirPath [file join ${macports::registry.path} receipts_converted]
+ set convertedDirPath [::file join ${macports::registry.path} receipts_converted]
file mkdir $convertedDirPath
file rename -- $receipt_file $convertedDirPath
} elseif {[string match "# Version: *" $receipt_contents]} {
@@ -273,15 +273,15 @@
foreach file $contents {
if {[llength $file]} {
set theFilePath [lindex $file 0]
- if {[file isfile $theFilePath]} {
- set previousPort [file_registered $theFilePath]
+ if {[::file isfile $theFilePath]} {
+ set previousPort [::file_registered $theFilePath]
if {$previousPort != 0} {
ui_warn "Conflict detected for file $theFilePath between $previousPort and $name."
}
if {[catch {register_file $theFilePath $name}]} {
ui_warn "An error occurred while adding $theFilePath to the file_map database."
}
- } elseif {![file exists $theFilePath]} {
+ } elseif {![::file exists $theFilePath]} {
ui_warn "Port $name refers to $theFilePath which doesn't exist."
}
lappend theActualContents $file
@@ -313,10 +313,10 @@
set receipt_contents [array get receipt_$ref]
- set receipt_path [file join ${macports::registry.path} receipts ${name} ${version}_${revision}${variants}]
- set receipt_file [file join ${receipt_path} receipt]
+ set receipt_path [::file join ${macports::registry.path} receipts ${name} ${version}_${revision}${variants}]
+ set receipt_file [::file join ${receipt_path} receipt]
- if { ![file isdirectory ${receipt_path}] } {
+ if { ![::file isdirectory ${receipt_path}] } {
file mkdir ${receipt_path}
}
@@ -325,15 +325,15 @@
puts $receipt_handle $receipt_contents
close $receipt_handle
- if { [file exists ${receipt_file}] } {
+ if { [::file exists ${receipt_file}] } {
file delete -force -- "${receipt_file}"
- } elseif { [file exists ${receipt_file}.bz2] } {
+ } elseif { [::file exists ${receipt_file}.bz2] } {
file delete -force -- "${receipt_file}.bz2"
}
file rename -force -- "${receipt_file}.tmp" "${receipt_file}"
- if { [file exists ${receipt_file}] && [file exists ${registry::autoconf::bzip2_path}] && ![info exists registry.nobzip] } {
+ if { [::file exists ${receipt_file}] && [::file exists ${registry::autoconf::bzip2_path}] && ![info exists registry.nobzip] } {
system "${registry::autoconf::bzip2_path} -f ${receipt_file}"
}
@@ -344,12 +344,12 @@
proc entry_exists {name version {revision 0} {variants ""}} {
global macports::registry.path
- set receipt_path [file join ${macports::registry.path} receipts ${name} ${version}_${revision}${variants}]
- set receipt_file [file join ${receipt_path} receipt]
+ set receipt_path [::file join ${macports::registry.path} receipts ${name} ${version}_${revision}${variants}]
+ set receipt_file [::file join ${receipt_path} receipt]
- if { [file exists $receipt_file] } {
+ if { [::file exists $receipt_file] } {
return 1
- } elseif { [file exists ${receipt_file}.bz2] } {
+ } elseif { [::file exists ${receipt_file}.bz2] } {
return 1
}
@@ -360,7 +360,7 @@
proc entry_exists_for_name {name} {
global macports::registry.path
- set receipt_path [file join ${macports::registry.path} receipts ${name}]
+ set receipt_path [::file join ${macports::registry.path} receipts ${name}]
if {[llength [glob -nocomplain -directory $receipt_path */receipt{,.bz2}]] > 0} {
return 1
@@ -416,14 +416,14 @@
array unset ref_index "$name,$version,$revision,$variants"
}
- set receipt_path [file join ${macports::registry.path} receipts ${name} ${version}_${revision}${variants}]
- if { [file exists ${receipt_path}] } {
+ set receipt_path [::file join ${macports::registry.path} receipts ${name} ${version}_${revision}${variants}]
+ if { [::file exists ${receipt_path}] } {
# remove port receipt directory
ui_debug "deleting directory: ${receipt_path}"
file delete -force -- ${receipt_path}
# remove port receipt parent directory (if empty)
- set receipt_dir [file join ${macports::registry.path} receipts ${name}]
- if { [file isdirectory ${receipt_dir}] } {
+ set receipt_dir [::file join ${macports::registry.path} receipts ${name}]
+ if { [::file isdirectory ${receipt_dir}] } {
# 0 item means empty.
if { [llength [readdir ${receipt_dir}]] == 0 } {
ui_debug "deleting directory: ${receipt_dir}"
@@ -448,12 +448,12 @@
proc installed {{name ""} {version ""}} {
global macports::registry.path
- set query_path [file join ${macports::registry.path} receipts]
+ set query_path [::file join ${macports::registry.path} receipts]
if { $name == "" } {
- set query_path [file join ${query_path} *]
+ set query_path [::file join ${query_path} *]
if { $version == "" } {
- set query_path [file join ${query_path} *]
+ set query_path [::file join ${query_path} *]
}
# [PG] Huh?
} else {
@@ -461,32 +461,32 @@
# returned with the correct case even if it's wrong when given. To get the
# correct case on a case-insensitive FS, we have to list the directory and
# compare against each entry.
- set name_path [file join ${query_path} *]
+ set name_path [::file join ${query_path} *]
set name_entries [glob -nocomplain -types d ${name_path}]
foreach entry $name_entries {
- set basename [file tail $entry]
+ set basename [::file tail $entry]
if {[string equal -nocase $basename $name]} {
set name $basename
break
}
}
- set query_path [file join ${query_path} ${name}]
+ set query_path [::file join ${query_path} ${name}]
if { $version != "" } {
- set query_path [file join ${query_path} ${version}]
+ set query_path [::file join ${query_path} ${version}]
} else {
- set query_path [file join ${query_path} *]
+ set query_path [::file join ${query_path} *]
}
}
set x [glob -nocomplain -types d ${query_path}]
set rlist [list]
foreach p $x {
- if {![file isfile [file join $p receipt.bz2]] && ![file isfile [file join $p receipt]]} {
+ if {![::file isfile [::file join $p receipt.bz2]] && ![::file isfile [::file join $p receipt]]} {
continue
}
set plist [list]
- regexp {([-_a-zA-Z0-9\.]+)_([0-9]*)([+-_a-zA-Z0-9]*)$} [lindex [file split $p] end] match version revision variants
- lappend plist [lindex [file split $p] end-1]
+ regexp {([-_a-zA-Z0-9\.]+)_([0-9]*)([+-_a-zA-Z0-9]*)$} [lindex [::file split $p] end] match version revision variants
+ lappend plist [lindex [::file split $p] end-1]
lappend plist $version
lappend plist $revision
lappend plist $variants
@@ -495,13 +495,13 @@
# append the ports in old HEAD format.
if { $name == "" } {
- set query_path [file join ${macports::registry.path} receipts *]
+ set query_path [::file join ${macports::registry.path} receipts *]
} else {
- set query_path [file join ${macports::registry.path} receipts ${name}-*]
+ set query_path [::file join ${macports::registry.path} receipts ${name}-*]
}
set receiptglob [glob -nocomplain -types f ${query_path}]
foreach receipt_file $receiptglob {
- set theFileName [file tail $receipt_file]
+ set theFileName [::file tail $receipt_file]
# Remark: these regexes do not always work.
set theName ""
@@ -538,14 +538,14 @@
global macports::registry.path
variable file_map
- set receipt_path [file join ${macports::registry.path} receipts]
- set map_file [file join ${receipt_path} file_map]
+ set receipt_path [::file join ${macports::registry.path} receipts]
+ set map_file [::file join ${receipt_path} file_map]
# Don't reopen it (it actually would deadlock us), unless it was open r/o.
# and we want it r/w.
if { [info exists file_map] } {
if { $readonly == 0 } {
- if {[filemap isreadonly file_map]} {
+ if {[::filemap isreadonly file_map]} {
filemap close file_map
filemap open file_map ${map_file}.db
}
@@ -555,11 +555,11 @@
set old_filemap [list]
- if { ![file exists ${map_file}.db] } {
+ if { ![::file exists ${map_file}.db] } {
# Convert to new format
- if { [file exists ${map_file}.bz2] && [file exists ${registry::autoconf::bzip2_path}] } {
+ if { [::file exists ${map_file}.bz2] && [::file exists ${registry::autoconf::bzip2_path}] } {
set old_filemap [exec ${registry::autoconf::bzip2_path} -d -c ${map_file}.bz2]
- } elseif { [file exists $map_file] } {
+ } elseif { [::file exists $map_file] } {
set map_handle [open ${map_file} r]
set old_filemap [read $map_handle]
close $map_handle
@@ -607,8 +607,8 @@
open_file_map 1
- if {[filemap exists file_map $file]} {
- return [filemap get file_map $file]
+ if {[::filemap exists file_map $file]} {
+ return [::filemap get file_map $file]
} else {
return 0
}
@@ -629,7 +629,7 @@
open_file_map 1
- set files [filemap list file_map $name]
+ set files [::filemap list file_map $name]
if { [llength $files] > 0 } {
return $files
@@ -640,7 +640,7 @@
# Convert the port and retry.
open_entry $name
- set files [filemap list file_map $name]
+ set files [::filemap list file_map $name]
return $files
} else {
@@ -661,7 +661,7 @@
open_file_map
- if { [file type $file] == "link" } {
+ if { [::file type $file] == "link" } {
ui_debug "Adding link to file_map: $file for: $port"
} else {
ui_debug "Adding file to file_map: $file for: $port"
@@ -683,7 +683,7 @@
foreach f $files {
set file [lindex $f 0]
- if { [file type $file] == "link" } {
+ if { [::file type $file] == "link" } {
ui_debug "Adding link to file_map: $file for: $port"
} else {
ui_debug "Adding file to file_map: $file for: $port"
@@ -742,13 +742,13 @@
global macports::registry.path
variable dep_map
- set receipt_path [file join ${macports::registry.path} receipts]
+ set receipt_path [::file join ${macports::registry.path} receipts]
- set map_file [file join ${receipt_path} dep_map]
+ set map_file [::file join ${receipt_path} dep_map]
- if { [file exists ${map_file}.bz2] && [file exists ${registry::autoconf::bzip2_path}] } {
+ if { [::file exists ${map_file}.bz2] && [::file exists ${registry::autoconf::bzip2_path}] } {
set dep_map [exec ${registry::autoconf::bzip2_path} -d -c ${map_file}.bz2]
- } elseif { [file exists ${map_file}] } {
+ } elseif { [::file exists ${map_file}] } {
set map_handle [open ${map_file} r]
set dep_map [read $map_handle]
close $map_handle
@@ -836,9 +836,9 @@
global macports::registry.path
variable dep_map
- set receipt_path [file join ${macports::registry.path} receipts]
+ set receipt_path [::file join ${macports::registry.path} receipts]
- set map_file [file join ${receipt_path} dep_map]
+ set map_file [::file join ${receipt_path} dep_map]
set map_handle [open ${map_file}.tmp w 0644]
puts $map_handle $dep_map
@@ -849,7 +849,7 @@
file rename -- ${map_file}.tmp ${map_file}
- if { [file exists ${map_file}] && [file exists ${registry::autoconf::bzip2_path}] && ![info exists registry.nobzip] } {
+ if { [::file exists ${map_file}] && [::file exists ${registry::autoconf::bzip2_path}] && ![info exists registry.nobzip] } {
system "${registry::autoconf::bzip2_path} -f ${map_file}"
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20110527/bb0974fc/attachment-0001.html>
More information about the macports-changes
mailing list