[25236] trunk/base

source_changes at macosforge.org source_changes at macosforge.org
Wed May 16 00:40:43 PDT 2007


Revision: 25236
          http://trac.macosforge.org/projects/macports/changeset/25236
Author:   eridius at macports.org
Date:     2007-05-16 00:40:42 -0700 (Wed, 16 May 2007)

Log Message:
-----------
Add support for [nosync] flag in sources.conf.
Validate each line in sources.conf
Emit warning during dportsearch when unknown source protocol is encountered
Add example for [nosync] flag to default sources.conf file

Modified Paths:
--------------
    trunk/base/ChangeLog
    trunk/base/doc/sources.conf
    trunk/base/src/darwinports1.0/darwinports.tcl

Modified: trunk/base/ChangeLog
===================================================================
--- trunk/base/ChangeLog	2007-05-16 07:32:15 UTC (rev 25235)
+++ trunk/base/ChangeLog	2007-05-16 07:40:42 UTC (rev 25236)
@@ -6,6 +6,10 @@
 
 (unreleased):
 
+    - Add support for [nosync] flag in sources.conf to prevent a source from syncing
+      during a `port sync` or `port selfupdate` (eridius r25236).
+      Example: file:///Users/landonf/misc/MacPorts/dports [nosync]
+
     - Updating a file: source via svn update during port sync now uses the uid/gid
       of the owner of the working copy (eridius r25142).
 
@@ -40,23 +44,23 @@
       (jberry r25146)
       
     - Add support for descriptions on variants:
-		 * The syntax follows the syntax for variant depends, etc.
-		 * Descriptions for variants are entirely optional
-		 * The change to the portindex format to allow variant descriptions
-		   should be backwards compatible. Variant descriptions are stored,
-		   keyed by the variant name, in a new portinfo array named "variant_desc".
+         * The syntax follows the syntax for variant depends, etc.
+         * Descriptions for variants are entirely optional
+         * The change to the portindex format to allow variant descriptions
+           should be backwards compatible. Variant descriptions are stored,
+           keyed by the variant name, in a new portinfo array named "variant_desc".
    
-		Example:
+        Example:
 
-			variant myvariant description "This variant does this and that" {
-				configure.args-append   --do-this --do-that
-			}
-			
-		(jberry r25147)
-		
-	- Only look for, or create, ~/.macports user directory if the HOME environment
-	  variable is defined. (jberry r25177)
-	
+            variant myvariant description "This variant does this and that" {
+                configure.args-append   --do-this --do-that
+            }
+            
+        (jberry r25147)
+        
+    - Only look for, or create, ~/.macports user directory if the HOME environment
+      variable is defined. (jberry r25177)
+    
 
 Release 1.4.40 (7-May-2007, tagged at r24909 by jberry):
 

Modified: trunk/base/doc/sources.conf
===================================================================
--- trunk/base/doc/sources.conf	2007-05-16 07:32:15 UTC (rev 25235)
+++ trunk/base/doc/sources.conf	2007-05-16 07:40:42 UTC (rev 25236)
@@ -2,6 +2,10 @@
 # following line to point at your local dports directory
 # Example: file:///Users/landonf/misc/MacPorts/dports
 #
+# To prevent a source from synchronizing when `port sync` is used,
+# append [nosync] to the end of the line
+# Example: file:///Users/landonf/misc/MacPorts/dports [nosync]
+#
 # To get MacPorts from the www.macports.org rsync server use:
 # rsync://rsync.darwinports.org/dpupdate/dports
 rsync://rsync.darwinports.org/dpupdate/dports

Modified: trunk/base/src/darwinports1.0/darwinports.tcl
===================================================================
--- trunk/base/src/darwinports1.0/darwinports.tcl	2007-05-16 07:32:15 UTC (rev 25235)
+++ trunk/base/src/darwinports1.0/darwinports.tcl	2007-05-16 07:40:42 UTC (rev 25236)
@@ -339,9 +339,19 @@
     fconfigure $fd -encoding utf-8
     while {[gets $fd line] >= 0} {
         set line [string trimright $line]
-        if {![regexp {[\ \t]*#.*|^$} $line]} {
-            lappend sources $line
-	}
+        if {![regexp {^\s*#|^$} $line]} {
+            if {[regexp {^([\w-]+://\S+)(?:\s+\[(\w+(?:,\w+)*)\])?$} $line _ url flags]} {
+                set flags [split $flags ,]
+                foreach flag $flags {
+                    if {[lsearch -exact [list nosync] $flag] == -1} {
+                        ui_warn "$sources_conf source '$line' specifies invalid flag '$flag'"
+                    }
+                }
+                lappend sources [concat [list $url] $flags]
+            } else {
+                ui_warn "$sources_conf specifies invalid source '$line', ignored."
+            }
+        }
     }
     if {![info exists sources]} {
 	if {[file isdirectory dports]} {
@@ -1186,7 +1196,14 @@
 	global darwinports::sources darwinports::portdbpath tcl_platform
 	global darwinports::autoconf::rsync_path
 
+    ui_debug "Synchronizing dports tree(s)"
 	foreach source $sources {
+	    set flags [lrange $source 1 end]
+	    set source [lindex $source 0]
+	    if {[lsearch -exact $flags nosync] != -1} {
+	        ui_debug "Skipping $source"
+	        continue
+	    }
 		ui_info "Synchronizing from $source"
 		switch -regexp -- [darwinports::getprotocol $source] {
 			{^file$} {
@@ -1240,6 +1257,9 @@
 				file mkdir [file dirname $indexfile]
 				exec curl -L -s -S -o $indexfile $source/PortIndex
 			}
+			default {
+			    ui_warn "Unknown protocol for $source"
+			}
 		}
 	}
 }
@@ -1251,6 +1271,8 @@
 	
 	set found 0
 	foreach source $sources {
+	    set flags [lrange $source 1 end]
+	    set source [lindex $source 0]
 		if {[darwinports::getprotocol $source] == "dports"} {
 			array set attrs [list name $pattern]
 			set res [darwinports::index::search $darwinports::portdbpath $source [array get attrs]]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20070516/03192e6c/attachment.html


More information about the macports-changes mailing list