Changeset 79167
- Timestamp:
- 06/03/11 22:00:16 (4 years ago)
- Location:
- trunk/base
- Files:
-
- 9 edited
-
portmgr/packaging/dpkgall.tcl (modified) (1 diff)
-
src/macports1.0/macports.tcl (modified) (3 diffs)
-
src/port/port.tcl (modified) (3 diffs)
-
src/port1.0/portactivate.tcl (modified) (1 diff)
-
src/port1.0/portdeactivate.tcl (modified) (1 diff)
-
src/port1.0/portuninstall.tcl (modified) (1 diff)
-
src/registry2.0/portimage.tcl (modified) (10 diffs)
-
src/registry2.0/portuninstall.tcl (modified) (8 diffs)
-
src/registry2.0/receipt_sqlite.tcl (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/base/portmgr/packaging/dpkgall.tcl
r78062 r79167 709 709 710 710 ui_msg "Uninstalling $port." 711 if { [catch {registry_uninstall::uninstall $portname $portversion } result] } {711 if { [catch {registry_uninstall::uninstall $portname $portversion "" 0 [array get options]} result] } { 712 712 global errorInfo 713 713 ui_debug "$errorInfo" -
trunk/base/src/macports1.0/macports.tcl
r79093 r79167 3438 3438 ui_msg "Skipping uninstall $newname @${version_in_tree}_${revision_in_tree}$portinfo(canonical_active_variants) (dry run)" 3439 3439 } elseif {![registry::run_target $newregref uninstall [array get options]] 3440 && [catch {registry_uninstall::uninstall $newname $ {version_in_tree}_${revision_in_tree}$portinfo(canonical_active_variants) [array get options]} result]} {3440 && [catch {registry_uninstall::uninstall $newname $version_in_tree $revision_in_tree $portinfo(canonical_active_variants) [array get options]} result]} { 3441 3441 global errorInfo 3442 3442 ui_debug "$errorInfo" … … 3462 3462 } elseif {![catch {registry::active $portname}] && 3463 3463 ![registry::run_target $regref deactivate [array get options]] 3464 && [catch {portimage::deactivate $portname $ {version_active}_${revision_active}${variant_active}[array get options]} result]} {3464 && [catch {portimage::deactivate $portname $version_active $revision_active $variant_active [array get options]} result]} { 3465 3465 global errorInfo 3466 3466 ui_debug "$errorInfo" … … 3538 3538 ui_msg "Skipping uninstall $portname @${version}_${revision}${variant} (dry run)" 3539 3539 } elseif {![registry::run_target $regref uninstall $optionslist] 3540 && [catch {registry_uninstall::uninstall $portname $ {version}_${revision}${variant}$optionslist} result]} {3540 && [catch {registry_uninstall::uninstall $portname $version $revision $variant $optionslist} result]} { 3541 3541 global errorInfo 3542 3542 ui_debug "$errorInfo" -
trunk/base/src/port/port.tcl
r79070 r79167 2235 2235 } 2236 2236 if {![macports::global_option_isset ports_dryrun]} { 2237 if { [catch {portimage::activate $portname $composite_version [array get options]} result] } {2237 if { [catch {portimage::activate_composite $portname $composite_version [array get options]} result] } { 2238 2238 global errorInfo 2239 2239 ui_debug "$errorInfo" … … 2271 2271 } 2272 2272 if {![macports::global_option_isset ports_dryrun]} { 2273 if { [catch {portimage::deactivate $portname $composite_version [array get options]} result] } {2273 if { [catch {portimage::deactivate_composite $portname $composite_version [array get options]} result] } { 2274 2274 global errorInfo 2275 2275 ui_debug "$errorInfo" … … 2835 2835 } 2836 2836 2837 if { [catch {registry_uninstall::uninstall $portname $composite_version [array get options]} result] } {2837 if { [catch {registry_uninstall::uninstall_composite $portname $composite_version [array get options]} result] } { 2838 2838 global errorInfo 2839 2839 ui_debug "$errorInfo" -
trunk/base/src/port1.0/portactivate.tcl
r78062 r79167 61 61 global env subport version revision portvariants user_options PortInfo 62 62 63 registry_activate $subport "${version}_${revision}${portvariants}"[array get user_options]63 registry_activate $subport $version $revision $portvariants [array get user_options] 64 64 65 65 # Display notes at the end of the activation phase. -
trunk/base/src/port1.0/portdeactivate.tcl
r78062 r79167 59 59 proc portdeactivate::deactivate_main {args} { 60 60 global subport version revision portvariants user_options 61 registry_deactivate $subport "${version}_${revision}${portvariants}"[array get user_options]61 registry_deactivate $subport $version $revision $portvariants [array get user_options] 62 62 return 0 63 63 } -
trunk/base/src/port1.0/portuninstall.tcl
r78062 r79167 59 59 proc portuninstall::uninstall_main {args} { 60 60 global subport version revision portvariants user_options 61 registry_uninstall $subport "${version}_${revision}${portvariants}"[array get user_options]61 registry_uninstall $subport $version $revision $portvariants [array get user_options] 62 62 return 0 63 63 } -
trunk/base/src/registry2.0/portimage.tcl
r79070 r79167 64 64 variable noexec 0 65 65 66 # takes a composite version spec rather than separate version,revision,variants 67 proc activate_composite {name {v ""} {optionslist ""}} { 68 if {$v == ""} { 69 return [activate $name "" "" 0 $optionslist] 70 } elseif {[registry::decode_spec $v version revision variants]} { 71 return [activate $name $version $revision $variants $optionslist] 72 } 73 throw registry::invalid "Registry error: Invalid version '$v' specified for ${name}. Please specify a version as recorded in the port registry." 74 } 75 66 76 # Activate a "Port Image" 67 proc activate {name v optionslist} {77 proc activate {name {version ""} {revision ""} {variants 0} {optionslist ""}} { 68 78 global macports::prefix macports::registry.path registry_open UI_PREFIX 69 79 array set options $optionslist … … 85 95 registry::read { 86 96 87 set requested [_check_registry $name $v ]97 set requested [_check_registry $name $version $revision $variants] 88 98 # set name again since the one we were passed may not have had the correct case 89 99 set name [$requested name] … … 104 114 # this shouldn't be possible 105 115 if { ![string equal [$requested installtype] "image"] } { 106 return -code error "Image error: ${name} @${ version}_${revision}${variants} not installed as an image."116 return -code error "Image error: ${name} @${specifier} not installed as an image." 107 117 } 108 118 if {![file isfile $location]} { … … 110 120 } 111 121 if { [string equal [$requested state] "installed"] } { 112 return -code error "Image error: ${name} @${ version}_${revision}${variants} is already active."122 return -code error "Image error: ${name} @${specifier} is already active." 113 123 } 114 124 } 115 125 foreach a $todeactivate { 116 126 if {$noexec || ![registry::run_target $a deactivate [list ports_nodepcheck 1]]} { 117 deactivate $name "[$a version]_[$a revision][$a variants]" [list ports_nodepcheck 1] 118 } 119 } 120 121 if {$v != ""} { 122 ui_msg "$UI_PREFIX [format [msgcat::mc "Activating %s @%s"] $name $v]" 123 } else { 124 ui_msg "$UI_PREFIX [format [msgcat::mc "Activating %s"] $name]" 125 } 127 deactivate $name [$a version] [$a revision] [$a variants] [list ports_nodepcheck 1] 128 } 129 } 130 131 ui_msg "$UI_PREFIX [format [msgcat::mc "Activating %s @%s"] $name $specifier]" 126 132 127 133 _activate_contents $requested … … 129 135 } 130 136 131 proc deactivate {name v optionslist} { 137 # takes a composite version spec rather than separate version,revision,variants 138 proc deactivate_composite {name {v ""} {optionslist ""}} { 139 if {$v == ""} { 140 return [deactivate $name "" "" 0 $optionslist] 141 } elseif {[registry::decode_spec $v version revision variants]} { 142 return [deactivate $name $version $revision $variants $optionslist] 143 } 144 throw registry::invalid "Registry error: Invalid version '$v' specified for ${name}. Please specify a version as recorded in the port registry." 145 } 146 147 proc deactivate {name {version ""} {revision ""} {variants 0} {optionslist ""}} { 132 148 global UI_PREFIX macports::registry.path registry_open 133 149 array set options $optionslist … … 157 173 # set name again since the one we were passed may not have had the correct case 158 174 set name [$requested name] 159 set version [$requested version] 160 set revision [$requested revision] 161 set variants [$requested variants] 162 set specifier "${version}_${revision}${variants}" 163 164 if { $v != "" && ![string equal $specifier $v] } { 175 set specifier "[$requested version]_[$requested revision][$requested variants]" 176 177 if {$version != "" && ($version != [$requested version] || 178 ($revision != "" && ($revision != [$requested revision] || $variants != [$requested variants])))} { 179 set v $version 180 if {$revision != ""} { 181 append v _${revision}${variants} 182 } 165 183 return -code error "Active version of $name is not $v but ${specifier}." 166 184 } 167 185 168 if {$v != ""} { 169 ui_msg "$UI_PREFIX [format [msgcat::mc "Deactivating %s @%s"] $name $v]" 170 } else { 171 ui_msg "$UI_PREFIX [format [msgcat::mc "Deactivating %s"] $name]" 172 } 186 ui_msg "$UI_PREFIX [format [msgcat::mc "Deactivating %s @%s"] $name $specifier]" 173 187 174 188 if { ![string equal [$requested installtype] "image"] } { … … 188 202 } 189 203 190 proc _check_registry {name v } {204 proc _check_registry {name version revision variants} { 191 205 global UI_PREFIX 192 206 193 if { [registry::decode_spec $v version revision variants] } { 194 set ilist [registry::entry imaged $name $version $revision $variants] 195 set valid 1 196 } else { 197 set valid [string equal $v {}] 198 set ilist [registry::entry imaged $name] 199 } 200 201 if { [llength $ilist] > 1 || (!$valid && [llength $ilist] == 1) } { 207 set searchkeys $name 208 set composite_spec "" 209 if {$version != ""} { 210 lappend searchkeys $version 211 set composite_spec $version 212 # restriction imposed by underlying registry API (see entry.c): 213 # if a revision is specified, so must variants be 214 if {$revision != ""} { 215 lappend searchkeys $revision $variants 216 append composite_spec _${revision}${variants} 217 } 218 } 219 set ilist [eval registry::entry imaged $searchkeys] 220 221 if { [llength $ilist] > 1 } { 202 222 ui_msg "$UI_PREFIX [msgcat::mc "The following versions of $name are currently installed:"]" 203 223 foreach i $ilist { … … 212 232 } 213 233 } 214 if { $valid } { 215 throw registry::invalid "Registry error: Please specify the full version as recorded in the port registry." 216 } else { 217 throw registry::invalid "Registry error: Invalid version specified. Please specify a version as recorded in the port registry." 218 } 234 throw registry::invalid "Registry error: Please specify the full version as recorded in the port registry." 219 235 } elseif { [llength $ilist] == 1 } { 220 236 return [lindex $ilist 0] 221 237 } 222 throw registry::invalid "Registry error: No port of $name installed." 238 if {$composite_spec != ""} { 239 set composite_spec " @${composite_spec}" 240 } 241 throw registry::invalid "Registry error: ${name}${composite_spec} is not installed." 223 242 } 224 243 … … 488 507 foreach owner [array names todeactivate] { 489 508 if {$noexec || ![registry::run_target $owner deactivate [list ports_nodepcheck 1]]} { 490 deactivate [$owner name] "" [list ports_nodepcheck 1]509 deactivate [$owner name] "" "" 0 [list ports_nodepcheck 1] 491 510 } 492 511 } … … 530 549 foreach entry [array names todeactivate] { 531 550 if {[$entry state] == "imaged" && ($noexec || ![registry::run_target $entry activate ""])} { 532 set pvers "[$entry version]_[$entry revision][$entry variants]" 533 activate [$entry name] $pvers [list ports_activate_no-exec $noexec] 551 activate [$entry name] [$entry version] [$entry revision] [$entry variants] [list ports_activate_no-exec $noexec] 534 552 } 535 553 } -
trunk/base/src/registry2.0/portuninstall.tcl
r79070 r79167 41 41 namespace eval registry_uninstall { 42 42 43 proc uninstall {portname {v ""} optionslist} { 43 # takes a composite version spec rather than separate version,revision,variants 44 proc uninstall_composite {portname {v ""} {optionslist ""}} { 45 if {$v == ""} { 46 return [uninstall $portname "" "" 0 $optionslist] 47 } elseif {[registry::decode_spec $v version revision variants]} { 48 return [uninstall $portname $version $revision $variants $optionslist] 49 } 50 throw registry::invalid "Registry error: Invalid version '$v' specified for ${portname}. Please specify a version as recorded in the port registry." 51 } 52 53 proc uninstall {portname {version ""} {revision ""} {variants 0} {optionslist ""}} { 44 54 global uninstall.force uninstall.nochecksum UI_PREFIX \ 45 55 macports::portimagefilepath … … 58 68 } 59 69 60 if { [registry::decode_spec $v version revision variants] } { 61 set ilist [registry::entry imaged $portname $version $revision $variants] 62 set valid 1 63 } else { 64 set valid [string equal $v {}] 65 set ilist [registry::entry imaged $portname] 66 } 70 set searchkeys $portname 71 set composite_spec "" 72 if {$version != ""} { 73 lappend searchkeys $version 74 set composite_spec $version 75 # restriction imposed by underlying registry API (see entry.c): 76 # if a revision is specified, so must variants be 77 if {$revision != ""} { 78 lappend searchkeys $revision $variants 79 append composite_spec _${revision}${variants} 80 } 81 } 82 set ilist [eval registry::entry imaged $searchkeys] 67 83 if { [llength $ilist] > 1 } { 68 84 # set portname again since the one we were passed may not have had the correct case … … 77 93 } 78 94 } 79 if { $valid } { 80 throw registry::invalid "Registry error: Please specify the full version as recorded in the port registry." 81 } else { 82 throw registry::invalid "Registry error: Invalid version specified. Please specify a version as recorded in the port registry." 83 } 95 throw registry::invalid "Registry error: Please specify the full version as recorded in the port registry." 84 96 } elseif { [llength $ilist] == 1 } { 85 97 set port [lindex $ilist 0] … … 87 99 set revision [$port revision] 88 100 set variants [$port variants] 89 if {$v == ""} { 90 set v "${version}_${revision}${variants}" 91 } 101 set composite_spec "${version}_${revision}${variants}" 92 102 } else { 93 throw registry::invalid "Registry error: $portname not registered as installed" 103 if {$composite_spec != ""} { 104 set composite_spec " @${composite_spec}" 105 } 106 throw registry::invalid "Registry error: ${portname}${composite_spec} not registered as installed" 94 107 } 95 108 … … 100 113 if {[registry::entry exists $depport] && ([$depport state] == "imaged" || [$depport state] == "installed")} { 101 114 if {[info exists options(ports_uninstall_no-exec)] || ![registry::run_target $depport uninstall $optionslist]} { 102 set depname [$depport name] 103 set depver "[$depport version]_[$depport revision][$depport variants]" 104 registry_uninstall::uninstall $depname $depver $optionslist 115 registry_uninstall::uninstall [$depport name] [$depport version] [$depport revision] [$depport variants] $optionslist 105 116 } 106 117 } … … 113 124 if { [string equal [$port state] installed] } { 114 125 if {[info exists options(ports_dryrun)] && [string is true -strict $options(ports_dryrun)]} { 115 ui_msg "For $portname @${ v}: skipping deactivate (dry run)"126 ui_msg "For $portname @${composite_spec}: skipping deactivate (dry run)" 116 127 } else { 117 128 if {[info exists options(ports_uninstall_no-exec)] || ![registry::run_target $port deactivate $optionslist]} { 118 portimage::deactivate $portname $v [array get options]129 portimage::deactivate $portname $version $revision $variants [array get options] 119 130 } 120 131 } … … 180 191 181 192 if {[info exists options(ports_dryrun)] && [string is true -strict $options(ports_dryrun)]} { 182 ui_msg "For $portname @${ v}: skipping uninstall (dry run)"193 ui_msg "For $portname @${composite_spec}: skipping uninstall (dry run)" 183 194 } else { 184 ui_msg "$UI_PREFIX [format [msgcat::mc "Uninstalling %s @%s"] $portname $ v]"195 ui_msg "$UI_PREFIX [format [msgcat::mc "Uninstalling %s @%s"] $portname $composite_spec]" 185 196 186 197 # Get the full path to the image file … … 208 219 set regref [registry::open_entry $dep $iversion $irevision $ivariants [lindex $i 5]] 209 220 if {![registry::property_retrieve $regref requested] && ([info exists options(ports_uninstall_no-exec)] || ![registry::run_target $regref uninstall $optionslist])} { 210 set depver "${iversion}_${irevision}${ivariants}" 211 registry_uninstall::uninstall $dep $depver $optionslist 221 registry_uninstall::uninstall $dep $iversion $irevision $ivariants $optionslist 212 222 } 213 223 } else { -
trunk/base/src/registry2.0/receipt_sqlite.tcl
r77511 r79167 161 161 # Otherwise, return only ports that exactly match this version. 162 162 # What we call version here is version_revision+variants. 163 # The syntax for that can be ambiguous if there's an underscore and dash in 164 # version for example, so we don't attempt to split up the composite version 165 # into its components, we just compare the whole thing. 163 166 proc installed {{name ""} {version ""}} { 164 167 if { $name == "" && $version == "" } { … … 167 170 set ports [registry::entry imaged $name] 168 171 } else { 169 set cmd "registry::entry imaged $name" 170 registry::decode_spec $version version revision variants 171 if {[info exists version] && $version != ""} { 172 append cmd " $version" 173 if {[info exists revision] && $revision != ""} { 174 append cmd " $revision" 175 if {![info exists variants]} { 176 set variants "" 177 } 178 append cmd " {$variants}" 179 } 180 } 181 if {[catch {set ports [eval $cmd]}]} { 182 set ports [list] 172 set ports {} 173 set possible_ports [registry::entry imaged $name] 174 foreach p $possible_ports { 175 if {"[$port version]_[$port revision][$port variants]" == $version 176 || [$port version] == $version} { 177 lappend ports $p 178 } 183 179 } 184 180 }
Note: See TracChangeset
for help on using the changeset viewer.

