[25283] trunk/base/src

source_changes at macosforge.org source_changes at macosforge.org
Wed May 16 21:44:07 PDT 2007


Revision: 25283
          http://trac.macosforge.org/projects/macports/changeset/25283
Author:   jberry at macports.org
Date:     2007-05-16 21:44:07 -0700 (Wed, 16 May 2007)

Log Message:
-----------
Remove workdir variable.

 * Placement of the work symlink in the portdir is now optional based on the place_worksymlink key in ports.conf. This defaults to yes.
 * New command Can't map the URL 'file://.' to a port description file ("Could not find Portfile in /Users/jberry/Projects/macports/trunk/base/src").
Please verify that the directory and portfile syntax are correct.
To use the current port, you must be in a port's directory.
(you might also see this message if a pseudo-port such as
outdated or installed expands to no ports). prints the path to the workdir, if there is one.

These changes make it possible to have a port repository that is entirely readonly and not written to during build, etc.

Note that by keeping place_worksymlink at its default value of yes, no behavior should be changed for the user/developer. (until we decide to default this to no ;).

There exists about three ports that use workdir, and these will need to be modified to use workpath instead.

Modified Paths:
--------------
    trunk/base/src/darwinports1.0/darwinports.tcl
    trunk/base/src/port/port.tcl
    trunk/base/src/port1.0/portclean.tcl
    trunk/base/src/port1.0/portmain.tcl
    trunk/base/src/port1.0/portutil.tcl

Modified: trunk/base/src/darwinports1.0/darwinports.tcl
===================================================================
--- trunk/base/src/darwinports1.0/darwinports.tcl	2007-05-17 04:05:00 UTC (rev 25282)
+++ trunk/base/src/darwinports1.0/darwinports.tcl	2007-05-17 04:44:07 UTC (rev 25283)
@@ -41,14 +41,14 @@
     	portdbpath libpath binpath auto_path extra_env sources_conf prefix portdbformat \
     	portinstalltype portarchivemode portarchivepath portarchivetype portautoclean \
     	porttrace portverbose destroot_umask variants_conf rsync_server rsync_options \
-    	rsync_dir startupitem_type xcodeversion xcodebuildcmd \
+    	rsync_dir startupitem_type place_worksymlink xcodeversion xcodebuildcmd \
     	mp_remote_url mp_remote_submit_url"
     variable user_options "submitter_name submitter_email submitter_key"
     variable portinterp_options "\
     	portdbpath portpath portbuildpath auto_path prefix prefix_frozen portsharepath \
     	registry.path registry.format registry.installtype portarchivemode portarchivepath \
     	portarchivetype portautoclean porttrace portverbose destroot_umask rsync_server \
-    	rsync_options rsync_dir startupitem_type \
+    	rsync_options rsync_dir startupitem_type place_worksymlink \
     	mp_remote_url mp_remote_submit_url \
     	$user_options"
     
@@ -255,7 +255,6 @@
 	global darwinports::registry.path
 	global darwinports::sources
 	global darwinports::sources_conf
-	global darwinports::startupitem_type
    	global darwinports::destroot_umask
    	global darwinports::libpath
    	global darwinports::prefix
@@ -530,19 +529,21 @@
     }
     
     # Set startupitem default type (can be overridden by portfile)
