[52589] branches/gsoc09-logging/base/src
enl at macports.org
enl at macports.org
Fri Jun 19 06:40:44 PDT 2009
Revision: 52589
http://trac.macports.org/changeset/52589
Author: enl at macports.org
Date: 2009-06-19 06:40:43 -0700 (Fri, 19 Jun 2009)
Log Message:
-----------
Added "keeplogs" option to macports.conf that defines if we need to clean logs automatically or not.
Modified Paths:
--------------
branches/gsoc09-logging/base/src/macports1.0/macports.tcl
branches/gsoc09-logging/base/src/port/port.tcl
branches/gsoc09-logging/base/src/port1.0/portclean.tcl
Modified: branches/gsoc09-logging/base/src/macports1.0/macports.tcl
===================================================================
--- branches/gsoc09-logging/base/src/macports1.0/macports.tcl 2009-06-19 13:37:20 UTC (rev 52588)
+++ branches/gsoc09-logging/base/src/macports1.0/macports.tcl 2009-06-19 13:40:43 UTC (rev 52589)
@@ -42,7 +42,7 @@
variable bootstrap_options "\
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 \
+ porttrace portverbose keeplogs destroot_umask variants_conf rsync_server rsync_options \
rsync_dir startupitem_type place_worksymlink xcodeversion xcodebuildcmd \
mp_remote_url mp_remote_submit_url configureccache configuredistcc configurepipe buildnicevalue buildmakejobs \
applications_dir frameworks_dir developer_dir universal_target universal_sysroot universal_archs \
@@ -51,7 +51,7 @@
variable portinterp_options "\
portdbpath porturl portpath portbuildpath auto_path prefix prefix_frozen portsharepath \
registry.path registry.format registry.installtype portarchivemode portarchivepath \
- portarchivetype portautoclean porttrace portverbose destroot_umask rsync_server \
+ portarchivetype portautoclean porttrace keeplogs portverbose destroot_umask rsync_server \
rsync_options rsync_dir startupitem_type place_worksymlink \
mp_remote_url mp_remote_submit_url configureccache configuredistcc configurepipe buildnicevalue buildmakejobs \
applications_dir frameworks_dir developer_dir universal_target universal_sysroot universal_archs $user_options"
@@ -525,6 +525,12 @@
set macports::portautoclean "yes"
global macports::portautoclean
}
+ # keeplogs option
+ if {![info exists keeplogs]} {
+ set macports::keeplogs "yes"
+ global macports::keeplogs
+ }
+
# Check command line override for autoclean
if {[info exists macports::global_options(ports_autoclean)]} {
if {![string equal $macports::global_options(ports_autoclean) $portautoclean]} {
Modified: branches/gsoc09-logging/base/src/port/port.tcl
===================================================================
--- branches/gsoc09-logging/base/src/port/port.tcl 2009-06-19 13:37:20 UTC (rev 52588)
+++ branches/gsoc09-logging/base/src/port/port.tcl 2009-06-19 13:40:43 UTC (rev 52589)
@@ -1425,10 +1425,14 @@
append logfile $portinfo(name)
append logfile "/main.log"
mportclose $mport
- set fp [open $logfile r]
- set data [read $fp]
- close $fp
- puts $data
+ if {[file exists $logfile]} {
+ set fp [open $logfile r]
+ set data [read $fp]
+ close $fp
+ puts $data
+ } else {
+ ui_msg "Log file not found"
+ }
}
return 0
}
Modified: branches/gsoc09-logging/base/src/port1.0/portclean.tcl
===================================================================
--- branches/gsoc09-logging/base/src/port1.0/portclean.tcl 2009-06-19 13:37:20 UTC (rev 52588)
+++ branches/gsoc09-logging/base/src/port1.0/portclean.tcl 2009-06-19 13:40:43 UTC (rev 52589)
@@ -59,7 +59,7 @@
global UI_PREFIX
global ports_clean_dist ports_clean_work ports_clean_archive
global ports_clean_all usealtworkpath
-
+ global keeplogs
if {[info exists ports_clean_all] && $ports_clean_all == "yes" || \
[info exists ports_clean_dist] && $ports_clean_dist == "yes"} {
ui_info "$UI_PREFIX [format [msgcat::mc "Removing distfiles for %s"] [option name]]"
@@ -76,6 +76,9 @@
ui_info "$UI_PREFIX [format [msgcat::mc "Removing build directory for %s"] [option name]]"
clean_work
}
+ if {$keeplogs == "no"} {
+ clean_logs
+ }
# start gsoc-08 privileges
if {[info exists usealtworkpath] && $usealtworkpath == "yes"} {
@@ -197,6 +200,20 @@
return 0
}
+proc portclean::clean_logs {args} {
+ global portbuildpath worksymlink name portverbose keeplogs prefix
+ set logpath "${prefix}/var/macports/logs/${name}"
+ if {[file isdirectory $logpath]} {
+ ui_debug "Removing directory: ${logpath}"
+ if {[catch {delete $logpath} result]} {
+ ui_debug "$::errorInfo"
+ ui_error "$result"
+ }
+ } else {
+ ui_debug "No log directory found to remove at ${logpath}"
+ }
+ return 0
+}
proc portclean::clean_archive {args} {
global workpath portarchivepath name version ports_version_glob
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20090619/60cedbc9/attachment.html>
More information about the macports-changes
mailing list