Revision
54738
Author
enl@macports.org
Date
2009-08-01 06:15:09 -0700 (Sat, 01 Aug 2009)

Log Message

"copy_log_files" Portfile option added that let to specify files in worksrcpath that need to be copied in the logdir

Modified Paths

Diff

Modified: branches/gsoc09-logging/base/src/port1.0/portmain.tcl (54737 => 54738)


--- branches/gsoc09-logging/base/src/port1.0/portmain.tcl	2009-08-01 12:53:21 UTC (rev 54737)
+++ branches/gsoc09-logging/base/src/port1.0/portmain.tcl	2009-08-01 13:15:09 UTC (rev 54738)
@@ -48,7 +48,7 @@
 options long_description description homepage license provides conflicts
 options worksrcdir filesdir distname portdbpath libpath distpath sources_conf os.platform os.version os.major os.arch os.endian platforms default_variants install.user install.group macosx_deployment_target
 options universal_variant os.universal_supported
-
+options copy_log_files
 # Export options via PortInfo
 options_export name version revision epoch categories maintainers platforms description long_description homepage license provides conflicts
 

Modified: branches/gsoc09-logging/base/src/port1.0/portutil.tcl (54737 => 54738)


--- branches/gsoc09-logging/base/src/port1.0/portutil.tcl	2009-08-01 12:53:21 UTC (rev 54737)
+++ branches/gsoc09-logging/base/src/port1.0/portutil.tcl	2009-08-01 13:15:09 UTC (rev 54738)
@@ -1207,7 +1207,7 @@
 set ports_dry_last_skipped ""
 
 proc target_run {ditem} {
-    global target_state_fd workpath ports_trace PortInfo ports_dryrun ports_dry_last_skipped current_stage
+    global target_state_fd workpath ports_trace PortInfo ports_dryrun ports_dry_last_skipped current_stage worksrcpath
    set portname [option name]
     set result 0
     set skipped 0
@@ -1367,6 +1367,18 @@
                 }
             }
         }
+        if {[exists copy_log_files]} {
+            set log_files [option copy_log_files]
+            set log_dir "/var/macports/logs/$portname"
+            file mkdir $log_dir
+ 
+            foreach log_file $log_files {
+                set from "$worksrcpath/$log_file"
+                if {[file exists $from]} {
+                    file copy -force $from $log_dir
+                }
+            }
+        }
         if {$result == 0} {
             # Only write to state file if:
             # - we indeed performed this step.