[27199] trunk/base/src/port1.0/portdestroot.tcl

source_changes at macosforge.org source_changes at macosforge.org
Tue Jul 24 02:09:43 PDT 2007


Revision: 27199
          http://trac.macosforge.org/projects/macports/changeset/27199
Author:   mww at macports.org
Date:     2007-07-24 02:09:43 -0700 (Tue, 24 Jul 2007)

Log Message:
-----------
add experimental code for testing for mtree violations (only some currently);
the test can be overriden by "destroot.violate_mtree yes"

Modified Paths:
--------------
    trunk/base/src/port1.0/portdestroot.tcl

Modified: trunk/base/src/port1.0/portdestroot.tcl
===================================================================
--- trunk/base/src/port1.0/portdestroot.tcl	2007-07-24 08:27:03 UTC (rev 27198)
+++ trunk/base/src/port1.0/portdestroot.tcl	2007-07-24 09:09:43 UTC (rev 27199)
@@ -42,6 +42,7 @@
 
 # define options
 options destroot.target destroot.destdir destroot.clean destroot.keepdirs destroot.umask
+options destroot.violate_mtree
 options startupitem.create startupitem.requires startupitem.init
 options startupitem.name startupitem.start startupitem.stop startupitem.restart
 options startupitem.type startupitem.executable
@@ -58,6 +59,7 @@
 default destroot.umask {$system_options(destroot_umask)}
 default destroot.clean no
 default destroot.keepdirs ""
+default destroot.violate_mtree no
 
 default startupitem.name		{${portname}}
 default startupitem.init		""
@@ -105,7 +107,7 @@
 }
 
 proc destroot_finish {args} {
-    global UI_PREFIX destroot prefix portname startupitem.create destroot::oldmask
+    global UI_PREFIX destroot prefix portname startupitem.create destroot::oldmask destroot.violate_mtree
 	global os.platform os.version
 
     # Create startup-scripts/items
@@ -221,6 +223,39 @@
 		ui_debug "Deleting stray info/dir file."
 	    file delete "${destroot}${prefix}/share/info/dir"
 	}
+
+	# test for violations of mtree
+	if { ${destroot.violate_mtree} != "yes" } {
+		ui_debug "checking for mtree violations"
+		set mtree_violation "no"
+
+		# test files in ${prefix}
+		foreach f [glob -directory "${destroot}${prefix}" *] {
+			set c [file tail ${f}]
+			# ignore bin, sbin, ... and only fail on other names
+			switch ${c} {
+				bin { }
+				etc { }
+				include { }
+				lib { }
+				libexec { }
+				sbin { }
+				share { }
+				var { }
+				www { }
+				Applications { }
+				Library { }
+				default { ui_error "violation by ${prefix}/${c}"
+					set mtree_violation "yes" }
+			}
+		}
+
+		# abort here only so all violations can be observed
+		if { ${mtree_violation} != "no" } {
+			error "mtree violation!"
+		}
+	}
+
     # Restore umask
     umask $oldmask
 

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


More information about the macports-changes mailing list