[54378] trunk/base/src
jmr at macports.org
jmr at macports.org
Sat Jul 25 14:31:52 PDT 2009
Revision: 54378
http://trac.macports.org/changeset/54378
Author: jmr at macports.org
Date: 2009-07-25 14:31:51 -0700 (Sat, 25 Jul 2009)
Log Message:
-----------
Add 'replaced_by' portfile option to allow renaming or replacing ports. Also add a --no-replace option to upgrade to stop it from doing the replacements. Closes #20157.
Modified Paths:
--------------
trunk/base/src/macports1.0/macports.tcl
trunk/base/src/port/port-help.tcl
trunk/base/src/port/port.tcl
trunk/base/src/port/portindex.tcl
trunk/base/src/port1.0/portmain.tcl
Modified: trunk/base/src/macports1.0/macports.tcl
===================================================================
--- trunk/base/src/macports1.0/macports.tcl 2009-07-25 21:09:21 UTC (rev 54377)
+++ trunk/base/src/macports1.0/macports.tcl 2009-07-25 21:31:51 UTC (rev 54378)
@@ -2424,6 +2424,33 @@
# remove implicit variants, without printing warnings
set oldvariantlist [mport_filtervariants $oldvariantlist no]
+ # at this point we need to check if a different port will be replacing this one
+ if {[info exists portinfo(replaced_by)] && ![info exists options(ports_upgrade_no-replace)]} {
+ ui_debug "$portname is replaced by $portinfo(replaced_by)"
+ if {[catch {mportlookup $portinfo(replaced_by)} result]} {
+ global errorInfo
+ ui_debug "$errorInfo"
+ ui_error "port lookup failed: $result"
+ return 1
+ }
+ if {$result == ""} {
+ ui_error "No port $portinfo(replaced_by) found."
+ return 1
+ }
+ array unset portinfo
+ array set portinfo [lindex $result 1]
+ set newname $portinfo(name)
+ set version_in_tree "$portinfo(version)"
+
+ set porturl $portinfo(porturl)
+ if {![info exists porturl]} {
+ set porturl file://./
+ }
+ set depscache(port:${newname}) 1
+ } else {
+ set newname $portname
+ }
+
# check if the variants are present in $version_in_tree
if {[info exists portinfo(variants)]} {
set avariants $portinfo(variants)
@@ -2433,7 +2460,7 @@
ui_debug "available variants are : $avariants"
foreach {variation value} $oldvariantlist {
if {[lsearch $avariants $variation] != -1} {
- ui_debug "variant $variation is present in $portname $version_in_tree"
+ ui_debug "variant $variation is present in $newname $version_in_tree"
if { ![info exists variations($variation)]} {
set variations($variation) $value
}
@@ -2460,7 +2487,6 @@
array unset portinfo
array set portinfo [mportinfo $workername]
- set portwasopened 1
set version_in_tree "$portinfo(version)"
set revision_in_tree "$portinfo(revision)"
set epoch_in_tree "$portinfo(epoch)"
@@ -2483,7 +2509,9 @@
|| ([rpm-vercomp $version_installed $version_in_tree] == 0
&& [rpm-vercomp $revision_installed $revision_in_tree] >= 0 ))
&& ![info exists options(ports_upgrade_force)] } {
- if { $epoch_installed < $epoch_in_tree } {
+ if {$portname != $newname} {
+ ui_debug "ignoring versions, installing replacement port"
+ } elseif { $epoch_installed < $epoch_in_tree } {
set epoch_override 1
ui_debug "epoch override ... upgrading!"
} elseif {[info exists options(ports_upgrade_enforce-variants)] && $options(ports_upgrade_enforce-variants) eq "yes"
@@ -2531,7 +2559,7 @@
# avoid building again unnecessarily
if {[info exists options(ports_upgrade_force)] || $epoch_override == 1
- || ![registry::entry_exists $portname $version_in_tree $revision_in_tree $portinfo(canonical_active_variants)]} {
+ || ![registry::entry_exists $newname $version_in_tree $revision_in_tree $portinfo(canonical_active_variants)]} {
if {[catch {set result [mportexec $workername $upgrade_action]} result] || $result != 0} {
global errorInfo
ui_debug "$errorInfo"
@@ -2562,18 +2590,18 @@
}
} else {
# are we installing an existing version due to force or epoch override?
- if {[registry::entry_exists $portname $version_in_tree $revision_in_tree $portinfo(canonical_active_variants)]
+ if {[registry::entry_exists $newname $version_in_tree $revision_in_tree $portinfo(canonical_active_variants)]
&& ([info exists options(ports_upgrade_force)] || $epoch_override == 1)} {
- ui_debug "Uninstalling $portname ${version_in_tree}_${revision_in_tree}$portinfo(canonical_active_variants)"
+ ui_debug "Uninstalling $newname ${version_in_tree}_${revision_in_tree}$portinfo(canonical_active_variants)"
# we have to force the uninstall in case of dependents
set force_cur [info exists options(ports_force)]
set options(ports_force) yes
if {$is_dryrun eq "yes"} {
- ui_msg "Skipping uninstall $portname @${version_in_tree}_${revision_in_tree}$portinfo(canonical_active_variants) (dry run)"
- } elseif {[catch {portuninstall::uninstall $portname ${version_in_tree}_${revision_in_tree}$portinfo(canonical_active_variants) [array get options]} result]} {
+ ui_msg "Skipping uninstall $newname @${version_in_tree}_${revision_in_tree}$portinfo(canonical_active_variants) (dry run)"
+ } elseif {[catch {portuninstall::uninstall $newname ${version_in_tree}_${revision_in_tree}$portinfo(canonical_active_variants) [array get options]} result]} {
global errorInfo
ui_debug "$errorInfo"
- ui_error "Uninstall $portname ${version_in_tree}_${revision_in_tree}$portinfo(canonical_active_variants) failed: $result"
+ ui_error "Uninstall $newname ${version_in_tree}_${revision_in_tree}$portinfo(canonical_active_variants) failed: $result"
catch {mportclose $workername}
return 1
}
@@ -2581,7 +2609,7 @@
unset options(ports_force)
}
if {$anyactive && $version_in_tree == $version_active && $revision_in_tree == $revision_active
- && $portinfo(canonical_active_variants) == $variant_active} {
+ && $portinfo(canonical_active_variants) == $variant_active && $portname == $newname} {
set anyactive no
}
}
@@ -2605,11 +2633,11 @@
}
if {$is_dryrun eq "yes"} {
- ui_msg "Skipping activate $portname @${version_in_tree}_${revision_in_tree} (dry run)"
+ ui_msg "Skipping activate $newname @${version_in_tree}_${revision_in_tree} (dry run)"
} elseif {[catch {set result [mportexec $workername install]} result]} {
global errorInfo
ui_debug "$errorInfo"
- ui_error "Couldn't activate $portname ${version_in_tree}_${revision_in_tree}: $result"
+ ui_error "Couldn't activate $newname ${version_in_tree}_${revision_in_tree}: $result"
catch {mportclose $workername}
return 1
}
@@ -2619,7 +2647,7 @@
set version [lindex $i 1]
set revision [lindex $i 2]
set variant [lindex $i 3]
- if {$version == $version_in_tree && $revision == $revision_in_tree && $variant == $portinfo(canonical_active_variants)} {
+ if {$version == $version_in_tree && $revision == $revision_in_tree && $variant == $portinfo(canonical_active_variants) && $portname == $newname} {
continue
}
ui_debug "Uninstalling $portname ${version}_${revision}${variant}"
@@ -2628,9 +2656,12 @@
} elseif {[catch {portuninstall::uninstall $portname ${version}_${revision}${variant} $optionslist} result]} {
global errorInfo
ui_debug "$errorInfo"
- ui_error "Uninstall $portname @${version}_${revision}${variant} failed: $result"
- catch {mportclose $workername}
- return 1
+ # replaced_by can mean that we try to uninstall all versions of the old port, so handle errors due to dependents
+ if {$result != "Please uninstall the ports that depend on $portname first." && ![ui_isset ports_processall]} {
+ ui_error "Uninstall $portname @${version}_${revision}${variant} failed: $result"
+ catch {mportclose $workername}
+ return 1
+ }
}
}
}
@@ -2641,7 +2672,10 @@
set options(ports_nodeps) 1
registry::open_dep_map
- set deplist [registry::list_dependents $portname]
+ set deplist [registry::list_dependents $newname]
+ if {$portname != $newname} {
+ set deplist [concat $deplist [registry::list_dependents $portname]]
+ }
if { [llength deplist] > 0 } {
foreach dep $deplist {
Modified: trunk/base/src/port/port-help.tcl
===================================================================
--- trunk/base/src/port/port-help.tcl 2009-07-25 21:09:21 UTC (rev 54377)
+++ trunk/base/src/port/port-help.tcl 2009-07-25 21:31:51 UTC (rev 54378)
@@ -286,6 +286,8 @@
skipped (e.g. not outdated).
--enforce-variants If the installed variants do not match those requested,
upgrade even if the port is not outdated.
+--no-replace Do not replace one port with another according to the
+ replaced_by field
}
set porthelp(url) {
Modified: trunk/base/src/port/port.tcl
===================================================================
--- trunk/base/src/port/port.tcl 2009-07-25 21:09:21 UTC (rev 54377)
+++ trunk/base/src/port/port.tcl 2009-07-25 21:31:51 UTC (rev 54378)
@@ -1492,11 +1492,13 @@
maintainers Maintainers
license License
conflicts "Conflicts with"
+ replaced_by "Replaced by"
}
# Wrap-length map for pretty printing
array set pretty_wrap {
heading 0
+ replaced_by 22
variants 22
depends_fetch 22
depends_extract 22
@@ -1560,7 +1562,9 @@
set opts_todo [array names options ports_info_*]
set fields_tried {}
if {![llength $opts_todo]} {
- set opts_todo {ports_info_heading ports_info_variants
+ set opts_todo {ports_info_heading
+ ports_info_replaced_by
+ ports_info_variants
ports_info_skip_line
ports_info_long_description ports_info_homepage
ports_info_skip_line ports_info_depends_fetch
@@ -3102,7 +3106,7 @@
depends description epoch fullname heading homepage index license
line long_description
maintainer maintainers name platform platforms portdir pretty
- revision variant variants version}
+ replaced_by revision variant variants version}
search {case-sensitive category categories depends_fetch
depends_extract depends_build depends_lib depends_run
depends description epoch exact glob homepage line
@@ -3115,7 +3119,7 @@
mirror {new}
lint {nitpick}
select {list set show}
- upgrade {force enforce-variants}
+ upgrade {force enforce-variants no-replace}
}
global cmd_implied_options
Modified: trunk/base/src/port/portindex.tcl
===================================================================
--- trunk/base/src/port/portindex.tcl 2009-07-25 21:09:21 UTC (rev 54377)
+++ trunk/base/src/port/portindex.tcl 2009-07-25 21:31:51 UTC (rev 54378)
@@ -68,7 +68,7 @@
}
}
- set keepkeys {categories depends_fetch depends_extract depends_build depends_lib depends_run description epoch homepage long_description maintainers name platforms revision variants version portdir portarchive}
+ set keepkeys {categories depends_fetch depends_extract depends_build depends_lib depends_run description epoch homepage long_description maintainers name platforms revision variants version portdir portarchive replaced_by}
foreach availkey [array names portinfo] {
if {[lsearch -exact ${keepkeys} $availkey] == -1} {
unset portinfo($availkey)
Modified: trunk/base/src/port1.0/portmain.tcl
===================================================================
--- trunk/base/src/port1.0/portmain.tcl 2009-07-25 21:09:21 UTC (rev 54377)
+++ trunk/base/src/port1.0/portmain.tcl 2009-07-25 21:31:51 UTC (rev 54378)
@@ -45,13 +45,13 @@
# define options
options prefix macportsuser name version revision epoch categories maintainers
-options long_description description homepage license provides conflicts
+options long_description description homepage license provides conflicts replaced_by
options worksrcdir filesdir distname portdbpath libpath distpath sources_conf os.platform os.version os.major os.arch os.endian platforms default_variants install.user install.group macosx_deployment_target
options universal_variant os.universal_supported
options compiler.cpath compiler.library_path
# Export options via PortInfo
-options_export name version revision epoch categories maintainers platforms description long_description homepage license provides conflicts
+options_export name version revision epoch categories maintainers platforms description long_description homepage license provides conflicts replaced_by
# Assign option procedure to default_variants
option_proc default_variants handle_default_variants
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20090725/7bc03cb1/attachment.html>
More information about the macports-changes
mailing list