[Abtlinux-svn] SF.net SVN: abtlinux: [304] src/trunk/AbtLogManager.rb
Status: Alpha
Brought to you by:
eschabell
From: <esc...@us...> - 2007-02-26 20:58:09
|
Revision: 304 http://svn.sourceforge.net/abtlinux/?rev=304&view=rev Author: eschabell Date: 2007-02-26 12:58:07 -0800 (Mon, 26 Feb 2007) Log Message: ----------- Added a few new directory checks to the constructor. Now able to log a package installation, creates an install log. Modified Paths: -------------- src/trunk/AbtLogManager.rb Modified: src/trunk/AbtLogManager.rb =================================================================== --- src/trunk/AbtLogManager.rb 2007-02-26 20:56:16 UTC (rev 303) +++ src/trunk/AbtLogManager.rb 2007-02-26 20:58:07 UTC (rev 304) @@ -55,8 +55,8 @@ # <b>RETURN</b> <i>AbtLogManager</i> - an initialized AbtLogManager object. ## def initialize - [$ABT_LOGS, $ABT_CACHES, $BUILD_LOCATION, $PACKAGE_INSTALLED, - $SOURCES_REPOSITORY].each { |dir| + [$ABT_LOGS, $ABT_CACHES, $ABT_STATE, $BUILD_LOCATION, $PACKAGE_INSTALLED, + $PACKAGE_CACHED, $ABT_TMP, $SOURCES_REPOSITORY].each { |dir| if ( ! File.directory?( dir ) ) FileUtils.mkdir_p( dir ) @@ -75,7 +75,8 @@ # otherwise false. ## def logPackageInstall( package ) - excludedDirs = "/dev /proc /tmp /var/tmp /usr/src /sys" + # some dirs we will not add to an install log. + excluded_pattern = Regexp.new( "^(/dev|/proc|/tmp|/var/tmp|/usr/src|/sys)+" ) require package sw = eval( "#{package.capitalize}.new" ) @@ -83,8 +84,8 @@ badLine = false # used to mark excluded lines from installwatch log. # our log locations. - installLog = "#{$PACKAGE_INSTALLED}/#{details['Source location']}.install" - tmpInstallLog = "/tmp/#{details['Source location']}.watch" + installLog = "#{$PACKAGE_INSTALLED}/#{details['Source location']}/#{details['Source location']}.install" + tmpInstallLog = "#{$ABT_TMP}/#{details['Source location']}.watch" # get the installed files from the tmp file # into our install log. @@ -97,12 +98,13 @@ # GIVEN LINE, MATCH MEANS WE DO NOT LOG IT! IO.foreach( tmpInstallLog ) do |line| if ( line.split[1] == 'open' ) - self.logToJournal( "DEBUG: checking: #{line.split[2]} against #{excludedDirs}." ) - if ( line.split[2].match( excludedDirs ) ) + self.logToJournal( "DEBUG: checking: #{line.split[2]} against #{excluded_pattern}." ) + if ( line.split[2] =~ excluded_pattern ) self.logToJournal( "DEBUG: Found bad logLine!" ) badLine = true else - self.logToJournal( "DEBUG: #{excludedDirs} not matching #{line.split[2]}") + badLine = false + self.logToJournal( "DEBUG: #{excluded_pattern} not matching #{line.split[2]}") end if ( !badLine ) @@ -117,6 +119,8 @@ installFile.close end + # cleanup the tmp files. + File.delete( tmpInstallLog ) return true; end This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |