[42575] branches/variant-descs-14482/base

blb at macports.org blb at macports.org
Mon Nov 24 16:53:06 PST 2008


Revision: 42575
          http://trac.macports.org/changeset/42575
Author:   blb at macports.org
Date:     2008-11-24 16:53:05 -0800 (Mon, 24 Nov 2008)
Log Message:
-----------
Add script to handle upgrades through configure/make/make install and
the package, so [default] is added as appropriate to sources.conf

Modified Paths:
--------------
    branches/variant-descs-14482/base/Makefile.in
    branches/variant-descs-14482/base/portmgr/dmg/postflight

Added Paths:
-----------
    branches/variant-descs-14482/base/src/upgrade_sources_conf_default.tcl

Property Changed:
----------------
    branches/variant-descs-14482/base/src/dep_map_clean.tcl

Modified: branches/variant-descs-14482/base/Makefile.in
===================================================================
--- branches/variant-descs-14482/base/Makefile.in	2008-11-24 21:51:41 UTC (rev 42574)
+++ branches/variant-descs-14482/base/Makefile.in	2008-11-25 00:53:05 UTC (rev 42575)
@@ -40,6 +40,8 @@
 	$(INSTALL) -o ${DSTUSR} -g ${DSTGRP} -m 444 setupenv.bash  ${datadir}/macports/
 # Remove duplicate entries from the dependency map (could occur with 1.6 and earlier):
 	$(TCLSH) src/dep_map_clean.tcl ${TCL_PACKAGE_DIR}
+# Add [default] tag to the central MacPorts repository, if it isn't already
+	$(TCLSH) src/upgrade_sources_conf_default.tcl ${prefix}
 	@echo ""; echo "Congratulations, you have successfully installed the MacPorts system. To get the Portfiles and update the system, run:"; echo ""
 	@echo "sudo port -v selfupdate"; echo ""
 	@echo "Please read \"man port\", the MacPorts guide at http://guide.macports.org/ and Wiki at http://trac.macports.org/ for full documentation."; echo ""

Modified: branches/variant-descs-14482/base/portmgr/dmg/postflight
===================================================================
--- branches/variant-descs-14482/base/portmgr/dmg/postflight	2008-11-24 21:51:41 UTC (rev 42574)
+++ branches/variant-descs-14482/base/portmgr/dmg/postflight	2008-11-25 00:53:05 UTC (rev 42575)
@@ -61,6 +61,8 @@
     
     # Remove any duplicates from the dep map (could occur with 1.6 and earlier)
     ${TCLSH} dep_map_clean.tcl ${TCL_PACKAGE_DIR}
+    # Add [default] tag to the central MacPorts repository, if it isn't already
+    ${TCLSH} upgrade_sources_conf_default.tcl ${PREFIX}
 }
 
 # Through this command we write an environment variable to an appropriate shell configuration file,


Property changes on: branches/variant-descs-14482/base/src/dep_map_clean.tcl
___________________________________________________________________
Added: svn:keywords
   + Id

Added: branches/variant-descs-14482/base/src/upgrade_sources_conf_default.tcl
===================================================================
--- branches/variant-descs-14482/base/src/upgrade_sources_conf_default.tcl	                        (rev 0)
+++ branches/variant-descs-14482/base/src/upgrade_sources_conf_default.tcl	2008-11-25 00:53:05 UTC (rev 42575)
@@ -0,0 +1,67 @@
+#!/usr/bin/tclsh
+#
+# $Id$
+#
+# Upgrade sources.conf for a given prefix (passed as the first and only
+# argument).
+#
+# For an rsync: repository, if it is the standard MacPorts one and not
+# already tagged, then make it default, if another wasn't already default.
+# For a file:// respository, if it is an svn checkout from the MacPorts
+# server, then make it default if another hasn't already been tagged.
+#
+
+if {[llength $::argv] == 0} {
+   puts "Usage: ${::argv0} <prefix>"
+   exit 1
+}
+
+set prefix [lindex $::argv 0]
+set sourcesConf ${prefix}/etc/macports/sources.conf
+if {[catch {set sourcesConfChannel [open $sourcesConf r]}]} {
+   exit 0
+}
+
+set mktempChannel [open "|/usr/bin/mktemp -t macports_sources_upgrade" r]
+set tempfile [read -nonewline $mktempChannel]
+close $mktempChannel
+
+set tempfileChannel [open $tempfile w]
+set defaultSeen false
+set defaultWritten false
+
+while {[gets $sourcesConfChannel line] >= 0} {
+   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 "$line \[default\]"
+         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
+            }
+            close $svnChannel
+            if {[regexp {^https?://svn\.macports\.org/repository/macports/trunk/dports} $svnURL]} {
+               set line "${line} \[default\]"
+               set defaultSeen true
+               set defaultWritten true
+            }
+         }
+      }
+   }
+   puts $tempfileChannel $line
+}
+close $tempfileChannel
+close $sourcesConfChannel
+
+if {$defaultWritten} {
+   file rename ${sourcesConf} "${sourcesConf}.mpsaved"
+   file rename ${tempfile} ${sourcesConf}
+}
+exit 0
+


Property changes on: branches/variant-descs-14482/base/src/upgrade_sources_conf_default.tcl
___________________________________________________________________
Added: svn:executable
   + *
Added: svn:keywords
   + Id
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20081124/6d32e5a8/attachment.html>


More information about the macports-changes mailing list