MacPorts_Framework: adapt to registry changes

git-svn-id: https://svn.macports.org/repository/macports/contrib/MacPorts_Framework@79172 d073be05-634f-4543-b044-5fe20cf6d1d6
This commit is contained in:
Joshua Root
2011-06-04 05:49:29 +00:00
parent bdf2291bb9
commit d42c8a913a
4 changed files with 112 additions and 27 deletions
+11 -7
View File
@@ -355,33 +355,37 @@
}
/* XXX uninstallWithVersion, activateWithVersion, deactivateWithVersion all need
to accept separate version,revision,variants args rather than a (possibly ambiguous)
composite version spec */
#pragma mark -
# pragma mark Exec methods
# pragma mark Exec methods
- (void)uninstallWithVersion:(NSString *)version error:(NSError **)mError {
if (version == nil) {
[self execPortProc:@"mportuninstall" withOptions:nil version:@"" error:mError];
[self execPortProc:@"mportuninstall_composite" withOptions:nil version:@"" error:mError];
}
else {
[self execPortProc:@"mportuninstall" withOptions:nil version:version error:mError];
[self execPortProc:@"mportuninstall_composite" withOptions:nil version:version error:mError];
}
}
- (void)activateWithVersion:(NSString *)version error:(NSError **)mError {
if (version == nil) {
[self execPortProc:@"mportactivate" withOptions:nil version:@"" error:mError];
[self execPortProc:@"mportactivate_composite" withOptions:nil version:@"" error:mError];
}
else {
[self execPortProc:@"mportactivate" withOptions:nil version:version error:mError];
[self execPortProc:@"mportactivate_composite" withOptions:nil version:version error:mError];
}
}
- (void)deactivateWithVersion:(NSString *)version error:(NSError **)mError {
if (version == nil) {
[self execPortProc:@"mportdeactivate" withOptions:nil version:@"" error:mError];
[self execPortProc:@"mportdeactivate_composite" withOptions:nil version:@"" error:mError];
}
else {
[self execPortProc:@"mportdeactivate" withOptions:nil version:version error:mError];
[self execPortProc:@"mportdeactivate_composite" withOptions:nil version:version error:mError];
}
}
+33 -6
View File
@@ -37,8 +37,17 @@ proc ui_init {priority prefix channels message} {
#Wrapping the following API routines to catch errors
#and log error Information in a similar fashion to code
#in macports.tcl.
proc mportuninstall {portname {v ""} {optionslist ""}} {
if {[catch {registry_uninstall::uninstall $portname $v $optionslist} result]} {
proc mportuninstall {portname {version ""} {revision ""} {variants 0} {optionslist ""}} {
if {[catch {registry_uninstall::uninstall $portname $version $revision $variants $optionslist} result]} {
global errorInfo
ui_debug "$errorInfo"
ui_error "Uninstall $portname ${version}_${revision}${variants} failed: $result"
return 1
}
}
proc mportuninstall_composite {portname {v ""} {optionslist ""}} {
if {[catch {registry_uninstall::uninstall_composite $portname $v $optionslist} result]} {
global errorInfo
ui_debug "$errorInfo"
@@ -47,8 +56,17 @@ proc mportuninstall {portname {v ""} {optionslist ""}} {
}
}
proc mportactivate {portname v optionslist} {
if {[catch {portimage::activate $portname $v $optionslist} result]} {
proc mportactivate {portname {version ""} {revision ""} {variants 0} {optionslist ""}} {
if {[catch {portimage::activate $portname $version $revision $variants $optionslist} result]} {
global errorInfo
ui_debug "$errorInfo"
ui_error "Activate $portname ${version}_${revision}${variants} failed: $result"
return 1
}
}
proc mportactivate_composite {portname {v ""} {optionslist ""}} {
if {[catch {portimage::activate_composite $portname $v $optionslist} result]} {
global errorInfo
ui_debug "$errorInfo"
@@ -57,8 +75,17 @@ proc mportactivate {portname v optionslist} {
}
}
proc mportdeactivate {portname v optionslist} {
if {[catch {portimage::deactivate $portname $v $optionslist} result]} {
proc mportdeactivate {portname {version ""} {revision ""} {variants 0} {optionslist ""}} {
if {[catch {portimage::deactivate $portname $version $revision $variants $optionslist} result]} {
global errorInfo
ui_debug "$errorInfo"
ui_error "Deactivate $portname ${version}_${revision}${variants} failed: $result"
return 1
}
}
proc mportdeactivate_composite {portname {v ""} {optionslist ""}} {
if {[catch {portimage::deactivate_composite $portname $v $optionslist} result]} {
global errorInfo
ui_debug "$errorInfo"
+34 -7
View File
@@ -38,8 +38,17 @@ proc ui_init {priority prefix channels message} {
#and log error Information in a similar fashion to code
#in macports.tcl. Note optionslist is not being used for now
set mp_empty_list [list]
proc mportuninstall {portname {v ""} {optionslist ""} } {
if {[catch {registry_uninstall::uninstall $portname $v [array get options]} result]} {
proc mportuninstall {portname {version ""} {revision ""} {variants 0} {optionslist ""} } {
if {[catch {registry_uninstall::uninstall $portname $version $revision $variants [array get options]} result]} {
global errorInfo
ui_debug "$errorInfo"
ui_error "Uninstall $portname ${version}_${revision}${variants} failed: $result"
return 1
}
}
proc mportuninstall_composite {portname {v ""} {optionslist ""} } {
if {[catch {registry_uninstall::uninstall_composite $portname $v [array get options]} result]} {
global errorInfo
ui_debug "$errorInfo"
@@ -48,8 +57,17 @@ proc mportuninstall {portname {v ""} {optionslist ""} } {
}
}
proc mportactivate {portname {v ""} {optionslist ""}} {
if {[catch {portimage::activate $portname $v $optionslist} result]} {
proc mportactivate {portname {version ""} {revision ""} {variants 0} {optionslist ""}} {
if {[catch {portimage::activate $portname $version $revision $variants $optionslist} result]} {
global errorInfo
ui_debug "$errorInfo"
ui_error "Activate $portname ${version}_${revision}${variants} failed: $result"
return 1
}
}
proc mportactivate_composite {portname {v ""} {optionslist ""}} {
if {[catch {portimage::activate_composite $portname $v $optionslist} result]} {
global errorInfo
ui_debug "$errorInfo"
@@ -58,8 +76,17 @@ proc mportactivate {portname {v ""} {optionslist ""}} {
}
}
proc mportdeactivate {portname {v ""} {optionslist ""} } {
if {[catch {portimage::deactivate $portname $v $optionslist} result]} {
proc mportdeactivate {portname {version ""} {revision ""} {variants 0} {optionslist ""} } {
if {[catch {portimage::deactivate $portname $version $revision $variants $optionslist} result]} {
global errorInfo
ui_debug "$errorInfo"
ui_error "Deactivate $portname ${version}_${revision}${variants} failed: $result"
return 1
}
}
proc mportdeactivate_composite {portname {v ""} {optionslist ""} } {
if {[catch {portimage::deactivate_composite $portname $v $optionslist} result]} {
global errorInfo
ui_debug "$errorInfo"
@@ -86,4 +113,4 @@ if {[catch {mportinit ui_options global_options global_variations} result]} {
global errorInfo
puts "$errorInfo"
fatal "Failed to initialize ports system, $result"
}
}
+34 -7
View File
@@ -38,8 +38,17 @@ proc ui_init {priority prefix channels message} {
#and log error Information in a similar fashion to code
#in macports.tcl. Note optionslist is not being used for now
set mp_empty_list [list]
proc mportuninstall {portname {v ""} {optionslist ""} } {
if {[catch {registry_uninstall::uninstall $portname $v [array get options]} result]} {
proc mportuninstall {portname {version ""} {revision ""} {variants 0} {optionslist ""} } {
if {[catch {registry_uninstall::uninstall $portname $version $revision $variants [array get options]} result]} {
global errorInfo
ui_debug "$errorInfo"
ui_error "Uninstall $portname ${version}_${revision}${variants} failed: $result"
return 1
}
}
proc mportuninstall_composite {portname {v ""} {optionslist ""} } {
if {[catch {registry_uninstall::uninstall_composite $portname $v [array get options]} result]} {
global errorInfo
ui_debug "$errorInfo"
@@ -48,8 +57,17 @@ proc mportuninstall {portname {v ""} {optionslist ""} } {
}
}
proc mportactivate {portname {v ""} {optionslist ""}} {
if {[catch {portimage::activate $portname $v $optionslist} result]} {
proc mportactivate {portname {version ""} {revision ""} {variants 0} {optionslist ""}} {
if {[catch {portimage::activate $portname $version $revision $variants $optionslist} result]} {
global errorInfo
ui_debug "$errorInfo"
ui_error "Activate $portname ${version}_${revision}${variants} failed: $result"
return 1
}
}
proc mportactivate_composite {portname {v ""} {optionslist ""}} {
if {[catch {portimage::activate_composite $portname $v $optionslist} result]} {
global errorInfo
ui_debug "$errorInfo"
@@ -58,8 +76,17 @@ proc mportactivate {portname {v ""} {optionslist ""}} {
}
}
proc mportdeactivate {portname {v ""} {optionslist ""} } {
if {[catch {portimage::deactivate $portname $v $optionslist} result]} {
proc mportdeactivate {portname {version ""} {revision ""} {variants 0} {optionslist ""} } {
if {[catch {portimage::deactivate $portname $version $revision $variants $optionslist} result]} {
global errorInfo
ui_debug "$errorInfo"
ui_error "Deactivate $portname ${version}_${revision}${variants} failed: $result"
return 1
}
}
proc mportdeactivate_composite {portname {v ""} {optionslist ""} } {
if {[catch {portimage::deactivate_composite $portname $v $optionslist} result]} {
global errorInfo
ui_debug "$errorInfo"
@@ -86,4 +113,4 @@ if {[catch {mportinit ui_options global_options global_variations} result]} {
global errorInfo
puts "$errorInfo"
fatal "Failed to initialize ports system, $result"
}
}