[33938] trunk/base/src/macports1.0/macports.tcl

raimue at macports.org raimue at macports.org
Thu Feb 7 19:34:58 PST 2008


Revision: 33938
          http://trac.macosforge.org/projects/macports/changeset/33938
Author:   raimue at macports.org
Date:     2008-02-07 19:34:55 -0800 (Thu, 07 Feb 2008)

Log Message:
-----------
macports1.0/macports.tcl:
Add --prepend option to selfupdate, which will check if an update is necessary.
I had to rearrange some things in order to present nice output.

Modified Paths:
--------------
    trunk/base/src/macports1.0/macports.tcl

Modified: trunk/base/src/macports1.0/macports.tcl
===================================================================
--- trunk/base/src/macports1.0/macports.tcl	2008-02-08 01:01:44 UTC (rev 33937)
+++ trunk/base/src/macports1.0/macports.tcl	2008-02-08 03:34:55 UTC (rev 33938)
@@ -1669,48 +1669,53 @@
     } else {
         set use_the_force_luke no
         ui_debug "Rebuilding and reinstalling MacPorts if needed"
-        # Choose what version file to use: old, floating point format or new, real version number format
-        set old_version_file [file join $mp_source_path config mp_version]
-        set new_version_file [file join $mp_source_path config macports_version]
-        if {[file exists $old_version_file]} {
-            set fd [open $old_version_file r]
-        } elseif {[file exists $new_version_file]} {
-            set fd [open $new_version_file r]
-        }
-        # get downloaded MacPorts version
-        gets $fd macports_version_new
-        close $fd
-        # echo downloaded MacPorts version
-        ui_msg "Downloaded MacPorts base version $macports_version_new"
     }
 
+    # Choose what version file to use: old, floating point format or new, real version number format
+    set old_version_file [file join $mp_source_path config mp_version]
+    set new_version_file [file join $mp_source_path config macports_version]
+    if {[file exists $old_version_file]} {
+        set fd [open $old_version_file r]
+    } elseif {[file exists $new_version_file]} {
+        set fd [open $new_version_file r]
+    }
+    # get downloaded MacPorts version
+    gets $fd macports_version_new
+    close $fd
+    # echo downloaded MacPorts version
+    ui_msg "Downloaded MacPorts base version $macports_version_new"
+
     # check if we we need to rebuild base
     if {$use_the_force_luke == "yes" || [rpm-vercomp $macports_version_new $macports::autoconf::macports_version] > 0} {
-        # get installation user/group and permissions
-        set owner [file attributes ${prefix} -owner]
-        set group [file attributes ${prefix} -group]
-        set perms [string range [file attributes ${prefix} -permissions] end-3 end]
-        set installing_user [exec /usr/bin/id -un]
-        if {![string equal $installing_user $owner]} {
-            return -code error "User $installing_user does not own ${prefix} - try using sudo"
-        }
-        ui_debug "Permissions OK"
+        if {[info exists options(ports_selfupdate_prepend)]} {
+            ui_msg "\nMacPorts base is outdated, selfupdate will install $macports_version_new"
+        } else {
+            # get installation user/group and permissions
+            set owner [file attributes ${prefix} -owner]
+            set group [file attributes ${prefix} -group]
+            set perms [string range [file attributes ${prefix} -permissions] end-3 end]
+            set installing_user [exec /usr/bin/id -un]
+            if {![string equal $installing_user $owner]} {
+                return -code error "User $installing_user does not own ${prefix} - try using sudo"
+            }
+            ui_debug "Permissions OK"
 
-        # where to install our macports1.0 tcl package
-        set mp_tclpackage_path [file join $portdbpath .tclpackage]
-        if { [file exists $mp_tclpackage_path]} {
-            set fd [open $mp_tclpackage_path r]
-            gets $fd tclpackage
-            close $fd
-        } else {
-            set tclpackage $libpath
+            # where to install our macports1.0 tcl package
+            set mp_tclpackage_path [file join $portdbpath .tclpackage]
+            if { [file exists $mp_tclpackage_path]} {
+                set fd [open $mp_tclpackage_path r]
+                gets $fd tclpackage
+                close $fd
+            } else {
+                set tclpackage $libpath
+            }
+            
+            # do the actual configure, build and installation of new base
+            ui_msg "\nInstalling new MacPorts release in $prefix as $owner:$group - TCL-PACKAGE in $tclpackage; Permissions: $perms\n"
+            if { [catch { system "cd $mp_source_path && ./configure --prefix=$prefix --with-tclpackage=$tclpackage --with-install-user=$owner --with-install-group=$group --with-directory-mode=$perms && make && make install" } result] } {
+                return -code error "Error installing new MacPorts base: $result"
+            }
         }
-        
-        # do the actual configure, build and installation of new base
-        ui_msg "\nInstalling new MacPorts release in $prefix as $owner:$group - TCL-PACKAGE in $tclpackage; Permissions: $perms\n"
-        if { [catch { system "cd $mp_source_path && ./configure --prefix=$prefix --with-tclpackage=$tclpackage --with-install-user=$owner --with-install-group=$group --with-directory-mode=$perms && make && make install" } result] } {
-            return -code error "Error installing new MacPorts base: $result"
-        }
     } else {
         ui_msg "\nThe MacPorts installation is not outdated so it was not updated"
     }
@@ -1722,8 +1727,6 @@
         return -code error "Couldn't change permissions of the MacPorts sources at $mp_source_path to $sources_owner: $result"
     }
 
-    ui_msg "selfupdate done!"
-
     return 0
 }
 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20080207/9785e200/attachment.html


More information about the macports-changes mailing list