[60372] trunk/base
blb at macports.org
blb at macports.org
Tue Nov 10 01:51:10 PST 2009
Revision: 60372
http://trac.macports.org/changeset/60372
Author: blb at macports.org
Date: 2009-11-10 01:51:08 -0800 (Tue, 10 Nov 2009)
Log Message:
-----------
Merge GSoC 2009 logging to trunk
Modified Paths:
--------------
trunk/base/doc/macports.conf.5
trunk/base/doc/macports.conf.in
trunk/base/doc/port.1
trunk/base/doc/portfile.7
trunk/base/src/macports1.0/macports.tcl
trunk/base/src/port/port-help.tcl
trunk/base/src/port/port.tcl
trunk/base/src/port1.0/portchecksum.tcl
trunk/base/src/port1.0/portclean.tcl
trunk/base/src/port1.0/portmain.tcl
trunk/base/src/port1.0/portutil.tcl
Added Paths:
-----------
trunk/base/portmgr/fedora/macports.spec
Removed Paths:
-------------
trunk/base/portmgr/fedora/macports.spec
Property Changed:
----------------
trunk/base/
trunk/base/src/pextlib1.0/sha256cmd.c
trunk/base/src/pextlib1.0/sha256cmd.h
Property changes on: trunk/base
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/gsoc08-privileges/base:37343-46937
/branches/universal-sanity/base:51872-52323
/branches/variant-descs-14482/base:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659
/users/perry/base-bugs_and_notes:45682-46060
/users/perry/base-select:44044-44692
+ /branches/gsoc08-privileges/base:37343-46937
/branches/gsoc09-logging/base:51231-60371
/branches/universal-sanity/base:51872-52323
/branches/variant-descs-14482/base:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659
/users/perry/base-bugs_and_notes:45682-46060
/users/perry/base-select:44044-44692
Modified: trunk/base/doc/macports.conf.5
===================================================================
--- trunk/base/doc/macports.conf.5 2009-11-10 09:41:26 UTC (rev 60371)
+++ trunk/base/doc/macports.conf.5 2009-11-10 09:51:08 UTC (rev 60372)
@@ -151,6 +151,11 @@
.br
.Ic Default:
yes
+.It Va keeplogs
+Keep logs for ports
+.br
+.Ic Default:
+yes
.It Va build_arch
The machine architecture to try to build for in normal use
.br
Modified: trunk/base/doc/macports.conf.in
===================================================================
--- trunk/base/doc/macports.conf.in 2009-11-10 09:41:26 UTC (rev 60371)
+++ trunk/base/doc/macports.conf.in 2009-11-10 09:51:08 UTC (rev 60372)
@@ -85,6 +85,10 @@
# Set whether to automatically execute "clean" after "install" of ports
#portautoclean yes
+# Uncomment if you dont want logs to be saved (but you will not be able to get
+# help if something goes wrong)
+#keeplogs no
+
# Rsync server to fetch MacPorts sources from. Note that this is only used
# for selfupdate. The source(s) for the ports tree are set in sources.conf.
# Known mirrors at time of writing (see http://trac.macports.org/wiki/Mirrors
Modified: trunk/base/doc/port.1
===================================================================
--- trunk/base/doc/port.1 2009-11-10 09:41:26 UTC (rev 60371)
+++ trunk/base/doc/port.1 2009-11-10 09:51:08 UTC (rev 60372)
@@ -394,10 +394,13 @@
.Fl -archive .
To remove the work files, distribution files and archives, pass
.Fl -all .
+To remove log files for certain port, pass
+.Fl -logs .
For example:
.Pp
.Dl "port clean --dist vim"
.Dl "port clean --archive vim"
+.Dl "port clean --logs vim"
.Pp
To remove only certain version(s) of a port's archives (
.Ar version
@@ -408,6 +411,19 @@
or:
.Pp
.Dl "port clean --archive vim '6.*'"
+.Ss log
+Parses and shows log files for
+.Ar portname .
+To filter log files by some criterions use
+.Fl -phase
+to specify phase you want to show and
+.Fl -verbosity
+to specify message category (msg, info, debug)
+For example:
+.Pp
+.Dl "port log --phase configure vim"
+.Dl "port log --phase fetch --verbosity debug vim"
+.Pp
.Ss echo
Writes to stdout the arguments passed to
.Nm .
Modified: trunk/base/doc/portfile.7
===================================================================
--- trunk/base/doc/portfile.7 2009-11-10 09:41:26 UTC (rev 60371)
+++ trunk/base/doc/portfile.7 2009-11-10 09:51:08 UTC (rev 60372)
@@ -317,6 +317,14 @@
.br
.Sy Example:
.Dl use_configure no
+.It Ic copy_log_files Ar path/to/logfile1 Ar path/to/logfile2 Ar ...
+Copy specific log files from the workdir to the main macports log dir
+.br
+.Sy Type:
+.Em optional
+.br
+.Sy Example:
+.Dl copy_log_files config.log
.It Ic conflicts
Used to list ports which conflict with the one containing the
.Cm conflicts
Deleted: trunk/base/portmgr/fedora/macports.spec
===================================================================
--- trunk/base/portmgr/fedora/macports.spec 2009-11-10 09:41:26 UTC (rev 60371)
+++ trunk/base/portmgr/fedora/macports.spec 2009-11-10 09:51:08 UTC (rev 60372)
@@ -1,100 +0,0 @@
-Summary: MacPorts allows installing software on Mac OS X (and other platforms)
-Name: macports
-Version: 1.6.0
-Release: 0%{?dist}
-License: BSD
-Group: System Environment/Base
-URL: http://www.macports.org
-Source: http://svn.macosforge.org/repository/macports/distfiles/MacPorts/MacPorts-%{version}.tar.bz2
-Prefix: /opt/local
-BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
-
-Requires: curl tcl rsync coreutils make
-BuildRequires: curl-devel tcl-devel tcl-thread sqlite-devel gcc-objc gnustep-base
-BuildRequires: mtree fakeroot /usr/GNUstep/System/Library/Makefiles/GNUstep.sh
-BuildRequires: openssl-devel
-
-%description
-MacPorts is a system for compiling, installing, and managing free and
-open source software. A MacPorts "port" is a set of specifications
-contained in a Portfile that defines an application, its characteristics,
-and any files or special instructions required to install it, so MacPorts
-may automatically fetch, patch, compile, and install ported software.
-
-MacPorts may also be used to pre-compile ported software into binaries
-that may be installed on remote computers. Binaries of ported software
-may be installed very quickly since the steps required to install ports
-from source code have all been performed in advance.
-
-%prep
-%setup -n MacPorts-%{version}
-# avoid the whole upgrade and information procedure
-perl -pe 's/^install::/interactive::/' -i Makefile.in
-
-%define _prefix %{prefix}
-%define _bindir %{prefix}/bin
-%define _sysconfdir %{prefix}/etc
-%define _datadir %{prefix}/share
-%define _mandir %{prefix}/share/man
-%define _infodir %{prefix}/share/info
-%define _localstatedir %{prefix}/var
-
-%build
-source /usr/GNUstep/System/Library/Makefiles/GNUstep.sh
-%configure \
- --without-included-tclthread --without-included-sqlite3 \
- --with-objc-runtime=GNU --with-objc-foundation=GNUstep
-make
-
-%install
-source /usr/GNUstep/System/Library/Makefiles/GNUstep.sh
-rm -rf $RPM_BUILD_ROOT
-make install \
- DESTDIR="$RPM_BUILD_ROOT" INSTALL="fakeroot install"
-
-%clean
-rm -rf $RPM_BUILD_ROOT
-
-%files
-%defattr(-, root, root)
-%doc LICENSE ChangeLog
-%{_bindir}/port
-%{_bindir}/portf
-%{_bindir}/portindex
-%{_bindir}/portmirror
-%config(noreplace) %{_sysconfdir}/macports
-%doc %{_mandir}/man1/port.1*
-%doc %{_mandir}/man5/macports.conf.5*
-%doc %{_mandir}/man7/portfile.7*
-%doc %{_mandir}/man7/portgroup.7*
-%doc %{_mandir}/man7/porthier.7*
-%doc %{_mandir}/man7/portstyle.7*
-%{_datadir}/macports
-%{_localstatedir}/macports
-/usr/share/tcl8.4/macports1.0
-#### mtree
-%dir %{prefix}
-%dir %{prefix}/bin
-%dir %{prefix}/etc
-%dir %{prefix}/include
-%dir %{prefix}/lib
-%dir %{prefix}/libexec
- %{prefix}/man
-%dir %{prefix}/sbin
-%dir %{prefix}/share
-%dir %{prefix}/share/info
-%dir %{prefix}/share/man
-%dir %{prefix}/share/man/cat?
-%dir %{prefix}/share/man/man?
-%dir %{prefix}/share/nls
-%dir %{prefix}/share/nls/*
-#dir %{prefix}/skel
-#dir %{prefix}/src
-%dir %{prefix}/var
-
-%changelog
-* Sun Aug 12 2007 Anders F Bjorklund <afb at macports.org> - 1.5.0
-- Updated to version 1.5.0
-
-* Sun Aug 12 2007 Anders F Bjorklund <afb at macports.org> - 1.4.0
-- Initial Fedora packaging
Copied: trunk/base/portmgr/fedora/macports.spec (from rev 60371, branches/gsoc09-logging/base/portmgr/fedora/macports.spec)
===================================================================
--- trunk/base/portmgr/fedora/macports.spec (rev 0)
+++ trunk/base/portmgr/fedora/macports.spec 2009-11-10 09:51:08 UTC (rev 60372)
@@ -0,0 +1,100 @@
+Summary: MacPorts allows installing software on Mac OS X (and other platforms)
+Name: macports
+Version: 1.6.0
+Release: 0%{?dist}
+License: BSD
+Group: System Environment/Base
+URL: http://www.macports.org
+Source: http://svn.macosforge.org/repository/macports/distfiles/MacPorts/MacPorts-%{version}.tar.bz2
+Prefix: /opt/local
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
+
+Requires: curl tcl rsync coreutils make
+BuildRequires: curl-devel tcl-devel tcl-thread sqlite-devel gcc-objc gnustep-base
+BuildRequires: mtree fakeroot /usr/GNUstep/System/Library/Makefiles/GNUstep.sh
+BuildRequires: openssl-devel
+
+%description
+MacPorts is a system for compiling, installing, and managing free and
+open source software. A MacPorts "port" is a set of specifications
+contained in a Portfile that defines an application, its characteristics,
+and any files or special instructions required to install it, so MacPorts
+may automatically fetch, patch, compile, and install ported software.
+
+MacPorts may also be used to pre-compile ported software into binaries
+that may be installed on remote computers. Binaries of ported software
+may be installed very quickly since the steps required to install ports
+from source code have all been performed in advance.
+
+%prep
+%setup -n MacPorts-%{version}
+# avoid the whole upgrade and information procedure
+perl -pe 's/^install::/interactive::/' -i Makefile.in
+
+%define _prefix %{prefix}
+%define _bindir %{prefix}/bin
+%define _sysconfdir %{prefix}/etc
+%define _datadir %{prefix}/share
+%define _mandir %{prefix}/share/man
+%define _infodir %{prefix}/share/info
+%define _localstatedir %{prefix}/var
+
+%build
+source /usr/GNUstep/System/Library/Makefiles/GNUstep.sh
+%configure \
+ --without-included-tclthread --without-included-sqlite3 \
+ --with-objc-runtime=GNU --with-objc-foundation=GNUstep
+make
+
+%install
+source /usr/GNUstep/System/Library/Makefiles/GNUstep.sh
+rm -rf $RPM_BUILD_ROOT
+make install \
+ DESTDIR="$RPM_BUILD_ROOT" INSTALL="fakeroot install"
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+%defattr(-, root, root)
+%doc LICENSE ChangeLog
+%{_bindir}/port
+%{_bindir}/portf
+%{_bindir}/portindex
+%{_bindir}/portmirror
+%config(noreplace) %{_sysconfdir}/macports
+%doc %{_mandir}/man1/port.1*
+%doc %{_mandir}/man5/macports.conf.5*
+%doc %{_mandir}/man7/portfile.7*
+%doc %{_mandir}/man7/portgroup.7*
+%doc %{_mandir}/man7/porthier.7*
+%doc %{_mandir}/man7/portstyle.7*
+%{_datadir}/macports
+%{_localstatedir}/macports
+/usr/share/tcl8.4/macports1.0
+#### mtree
+%dir %{prefix}
+%dir %{prefix}/bin
+%dir %{prefix}/etc
+%dir %{prefix}/include
+%dir %{prefix}/lib
+%dir %{prefix}/libexec
+ %{prefix}/man
+%dir %{prefix}/sbin
+%dir %{prefix}/share
+%dir %{prefix}/share/info
+%dir %{prefix}/share/man
+%dir %{prefix}/share/man/cat?
+%dir %{prefix}/share/man/man?
+%dir %{prefix}/share/nls
+%dir %{prefix}/share/nls/*
+#dir %{prefix}/skel
+#dir %{prefix}/src
+%dir %{prefix}/var
+
+%changelog
+* Sun Aug 12 2007 Anders F Bjorklund <afb at macports.org> - 1.5.0
+- Updated to version 1.5.0
+
+* Sun Aug 12 2007 Anders F Bjorklund <afb at macports.org> - 1.4.0
+- Initial Fedora packaging
Property changes on: trunk/base/portmgr/fedora/macports.spec
___________________________________________________________________
Added: svn:mergeinfo
+ /branches/gsoc08-privileges/base/portmgr/fedora/macports.spec:37343-46937
/branches/universal-sanity/base/portmgr/fedora/macports.spec:51872-52323
/branches/variant-descs-14482/base/portmgr/fedora/macports.spec:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659
/trunk/base/portmgr/fedora/macports.spec.in:30388-57826
/users/perry/base-bugs_and_notes/portmgr/fedora/macports.spec:45682-46060
/users/perry/base-select/portmgr/fedora/macports.spec:44044-44692
Modified: trunk/base/src/macports1.0/macports.tcl
===================================================================
--- trunk/base/src/macports1.0/macports.tcl 2009-11-10 09:41:26 UTC (rev 60371)
+++ trunk/base/src/macports1.0/macports.tcl 2009-11-10 09:51:08 UTC (rev 60372)
@@ -38,11 +38,11 @@
package require macports_util 1.0
namespace eval macports {
- namespace export bootstrap_options user_options portinterp_options open_mports ui_priorities
+ namespace export bootstrap_options user_options portinterp_options open_mports ui_priorities port_stages
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_archs build_arch \
@@ -51,10 +51,10 @@
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_archs build_arch $user_options"
+ applications_dir current_stage frameworks_dir developer_dir universal_archs build_arch $user_options"
# deferred options are only computed when needed.
# they are not exported to the trace thread.
@@ -63,7 +63,9 @@
variable open_mports {}
- variable ui_priorities "debug info msg error warn"
+ variable ui_priorities "debug info msg error warn any"
+ variable port_stages "any fetch checksum"
+ variable current_stage "main"
}
# Provided UI instantiations
@@ -106,55 +108,108 @@
return 0
}
+proc macports::init_logging {portname} {
+ global ::debuglog ::debuglogname macports::channels macports::portdbpath
-proc macports::ui_init {priority args} {
- # Get the list of channels.
- if {[llength [info commands ui_channels]] > 0} {
- set channels [ui_channels $priority]
- } else {
- set channels [ui_channels_default $priority]
+ set logname [file join $macports::portdbpath "logs/$portname"]
+ file mkdir $logname
+ set logname [file join $logname "main.log"]
+ ui_msg $logname
+ set ::debuglogname $logname
+
+ # Recreate the file if already exists
+ if {[file exists $::debuglogname]} {
+ file delete -force $::debuglogname
}
+ set ::debuglog [open $::debuglogname w]
+ puts $::debuglog "version:1"
+ # Add our log-channel to all already initialized channels
+ foreach key [array names channels] {
+ set macports::channels($key) [concat $macports::channels($key) "debuglog"]
+ }
+}
+proc macports::ch_logging {portname} {
+ global ::debuglog ::debuglogname macports::channels macports::portdbpath
- # Simplify ui_$priority.
- set nbchans [llength $channels]
- if {$nbchans == 0} {
- proc ::ui_$priority {args} {}
- } else {
- if {[llength [info commands ui_prefix]] > 0} {
- set prefix [ui_prefix $priority]
- } else {
- set prefix [ui_prefix_default $priority]
- }
+ set logname [file join $macports::portdbpath "logs/$portname"]
+ file mkdir $logname
+ set logname [file join $logname "main.log"]
- if {[llength [info commands ::ui_init]] > 0} {
- eval ::ui_init $priority $prefix $channels $args
+ set ::debuglogname $logname
+
+ # Recreate the file if already exists
+ if {[file exists $::debuglogname]} {
+ file delete -force $::debuglogname
+ }
+ set ::debuglog [open $::debuglogname w]
+ puts $::debuglog "version:1"
+}
+
+proc ui_phase {phase} {
+ global macports::current_stage
+ set macports::current_stage $phase
+ if {$phase != "main"} {
+ set cur_time [clock format [clock seconds] -format {%+}]
+ ui_any "---> Stage $phase started at $cur_time"
+ }
+}
+proc ui_message {priority prefix stage args} {
+ global macports::channels ::debuglog macports::current_stage
+ foreach chan $macports::channels($priority) {
+ if {[info exists ::debuglog] && ($chan == "debuglog")} {
+ set chan $::debuglog
+ if {[info exists macports::current_stage]} {
+ set stage $macports::current_stage
+ }
+ set strprefix ":$priority:$stage "
+ if {[lindex $args 0] == "-nonewline"} {
+ puts -nonewline $chan "$strprefix[lindex $args 1]"
+ } else {
+ puts $chan "$strprefix[lindex $args 0]"
+ }
+
} else {
- if {$nbchans == 1} {
- set chan [lindex $channels 0]
- proc ::ui_$priority {args} [subst {
- if {\[lindex \$args 0\] == "-nonewline"} {
- puts -nonewline $chan "$prefix\[lindex \$args 1\]"
- } else {
- puts $chan "$prefix\[lindex \$args 0\]"
- }
- }]
+ if {[lindex $args 0] == "-nonewline"} {
+ puts -nonewline $chan "$prefix[lindex $args 1]"
} else {
- proc ::ui_$priority {args} [subst {
- foreach chan \$channels {
- if {\[lindex \$args 0\] == "-nonewline"} {
- puts -nonewline $chan "$prefix\[lindex \$args 1\]"
- } else {
- puts $chan "$prefix\[lindex \$args 0\]"
- }
- }
- }]
+ puts $chan "$prefix[lindex $args 0]"
}
}
-
- # Call ui_$priority
- eval ::ui_$priority $args
}
}
+proc macports::ui_init {priority args} {
+ global macports::channels ::debuglog
+ set default_channel [macports::ui_channels_default $priority]
+ # Get the list of channels.
+ if {[llength [info commands ui_channels]] > 0} {
+ set channels($priority) [ui_channels $priority]
+ } else {
+ set channels($priority) $default_channel
+ }
+
+ # if some priority initialized after log file is being created
+ if [info exist ::debuglog] {
+ set channels($priority) [concat $channels($priority) "debuglog"]
+ }
+ # Simplify ui_$priority.
+ try {
+ set prefix [ui_prefix $priority]
+ } catch * {
+ set prefix [ui_prefix_default $priority]
+ }
+ set stages {fetch checksum}
+ try {
+ eval ::ui_init $priority $prefix $channels($priority) $args
+ } catch * {
+ interp alias {} ui_$priority {} ui_message $priority $prefix ""
+ foreach stage $stages {
+ interp alias {} ui_${priority}_${stage} {} ui_message $priority $prefix $stage
+ }
+ }
+ # Call ui_$priority
+ eval ::ui_$priority $args
+
+}
# Default implementation of ui_prefix
proc macports::ui_prefix_default {priority} {
@@ -520,6 +575,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]} {
@@ -824,11 +885,17 @@
$workername alias mport_open mportopen
$workername alias mport_close mportclose
$workername alias mport_lookup mportlookup
+ $workername alias ui_phase ui_phase
# instantiate the UI call-backs
foreach priority ${macports::ui_priorities} {
$workername alias ui_$priority ui_$priority
+ foreach stage ${macports::port_stages} {
+ $workername alias ui_${priority}_${stage} ui_${priority}_${stage}
+ }
+
}
+
$workername alias ui_prefix ui_prefix
$workername alias ui_channels ui_channels
@@ -1401,6 +1468,11 @@
### _mportexec is private; may change without notice
proc _mportexec {target mport} {
+ global ::debuglog
+ set previouslog $::debuglog
+ set portname [_mportkey $mport name]
+ ui_debug "Starting logging for $portname"
+ macports::ch_logging $portname
# xxx: set the work path?
set workername [ditem_key $mport workername]
if {![catch {$workername eval check_variants variations $target} result] && $result == 0 &&
@@ -1416,9 +1488,11 @@
catch {cd $portpath}
$workername eval eval_targets clean
}
+ set ::debuglog $previouslog
return 0
} else {
# An error occurred.
+ set ::debuglog $previouslog
return 1
}
}
@@ -1434,6 +1508,8 @@
if {[$workername eval check_variants variations $target] != 0} {
return 1
}
+ set portname [_mportkey $mport name]
+ macports::init_logging $portname
# Before we build the port, we must build its dependencies.
# XXX: need a more general way of comparing against targets
Property changes on: trunk/base/src/pextlib1.0/sha256cmd.c
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/gsoc08-privileges/base/src/pextlib1.0/rmd160cmd.c:37343-46937
/branches/universal-sanity/base/src/pextlib1.0/rmd160cmd.c:51872-52323
/branches/variant-descs-14482/base/src/pextlib1.0/rmd160cmd.c:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659
/users/perry/base-bugs_and_notes/src/pextlib1.0/rmd160cmd.c:45682-46060
/users/perry/base-select/src/pextlib1.0/rmd160cmd.c:44044-44692
+ /branches/gsoc08-privileges/base/src/pextlib1.0/rmd160cmd.c:37343-46937
/branches/gsoc09-logging/base/src/pextlib1.0/sha256cmd.c:51231-60371
/branches/universal-sanity/base/src/pextlib1.0/rmd160cmd.c:51872-52323
/branches/variant-descs-14482/base/src/pextlib1.0/rmd160cmd.c:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659
/users/perry/base-bugs_and_notes/src/pextlib1.0/rmd160cmd.c:45682-46060
/users/perry/base-select/src/pextlib1.0/rmd160cmd.c:44044-44692
Property changes on: trunk/base/src/pextlib1.0/sha256cmd.h
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/gsoc08-privileges/base/src/pextlib1.0/rmd160cmd.h:37343-46937
/branches/universal-sanity/base/src/pextlib1.0/rmd160cmd.h:51872-52323
/branches/variant-descs-14482/base/src/pextlib1.0/rmd160cmd.h:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659
/users/perry/base-bugs_and_notes/src/pextlib1.0/rmd160cmd.h:45682-46060
/users/perry/base-select/src/pextlib1.0/rmd160cmd.h:44044-44692
+ /branches/gsoc08-privileges/base/src/pextlib1.0/rmd160cmd.h:37343-46937
/branches/gsoc09-logging/base/src/pextlib1.0/sha256cmd.h:51231-60371
/branches/universal-sanity/base/src/pextlib1.0/rmd160cmd.h:51872-52323
/branches/variant-descs-14482/base/src/pextlib1.0/rmd160cmd.h:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659
/users/perry/base-bugs_and_notes/src/pextlib1.0/rmd160cmd.h:45682-46060
/users/perry/base-select/src/pextlib1.0/rmd160cmd.h:44044-44692
Modified: trunk/base/src/port/port-help.tcl
===================================================================
--- trunk/base/src/port/port-help.tcl 2009-11-10 09:41:26 UTC (rev 60371)
+++ trunk/base/src/port/port-help.tcl 2009-11-10 09:51:08 UTC (rev 60372)
@@ -40,8 +40,16 @@
--dist Removes downloaded distfiles
--work Removes work directory (default)
--all Removes everything from above
+--logs Removes log files for port
}
+set porthelp(log) {
+Shows main log for given ports
+
+--phase <phase> Filteres log file by phase (configure, fetch, etc..)
+--verbosity <ver> Filteres log file by verbosity level (msg, debug, info)
+}
+
set porthelp(configure) {
Configure the given ports
}
Modified: trunk/base/src/port/port.tcl
===================================================================
--- trunk/base/src/port/port.tcl 2009-11-10 09:41:26 UTC (rev 60371)
+++ trunk/base/src/port/port.tcl 2009-11-10 09:51:08 UTC (rev 60372)
@@ -155,7 +155,6 @@
}
}
-
# Form a composite version as is sometimes used for registry functions
proc composite_version {version variations {emptyVersionOkay 0}} {
# Form a composite version out of the version and variations
@@ -1398,6 +1397,94 @@
}
+proc action_log { action portlist opts } {
+ global global_options
+ set logfile "$macports::prefix/var/macports/logs/"
+ #puts "$opts"
+ if {[llength $portlist] == 0} {
+ print_help
+ return 0
+ }
+ foreachport $portlist {
+ # If we have a url, use that, since it's most specific
+ # otherwise try to map the portname to a url
+ if {$porturl eq ""} {
+ # Verify the portname, getting portinfo to map to a porturl
+ if {[catch {mportlookup $portname} result]} {
+ ui_debug "$::errorInfo"
+ break_softcontinue "lookup of portname $portname failed: $result" 1 status
+ }
+ if {[llength $result] < 2} {
+ break_softcontinue "Port $portname not found" 1 status
+ }
+ array unset portinfo
+ array set portinfo [lindex $result 1]
+ set porturl $portinfo(porturl)
+ set portdir $portinfo(portdir)
+ } elseif {$porturl ne "file://."} {
+ # Extract the portdir from porturl and use it to search PortIndex.
+ # Only the last two elements of the path (porturl) make up the
+ # portdir.
+ set portdir [file split [macports::getportdir $porturl]]
+ set lsize [llength $portdir]
+ set portdir \
+ [file join [lindex $portdir [expr $lsize - 2]] \
+ [lindex $portdir [expr $lsize - 1]]]
+ if {[catch {mportsearch $portdir no exact portdir} result]} {
+ ui_debug "$::errorInfo"
+ break_softcontinue "Portdir $portdir not found" 1 status
+ }
+ if {[llength $result] < 2} {
+ break_softcontinue "Portdir $portdir not found" 1 status
+ }
+ array unset portinfo
+ array set portinfo [lindex $result 1]
+ }
+ if {[catch {set mport [mportopen $porturl [array get options] [array get merged_variations]]} result]} {
+ ui_debug "$::errorInfo"
+ break_softcontinue "Unable to open port: $result" 1 status
+ }
+ array unset portinfo
+ array set portinfo [mportinfo $mport]
+
+ append logfile $portinfo(name)
+ append logfile "/main.log"
+ mportclose $mport
+ if {[file exists $logfile]} {
+ set fp [open $logfile r]
+ set data [read $fp]
+ set data [split $data "\n"]
+
+ if {[info exists global_options(ports_log_phase)]} {
+ set stage $global_options(ports_log_phase);
+ } else {
+ set stage "\[a-z\]*"
+ }
+
+ if {[info exists global_options(ports_log_verbosity)]} {
+ set prefix $global_options(ports_log_verbosity);
+ } else {
+ set prefix "\[a-z\]*"
+ }
+ set match ""
+ foreach line $data {
+ set exp "^:($prefix|any):($stage|any) .*$"
+ regexp $exp $line match
+ if {$match == $line} {
+ regsub "^:\[a-z\]*:\[a-z\]* " $line "" line
+ puts $line
+ }
+ }
+
+ close $fp
+ } else {
+ ui_msg "Log file not found"
+ }
+ }
+ return 0
+}
+
+
proc action_info { action portlist opts } {
global global_variations
set status 0
@@ -2998,6 +3085,7 @@
location [list action_location [action_args_const ports]] \
notes [list action_notes [action_args_const ports]] \
provides [list action_provides [action_args_const strings]] \
+ log [list action_log [action_args_const ports]] \
\
activate [list action_activate [action_args_const ports]] \
deactivate [list action_deactivate [action_args_const ports]] \
@@ -3121,10 +3209,11 @@
selfupdate {nosync}
uninstall {follow-dependents}
variants {index}
- clean {all archive dist work}
+ clean {all archive dist work logs}
mirror {new}
lint {nitpick}
select {list set show}
+ log {{phase 1} {verbosity 1}}
upgrade {force enforce-variants no-replace}
}
@@ -3665,6 +3754,7 @@
set global_options_base [array get global_options]
# First process any remaining args as action(s)
+global exit_status
set exit_status 0
if { [llength $remaining_args] > 0 } {
Modified: trunk/base/src/port1.0/portchecksum.tcl
===================================================================
--- trunk/base/src/port1.0/portchecksum.tcl 2009-11-10 09:41:26 UTC (rev 60371)
+++ trunk/base/src/port1.0/portchecksum.tcl 2009-11-10 09:51:08 UTC (rev 60372)
@@ -236,7 +236,7 @@
ui_debug "[format [msgcat::mc "Correct (%s) checksum for %s"] $type $distfile]"
} else {
ui_error "[format [msgcat::mc "Checksum (%s) mismatch for %s"] $type $distfile]"
- ui_info "[format [msgcat::mc "Portfile checksum: %s %s %s"] $distfile $type $sum]"
+ ui_info_fetch "[format [msgcat::mc "Portfile checksum: %s %s %s"] $distfile $type $sum]"
ui_info "[format [msgcat::mc "Distfile checksum: %s %s %s"] $distfile $type $calculated_sum]"
# Raise the failure flag
Modified: trunk/base/src/port1.0/portclean.tcl
===================================================================
--- trunk/base/src/port1.0/portclean.tcl 2009-11-10 09:41:26 UTC (rev 60371)
+++ trunk/base/src/port1.0/portclean.tcl 2009-11-10 09:51:08 UTC (rev 60372)
@@ -57,8 +57,9 @@
proc portclean::clean_main {args} {
global UI_PREFIX
- global ports_clean_dist ports_clean_work ports_clean_archive
+ global ports_clean_dist ports_clean_work ports_clean_archive ports_clean_logs
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"} {
@@ -76,6 +77,9 @@
ui_info "$UI_PREFIX [format [msgcat::mc "Removing build directory for %s"] [option name]]"
clean_work
}
+ if {([info exists ports_clean_logs] && $ports_clean_logs == "yes") || ($keeplogs == "no")} {
+ clean_logs
+ }
# start gsoc-08 privileges
if {[info exists usealtworkpath] && $usealtworkpath == "yes"} {
@@ -197,6 +201,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
Modified: trunk/base/src/port1.0/portmain.tcl
===================================================================
--- trunk/base/src/port1.0/portmain.tcl 2009-11-10 09:41:26 UTC (rev 60371)
+++ trunk/base/src/port1.0/portmain.tcl 2009-11-10 09:51:08 UTC (rev 60372)
@@ -48,6 +48,7 @@
options long_description description homepage license provides conflicts replaced_by
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
options compiler.cpath compiler.library_path
# Export options via PortInfo
Modified: trunk/base/src/port1.0/portutil.tcl
===================================================================
--- trunk/base/src/port1.0/portutil.tcl 2009-11-10 09:41:26 UTC (rev 60371)
+++ trunk/base/src/port1.0/portutil.tcl 2009-11-10 09:51:08 UTC (rev 60372)
@@ -1199,7 +1199,7 @@
set ports_dry_last_skipped ""
proc target_run {ditem} {
- global target_state_fd workpath ports_trace PortInfo ports_dryrun ports_dry_last_skipped
+ global target_state_fd workpath ports_trace PortInfo ports_dryrun ports_dry_last_skipped current_stage worksrcpath prefix
set portname [option name]
set result 0
set skipped 0
@@ -1250,7 +1250,7 @@
if {[ditem_contains $ditem prerun]} {
set result [catch {[ditem_key $ditem prerun] $targetname} errstr]
}
-
+ ui_phase $target
#start tracelib
if {($result ==0
&& [info exists ports_trace]
@@ -1360,6 +1360,18 @@
}
}
}
+ if {[exists copy_log_files]} {
+ set log_files [option copy_log_files]
+ set log_dir "$prefix/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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20091110/2f28e246/attachment-0001.html>
More information about the macports-changes
mailing list