-    if {![info exists startupitem_type]} {
+    if {![info exists darwinports::startupitem_type]} {
     	set darwinports::startupitem_type "default"
-    	global darwinports::startupitem_type
     }
     
+    # Default place_worksymlink
+    if {![info exists darwinports::place_worksymlink]} {
+    	set darwinports::place_worksymlink yes
+    }
+    
     # Default mp remote options
-    if {![info exists mp_remote_url]} {
+    if {![info exists darwinports::mp_remote_url]} {
     	set darwinports::mp_remote_url "http://db.macports.org"
-    	global darwinports::mp_remote_url
     }
-    if {![info exists mp_remote_submit_url]} {
+    if {![info exists darwinports::mp_remote_submit_url]} {
     	set darwinports::mp_remote_submit_url "${darwinports::mp_remote_url}/submit"
-    	global darwinports::mp_remote_submit_url
     }
     
     # ENV cleanup.
@@ -633,6 +634,7 @@
     
     # Export some utility functions defined here.
     $workername alias darwinports_create_thread darwinports::create_thread
+    $workername alias getportworkpath_from_buildpath darwinports::getportworkpath_from_buildpath
 
 	# New Registry/Receipts stuff
 	$workername alias registry_new registry::new_entry
@@ -765,7 +767,7 @@
 	if {[regexp {(?x)([^:]+)://(.+)} $url match protocol string] == 1} {
 		switch -regexp -- ${protocol} {
 			{^file$} {
-				return $string
+				return [file normalize $string]
 			}
 			{^dports$} {
 				return [darwinports::index::fetch_port $url $destdir]
@@ -813,12 +815,11 @@
 		set portdir ""
 	}
 
-	set portdir [darwinports::getportdir $porturl $portdir]
-	ui_debug "Changing to port directory: $portdir"
-	cd $portdir
-	set portpath [pwd]
+	set portpath [darwinports::getportdir $porturl $portdir]
+	ui_debug "Changing to port directory: $portpath"
+	cd $portpath
     if {![file isfile Portfile]} {
-        return -code error "Could not find Portfile in $portdir"
+        return -code error "Could not find Portfile in $portpath"
     }
 
 	set workername [interp create]
@@ -1183,6 +1184,14 @@
 	return [file join $portdbpath build $port_path]
 }
 
+proc darwinports::getportworkpath_from_buildpath {portbuildpath} {
+	return [file join $portbuildpath work]
+}
+
+proc darwinports::getportworkpath_from_portdir {portpath} {
+	return [darwinports::getportworkpath_from_buildpath [darwinports::getportbuildpath $portpath]]
+}
+
 proc darwinports::getindex {source} {
 	# Special case file:// sources
 	if {[darwinports::getprotocol $source] == "file"} {

Modified: trunk/base/src/port/port.tcl
===================================================================
--- trunk/base/src/port/port.tcl	2007-05-17 04:05:00 UTC (rev 25282)
+++ trunk/base/src/port/port.tcl	2007-05-17 04:44:07 UTC (rev 25283)
@@ -1968,6 +1968,14 @@
 					puts $portdir
 				}
 				
+				work {
+					# output the path to the port's work directory
+					set workpath [darwinports::getportworkpath_from_portdir $portdir]
+					if {[file exists $workpath]} {
+						puts $workpath
+					}
+				}
+				
 				cd {
 					# Change to the port's directory, making it the default
 					# port for any future commands
@@ -2157,6 +2165,7 @@
 	edit		action_portcmds
 	cat			action_portcmds
 	dir			action_portcmds
+	work		action_portcmds
 	cd			action_portcmds
 	url			action_portcmds
 	file		action_portcmds

Modified: trunk/base/src/port1.0/portclean.tcl
===================================================================
--- trunk/base/src/port1.0/portclean.tcl	2007-05-17 04:05:00 UTC (rev 25282)
+++ trunk/base/src/port1.0/portclean.tcl	2007-05-17 04:44:07 UTC (rev 25283)
@@ -165,7 +165,7 @@
 	}
 
 	# Clean symlink, if necessary
-	if {[file type $worksymlink] == "link"} {
+	if {[file exists $worksymlink] && [file type $worksymlink] == "link"} {
 		ui_debug "Removing symlink: ${worksymlink}"
 		file delete -force -- ${worksymlink}
 	}

Modified: trunk/base/src/port1.0/portmain.tcl
===================================================================
--- trunk/base/src/port1.0/portmain.tcl	2007-05-17 04:05:00 UTC (rev 25282)
+++ trunk/base/src/port1.0/portmain.tcl	2007-05-17 04:44:07 UTC (rev 25283)
@@ -42,7 +42,7 @@
 # define options
 options prefix name version revision epoch categories maintainers
 options long_description description homepage
-options workdir worksrcdir filesdir distname portdbpath libpath distpath sources_conf os.platform os.version os.arch os.endian platforms default_variants install.user install.group
+options worksrcdir filesdir distname portdbpath libpath distpath sources_conf os.platform os.version os.arch os.endian platforms default_variants install.user install.group
 
 # Export options via PortInfo
 options_export name version revision epoch categories maintainers platforms description long_description homepage
@@ -53,9 +53,8 @@
 # Hard coded version number for resource location
 default portresourcepath {[file join $portsharepath resources/port1.0]}
 default distpath {[file join $portdbpath distfiles]}
-default workdir work
-default workpath {[file join $portbuildpath $workdir]}
-default worksymlink {[file join $portpath $workdir]}
+default workpath {[getportworkpath_from_buildpath $portbuildpath]}
+default worksymlink {[file join $portpath work]}
 default prefix /opt/local
 default x11prefix /usr/X11R6
 default destdir destroot

Modified: trunk/base/src/port1.0/portutil.tcl
===================================================================
--- trunk/base/src/port1.0/portutil.tcl	2007-05-17 04:05:00 UTC (rev 25282)
+++ trunk/base/src/port1.0/portutil.tcl	2007-05-17 04:44:07 UTC (rev 25283)
@@ -941,7 +941,7 @@
 # filefindbypath
 # Provides searching of the standard path for included files
 proc filefindbypath {fname} {
-    global distpath filesdir workdir worksrcdir portpath
+    global distpath filesdir worksrcdir portpath
     
     if {[file readable $portpath/$fname]} {
 	return $portpath/$fname
@@ -1246,7 +1246,7 @@
 # open_statefile
 # open file to store name of completed targets
 proc open_statefile {args} {
-    global workpath worksymlink portname portpath ports_ignore_older
+    global workpath worksymlink place_worksymlink portname portpath ports_ignore_older
     
     if {![file isdirectory $workpath]} {
 	file mkdir $workpath
@@ -1266,7 +1266,7 @@
     }
 
     # Create a symlink to the workpath for port authors 
-    if {![file isdirectory $worksymlink]} {
+    if {[tbool place_worksymlink] && ![file isdirectory $worksymlink]} {
 	    exec ln -sf $workpath $worksymlink
     }
     
@@ -1288,8 +1288,6 @@
 # check_statefile
 # Check completed/selected state of target/variant $name
 proc check_statefile {class name fd} {
-    global portpath workdir
-    
     seek $fd 0
     while {[gets $fd line] >= 0} {
 	if {$line == "$class: $name"} {

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


More information about the macports-changes mailing list