New Ticket     Wiki     Browse Source     Timeline     Roadmap     Ticket Reports     Search

Changeset 33938

Show
Ignore:
Timestamp:
02/07/2008 19:34:55 (4 years ago)
Author:
raimue@…
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.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/base/src/macports1.0/macports.tcl

    r33729 r33938  
    16701670        set use_the_force_luke no 
    16711671        ui_debug "Rebuilding and reinstalling MacPorts if needed" 
    1672         # Choose what version file to use: old, floating point format or new, real version number format 
    1673         set old_version_file [file join $mp_source_path config mp_version] 
    1674         set new_version_file [file join $mp_source_path config macports_version] 
    1675         if {[file exists $old_version_file]} { 
    1676             set fd [open $old_version_file r] 
    1677         } elseif {[file exists $new_version_file]} { 
    1678             set fd [open $new_version_file r] 
    1679         } 
    1680         # get downloaded MacPorts version 
    1681         gets $fd macports_version_new 
    1682         close $fd 
    1683         # echo downloaded MacPorts version 
    1684         ui_msg "Downloaded MacPorts base version $macports_version_new" 
    1685     } 
     1672    } 
     1673 
     1674    # Choose what version file to use: old, floating point format or new, real version number format 
     1675    set old_version_file [file join $mp_source_path config mp_version] 
     1676    set new_version_file [file join $mp_source_path config macports_version] 
     1677    if {[file exists $old_version_file]} { 
     1678        set fd [open $old_version_file r] 
     1679    } elseif {[file exists $new_version_file]} { 
     1680        set fd [open $new_version_file r] 
     1681    } 
     1682    # get downloaded MacPorts version 
     1683    gets $fd macports_version_new 
     1684    close $fd 
     1685    # echo downloaded MacPorts version 
     1686    ui_msg "Downloaded MacPorts base version $macports_version_new" 
    16861687 
    16871688    # check if we we need to rebuild base 
    16881689    if {$use_the_force_luke == "yes" || [rpm-vercomp $macports_version_new $macports::autoconf::macports_version] > 0} { 
    1689         # get installation user/group and permissions 
    1690         set owner [file attributes ${prefix} -owner] 
    1691         set group [file attributes ${prefix} -group] 
    1692         set perms [string range [file attributes ${prefix} -permissions] end-3 end] 
    1693         set installing_user [exec /usr/bin/id -un] 
    1694         if {![string equal $installing_user $owner]} { 
    1695             return -code error "User $installing_user does not own ${prefix} - try using sudo" 
    1696         } 
    1697         ui_debug "Permissions OK" 
    1698  
    1699         # where to install our macports1.0 tcl package 
    1700         set mp_tclpackage_path [file join $portdbpath .tclpackage] 
    1701         if { [file exists $mp_tclpackage_path]} { 
    1702             set fd [open $mp_tclpackage_path r] 
    1703             gets $fd tclpackage 
    1704             close $fd 
     1690        if {[info exists options(ports_selfupdate_prepend)]} { 
     1691            ui_msg "\nMacPorts base is outdated, selfupdate will install $macports_version_new" 
    17051692        } else { 
    1706             set tclpackage $libpath 
    1707         } 
    1708          
    1709         # do the actual configure, build and installation of new base 
    1710         ui_msg "\nInstalling new MacPorts release in $prefix as $owner:$group - TCL-PACKAGE in $tclpackage; Permissions: $perms\n" 
    1711         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] } { 
    1712             return -code error "Error installing new MacPorts base: $result" 
     1693            # get installation user/group and permissions 
     1694            set owner [file attributes ${prefix} -owner] 
     1695            set group [file attributes ${prefix} -group] 
     1696            set perms [string range [file attributes ${prefix} -permissions] end-3 end] 
     1697            set installing_user [exec /usr/bin/id -un] 
     1698            if {![string equal $installing_user $owner]} { 
     1699                return -code error "User $installing_user does not own ${prefix} - try using sudo" 
     1700            } 
     1701            ui_debug "Permissions OK" 
     1702 
     1703            # where to install our macports1.0 tcl package 
     1704            set mp_tclpackage_path [file join $portdbpath .tclpackage] 
     1705            if { [file exists $mp_tclpackage_path]} { 
     1706                set fd [open $mp_tclpackage_path r] 
     1707                gets $fd tclpackage 
     1708                close $fd 
     1709            } else { 
     1710                set tclpackage $libpath 
     1711            } 
     1712             
     1713            # do the actual configure, build and installation of new base 
     1714            ui_msg "\nInstalling new MacPorts release in $prefix as $owner:$group - TCL-PACKAGE in $tclpackage; Permissions: $perms\n" 
     1715            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] } { 
     1716                return -code error "Error installing new MacPorts base: $result" 
     1717            } 
    17131718        } 
    17141719    } else { 
     
    17221727        return -code error "Couldn't change permissions of the MacPorts sources at $mp_source_path to $sources_owner: $result" 
    17231728    } 
    1724  
    1725     ui_msg "selfupdate done!" 
    17261729 
    17271730    return 0