[42662] trunk/base

raimue at macports.org raimue at macports.org
Fri Nov 28 15:18:50 PST 2008


Revision: 42662
          http://trac.macports.org/changeset/42662
Author:   raimue at macports.org
Date:     2008-11-28 15:18:50 -0800 (Fri, 28 Nov 2008)
Log Message:
-----------
Merged revisions 34469,34852,34854-34855,34900,36952-36956,37507-37508,37511-37512,41040,41042-41046,41138-41139,41142-41143,41145,41151,41403,41458,41462-41463,42575,42626,42640-42641,42659 via svnmerge from 
https://svn.macosforge.org/repository/macports/branches/variant-descs-14482/base

........
  r34469 | raimue at macports.org | 2008-02-26 07:08:09 +0100 (Tue, 26 Feb 2008) | 3 lines
  
  port/port.tcl:
  Reading from .config/variant_descriptions actually works
........
  r34852 | raimue at macports.org | 2008-03-09 02:45:22 +0100 (Sun, 09 Mar 2008) | 4 lines
  
  macports1.0/macports.tcl:
  New API: macports::getsourceconfigdir
  Returns the path to .config for a porturl.
........
  r34854 | raimue at macports.org | 2008-03-09 03:11:27 +0100 (Sun, 09 Mar 2008) | 3 lines
  
  port/port.tcl:
  Use new API macports::getsourceconfigdir
........
  r34855 | raimue at macports.org | 2008-03-09 03:12:54 +0100 (Sun, 09 Mar 2008) | 3 lines
  
  port/port.tcl:
  Treat variant descriptions as strings to avoid problems with braces
........
  r34900 | raimue at macports.org | 2008-03-10 16:54:25 +0100 (Mon, 10 Mar 2008) | 3 lines
  
  port/port.tcl:
  Rename variable
........
  r36952 | raimue at macports.org | 2008-05-21 04:20:27 +0200 (Wed, 21 May 2008) | 3 lines
  
  port/port.tcl:
  Remove get_variant_desc, this will now be done in port1.0/portutil.tcl instead
........
  r36953 | raimue at macports.org | 2008-05-21 04:22:04 +0200 (Wed, 21 May 2008) | 3 lines
  
  macports1.0/macports.tcl:
  Give the worker access to variable porturl and proc getsourceconfigdir
........
  r36954 | raimue at macports.org | 2008-05-21 04:23:37 +0200 (Wed, 21 May 2008) | 3 lines
  
  port1.0/tests:
  Fix the portutil test after r36953
........
  r36955 | raimue at macports.org | 2008-05-21 05:01:11 +0200 (Wed, 21 May 2008) | 3 lines
  
  macports1.0/macports.tcl:
  Give worker access to getprotocol and getportdir as they are needed for getsourceconfigdir
........
  r36956 | raimue at macports.org | 2008-05-21 05:02:23 +0200 (Wed, 21 May 2008) | 3 lines
  
  port1.0/portutil.tcl:
  New proc variant_desc, reads global variant description file
........
  r37507 | raimue at macports.org | 2008-06-10 16:04:54 +0200 (Tue, 10 Jun 2008) | 4 lines
  
  port1.0/portutil.tcl:
  Don't warn about a missing description if it is set global,
  but warn if the variant overrides the global description
........
  r37508 | raimue at macports.org | 2008-06-10 16:14:03 +0200 (Tue, 10 Jun 2008) | 3 lines
  
  macports1.0/macports.tcl:
  Use .resources instead of .config as it is a bit clearer, see #14553
........
  r37511 | raimue at macports.org | 2008-06-10 17:22:12 +0200 (Tue, 10 Jun 2008) | 5 lines
  
  port1.0/portutil.tcl:
  Switch back to this format:
  name {description}
  So this could be easily extended if ever needed.
........
  r37512 | raimue at macports.org | 2008-06-10 17:27:48 +0200 (Tue, 10 Jun 2008) | 3 lines
  
  port1.0/portutil.tcl:
  Add a warning if global variant description file could not be opened
........
  r41040 | raimue at macports.org | 2008-10-21 13:06:39 +0200 (Tue, 21 Oct 2008) | 4 lines
  
  macports/macport.tcl:
   * New flag "default" for sources to indicate fallback for resources (group)
   * Add parameter to getsourceconfigdir to get path for a requested file
........
  r41042 | raimue at macports.org | 2008-10-21 13:11:44 +0200 (Tue, 21 Oct 2008) | 3 lines
  
  macports1.0/macports.tcl:
  Rename getsourceconfigdir to getportresourcepath
