Changeset 50253
- Timestamp:
- Apr 28, 2009, 8:42:07 AM (10 years ago)
- Location:
- branches/images-and-archives/base/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/images-and-archives/base/src/macports1.0/macports.tcl
r50252 r50253 42 42 variable bootstrap_options "\ 43 43 portdbpath libpath binpath auto_path extra_env sources_conf prefix x11prefix portdbformat \ 44 port installtype portarchivepath portarchivetype portautoclean \44 portarchivepath portarchivetype portautoclean \ 45 45 porttrace portverbose destroot_umask variants_conf rsync_server rsync_options \ 46 46 rsync_dir startupitem_type place_worksymlink xcodeversion xcodebuildcmd \ … … 51 51 variable portinterp_options "\ 52 52 portdbpath porturl portpath portbuildpath auto_path prefix prefix_frozen x11prefix portsharepath \ 53 registry.path registry.format registry.installtypeportarchivepath \53 registry.path registry.format portarchivepath \ 54 54 portarchivetype portautoclean porttrace portverbose destroot_umask rsync_server \ 55 55 rsync_options rsync_dir startupitem_type place_worksymlink \ … … 340 340 global macports::prefix_frozen 341 341 global macports::x11prefix 342 global macports::registry.installtype343 342 global macports::rsync_dir 344 343 global macports::rsync_options … … 501 500 } 502 501 503 # Installation type, whether to use port "images" or install "direct"504 if {[info exists portinstalltype]} {505 set registry.installtype $portinstalltype506 } else {507 set registry.installtype image508 }509 510 502 # Autoclean mode, whether to automatically call clean after "install" 511 503 if {![info exists portautoclean]} { … … 752 744 753 745 proc macports::worker_init {workername portpath porturl portbuildpath options variations} { 754 global macports::portinterp_options macports::portinterp_deferred_options registry.installtype746 global macports::portinterp_options macports::portinterp_deferred_options 755 747 756 748 # Hide any Tcl commands that should be inaccessible to port1.0 and Portfiles … … 849 841 $workername eval set variations($var) $val 850 842 } 851 852 if { [info exists registry.installtype] } {853 $workername eval set installtype ${registry.installtype}854 }855 843 } 856 844 … … 1254 1242 } 1255 1243 1256 ### _mportinstalled is private; may change without notice1257 1258 # Determine if a port is already *installed*, as in "in the registry".1259 proc _mportinstalled {mport} {1260 # Check for the presence of the port in the registry1261 set workername [ditem_key $mport workername]1262 return [$workername eval registry_exists_for_name \${portname}]1263 }1264 1265 1244 # Determine if a port is active (only for image mode) 1266 1245 proc _mportactive {mport} { … … 1283 1262 proc _mportispresent {mport depspec} { 1284 1263 ui_debug "Searching for dependency: [ditem_key $mport provides]" 1285 if {[string equal ${macports::registry.installtype} "image"]} { 1286 set res [_mportactive $mport] 1287 } else { 1288 set res [_mportinstalled $mport] 1289 } 1264 set res [_mportactive $mport] 1290 1265 if {$res != 0} { 1291 1266 ui_debug "Found Dependency: receipt exists for [ditem_key $mport provides]" … … 1334 1309 # Execute the specified target of the given mport. 1335 1310 proc mportexec {mport target} { 1336 global macports::registry.installtype1337 1338 1311 set workername [ditem_key $mport workername] 1339 1312 … … 1374 1347 # xxx: as with below, this is ugly. and deps need to be fixed to 1375 1348 # understand Port Images before this can get prettier 1376 if { [string equal ${macports::registry.installtype} "image"] } { 1377 set result [dlist_eval $dlist _mportactive [list _mportexec "activate"]] 1378 } else { 1379 set result [dlist_eval $dlist _mportinstalled [list _mportexec "install"]] 1380 } 1381 1349 set result [dlist_eval $dlist _mportactive [list _mportexec "activate"]] 1350 1382 1351 if {$result != {}} { 1383 1352 set errstring "The following dependencies failed to build:" … … 1403 1372 # If we're doing image installs, then we should activate after install 1404 1373 # xxx: This isn't pretty 1405 if { [string equal ${macports::registry.installtype} "image"] && [string equal $target "install"]} {1374 if {[string equal $target "install"]} { 1406 1375 set target activate 1407 1376 } … … 2138 2107 # upgrade procedure 2139 2108 proc macports::upgrade {portname dspec globalvarlist variationslist optionslist {depscachename ""}} { 2140 global macports::registry.installtype2141 2109 array set options $optionslist 2142 2110 … … 2402 2370 } 2403 2371 2404 # a lways uninstall old port in direct mode2405 if { 0 != [string compare "image" ${macports::registry.installtype}] } {2406 # uninstall old2407 ui_debug "Uninstalling $portname ${version_installed}_${revision_installed}${variant_installed}"2372 # are we installing an existing version due to force or epoch override? 2373 if {([info exists options(ports_force)] || $epoch_override == 1) 2374 && [registry::entry_exists $portname $version_in_tree $revision_in_tree $portinfo(canonical_active_variants)]} { 2375 ui_debug "Uninstalling $portname ${version_in_tree}_${revision_in_tree}$portinfo(canonical_active_variants)" 2408 2376 # we have to force the uninstall in case of dependents 2409 2377 set force_cur [info exists options(ports_force)] 2410 2378 set options(ports_force) yes 2411 2379 if {$is_dryrun eq "yes"} { 2412 ui_msg "Skipping uninstall $portname @${version_in stalled}_${revision_installed}${variant_installed}(dry run)"2413 } elseif {[catch {portuninstall::uninstall $portname ${version_in stalled}_${revision_installed}${variant_installed}[array get options]} result]} {2380 ui_msg "Skipping uninstall $portname @${version_in_tree}_${revision_in_tree}$portinfo(canonical_active_variants) (dry run)" 2381 } elseif {[catch {portuninstall::uninstall $portname ${version_in_tree}_${revision_in_tree}$portinfo(canonical_active_variants) [array get options]} result]} { 2414 2382 global errorInfo 2415 2383 ui_debug "$errorInfo" 2416 ui_error "Uninstall $portname ${version_in stalled}_${revision_installed}${variant_installed}failed: $result"2384 ui_error "Uninstall $portname ${version_in_tree}_${revision_in_tree}$portinfo(canonical_active_variants) failed: $result" 2417 2385 return 1 2418 2386 } … … 2420 2388 unset options(ports_force) 2421 2389 } 2422 } else { 2423 # are we installing an existing version due to force or epoch override? 2424 if {([info exists options(ports_force)] || $epoch_override == 1) 2425 && [registry::entry_exists $portname $version_in_tree $revision_in_tree $portinfo(canonical_active_variants)]} { 2426 ui_debug "Uninstalling $portname ${version_in_tree}_${revision_in_tree}$portinfo(canonical_active_variants)" 2427 # we have to force the uninstall in case of dependents 2428 set force_cur [info exists options(ports_force)] 2429 set options(ports_force) yes 2430 if {$is_dryrun eq "yes"} { 2431 ui_msg "Skipping uninstall $portname @${version_in_tree}_${revision_in_tree}$portinfo(canonical_active_variants) (dry run)" 2432 } elseif {[catch {portuninstall::uninstall $portname ${version_in_tree}_${revision_in_tree}$portinfo(canonical_active_variants) [array get options]} result]} { 2433 global errorInfo 2434 ui_debug "$errorInfo" 2435 ui_error "Uninstall $portname ${version_in_tree}_${revision_in_tree}$portinfo(canonical_active_variants) failed: $result" 2436 return 1 2437 } 2438 if {!$force_cur} { 2439 unset options(ports_force) 2440 } 2441 if {$anyactive && $version_in_tree == $version_active && $revision_in_tree == $revision_active 2442 && $portinfo(canonical_active_variants) == $variant_active} { 2443 set anyactive no 2444 } 2445 } 2446 if {$anyactive} { 2447 # deactivate version_active 2448 if {$is_dryrun eq "yes"} { 2449 ui_msg "Skipping deactivate $portname @${version_active}_${revision_active} (dry run)" 2450 } elseif {[catch {portimage::deactivate $portname ${version_active}_${revision_active}${variant_active} $optionslist} result]} { 2451 global errorInfo 2452 ui_debug "$errorInfo" 2453 ui_error "Deactivating $portname ${version_active}_${revision_active} failed: $result" 2454 return 1 2455 } 2456 } 2457 if {[info exists options(port_uninstall_old)]} { 2458 # uninstalling now could fail due to dependents when not forced, 2459 # because the new version is not installed 2460 set uninstall_later yes 2461 } 2390 if {$anyactive && $version_in_tree == $version_active && $revision_in_tree == $revision_active 2391 && $portinfo(canonical_active_variants) == $variant_active} { 2392 set anyactive no 2393 } 2394 } 2395 if {$anyactive} { 2396 # deactivate version_active 2397 if {$is_dryrun eq "yes"} { 2398 ui_msg "Skipping deactivate $portname @${version_active}_${revision_active} (dry run)" 2399 } elseif {[catch {portimage::deactivate $portname ${version_active}_${revision_active}${variant_active} $optionslist} result]} { 2400 global errorInfo 2401 ui_debug "$errorInfo" 2402 ui_error "Deactivating $portname ${version_active}_${revision_active} failed: $result" 2403 return 1 2404 } 2405 } 2406 if {[info exists options(port_uninstall_old)]} { 2407 # uninstalling now could fail due to dependents when not forced, 2408 # because the new version is not installed 2409 set uninstall_later yes 2462 2410 } 2463 2411 -
branches/images-and-archives/base/src/port/port.tcl
r49845 r50253 661 661 662 662 proc get_outdated_ports {} { 663 global macports::registry.installtype664 set is_image_mode [expr 0 == [string compare "image" ${macports::registry.installtype}]]665 666 663 # Get the list of installed ports 667 664 set ilist {} … … 687 684 688 685 set is_active [lindex $i 4] 689 if { $is_active == 0 && $is_image_mode} continue686 if {$is_active == 0} continue 690 687 691 688 set installed_epoch [lindex $i 5] … … 1704 1701 1705 1702 set ref [registry::open_entry $portname $version $revision $variants] 1706 if { [string equal [registry::property_retrieve $ref installtype] "image"] } { 1707 set imagedir [registry::property_retrieve $ref imagedir] 1708 if {![macports::ui_isset ports_quiet]} { 1709 puts "Port $portname ${version}_${revision}${variants} is installed as an image in:" 1710 } 1711 puts $imagedir 1712 } else { 1713 break_softcontinue "Port $portname is not installed as an image." 1 status 1714 } 1703 set imagedir [registry::property_retrieve $ref imagedir] 1704 if {![macports::ui_isset ports_quiet]} { 1705 puts "Port $portname ${version}_${revision}${variants} is installed as an image in:" 1706 } 1707 puts $imagedir 1715 1708 } 1716 1709 … … 2156 2149 2157 2150 proc action_outdated { action portlist opts } { 2158 global macports::registry.installtype private_options2159 set is_image_mode [expr 0 == [string compare "image" ${macports::registry.installtype}]]2160 2161 2151 set status 0 2162 2152 … … 2200 2190 2201 2191 set is_active [lindex $i 4] 2202 if { $is_active == 0 && $is_image_mode} {2192 if {$is_active == 0} { 2203 2193 continue 2204 2194 } -
branches/images-and-archives/base/src/port1.0/portinstall.tcl
r50252 r50253 115 115 } 116 116 117 if { [registry_prop_retr $regref installtype] == "image" } { 118 set imagedir [registry_prop_retr $regref imagedir] 119 set root [file join $root $imagedir] 120 } 117 set imagedir [registry_prop_retr $regref imagedir] 118 set root [file join $root $imagedir] 121 119 122 120 set dst_element [file join $root $element] … … 177 175 if {[info exists installPlist]} { 178 176 registry_prop_store $regref contents [registry_fileinfo_for_index $installPlist] 179 if { [registry_prop_retr $regref installtype] != "image" } {180 registry_bulk_register_files [registry_fileinfo_for_index $installPlist] $portname181 }182 177 } 183 178 if {[info exists package-install]} { -
branches/images-and-archives/base/src/registry1.0/portimage.tcl
r49347 r50253 109 109 set ref [registry::open_entry $name $version $revision $variants] 110 110 111 if { ![string equal [registry::property_retrieve $ref installtype] "image"] } {112 return -code error "Image error: ${name} @${version}_${revision}${variants} not installed as an image."113 }114 111 if { [registry::property_retrieve $ref active] != 0 } { 115 112 return -code error "Image error: ${name} @${version}_${revision}${variants} is already active." … … 174 171 set ref [registry::open_entry $name $version $revision $variants] 175 172 176 if { ![string equal [registry::property_retrieve $ref installtype] "image"] } {177 return -code error "Image error: ${name} @${fqversion} not installed as an image."178 }179 173 if { [registry::property_retrieve $ref active] != 1 } { 180 174 return -code error "Image error: ${name} @${fqversion} is not active." -
branches/images-and-archives/base/src/registry1.0/portuninstall.tcl
r49845 r50253 123 123 } 124 124 125 set installtype [registry::property_retrieve $ref installtype] 126 if { $installtype == "image" && [registry::property_retrieve $ref active] == 1} { 125 if {[registry::property_retrieve $ref active] == 1} { 127 126 #return -code error [msgcat::mc "Registry Error: ${portname} ${version}_${revision}${variants} is active."] 128 127 portimage::deactivate $portname ${version}_${revision}${variants} $optionslist -
branches/images-and-archives/base/src/registry1.0/receipt_flat.tcl
r49846 r50253 102 102 # Open an existing entry and return its reference number. 103 103 proc open_entry {name {version ""} {revision 0} {variants ""}} { 104 global macports::registry.installtype105 104 global macports::registry.path 106 105 variable ref_index … … 311 310 # variants the variants of the port. 312 311 proc write_entry {ref name version {revision 0} {variants ""}} { 313 global macports::registry.installtype314 312 variable receipt_$ref 315 313 -
branches/images-and-archives/base/src/registry1.0/registry.tcl
r49845 r50253 44 44 # This process assembles the directory name and creates a receipt dlist 45 45 proc new_entry {name version {revision 0} {variants ""} {epoch 0} } { 46 global macports::registry.path macports::registry.format macports:: registry.installtype macports::prefix46 global macports::registry.path macports::registry.format macports::prefix 47 47 48 48 … … 61 61 # (because we'll compare this with a file mtime). 62 62 property_store $ref date [expr [clock scan now -gmt true] - [clock scan "1970-1-1 00:00:00" -gmt true]] 63 property_store $ref installtype ${macports::registry.installtype}64 63 property_store $ref receipt_f ${macports::registry.format} 65 if { ${macports::registry.installtype} == "image" } { 66 set imagedir [file join ${macports::registry.path} software ${name} ${version}_${revision}${variants}] 67 property_store $ref imagedir $imagedir 68 property_store $ref active 0 69 property_store $ref compact 0 70 } 64 set imagedir [file join ${macports::registry.path} software ${name} ${version}_${revision}${variants}] 65 property_store $ref imagedir $imagedir 66 property_store $ref active 0 67 property_store $ref compact 0 71 68 72 69 return $ref
Note: See TracChangeset
for help on using the changeset viewer.