[64627] trunk/base/src
jmr at macports.org
jmr at macports.org
Thu Mar 11 07:00:39 PST 2010
Revision: 64627
http://trac.macports.org/changeset/64627
Author: jmr at macports.org
Date: 2010-03-11 07:00:37 -0800 (Thu, 11 Mar 2010)
Log Message:
-----------
enable checking dependents on inactive ports, check when uninstalling and only one version of the port is installed, don't explicitly deactivate in upgrade to avoid dependent check
Modified Paths:
--------------
trunk/base/src/cregistry/entry.c
trunk/base/src/macports1.0/macports.tcl
trunk/base/src/registry2.0/receipt_sqlite.tcl
trunk/base/src/registry2.0/registry_util.tcl
Modified: trunk/base/src/cregistry/entry.c
===================================================================
--- trunk/base/src/cregistry/entry.c 2010-03-11 13:42:47 UTC (rev 64626)
+++ trunk/base/src/cregistry/entry.c 2010-03-11 15:00:37 UTC (rev 64627)
@@ -1185,8 +1185,6 @@
* could potentially break any port listed in its dependents, and could not
* break any other.
*
- * N.B.: an inactive port has no dependents, since it can be safely removed.
- *
* @param [in] entry a port
* @param [out] dependents a list of ports dependent on the given port
* @param [out] errPtr on error, a description of the error that occurred
@@ -1197,8 +1195,7 @@
reg_registry* reg = entry->reg;
char* query = sqlite3_mprintf("SELECT dependent.id FROM ports port "
"INNER JOIN dependencies USING(name) INNER JOIN ports dependent "
- "USING(id) WHERE port.id=%lld AND port.state = 'installed' "
- "AND dependent.state = 'installed'",
+ "USING(id) WHERE port.id=%lld",
entry->id);
int result = reg_all_entries(reg, query, -1, dependents, errPtr);
sqlite3_free(query);
@@ -1220,8 +1217,8 @@
reg_error* errPtr) {
reg_registry* reg = entry->reg;
char* query = sqlite3_mprintf("SELECT ports.id FROM registry.dependencies "
- "INNER JOIN registry.ports USING(name) WHERE dependencies.id=%lld AND "
- "ports.state = 'installed'", entry->id);
+ "INNER JOIN registry.ports USING(name) WHERE dependencies.id=%lld",
+ entry->id);
int result = reg_all_entries(reg, query, -1, dependencies, errPtr);
sqlite3_free(query);
return result;
Modified: trunk/base/src/macports1.0/macports.tcl
===================================================================
--- trunk/base/src/macports1.0/macports.tcl 2010-03-11 13:42:47 UTC (rev 64626)
+++ trunk/base/src/macports1.0/macports.tcl 2010-03-11 15:00:37 UTC (rev 64627)
@@ -2875,18 +2875,6 @@
set anyactive no
}
}
- if {$anyactive} {
- # deactivate version_active
- if {$is_dryrun eq "yes"} {
- ui_msg "Skipping deactivate $portname @${version_active}_${revision_active} (dry run)"
- } elseif {[catch {portimage::deactivate $portname ${version_active}_${revision_active}${variant_active} $optionslist} result]} {
- global errorInfo
- ui_debug "$errorInfo"
- ui_error "Deactivating $portname ${version_active}_${revision_active} failed: $result"
- catch {mportclose $workername}
- return 1
- }
- }
if {[info exists options(port_uninstall_old)]} {
# uninstalling now could fail due to dependents when not forced,
# because the new version is not installed
@@ -2895,11 +2883,14 @@
}
if {$is_dryrun eq "yes"} {
- ui_msg "Skipping activate $newname @${version_in_tree}_${revision_in_tree} (dry run)"
+ if {$anyactive} {
+ ui_msg "Skipping deactivate $portname @${version_active}_${revision_active}${variant_active} (dry run)"
+ }
+ ui_msg "Skipping activate $newname @${version_in_tree}_${revision_in_tree}$portinfo(canonical_active_variants) (dry run)"
} elseif {[catch {set result [mportexec $workername install]} result]} {
global errorInfo
ui_debug "$errorInfo"
- ui_error "Couldn't activate $newname ${version_in_tree}_${revision_in_tree}: $result"
+ ui_error "Couldn't activate $newname ${version_in_tree}_${revision_in_tree}$portinfo(canonical_active_variants): $result"
catch {mportclose $workername}
return 1
}
Modified: trunk/base/src/registry2.0/receipt_sqlite.tcl
===================================================================
--- trunk/base/src/registry2.0/receipt_sqlite.tcl 2010-03-11 13:42:47 UTC (rev 64626)
+++ trunk/base/src/registry2.0/receipt_sqlite.tcl 2010-03-11 15:00:37 UTC (rev 64627)
@@ -192,7 +192,7 @@
}
}
- return $rlist
+ return [lsort -unique $rlist]
}
# adds a registry entry from a list of keys and values
Modified: trunk/base/src/registry2.0/registry_util.tcl
===================================================================
--- trunk/base/src/registry2.0/registry_util.tcl 2010-03-11 13:42:47 UTC (rev 64626)
+++ trunk/base/src/registry2.0/registry_util.tcl 2010-03-11 15:00:37 UTC (rev 64627)
@@ -62,18 +62,20 @@
## @param [in] force if true, continue even if there are dependents
proc check_dependents {port force} {
global UI_PREFIX
- # Check and make sure no ports depend on this one
- set deplist [$port dependents]
- if { [llength $deplist] > 0 } {
- ui_msg "$UI_PREFIX [format [msgcat::mc "Unable to uninstall/deactivate %s @%s_%s%s, the following ports depend on it:"] [$port name] [$port version] [$port revision] [$port variants]]"
- foreach depport $deplist {
- ui_msg "$UI_PREFIX [format [msgcat::mc " %s @%s_%s%s"] [$depport name] [$depport version] [$depport revision] [$depport variants]]"
+ if {[$port state] == "installed" || [llength [registry::entry imaged [$port name]]] == 1} {
+ # Check and make sure no ports depend on this one
+ set deplist [$port dependents]
+ if { [llength $deplist] > 0 } {
+ ui_msg "$UI_PREFIX [format [msgcat::mc "Unable to uninstall/deactivate %s @%s_%s%s, the following ports depend on it:"] [$port name] [$port version] [$port revision] [$port variants]]"
+ foreach depport $deplist {
+ ui_msg "$UI_PREFIX [format [msgcat::mc " %s @%s_%s%s"] [$depport name] [$depport version] [$depport revision] [$depport variants]]"
+ }
+ if { [string is true -strict $force] } {
+ ui_warn "Uninstall/deactivate forced. Proceeding despite dependencies."
+ } else {
+ throw registry::uninstall-error "Please uninstall the ports that depend on [$port name] first."
+ }
}
- if { [string is true -strict $force] } {
- ui_warn "Uninstall/deactivate forced. Proceeding despite dependencies."
- } else {
- throw registry::uninstall-error "Please uninstall the ports that depend on [$port name] first."
- }
}
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20100311/21347a48/attachment.html>
More information about the macports-changes
mailing list