........
  r41043 | raimue at macports.org | 2008-10-21 13:15:16 +0200 (Tue, 21 Oct 2008) | 3 lines
  
  port1.0/portutil.tcl:
  Use getportresourcepath for the group files
........
  r41044 | raimue at macports.org | 2008-10-21 13:19:47 +0200 (Tue, 21 Oct 2008) | 3 lines
  
  port1.0/portlint.tcl:
  Use getresourcepath for group files
........
  r41045 | raimue at macports.org | 2008-10-21 13:20:36 +0200 (Tue, 21 Oct 2008) | 3 lines
  
  port1.0/portmain.tcl:
  Add a note that we should get rid of $portresourcepath in favor of [getportresourcepath]
........
  r41046 | raimue at macports.org | 2008-10-21 13:40:29 +0200 (Tue, 21 Oct 2008) | 3 lines
  
  port1.0/portutil.tcl:
  Missed one instance of getsourceconfigdir
........
  r41138 | raimue at macports.org | 2008-10-25 20:52:50 +0200 (Sat, 25 Oct 2008) | 3 lines
  
  port1.0/portutil.tcl:
  Use getportresourcepath for global variant descriptions
........
  r41139 | raimue at macports.org | 2008-10-25 21:23:15 +0200 (Sat, 25 Oct 2008) | 3 lines
  
  port1.0/portmain.tcl:
  Correct XXX tag
........
  r41142 | raimue at macports.org | 2008-10-25 23:11:30 +0200 (Sat, 25 Oct 2008) | 3 lines
  
  port1.0/portfetch.tcl:
  Use getportresourcepath
........
  r41143 | raimue at macports.org | 2008-10-25 23:12:04 +0200 (Sat, 25 Oct 2008) | 3 lines
  
  port1.0/portdestroot.tcl:
  Use getportresourcepath
........
  r41145 | raimue at macports.org | 2008-10-26 00:04:15 +0200 (Sun, 26 Oct 2008) | 3 lines
  
  macports1.0/macports.tcl:
  Fix a problem with URLs not using the file protocol
........
  r41151 | raimue at macports.org | 2008-10-26 03:09:54 +0100 (Sun, 26 Oct 2008) | 3 lines
  
  macports1.0/macports.tcl:
  Fix issues introduced in r41145, the file exists check was wrong
........
  r41403 | raimue at macports.org | 2008-11-01 22:59:21 +0100 (Sat, 01 Nov 2008) | 3 lines
  
  port1.0/portutil.tcl:
  Add a debug output which group files are used
........
  r41458 | blb at macports.org | 2008-11-03 22:58:28 +0100 (Mon, 03 Nov 2008) | 2 lines
  
  Add [default] tag and description to sources.conf
........
  r41462 | blb at macports.org | 2008-11-04 02:12:28 +0100 (Tue, 04 Nov 2008) | 2 lines
  
  No longer need to install resources with base
