Revision: 83271 http://trac.macports.org/changeset/83271 Author: jmr@macports.org Date: 2011-08-29 06:58:53 -0700 (Mon, 29 Aug 2011) Log Message: ----------- don't regenerate PortIndex locally during selfupdate when base is outdated, and tell user to selfupdate again if that means there are sources without a current index (#30739) Modified Paths: -------------- trunk/base/src/macports1.0/macports.tcl Modified: trunk/base/src/macports1.0/macports.tcl =================================================================== --- trunk/base/src/macports1.0/macports.tcl 2011-08-29 12:55:50 UTC (rev 83270) +++ trunk/base/src/macports1.0/macports.tcl 2011-08-29 13:58:53 UTC (rev 83271) @@ -1938,6 +1938,9 @@ global macports::portverbose global macports::autoconf::rsync_path macports::autoconf::tar_path macports::autoconf::openssl_path array set options $optionslist + if {[info exists options(no_reindex)]} { + upvar $options(needed_portindex_var) any_needed_portindex + } set numfailed 0 @@ -2065,8 +2068,10 @@ file delete -force ${destdir}/tmp } + set needs_portindex 1 # now sync the index if the local file is missing or older than a day - if {![file isfile $indexfile] || [expr [clock seconds] - [file mtime $indexfile]] > 86400} { + if {![file isfile $indexfile] || [expr [clock seconds] - [file mtime $indexfile]] > 86400 + || [info exists options(no_reindex)]} { if {$is_tarball} { # chop ports.tar off the end set index_source [string range $source 0 end-[string length [file tail $source]]] @@ -2080,8 +2085,10 @@ ui_debug "Synchronization of the PortIndex failed doing rsync" } else { set ok 1 + set needs_portindex 0 if {$is_tarball} { set ok 0 + set needs_portindex 1 # verify signature for PortIndex set rsync_commandline "${macports::autoconf::rsync_path} ${rsync_options} ${remote_indexfile}.rmd160 ${destdir}" ui_debug $rsync_commandline @@ -2089,6 +2096,7 @@ foreach pubkey ${macports::archivefetch_pubkeys} { if {![catch {exec $openssl dgst -ripemd160 -verify $pubkey -signature ${destdir}/PortIndex.rmd160 ${destdir}/PortIndex} result]} { set ok 1 + set needs_portindex 0 ui_debug "successful verification with key $pubkey" break } else { @@ -2110,7 +2118,6 @@ if {[catch {system "chmod -R a+r \"$destdir\""}]} { ui_warn "Setting world read permissions on parts of the ports tree failed, need root?" } - set needs_portindex 1 } {^https?$|^ftp$} { if {[_source_is_snapshot $source filename extension]} { @@ -2172,8 +2179,6 @@ } file delete $tarpath - - set needs_portindex 1 } else { # sync just a PortIndex file set indexfile [macports::getindex $source] @@ -2188,10 +2193,13 @@ } if {$needs_portindex} { - global macports::prefix - set indexdir [file dirname [macports::getindex $source]] - if {[catch {system "${macports::prefix}/bin/portindex $indexdir"}]} { - ui_error "updating PortIndex for $source failed" + set any_needed_portindex 1 + if {![info exists options(no_reindex)]} { + global macports::prefix + set indexdir [file dirname [macports::getindex $source]] + if {[catch {system "${macports::prefix}/bin/portindex $indexdir"}]} { + ui_error "updating PortIndex for $source failed" + } } } } @@ -2935,14 +2943,6 @@ set updatestatus no } - # syncing ports tree. - if {![info exists options(ports_selfupdate_nosync)] || $options(ports_selfupdate_nosync) != "yes"} { - ui_msg "---> Updating the ports tree" - if {[catch {mportsync $optionslist} result]} { - return -code error "Couldn't sync the ports tree: $result" - } - } - # are we syncing a tarball? (implies detached signature) set is_tarball 0 if {[string range ${rsync_dir} end-3 end] == ".tar"} { @@ -3031,6 +3031,20 @@ # check if we we need to rebuild base set comp [vercmp $macports_version_new $macports::autoconf::macports_version] + + # syncing ports tree. + if {![info exists options(ports_selfupdate_nosync)] || $options(ports_selfupdate_nosync) != "yes"} { + ui_msg "---> Updating the ports tree" + if {$comp > 0} { + # updated portfiles potentially need new base to parse - tell sync to try to + # use prefabricated PortIndex files and signal if it couldn't + lappend optionslist no_reindex 1 needed_portindex_var needed_portindex + } + if {[catch {mportsync $optionslist} result]} { + return -code error "Couldn't sync the ports tree: $result" + } + } + if {$use_the_force_luke == "yes" || $comp > 0} { if {[info exists options(ports_dryrun)] && $options(ports_dryrun) == "yes"} { ui_msg "---> MacPorts base is outdated, selfupdate would install $macports_version_new (dry run)" @@ -3098,8 +3112,13 @@ } if {![info exists options(ports_selfupdate_nosync)] || $options(ports_selfupdate_nosync) != "yes"} { - ui_msg "\nThe ports tree has been updated. To upgrade your installed ports, you should run" - ui_msg " port upgrade outdated" + if {[info exists needed_portindex]} { + ui_msg "Not all sources could be fully synced using the old version of MacPorts." + ui_msg "Please run selfupdate again now that MacPorts base has been updated." + } else { + ui_msg "\nThe ports tree has been updated. To upgrade your installed ports, you should run" + ui_msg " port upgrade outdated" + } } return 0