From d42c8a913a12e4e911b0337727cca831595a4e4e Mon Sep 17 00:00:00 2001 From: Joshua Root Date: Sat, 4 Jun 2011 05:49:29 +0000 Subject: [PATCH] MacPorts_Framework: adapt to registry changes git-svn-id: https://svn.macports.org/repository/macports/contrib/MacPorts_Framework@79172 d073be05-634f-4543-b044-5fe20cf6d1d6 --- MacPorts_Framework/MPPort.m | 18 ++++++----- MacPorts_Framework/init.tcl | 39 ++++++++++++++++++++---- MacPorts_Framework/interpInit.tcl | 41 +++++++++++++++++++++----- MacPorts_Framework/portProcessInit.tcl | 41 +++++++++++++++++++++----- 4 files changed, 112 insertions(+), 27 deletions(-) diff --git a/MacPorts_Framework/MPPort.m b/MacPorts_Framework/MPPort.m index 16497a1..9b9c480 100644 --- a/MacPorts_Framework/MPPort.m +++ b/MacPorts_Framework/MPPort.m @@ -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]; } } diff --git a/MacPorts_Framework/init.tcl b/MacPorts_Framework/init.tcl index dcffe1b..2eb1bc1 100644 --- a/MacPorts_Framework/init.tcl +++ b/MacPorts_Framework/init.tcl @@ -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" diff --git a/MacPorts_Framework/interpInit.tcl b/MacPorts_Framework/interpInit.tcl index ce78c2a..f474323 100644 --- a/MacPorts_Framework/interpInit.tcl +++ b/MacPorts_Framework/interpInit.tcl @@ -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" -} \ No newline at end of file +} diff --git a/MacPorts_Framework/portProcessInit.tcl b/MacPorts_Framework/portProcessInit.tcl index ce78c2a..f474323 100644 --- a/MacPorts_Framework/portProcessInit.tcl +++ b/MacPorts_Framework/portProcessInit.tcl @@ -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" -} \ No newline at end of file +}