........
  r41463 | blb at macports.org | 2008-11-04 02:14:49 +0100 (Tue, 04 Nov 2008) | 4 lines
  
  Move the install/ subdir (containing the mtree files) into .../share/macports
  from the resources dir (the mtree contains a bit of install-time info, so it
  shouldn't be with the resources stuff in the port tree)
........
  r42575 | blb at macports.org | 2008-11-25 01:53:05 +0100 (Tue, 25 Nov 2008) | 3 lines
  
  Add script to handle upgrades through configure/make/make install and
  the package, so [default] is added as appropriate to sources.conf
........
  r42626 | raimue at macports.org | 2008-11-27 02:21:15 +0100 (Thu, 27 Nov 2008) | 3 lines
  
  package1.0/portpkg.tcl, package1.0/portmpkg.tcl:
  Remove portresourcepath and use [getportresourcepath] instead
........
  r42640 | raimue at macports.org | 2008-11-27 11:49:32 +0100 (Thu, 27 Nov 2008) | 3 lines
  
  package1.0/portrpm.tcl, package1.0/portsrpm.tcl:
  Remove reference to portresurcepath which is not used at all
........
  r42641 | raimue at macports.org | 2008-11-27 11:52:12 +0100 (Thu, 27 Nov 2008) | 3 lines
  
  port1.0/portmain.tcl:
  Remove definition of portresourcepath as it is not used any more
........
  r42659 | raimue at macports.org | 2008-11-28 16:44:30 +0100 (Fri, 28 Nov 2008) | 3 lines
  
  macports1.0/macports.tcl:
  Rename portresourcepath from .resources to _resources
........

Modified Paths:
--------------
    trunk/base/Makefile.in
    trunk/base/doc/Makefile
    trunk/base/doc/sources.conf
    trunk/base/portmgr/dmg/postflight
    trunk/base/src/macports1.0/macports.tcl
    trunk/base/src/package1.0/portmpkg.tcl
    trunk/base/src/package1.0/portpkg.tcl
    trunk/base/src/package1.0/portrpm.tcl
    trunk/base/src/package1.0/portsrpm.tcl
    trunk/base/src/port/port.tcl
    trunk/base/src/port1.0/Makefile
    trunk/base/src/port1.0/portdestroot.tcl
    trunk/base/src/port1.0/portfetch.tcl
    trunk/base/src/port1.0/portlint.tcl
    trunk/base/src/port1.0/portmain.tcl
    trunk/base/src/port1.0/portutil.tcl
    trunk/base/src/port1.0/tests/portutil.tcl
    trunk/base/tests/sources.conf

Added Paths:
-----------
    trunk/base/src/upgrade_sources_conf_default.tcl

Property Changed:
----------------
    trunk/base/
    trunk/base/setupenv.bash.in
    trunk/base/src/dep_map_clean.tcl
    trunk/base/tests/test/dependencies-d/
    trunk/base/tests/test/dependencies-e/


Property changes on: trunk/base
___________________________________________________________________
Modified: svnmerge-integrated
   - /branches/variant-descs-14482/base:1-34465
   + /branches/variant-descs-14482/base:1-42661
Added: svn:mergeinfo
   + /branches/variant-descs-14482/base:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659

Modified: trunk/base/Makefile.in
===================================================================
--- trunk/base/Makefile.in	2008-11-28 21:52:08 UTC (rev 42661)
+++ trunk/base/Makefile.in	2008-11-28 23:18:50 UTC (rev 42662)
@@ -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: trunk/base/doc/Makefile
===================================================================
--- trunk/base/doc/Makefile	2008-11-28 21:52:08 UTC (rev 42661)
+++ trunk/base/doc/Makefile	2008-11-28 23:18:50 UTC (rev 42662)
@@ -58,9 +58,9 @@
 	for m in ${MAN5}; do rm -f ${INSTALLDIR}/share/man/man5/$$m ; done
 	for m in ${MAN7}; do rm -f ${INSTALLDIR}/share/man/man7/$$m ; done
 
-	$(INSTALL) -d -o ${DSTUSR} -g ${DSTGRP} -m ${DSTMODE} ${INSTALLDIR}/share/macports/resources/port1.0/install
-	$(INSTALL) -o ${DSTUSR} -g ${DSTGRP} -m 644 prefix.mtree ${INSTALLDIR}/share/macports/resources/port1.0/install/
-	$(INSTALL) -o ${DSTUSR} -g ${DSTGRP} -m 644 macosx.mtree ${INSTALLDIR}/share/macports/resources/port1.0/install/
+	$(INSTALL) -d -o ${DSTUSR} -g ${DSTGRP} -m ${DSTMODE} ${INSTALLDIR}/share/macports/install
+	$(INSTALL) -o ${DSTUSR} -g ${DSTGRP} -m 644 prefix.mtree ${INSTALLDIR}/share/macports/install/
+	$(INSTALL) -o ${DSTUSR} -g ${DSTGRP} -m 644 macosx.mtree ${INSTALLDIR}/share/macports/install/
 	$(INSTALL) -o ${DSTUSR} -g ${DSTGRP} -m 444 port.1.gz ${INSTALLDIR}/share/man/man1
 	$(INSTALL) -o ${DSTUSR} -g ${DSTGRP} -m 444 macports.conf.5.gz ${INSTALLDIR}/share/man/man5
 	$(INSTALL) -o ${DSTUSR} -g ${DSTGRP} -m 444 portfile.7.gz ${INSTALLDIR}/share/man/man7

Modified: trunk/base/doc/sources.conf
===================================================================
--- trunk/base/doc/sources.conf	2008-11-28 21:52:08 UTC (rev 42661)
+++ trunk/base/doc/sources.conf	2008-11-28 23:18:50 UTC (rev 42662)
@@ -5,6 +5,11 @@
 #  the example below that points to your local ports directory:
 #  Example: file:///Users/landonf/misc/MacPorts/ports
 
+#  The default MacPorts repository should always be tagged [default]
+#  for proper functionality of various resources (port groups, mirror
+#  sites, etc).  If you switch it from the rsync:// URL, be sure to keep
+#  it tagged [default].
+
 #  To prevent a source from synchronizing when `port sync` is used,
 #  append [nosync] at the end as shown in this example:
 #  Example: file:///Users/landonf/misc/MacPorts/ports [nosync]
@@ -19,4 +24,4 @@
 #  To get it from the mirror in Trondheim, Norway use:
 #      rsync://trd.no.rsync.macports.org/release/ports/
 #  A current list of mirrors is available at http://trac.macports.org/wiki/Mirrors
-rsync://rsync.macports.org/release/ports/
+rsync://rsync.macports.org/release/ports/ [default]

Modified: trunk/base/portmgr/dmg/postflight
===================================================================
--- trunk/base/portmgr/dmg/postflight	2008-11-28 21:52:08 UTC (rev 42661)
+++ trunk/base/portmgr/dmg/postflight	2008-11-28 23:18:50 UTC (rev 42662)
@@ -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: trunk/base/setupenv.bash.in
___________________________________________________________________
Deleted: svn:mergeinfo
   - 


Property changes on: trunk/base/src/dep_map_clean.tcl
___________________________________________________________________
Added: svn:keywords
   + Id

Modified: trunk/base/src/macports1.0/macports.tcl
===================================================================
--- trunk/base/src/macports1.0/macports.tcl	2008-11-28 21:52:08 UTC (rev 42661)
+++ trunk/base/src/macports1.0/macports.tcl	2008-11-28 23:18:50 UTC (rev 42662)
@@ -48,7 +48,7 @@
         applications_dir frameworks_dir universal_target universal_sysroot universal_archs"
     variable user_options "submitter_name submitter_email submitter_key"
     variable portinterp_options "\
-        portdbpath portpath portbuildpath auto_path prefix prefix_frozen x11prefix portsharepath \
+        portdbpath porturl portpath portbuildpath auto_path prefix prefix_frozen x11prefix portsharepath \
         registry.path registry.format registry.installtype portarchivemode portarchivepath \
         portarchivetype portautoclean porttrace portverbose destroot_umask rsync_server \
         rsync_options rsync_dir startupitem_type place_worksymlink \
@@ -327,6 +327,7 @@
     global macports::registry.format
     global macports::registry.path
     global macports::sources
+    global macports::sources_default
     global macports::sources_conf
     global macports::destroot_umask
     global macports::libpath
@@ -418,9 +419,12 @@
             if {[regexp {^([\w-]+://\S+)(?:\s+\[(\w+(?:,\w+)*)\])?$} $line _ url flags]} {
                 set flags [split $flags ,]
                 foreach flag $flags {
-                    if {[lsearch -exact [list nosync] $flag] == -1} {
+                    if {[lsearch -exact [list nosync default] $flag] == -1} {
                         ui_warn "$sources_conf source '$line' specifies invalid flag '$flag'"
                     }
+                    if {$flag == "default"} {
+                        set sources_default [concat [list $url] $flags]
+                    }
                 }
                 lappend sources [concat [list $url] $flags]
             } else {
@@ -705,7 +709,7 @@
     }
 }
 
-proc macports::worker_init {workername portpath portbuildpath options variations} {
+proc macports::worker_init {workername portpath porturl portbuildpath options variations} {
     global macports::portinterp_options macports::portinterp_deferred_options registry.installtype
 
     # Hide any Tcl commands that should be inaccessible to port1.0 and Portfiles
@@ -744,6 +748,9 @@
     # Export some utility functions defined here.
     $workername alias macports_create_thread macports::create_thread
     $workername alias getportworkpath_from_buildpath macports::getportworkpath_from_buildpath
+    $workername alias getportresourcepath macports::getportresourcepath
+    $workername alias getprotocol macports::getprotocol
+    $workername alias getportdir macports::getportdir
 
     # New Registry/Receipts stuff
     $workername alias registry_new registry::new_entry
@@ -893,6 +900,41 @@
     }
 }
 
+##
+# Get the path to the _resources directory of the source
+#
+# @param url port url
+# @return path to the _resources directory or the path to the fallback
+proc macports::getportresourcepath {url {path ""}} {
+    global macports::sources_default
+
+    set protocol [getprotocol $url]
+
+    switch -- ${protocol} {
+        file {
+            set proposedpath [file normalize [file join [getportdir $url] .. ..]]
+        }
+    }
+
+    # append requested path
+    set proposedpath [file join $proposedpath _resources $path]
+
+    if {![file exists $proposedpath]} {
+        # fallback
+        set default_source_url [lindex ${sources_default} 0]
+        if {[getprotocol $default_source_url] == "file"} {
+            set proposedpath [getportdir $default_source_url]
+        } else {
+            set proposedpath [getsourcepath $default_source_url]
+        }
+
+        # append requested path
+        set proposedpath [file join $proposedpath _resources $path]
+    }
+
+    return $proposedpath
+}
+
 # dportopen
 # Deprecated version of the new mportopen proc, listed here as backwards
 # compatibility glue for API clients that haven't updated to the new naming
@@ -950,7 +992,7 @@
     ditem_key $mport variations $variations
     ditem_key $mport refcnt 1
     
-    macports::worker_init $workername $portpath [macports::getportbuildpath $portpath] $options $variations
+    macports::worker_init $workername $portpath $porturl [macports::getportbuildpath $portpath] $options $variations
 
     $workername eval source Portfile
     

Modified: trunk/base/src/package1.0/portmpkg.tcl
===================================================================
--- trunk/base/src/package1.0/portmpkg.tcl	2008-11-28 21:52:08 UTC (rev 42661)
+++ trunk/base/src/package1.0/portmpkg.tcl	2008-11-28 23:18:50 UTC (rev 42662)
@@ -109,7 +109,7 @@
 }
 
 proc package_mpkg {portname portversion portrevision} {
-    global portdbpath destpath workpath prefix portresourcepath description package.destpath package.flat long_description homepage depends_run depends_lib
+    global portdbpath destpath workpath prefix porturl description package.destpath package.flat long_description homepage depends_run depends_lib
 
 	set pkgpath ${package.destpath}/${portname}-${portversion}.pkg
 	set mpkgpath ${package.destpath}/${portname}-${portversion}.mpkg
@@ -146,7 +146,7 @@
 	}
     }
     write_welcome_html ${mpkgpath}/Contents/Resources/Welcome.html $portname $portversion $pkg_long_description $pkg_description $pkg_homepage
-    file copy -force -- ${portresourcepath}/package/background.tiff ${mpkgpath}/Contents/Resources/background.tiff
+    file copy -force -- [getportresourcepath $porturl "port1.0/package/background.tiff"] ${mpkgpath}/Contents/Resources/background.tiff
 
 	return 0
 }

Modified: trunk/base/src/package1.0/portpkg.tcl
===================================================================
--- trunk/base/src/package1.0/portpkg.tcl	2008-11-28 21:52:08 UTC (rev 42661)
+++ trunk/base/src/package1.0/portpkg.tcl	2008-11-28 23:18:50 UTC (rev 42662)
@@ -60,7 +60,7 @@
 }
 
 proc package_pkg {portname portversion portrevision} {
-    global UI_PREFIX portdbpath destpath workpath prefix portresourcepath description package.destpath package.flat long_description homepage portpath
+    global UI_PREFIX portdbpath destpath workpath prefix description package.destpath package.flat long_description homepage portpath porturl
     global os.version os.major
 
     set pkgpath ${package.destpath}/${portname}-${portversion}.pkg
@@ -89,7 +89,7 @@
         }
     }
     write_welcome_html ${resourcepath}/${language}.lproj/Welcome.html $portname $portversion $pkg_long_description $pkg_description $pkg_homepage
