[42848] branches/release_1_7
blb at macports.org
blb at macports.org
Mon Dec 1 00:42:29 PST 2008
Revision: 42848
http://trac.macports.org/changeset/42848
Author: blb at macports.org
Date: 2008-12-01 00:42:29 -0800 (Mon, 01 Dec 2008)
Log Message:
-----------
base/src/upgrade_sources_conf_default.tcl - merge r42845, r42846, and r42847
from trunk:
make sure to delete the temp file if we didn't use it
support svn from macports.org and macosforge.org, and rsync from macports.org and old darwinports.org
copy some code from mportinit to better parse the lines from sources.conf, which then allows the use of lists to vastly improve detection of whether the default tag is present, so we don't end up with '[nosync,default,default]'
Modified Paths:
--------------
branches/release_1_7/base/src/upgrade_sources_conf_default.tcl
Property Changed:
----------------
branches/release_1_7/
Property changes on: branches/release_1_7
___________________________________________________________________
Modified: svn:mergeinfo
- /trunk:42683,42697,42734,42747,42760
+ /trunk:42683,42697,42734,42747,42760,42845-42847
Modified: branches/release_1_7/base/src/upgrade_sources_conf_default.tcl
===================================================================
--- branches/release_1_7/base/src/upgrade_sources_conf_default.tcl 2008-12-01 08:34:14 UTC (rev 42847)
+++ branches/release_1_7/base/src/upgrade_sources_conf_default.tcl 2008-12-01 08:42:29 UTC (rev 42848)
@@ -23,15 +23,6 @@
}
-proc append_default_tag_to_line {line} {
- if {[regexp {^(.* )\[(.*)\](.*)$} $line -> line_begin current_tag line_end]} {
- return "${line_begin}\[${current_tag},default\]${line_end}"
- } else {
- return "${line} \[default\]"
- }
-}
-
-
set mktempChannel [open "|/usr/bin/mktemp -t macports_sources_upgrade" r]
set tempfile [read -nonewline $mktempChannel]
close $mktempChannel
@@ -41,27 +32,33 @@
set defaultWritten false
while {[gets $sourcesConfChannel line] >= 0} {
+ set addDefault false
if {!$defaultSeen && ![regexp {^\s*#|^$} $line]} {
- if {[string first {[default]} $line] >= 0} {
- set defaultSeen true
- } elseif {[regexp {^\s*rsync://rsync\.macports\.org/release/ports/} $line]} {
- set line [append_default_tag_to_line $line]
- set defaultSeen true
- set defaultWritten true
- } elseif {[regexp {^\s*file://(/[^ #]+)} $line -> filepath]} {
- if {[file exists [file join ${filepath} .svn]]} {
- set svnChannel [open "|svn info ${filepath}" r]
- set svnURL {}
- while {[gets $svnChannel svnLine] >= 0} {
- regexp {^URL: (.*)} $svnLine -> svnURL
+ if {[regexp {^([\w-]+://\S+)(?:\s+\[(\w+(?:,\w+)*)\])?$} $line -> url flags]} {
+ set flags [split $flags ,]
+ if {[lsearch $flags default] >= 0} {
+ set defaultSeen true
+ } elseif {[regexp {rsync://rsync\.(macports|darwinports)\.org/(release|dpupdate)/d?ports} $url]} {
+ set addDefault true
+ } elseif {[regexp {file://(/.+)} $url -> filepath]} {
+ if {[file exists [file join ${filepath} .svn]]} {
+ set svnChannel [open "|svn info ${filepath}" r]
+ set svnURL {}
+ while {[gets $svnChannel svnLine] >= 0} {
+ regexp {^URL: (.*)} $svnLine -> svnURL
+ }
+ close $svnChannel
+ if {[regexp {^https?://svn\.(macports|macosforge)\.org/repository/macports/trunk/dports} $svnURL]} {
+ set addDefault true
+ }
}
- close $svnChannel
- if {[regexp {^https?://svn\.macports\.org/repository/macports/trunk/dports} $svnURL]} {
- set line [append_default_tag_to_line $line]
- set defaultSeen true
- set defaultWritten true
- }
}
+ if {$addDefault} {
+ lappend flags default
+ set line "$url \[[join $flags ,]\]"
+ set defaultSeen true
+ set defaultWritten true
+ }
}
}
puts $tempfileChannel $line
@@ -76,6 +73,9 @@
}
file rename ${tempfile} ${sourcesConf}
eval file attributes ${sourcesConf} $attributes
+} else {
+ file delete ${tempfile}
}
+
exit 0
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20081201/96577dd3/attachment-0001.html>
More information about the macports-changes
mailing list