[38194] branches/gsoc08-logging
dpemmons at macports.org
dpemmons at macports.org
Fri Jul 11 22:31:35 PDT 2008
Revision: 38194
http://trac.macosforge.org/projects/macports/changeset/38194
Author: dpemmons at macports.org
Date: 2008-07-11 22:31:35 -0700 (Fri, 11 Jul 2008)
Log Message:
-----------
the beginnings of a log recorder
Added Paths:
-----------
branches/gsoc08-logging/mplog/
branches/gsoc08-logging/mplog/MPLog.pm
branches/gsoc08-logging/mplog/mplog.pl
Added: branches/gsoc08-logging/mplog/MPLog.pm
===================================================================
--- branches/gsoc08-logging/mplog/MPLog.pm (rev 0)
+++ branches/gsoc08-logging/mplog/MPLog.pm 2008-07-12 05:31:35 UTC (rev 38194)
@@ -0,0 +1,117 @@
+package MPLog;
+
+use strict;
+use Carp;
+use XML::Simple;
+
+# Mac::Gestalt; # for hardware info
+# Mac::OSVersion; # self explanatory
+# Mac::SysProfile -> I should probably use this for most system info
+
+sub new {
+ my $class = shift;
+ my $self = {
+ "logtype" => {
+ name => 'macports log file',
+ version => '0.1',
+ },
+ "system" => {
+ "OSVersion" => {
+ major => 0,
+ minor => 0,
+ point => 0,
+ build => 0,
+ kernelMajor => 0,
+ kernelMinor => 0,
+ kernelPoint => 0
+ },
+ "hardware" => {
+ CPU_type => '',
+ RAM_M => 0,
+ HDsizeM => 0,
+ HDfreeM => 0,
+ },
+ "tcl" => {
+ version => 0,
+ path => ''
+ },
+ "gcc" => {
+ target => '',
+ path => '',
+ confWith => {}, # configuration settings when gcc was built
+ threadModel => '',
+ version => 0,
+ versionInfo => ''
+ },
+ "perl" => {
+ version => 0,
+ path => ''
+ },
+ "macports" => {
+ version => 0,
+ }
+ },
+ "command" => {
+ text => '',
+ type => '', # eg. install, build, etc.
+ verbose => '', # no, yes, debug
+ },
+ "installedPorts" => [],
+ "target" => {
+ name => '', # the actual port name
+ failureInfo => {
+ type => '', # build, etc.
+ description => ''
+ },
+ output => '' # full output of the port <blah> command
+ }
+
+ };
+ bless $self, $class;
+ $self->initialize();
+ return $self;
+}
+
+sub initialize {
+ my $self = shift;
+
+ # TODO: get os version
+ $self->{osVersion};
+
+ # TCL info
+ $self->{systemTCLver} = `echo "puts \\\$tcl_version" | tcl`;
+ chomp($self->{systemTCLver});
+ $self->{systemTCLlocation} = `which tcl`;
+ chomp($self->{systemTCLlocation});
+
+ # GCC info
+ # TODO: parse version info
+ $self->{systemGCCver} = `gcc -v`;
+ $self->{systemGCClocation} = `which gcc`;
+ chomp($self->{systemGCClocation});
+
+ # Perl info
+ $self->{systemPERLver} = $^V;
+ chomp($self->{systemPERLver});
+ $self->{systemPERLlocation} = `which perl`;
+ chomp($self->{systemPERLlocation});
+
+}
+
+# writes xml data to file
+sub writeXML {
+ my $s = shift;
+ my $to = shift;
+ if (!$to) {
+ confess "You must provide a filename!";
+ }
+ return;
+}
+
+# returns a string treference to the xml data
+sub getXML {
+ my $s = shift;
+ return;
+}
+
+1;
\ No newline at end of file
Added: branches/gsoc08-logging/mplog/mplog.pl
===================================================================
--- branches/gsoc08-logging/mplog/mplog.pl (rev 0)
+++ branches/gsoc08-logging/mplog/mplog.pl 2008-07-12 05:31:35 UTC (rev 38194)
@@ -0,0 +1,64 @@
+#!/usr/bin/perl -w
+
+use strict;
+use Carp;
+use Getopt::Long;
+use MPLog;
+
+# some defaults
+my $defaultSubmissionServer = "http://blahblah:8080";
+
+# first we need to parse the command line options and our port command.
+my $helpFlag = 0;
+my $portCommand = "";
+my $logFile = "";
+my $submitOnError = 0;
+my $submit = 0;
+my $submitExistingLogfile = "";
+my $submissionServer = "";
+my $submissionServerUser = "";
+my $submissionServerPass = "";
+my $printcmdoutput = 0;
+my $result = GetOptions(
+ "help|h|?" => \$helpFlag,
+ "command=s" => \$portCommand,
+ "logfile:s" => \$logFile,
+ "submitOnError" => \$submitOnError,
+ "submit" => \$submit,
+ "submitLog" => \$submitExistingLogfile,
+ "server:s" => \$submissionServer,
+ "user:s" => \$submissionServerUser,
+ "pass:s" => \$submissionServerPass,
+ "cmdout" => \$printcmdoutput
+);
+
+## print the help text
+if ( ($portCommand && $submitExistingLogfile) || (!$portCommand && !$submitExistingLogfile) || $helpFlag) {
+ print "\n";
+ print " Usage:\n";
+ print " mplog.pl --command='port install <portname>' [options]\n";
+ print " executes the port command specified, saves a log file and optionally\n";
+ print " submits it.\n";
+ print " --or--\n";
+ print " mplog.pl --submitLog=<filename.mpxlog> [options]\n";
+ print " submits a locally saved log file.\n";
+ print "\n";
+ print " Options:\n";
+ print " --logfile='/some/path/out.mpxlog' Default: the current working directory\n";
+ print " /portname.xmllog\n";
+ print " --submitOnError Default: false\n";
+ print " --submit Default: false\n";
+ print " --server='http://localhost:8822' Default: $defaultSubmissionServer\n";
+ print " --user='username'\n";
+ print " --pass='password'\n";
+ print " --cmdout print port command output to the\n";
+ print " commandline\n";
+ print "\n";
+ # exit with an error code if we printed this because of bad input (help wasn't requested)
+
+ $helpFlag ? exit(0) : exit(1);
+
+}
+
+print "Calling port(1) with this command: \"$portCommand\"\n";
+
Property changes on: branches/gsoc08-logging/mplog/mplog.pl
___________________________________________________________________
Name: svn:executable
+ *
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20080711/09cab3b1/attachment-0001.html
More information about the macports-changes
mailing list