-    file copy -force -- ${portresourcepath}/package/background.tiff ${resourcepath}/${language}.lproj/background.tiff
+    file copy -force -- [getportresourcepath $porturl "port1.0/package/background.tiff"] ${resourcepath}/${language}.lproj/background.tiff
 
     foreach dir {etc var tmp} {
         if ([file exists "${destpath}/$dir"]) {

Modified: trunk/base/src/package1.0/portrpm.tcl
===================================================================
--- trunk/base/src/package1.0/portrpm.tcl	2008-11-28 21:52:08 UTC (rev 42661)
+++ trunk/base/src/package1.0/portrpm.tcl	2008-11-28 23:18:50 UTC (rev 42662)
@@ -51,7 +51,7 @@
 }
 
 proc rpm_pkg {portname portversion portrevision} {
-    global UI_PREFIX package.destpath portdbpath destpath workpath prefix portresourcepath categories maintainers description long_description homepage epoch portpath
+    global UI_PREFIX package.destpath portdbpath destpath workpath prefix categories maintainers description long_description homepage epoch portpath
 	global os.platform os.arch os.version os.major
     
     set rpmdestpath ""

Modified: trunk/base/src/package1.0/portsrpm.tcl
===================================================================
--- trunk/base/src/package1.0/portsrpm.tcl	2008-11-28 21:52:08 UTC (rev 42661)
+++ trunk/base/src/package1.0/portsrpm.tcl	2008-11-28 23:18:50 UTC (rev 42662)
@@ -52,7 +52,7 @@
 }
 
 proc srpm_pkg {portname portversion portrevision} {
-    global UI_PREFIX package.destpath portdbpath destpath workpath distpath prefix portresourcepath categories maintainers description long_description homepage epoch portpath distfiles fetch_urls
+    global UI_PREFIX package.destpath portdbpath destpath workpath distpath prefix categories maintainers description long_description homepage epoch portpath distfiles fetch_urls
 	global os.platform os.arch os.version os.major
     
     set rpmdestpath ""

Modified: trunk/base/src/port/port.tcl
===================================================================
--- trunk/base/src/port/port.tcl	2008-11-28 21:52:08 UTC (rev 42661)
+++ trunk/base/src/port/port.tcl	2008-11-28 23:18:50 UTC (rev 42662)
@@ -2106,8 +2106,8 @@
             # print out all the variants
             puts "$portname has the variants:"
             foreach v $portinfo(variants) {
-                if {[info exists descs($v)]} {
-                    puts "\t$v: [join [string trim $descs($v)]]"
+                if {[info exists descs($v)] && $descs($v) != ""} {
+                    puts "\t$v: [string trim $descs($v)]"
                 } else {
                     puts "\t$v"
                 }

Modified: trunk/base/src/port1.0/Makefile
===================================================================
--- trunk/base/src/port1.0/Makefile	2008-11-28 21:52:08 UTC (rev 42661)
+++ trunk/base/src/port1.0/Makefile	2008-11-28 23:18:50 UTC (rev 42662)
@@ -8,8 +8,6 @@
 	portdistcheck.tcl portmirror.tcl portload.tcl portunload.tcl \
 	portdistfiles.tcl
 
-SUBDIR=		resources
-
 include ../../Mk/macports.subdir.mk
 include ../../Mk/macports.autoconf.mk
 

Modified: trunk/base/src/port1.0/portdestroot.tcl
===================================================================
--- trunk/base/src/port1.0/portdestroot.tcl	2008-11-28 21:52:08 UTC (rev 42661)
+++ trunk/base/src/port1.0/portdestroot.tcl	2008-11-28 23:18:50 UTC (rev 42662)
@@ -86,7 +86,7 @@
 }
 
 proc destroot_start {args} {
-    global UI_PREFIX prefix portname destroot portresourcepath os.platform destroot.clean
+    global UI_PREFIX prefix portname porturl destroot os.platform destroot.clean portsharepath
     global destroot::oldmask destroot.umask
     
     ui_msg "$UI_PREFIX [format [msgcat::mc "Staging %s into destroot"] ${portname}]"
@@ -100,10 +100,10 @@
     
     file mkdir "${destroot}"
     if { ${os.platform} == "darwin" } {
-        system "cd \"${destroot}\" && ${mtree} -e -U -f ${portresourcepath}/install/macosx.mtree"
+        system "cd \"${destroot}\" && ${mtree} -e -U -f [file join ${portsharepath} install macosx.mtree]"
     }
     file mkdir "${destroot}/${prefix}"
-    system "cd \"${destroot}/${prefix}\" && ${mtree} -e -U -f ${portresourcepath}/install/prefix.mtree"
+    system "cd \"${destroot}/${prefix}\" && ${mtree} -e -U -f [file join ${portsharepath} install prefix.mtree]"
 }
 
 proc destroot_main {args} {

Modified: trunk/base/src/port1.0/portfetch.tcl
===================================================================
--- trunk/base/src/port1.0/portfetch.tcl	2008-11-28 21:52:08 UTC (rev 42661)
+++ trunk/base/src/port1.0/portfetch.tcl	2008-11-28 23:18:50 UTC (rev 42662)
@@ -100,7 +100,7 @@
 default fallback_mirror_site "macports"
 default global_mirror_site "macports_distfiles"
 default mirror_sites.listfile {"mirror_sites.tcl"}
-default mirror_sites.listpath {"${portresourcepath}/fetch/"}
+default mirror_sites.listpath {"port1.0/fetch"}
 
 # Option-executed procedures
 option_proc use_bzip2 fix_extract_suffix
@@ -173,8 +173,10 @@
 # For a given mirror site type, e.g. "gnu" or "x11", check to see if there's a
 # pre-registered set of sites, and if so, return them.
 proc mirror_sites {mirrors tag subdir} {
-    global UI_PREFIX portname portresourcepath mirror_sites.listfile mirror_sites.listpath dist_subdir
-    source ${mirror_sites.listpath}${mirror_sites.listfile}
+    global UI_PREFIX portname porturl mirror_sites.listfile mirror_sites.listpath dist_subdir
+
+    source [getportresourcepath $porturl [file join ${mirror_sites.listpath} ${mirror_sites.listfile}]]
+
     if {![info exists portfetch::mirror_sites::sites($mirrors)]} {
         ui_warn "[format [msgcat::mc "No mirror sites on file for class %s"] $mirrors]"
         return {}

Modified: trunk/base/src/port1.0/portlint.tcl
===================================================================
--- trunk/base/src/port1.0/portlint.tcl	2008-11-28 21:52:08 UTC (rev 42661)
+++ trunk/base/src/port1.0/portlint.tcl	2008-11-28 23:18:50 UTC (rev 42662)
@@ -146,7 +146,7 @@
 }
 
 proc lint_main {args} {
-	global UI_PREFIX portname portpath portresourcepath ports_lint_nitpick
+	global UI_PREFIX portname portpath porturl ports_lint_nitpick
 	set portfile ${portpath}/Portfile
 	set portdirs [split ${portpath} /]
 	set last [llength $portdirs]
@@ -154,7 +154,6 @@
 	set portdir [lindex $portdirs $last]
 	incr last -1
 	set portcatdir [lindex $portdirs $last]
-	set groupdir ${portresourcepath}/group
 
 	set warnings 0
 	set errors 0
@@ -317,7 +316,7 @@
     }
     if (!$seen_portgroup) {
         # PortGroup is optional, so missing is OK
-    }  elseif {![file exists $groupdir/$portgroup-$portgroupversion.tcl]} {
+    }  elseif {![file exists [getportresourcepath $porturl "port1.0/group/${portgroup}-${portgroupversion}.tcl"]]} {
         ui_error "Unknown PortGroup: $portgroup-$portgroupversion"
         incr errors
     } else {
@@ -416,13 +415,19 @@
             if {![info exists variantdesc] || $variantdesc == ""} {
                 # don't warn about missing descriptions for global variants
                 if {[lsearch -exact $local_variants $variantname] != -1 &&
-                    [lsearch -exact $lint_variants $variantname] == -1} {
+                    [lsearch -exact $lint_variants $variantname] == -1 && 
+                    [variant_desc $porturl $variantname] == ""} {
                     ui_warn "Variant $variantname does not have a description"
                     incr warnings
                     set desc_ok false
                 } elseif {$variantdesc == ""} {
                     set variantdesc "(pre-defined variant)"
                 }
+            } else {
+                if {[variant_desc $porturl $variantname] != ""} {
+                    ui_warn "Variant $variantname overrides global description"
+                    incr warnings
+                }
             }
 
             if {$name_ok} {

Modified: trunk/base/src/port1.0/portmain.tcl
===================================================================
--- trunk/base/src/port1.0/portmain.tcl	2008-11-28 21:52:08 UTC (rev 42661)
+++ trunk/base/src/port1.0/portmain.tcl	2008-11-28 23:18:50 UTC (rev 42662)
@@ -52,8 +52,6 @@
 # Assign option procedure to default_variants
 option_proc default_variants handle_default_variants
 
-# Hard coded version number for resource location
-default portresourcepath {[file join $portsharepath resources/port1.0]}
 default distpath {[file join $portdbpath distfiles]}
 default workpath {[getportworkpath_from_buildpath $portbuildpath]}
 default worksymlink {[file join $portpath work]}

Modified: trunk/base/src/port1.0/portutil.tcl
===================================================================
--- trunk/base/src/port1.0/portutil.tcl	2008-11-28 21:52:08 UTC (rev 42661)
+++ trunk/base/src/port1.0/portutil.tcl	2008-11-28 23:18:50 UTC (rev 42662)
@@ -412,7 +412,7 @@
 # variant <provides> [<provides> ...] [requires <requires> [<requires>]]
 # Portfile level procedure to provide support for declaring variants
 proc variant {args} {
-    global all_variants PortInfo
+    global all_variants PortInfo porturl
     
     set len [llength $args]
     set code [lindex $args end]
@@ -450,6 +450,12 @@
     } else {
         lappend PortInfo(variants) $variant_provides
         set vdesc [join [ditem_key $ditem description]]
+
+        # read global variant description, if none given
+        if {$vdesc == ""} {
+            set vdesc [variant_desc $porturl $variant_provides]
+        }
+
         if {$vdesc != ""} {
             lappend PortInfo(variant_desc) $variant_provides $vdesc
         }
@@ -538,6 +544,46 @@
     return 0
 }
 
+##
+# Get description for a variant from global descriptions file
+#
+# @param porturl url to a port
+# @param variant name
+# @return description from descriptions file or an empty string
+proc variant_desc {porturl variant} {
+    global variant_descs_global
+
+    set descfile [getportresourcepath $porturl variant_descriptions.conf]
+    if {![info exists variant_descs_global($descfile)]} {
+        set variant_descs_global($descfile) yes
+
+        if {[file exists $descfile]} {
+            if {[catch {set fd [open $descfile r]} err]} {
+                ui_warn "Could not open global variant description file: $err"
+                return ""
+            }
+            set lineno 0
+            while {[gets $fd line] >= 0} {
+                incr lineno
+                set name [lindex $line 0]
+                set desc [lindex $line 1]
+                if {$name != "" && $desc != ""} {
+                    set variant_descs_global(${descfile}_$name) $desc
+                } else {
+                    ui_warn "Invalid variant description in $descfile at line $lineno"
+                }
+            }
+            close $fd
+        }
+    }
+
+    if {[info exists variant_descs_global(${descfile}_${variant})]} {
+        return $variant_descs_global(${descfile}_${variant})
+    } else {
+        return ""
+    }
+}
+
 # platform <os> [<release>] [<arch>] 
 # Portfile level procedure to provide support for declaring platform-specifics
 # Basically, just wrap 'variant', so that Portfiles' platform declarations can
@@ -1985,11 +2031,12 @@
 
 # Use a specified group/version.
 proc PortGroup {group version} {
-    global portresourcepath
+    global porturl
 
-    set groupFile ${portresourcepath}/group/${group}-${version}.tcl
+    set groupFile [getportresourcepath $porturl "port1.0/group/${group}-${version}.tcl"]
 
     if {[file exists $groupFile]} {
+        ui_debug "Using group file $groupFile"
         uplevel "source $groupFile"
     } else {
         ui_warn "Group file could not be located."

Modified: trunk/base/src/port1.0/tests/portutil.tcl
===================================================================
--- trunk/base/src/port1.0/tests/portutil.tcl	2008-11-28 21:52:08 UTC (rev 42661)
+++ trunk/base/src/port1.0/tests/portutil.tcl	2008-11-28 23:18:50 UTC (rev 42662)
@@ -67,7 +67,7 @@
     # depends_lib is intended to work from within a worker thread
     # so we shall oblige
     set workername [interp create]
-    macports::worker_init $workername {} [macports::getportbuildpath {}] {} {}
+    macports::worker_init $workername {} {} [macports::getportbuildpath {}] {} {}
     $workername alias scriptname info script
     set body {
         # load the current copy of portutil instead of the installed one

Copied: trunk/base/src/upgrade_sources_conf_default.tcl (from rev 42626, branches/variant-descs-14482/base/src/upgrade_sources_conf_default.tcl)
===================================================================
--- trunk/base/src/upgrade_sources_conf_default.tcl	                        (rev 0)
+++ trunk/base/src/upgrade_sources_conf_default.tcl	2008-11-28 23:18:50 UTC (rev 42662)
@@ -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
+

Modified: trunk/base/tests/sources.conf
===================================================================
--- trunk/base/tests/sources.conf	2008-11-28 21:52:08 UTC (rev 42661)
+++ trunk/base/tests/sources.conf	2008-11-28 23:18:50 UTC (rev 42662)
@@ -1,3 +1,3 @@
 # To enable your local ports repository, uncomment and customize the
 # following line to point at your local ports directory
-file:///tmp/macports-tests/ports
+file:///tmp/macports-tests/ports [default]


Property changes on: trunk/base/tests/test/dependencies-d
___________________________________________________________________
Deleted: svn:mergeinfo
   - 


Property changes on: trunk/base/tests/test/dependencies-e
___________________________________________________________________
Deleted: svn:mergeinfo
   - 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20081128/6b2c7e3d/attachment-0001.html>


More information about the macports-changes mailing list