Thread: [Abtlinux-svn] SF.net SVN: abtlinux: [344] src/trunk (Page 5)
Status: Alpha
Brought to you by:
eschabell
From: <esc...@us...> - 2007-07-05 13:41:08
|
Revision: 344 http://svn.sourceforge.net/abtlinux/?rev=344&view=rev Author: eschabell Date: 2007-07-05 06:41:05 -0700 (Thu, 05 Jul 2007) Log Message: ----------- Refactored download manager to use << where possible. Refactored test class to download sources to global location instead of /tmp (early testing destination for everything). Modified Paths: -------------- src/trunk/AbtDownloadManager.rb src/trunk/TestAbtDownloadManager.rb Modified: src/trunk/AbtDownloadManager.rb =================================================================== --- src/trunk/AbtDownloadManager.rb 2007-07-05 13:39:30 UTC (rev 343) +++ src/trunk/AbtDownloadManager.rb 2007-07-05 13:41:05 UTC (rev 344) @@ -58,16 +58,14 @@ logger = AbtLogManager.new package = eval( packageName.capitalize + '.new' ) - if ( File.exist?( - destination + "/" + File.basename( package.srcUrl ) ) ) - logger.logToJournal( "Download not needed, existing source " + - "found for " + packageName ) + if ( File.exist?( "#{destination}/#{File.basename( package.srcUrl )}" ) ) + logger.logToJournal( "Download not needed, existing source found for #{packageName}" ) return true end Dir.chdir( destination ) if ( system( "wget #{package.srcUrl}" ) ) - logger.logToJournal( "Download completed for " + packageName ) + logger.logToJournal( "Download completed for #{packageName}" ) return true end @@ -127,15 +125,15 @@ "is not RSS 1.0/2.0." ) return false else - newsLog.puts "*** #{rss.channel.title} ***" + newsLog << "*** #{rss.channel.title} ***\n" rss.items.each_with_index do |item, itemCount| itemCount += 1 - newsLog.puts "#{itemCount} #{item.link} #{item.title}" + newsLog << "#{itemCount} #{item.link} #{item.title}\n" end end - newsLog.puts "\n" + newsLog << "\n\n" newsLog.close return true Modified: src/trunk/TestAbtDownloadManager.rb =================================================================== --- src/trunk/TestAbtDownloadManager.rb 2007-07-05 13:39:30 UTC (rev 343) +++ src/trunk/TestAbtDownloadManager.rb 2007-07-05 13:41:05 UTC (rev 344) @@ -49,7 +49,7 @@ # Test method for 'AbtDownloadManager.testRetrievePackageSource()' ## def testRetrievePackageSource() - assert( @download.retrievePackageSource( "ipc", "/tmp" ), + assert( @download.retrievePackageSource( "ipc", "#{$SOURCES_REPOSITORY}" ), "testRetrievePackageSource()" ) end This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <esc...@us...> - 2007-07-15 20:09:18
|
Revision: 346 http://svn.sourceforge.net/abtlinux/?rev=346&view=rev Author: eschabell Date: 2007-07-15 13:09:20 -0700 (Sun, 15 Jul 2007) Log Message: ----------- Rubifed the depengine file names. Modified Paths: -------------- src/trunk/TestAbtDepEngine.rb src/trunk/testSuiteAbt.rb Added Paths: ----------- src/trunk/abtdepengine.rb Removed Paths: ------------- src/trunk/AbtDepEngine.rb Deleted: src/trunk/AbtDepEngine.rb =================================================================== --- src/trunk/AbtDepEngine.rb 2007-07-05 13:42:56 UTC (rev 345) +++ src/trunk/AbtDepEngine.rb 2007-07-15 20:09:20 UTC (rev 346) @@ -1,44 +0,0 @@ -#!/usr/bin/ruby -w - -## -# AbtDepEngine.rb -# -# AbtDepEngine class handles all dependency aspects of the AbTLinux system. It is -# part of a sub-project with it's own requirements document. -# -# Created by Eric D. Schabell <er...@ab...> -# Copyright 2006, GPL. -# -# This file is part of AbTLinux. -# -# AbTLinux is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# AbTLinux is distributed in the hope that it will be useful, but WITHOUT ANY -# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -# details. -# -# You should have received a copy of the GNU General Public License along with -# AbTLinux; if not, write to the Free Software Foundation, Inc., 51 Franklin -# St, Fifth Floor, Boston, MA 02110-1301 USA -## -class AbtDepEngine - - protected - - private - - public - - ## - # Constructor for the AbtDepEngine class. - # - # <b>RETURN</b> <i>AbtDepEngine</i> - an initialized AbtDepEngine object. - ## - def initialize - end - -end \ No newline at end of file Modified: src/trunk/TestAbtDepEngine.rb =================================================================== --- src/trunk/TestAbtDepEngine.rb 2007-07-05 13:42:56 UTC (rev 345) +++ src/trunk/TestAbtDepEngine.rb 2007-07-15 20:09:20 UTC (rev 346) @@ -2,7 +2,7 @@ require 'test/unit/testcase' require 'test/unit/autorunner' -require 'AbtDepEngine' +require 'abtdepengine' ## # TestAbtDepEngine.rb Copied: src/trunk/abtdepengine.rb (from rev 345, src/trunk/AbtDepEngine.rb) =================================================================== --- src/trunk/abtdepengine.rb (rev 0) +++ src/trunk/abtdepengine.rb 2007-07-15 20:09:20 UTC (rev 346) @@ -0,0 +1,44 @@ +#!/usr/bin/ruby -w + +## +# AbtDepEngine.rb +# +# AbtDepEngine class handles all dependency aspects of the AbTLinux system. It is +# part of a sub-project with it's own requirements document. +# +# Created by Eric D. Schabell <er...@ab...> +# Copyright 2006, GPL. +# +# This file is part of AbTLinux. +# +# AbTLinux is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# AbTLinux is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# AbTLinux; if not, write to the Free Software Foundation, Inc., 51 Franklin +# St, Fifth Floor, Boston, MA 02110-1301 USA +## +class AbtDepEngine + + protected + + private + + public + + ## + # Constructor for the AbtDepEngine class. + # + # <b>RETURN</b> <i>AbtDepEngine</i> - an initialized AbtDepEngine object. + ## + def initialize + end + +end \ No newline at end of file Modified: src/trunk/testSuiteAbt.rb =================================================================== --- src/trunk/testSuiteAbt.rb 2007-07-05 13:42:56 UTC (rev 345) +++ src/trunk/testSuiteAbt.rb 2007-07-15 20:09:20 UTC (rev 346) @@ -29,4 +29,4 @@ require 'TestAbtQueueManager' require 'TestAbtReportManager' require 'TestAbtSystemManager' -require 'TestAbtDepEngine' \ No newline at end of file +require 'TestAbtDepEngine' This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <esc...@us...> - 2007-07-16 11:45:15
|
Revision: 348 http://svn.sourceforge.net/abtlinux/?rev=348&view=rev Author: eschabell Date: 2007-07-16 04:44:54 -0700 (Mon, 16 Jul 2007) Log Message: ----------- Migrated test class file for dep engine to rubyfied name and update references. Modified Paths: -------------- src/trunk/testSuiteAbt.rb Added Paths: ----------- src/trunk/testabtdepengine.rb Removed Paths: ------------- src/trunk/TestAbtDepEngine.rb Deleted: src/trunk/TestAbtDepEngine.rb =================================================================== --- src/trunk/TestAbtDepEngine.rb 2007-07-16 11:42:14 UTC (rev 347) +++ src/trunk/TestAbtDepEngine.rb 2007-07-16 11:44:54 UTC (rev 348) @@ -1,53 +0,0 @@ -#!/usr/bin/ruby -w - -require 'test/unit/testcase' -require 'test/unit/autorunner' -require 'abtdepengine' - -## -# TestAbtDepEngine.rb -# -# Unit testing for AbtDepEngine class. -# -# Created by Eric D. Schabell <er...@ab...> -# Copyright 2006, GPL. -# -# This file is part of AbTLinux. -# -# AbTLinux is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# AbTLinux is distributed in the hope that it will be useful, but WITHOUT ANY -# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -# details. -# -# You should have received a copy of the GNU General Public License along with -# AbTLinux; if not, write to the Free Software Foundation, Inc., 51 Franklin -# St, Fifth Floor, Boston, MA 02110-1301 USA -## -class TestAbtDepEngine < Test::Unit::TestCase - - ## - # setup method for testing AbtDepEngine. - ## - def setup - @depEngine = AbtDepEngine.new() - end - - ## - # teardown method to cleanup after testing. - ## - def teardown - end - - ## - # Test method for 'AbtDepEngine.testDepEngine()' - ## - def testDepEngine - assert_equal( false, true, "testDepEngine()" ) - end - -end Modified: src/trunk/testSuiteAbt.rb =================================================================== --- src/trunk/testSuiteAbt.rb 2007-07-16 11:42:14 UTC (rev 347) +++ src/trunk/testSuiteAbt.rb 2007-07-16 11:44:54 UTC (rev 348) @@ -29,4 +29,4 @@ require 'TestAbtQueueManager' require 'TestAbtReportManager' require 'TestAbtSystemManager' -require 'TestAbtDepEngine' +require 'testabtdepengine' Copied: src/trunk/testabtdepengine.rb (from rev 346, src/trunk/TestAbtDepEngine.rb) =================================================================== --- src/trunk/testabtdepengine.rb (rev 0) +++ src/trunk/testabtdepengine.rb 2007-07-16 11:44:54 UTC (rev 348) @@ -0,0 +1,53 @@ +#!/usr/bin/ruby -w + +require 'test/unit/testcase' +require 'test/unit/autorunner' +require 'abtdepengine' + +## +# TestAbtDepEngine.rb +# +# Unit testing for AbtDepEngine class. +# +# Created by Eric D. Schabell <er...@ab...> +# Copyright 2006, GPL. +# +# This file is part of AbTLinux. +# +# AbTLinux is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# AbTLinux is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# AbTLinux; if not, write to the Free Software Foundation, Inc., 51 Franklin +# St, Fifth Floor, Boston, MA 02110-1301 USA +## +class TestAbtDepEngine < Test::Unit::TestCase + + ## + # setup method for testing AbtDepEngine. + ## + def setup + @depEngine = AbtDepEngine.new() + end + + ## + # teardown method to cleanup after testing. + ## + def teardown + end + + ## + # Test method for 'AbtDepEngine.testDepEngine()' + ## + def testDepEngine + assert_equal( false, true, "testDepEngine()" ) + end + +end This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <esc...@us...> - 2007-07-16 11:55:54
|
Revision: 349 http://svn.sourceforge.net/abtlinux/?rev=349&view=rev Author: eschabell Date: 2007-07-16 04:55:55 -0700 (Mon, 16 Jul 2007) Log Message: ----------- Migrated abt download manager to rubified file name and updated references. Modified Paths: -------------- src/trunk/TestAbtDownloadManager.rb src/trunk/TestAbtPackage.rb src/trunk/abtconfig.rb Added Paths: ----------- src/trunk/abtdownloadmanager.rb Removed Paths: ------------- src/trunk/AbtDownloadManager.rb Deleted: src/trunk/AbtDownloadManager.rb =================================================================== --- src/trunk/AbtDownloadManager.rb 2007-07-16 11:44:54 UTC (rev 348) +++ src/trunk/AbtDownloadManager.rb 2007-07-16 11:55:55 UTC (rev 349) @@ -1,162 +0,0 @@ -#!/usr/bin/ruby -w - -## -# AbtDownloadManager.rb -# -# AbtDownloadManager class handles all downloading of components needed for -# AbTLinux. -# -# Created by Eric D. Schabell <er...@ab...> -# Copyright 2006, GPL. -# -# This file is part of AbTLinux. -# -# AbTLinux is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# AbTLinux is distributed in the hope that it will be useful, but WITHOUT ANY -# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -# details. -# -# You should have received a copy of the GNU General Public License along with -# AbTLinux; if not, write to the Free Software Foundation, Inc., 51 Franklin -# St, Fifth Floor, Boston, MA 02110-1301 USA -## -class AbtDownloadManager - - protected - - private - - public - - ## - # Constructor for the AbtDownloadManager class. - # - # <b>RETURN</b> <i>AbtDownloadManager</i> - an initialized - # AbtDownloadManager object. - ## - def initialize - end - - ## - # Downloads a given package source. If the file already exists, returns - # true as if download completed. - # - # <b>PARAM</b> <i>String</i> - the name of the package for which the source - # is to be downloaded. - # <b>PARAM</b> <i>String</i> - the path to the download destination. - # - # <b>RETURN</b> <i>boolean</i> - True if the package source has been - # downloaded, otherwise false. - ## - def retrievePackageSource( packageName, destination ) - require "#{$PACKAGE_PATH}#{packageName}" - logger = AbtLogManager.new - package = eval( packageName.capitalize + '.new' ) - - if ( File.exist?( "#{destination}/#{File.basename( package.srcUrl )}" ) ) - logger.logToJournal( "Download not needed, existing source found for #{packageName}" ) - return true - end - - Dir.chdir( destination ) - if ( system( "wget #{package.srcUrl}" ) ) - logger.logToJournal( "Download completed for #{packageName}" ) - return true - end - - return false # download failed. - end - - ## - # Downloads a given pacakge tree. - # - # <b>PARAM</b> <i>String</i> - the name of the package tree to be retrieved. - # - # <b>RETURN</b> <i>boolean</i> - True if the package tree is retrieved, - # otherwise false. - ## - def retrievePackageTree( packageTreeName ) - end - - ## - # Retrieves the given feed and displays the news items. - # - # <b>PARAM</b> <i>String</i> - the uri of the rss news feed to be retrieved. - # <b>PARAM</b> <i>boolean</i> - default is to emplty the log file, - # passing 'false' will append to news file. - # <b>RETURN</b> <i>boolean</i> - True if the AbTLinux news feed has been - # retrieved, otherwise false. - ## - def retrieveNewsFeed( uri, cleanLog=true ) - require 'net/http' - require 'uri' - require 'rss/1.0' - require 'rss/2.0' - newsLog = "" - logger = AbtLogManager.new - - # ensure we have our news logfile. - if ( cleanLog ) - newsLog = File.new( $ABTNEWS_LOG, "w+" ) - else - newsLog = File.new( $ABTNEWS_LOG, "a+" ) - end - - # pick up the abtlinux.org news feed. - if ( !news = Net::HTTP.get( URI.parse( uri ) ) ) - logger.logToJournal( "Failed to retrieve news feed #{uri}." ) - return false - end - - # display the feeds. - rss = nil - begin - rss = RSS::Parser.parse(news, false) - rescue RSS::Error - end - - if ( rss.nil? ) - logger.logToJournal( "Failed to display news feed as feed #{uri} " + - "is not RSS 1.0/2.0." ) - return false - else - newsLog << "*** #{rss.channel.title} ***\n" - - rss.items.each_with_index do |item, itemCount| - itemCount += 1 - newsLog << "#{itemCount} #{item.link} #{item.title}\n" - end - end - - newsLog << "\n\n" - newsLog.close - return true - - end - - ## - # Updates a given package with available patches (version updates). - # - # <b>PARAM</b> <i>String</i> - the name of the package to be updated. - # - # <b>RETURN</b> <i>boolean</i> - True if the given package has been updated, - # otherwise false. - ## - def updatePackage - end - - ## - # Updates the package tree. - # - # <b>RETURN</b> <i>boolean</i> - True if the package tree has been updated, - # otherwise false. - ## - def updatePackageTree - end - -end Modified: src/trunk/TestAbtDownloadManager.rb =================================================================== --- src/trunk/TestAbtDownloadManager.rb 2007-07-16 11:44:54 UTC (rev 348) +++ src/trunk/TestAbtDownloadManager.rb 2007-07-16 11:55:55 UTC (rev 349) @@ -3,7 +3,7 @@ require 'test/unit/testcase' require 'test/unit/autorunner' require 'abtconfig' -require 'AbtDownloadManager' +require 'abtdownloadmanager' require 'AbtLogManager' ## Modified: src/trunk/TestAbtPackage.rb =================================================================== --- src/trunk/TestAbtPackage.rb 2007-07-16 11:44:54 UTC (rev 348) +++ src/trunk/TestAbtPackage.rb 2007-07-16 11:55:55 UTC (rev 349) @@ -4,7 +4,6 @@ require "test/unit/autorunner" require "abtconfig" require "AbtPackage" -require "AbtDownloadManager" require "#{$PACKAGE_PATH}ipc" ## Modified: src/trunk/abtconfig.rb =================================================================== --- src/trunk/abtconfig.rb 2007-07-16 11:44:54 UTC (rev 348) +++ src/trunk/abtconfig.rb 2007-07-16 11:55:55 UTC (rev 349) @@ -26,7 +26,7 @@ ## # global requires. -require 'AbtDownloadManager' +require 'abtdownloadmanager' require 'AbtLogManager' require 'AbtPackageManager' require 'AbtQueueManager' Copied: src/trunk/abtdownloadmanager.rb (from rev 346, src/trunk/AbtDownloadManager.rb) =================================================================== --- src/trunk/abtdownloadmanager.rb (rev 0) +++ src/trunk/abtdownloadmanager.rb 2007-07-16 11:55:55 UTC (rev 349) @@ -0,0 +1,162 @@ +#!/usr/bin/ruby -w + +## +# AbtDownloadManager.rb +# +# AbtDownloadManager class handles all downloading of components needed for +# AbTLinux. +# +# Created by Eric D. Schabell <er...@ab...> +# Copyright 2006, GPL. +# +# This file is part of AbTLinux. +# +# AbTLinux is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# AbTLinux is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# AbTLinux; if not, write to the Free Software Foundation, Inc., 51 Franklin +# St, Fifth Floor, Boston, MA 02110-1301 USA +## +class AbtDownloadManager + + protected + + private + + public + + ## + # Constructor for the AbtDownloadManager class. + # + # <b>RETURN</b> <i>AbtDownloadManager</i> - an initialized + # AbtDownloadManager object. + ## + def initialize + end + + ## + # Downloads a given package source. If the file already exists, returns + # true as if download completed. + # + # <b>PARAM</b> <i>String</i> - the name of the package for which the source + # is to be downloaded. + # <b>PARAM</b> <i>String</i> - the path to the download destination. + # + # <b>RETURN</b> <i>boolean</i> - True if the package source has been + # downloaded, otherwise false. + ## + def retrievePackageSource( packageName, destination ) + require "#{$PACKAGE_PATH}#{packageName}" + logger = AbtLogManager.new + package = eval( packageName.capitalize + '.new' ) + + if ( File.exist?( "#{destination}/#{File.basename( package.srcUrl )}" ) ) + logger.logToJournal( "Download not needed, existing source found for #{packageName}" ) + return true + end + + Dir.chdir( destination ) + if ( system( "wget #{package.srcUrl}" ) ) + logger.logToJournal( "Download completed for #{packageName}" ) + return true + end + + return false # download failed. + end + + ## + # Downloads a given pacakge tree. + # + # <b>PARAM</b> <i>String</i> - the name of the package tree to be retrieved. + # + # <b>RETURN</b> <i>boolean</i> - True if the package tree is retrieved, + # otherwise false. + ## + def retrievePackageTree( packageTreeName ) + end + + ## + # Retrieves the given feed and displays the news items. + # + # <b>PARAM</b> <i>String</i> - the uri of the rss news feed to be retrieved. + # <b>PARAM</b> <i>boolean</i> - default is to emplty the log file, + # passing 'false' will append to news file. + # <b>RETURN</b> <i>boolean</i> - True if the AbTLinux news feed has been + # retrieved, otherwise false. + ## + def retrieveNewsFeed( uri, cleanLog=true ) + require 'net/http' + require 'uri' + require 'rss/1.0' + require 'rss/2.0' + newsLog = "" + logger = AbtLogManager.new + + # ensure we have our news logfile. + if ( cleanLog ) + newsLog = File.new( $ABTNEWS_LOG, "w+" ) + else + newsLog = File.new( $ABTNEWS_LOG, "a+" ) + end + + # pick up the abtlinux.org news feed. + if ( !news = Net::HTTP.get( URI.parse( uri ) ) ) + logger.logToJournal( "Failed to retrieve news feed #{uri}." ) + return false + end + + # display the feeds. + rss = nil + begin + rss = RSS::Parser.parse(news, false) + rescue RSS::Error + end + + if ( rss.nil? ) + logger.logToJournal( "Failed to display news feed as feed #{uri} " + + "is not RSS 1.0/2.0." ) + return false + else + newsLog << "*** #{rss.channel.title} ***\n" + + rss.items.each_with_index do |item, itemCount| + itemCount += 1 + newsLog << "#{itemCount} #{item.link} #{item.title}\n" + end + end + + newsLog << "\n\n" + newsLog.close + return true + + end + + ## + # Updates a given package with available patches (version updates). + # + # <b>PARAM</b> <i>String</i> - the name of the package to be updated. + # + # <b>RETURN</b> <i>boolean</i> - True if the given package has been updated, + # otherwise false. + ## + def updatePackage + end + + ## + # Updates the package tree. + # + # <b>RETURN</b> <i>boolean</i> - True if the package tree has been updated, + # otherwise false. + ## + def updatePackageTree + end + +end This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <esc...@us...> - 2007-07-16 12:11:34
|
Revision: 350 http://svn.sourceforge.net/abtlinux/?rev=350&view=rev Author: eschabell Date: 2007-07-16 05:11:36 -0700 (Mon, 16 Jul 2007) Log Message: ----------- Migrated test of download manager and references. Modified Paths: -------------- src/trunk/testSuiteAbt.rb Added Paths: ----------- src/trunk/testabtdownloadmanager.rb Removed Paths: ------------- src/trunk/TestAbtDownloadManager.rb Deleted: src/trunk/TestAbtDownloadManager.rb =================================================================== --- src/trunk/TestAbtDownloadManager.rb 2007-07-16 11:55:55 UTC (rev 349) +++ src/trunk/TestAbtDownloadManager.rb 2007-07-16 12:11:36 UTC (rev 350) @@ -1,84 +0,0 @@ -#!/usr/bin/ruby -w - -require 'test/unit/testcase' -require 'test/unit/autorunner' -require 'abtconfig' -require 'abtdownloadmanager' -require 'AbtLogManager' - -## -# TestAbtDownloadManager.rb -# -# Unit testing for AbtDownloadManager class. -# -# Created by Eric D. Schabell <er...@ab...> -# Copyright 2006, GPL. -# -# This file is part of AbTLinux. -# -# AbTLinux is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# AbTLinux is distributed in the hope that it will be useful, but WITHOUT ANY -# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -# details. -# -# You should have received a copy of the GNU General Public License along with -# AbTLinux; if not, write to the Free Software Foundation, Inc., 51 Franklin -# St, Fifth Floor, Boston, MA 02110-1301 USA -## -class TestAbtDownloadManager < Test::Unit::TestCase - - ## - # setup method for testing AbtDownloadManager. - ## - def setup - @download = AbtDownloadManager.new() - end - - ## - # teardown method to cleanup after testing. - ## - def teardown - end - - ## - # Test method for 'AbtDownloadManager.testRetrievePackageSource()' - ## - def testRetrievePackageSource() - assert( @download.retrievePackageSource( "ipc", "#{$SOURCES_REPOSITORY}" ), - "testRetrievePackageSource()" ) - end - - ## - # Test method for 'AbtDownloadManager.testRetrievePackageTree()' - ## - def testRetrievePackageTree() - assert( @download.retrievePackageTree( "dummy" ), - "testRetrievePackageTree()" ) - end - - ## - # Test method for 'AbtDownloadManager.testRetrieveNewsFeed()' - ## - def testRetrieveNewsFeed() - assert( @download.retrieveNewsFeed( $ABTNEWS ), "testRetrieveNewsFeed()" ) - end - - ## - # Test method for 'AbtDownloadManager.testUpdatePackage()' - ## - def testUpdatePackage() - assert( @download.updatePackage(), "testUpdatePackage()" ) - end - - ## - # Test method for 'AbtDownloadManager.testUpdatePackageTree()' - ## - def testUpdatePackageTree() - assert( @download.updatePackageTree(), "testUpdatePackageTree()" ) - end -end Modified: src/trunk/testSuiteAbt.rb =================================================================== --- src/trunk/testSuiteAbt.rb 2007-07-16 11:55:55 UTC (rev 349) +++ src/trunk/testSuiteAbt.rb 2007-07-16 12:11:36 UTC (rev 350) @@ -24,7 +24,7 @@ require 'TestAbtPackageManager' require 'TestAbtLogManager' -require 'TestAbtDownloadManager' +require 'testabtdownloadmanager' require 'TestAbtPackage' require 'TestAbtQueueManager' require 'TestAbtReportManager' Copied: src/trunk/testabtdownloadmanager.rb (from rev 349, src/trunk/TestAbtDownloadManager.rb) =================================================================== --- src/trunk/testabtdownloadmanager.rb (rev 0) +++ src/trunk/testabtdownloadmanager.rb 2007-07-16 12:11:36 UTC (rev 350) @@ -0,0 +1,82 @@ +#!/usr/bin/ruby -w + +require 'test/unit/testcase' +require 'test/unit/autorunner' +require 'abtconfig' + +## +# testabtdownloadmanager.rb +# +# Unit testing for AbtDownloadManager class. +# +# Created by Eric D. Schabell <er...@ab...> +# Copyright 2006, GPL. +# +# This file is part of AbTLinux. +# +# AbTLinux is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# AbTLinux is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# AbTLinux; if not, write to the Free Software Foundation, Inc., 51 Franklin +# St, Fifth Floor, Boston, MA 02110-1301 USA +## +class TestAbtDownloadManager < Test::Unit::TestCase + + ## + # setup method for testing AbtDownloadManager. + ## + def setup + @download = AbtDownloadManager.new() + end + + ## + # teardown method to cleanup after testing. + ## + def teardown + end + + ## + # Test method for 'AbtDownloadManager.testRetrievePackageSource()' + ## + def testRetrievePackageSource() + assert( @download.retrievePackageSource( "ipc", "#{$SOURCES_REPOSITORY}" ), + "testRetrievePackageSource()" ) + end + + ## + # Test method for 'AbtDownloadManager.testRetrievePackageTree()' + ## + def testRetrievePackageTree() + assert( @download.retrievePackageTree( "dummy" ), + "testRetrievePackageTree()" ) + end + + ## + # Test method for 'AbtDownloadManager.testRetrieveNewsFeed()' + ## + def testRetrieveNewsFeed() + assert( @download.retrieveNewsFeed( $ABTNEWS ), "testRetrieveNewsFeed()" ) + end + + ## + # Test method for 'AbtDownloadManager.testUpdatePackage()' + ## + def testUpdatePackage() + assert( @download.updatePackage(), "testUpdatePackage()" ) + end + + ## + # Test method for 'AbtDownloadManager.testUpdatePackageTree()' + ## + def testUpdatePackageTree() + assert( @download.updatePackageTree(), "testUpdatePackageTree()" ) + end +end This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <esc...@us...> - 2007-07-16 12:15:41
|
Revision: 351 http://svn.sourceforge.net/abtlinux/?rev=351&view=rev Author: eschabell Date: 2007-07-16 05:15:43 -0700 (Mon, 16 Jul 2007) Log Message: ----------- Migrated log manager and references to rubified file name. Modified Paths: -------------- src/trunk/TestAbtLogManager.rb src/trunk/TestAbtQueueManager.rb src/trunk/abtconfig.rb Added Paths: ----------- src/trunk/abtlogmanager.rb Removed Paths: ------------- src/trunk/AbtLogManager.rb Deleted: src/trunk/AbtLogManager.rb =================================================================== --- src/trunk/AbtLogManager.rb 2007-07-16 12:11:36 UTC (rev 350) +++ src/trunk/AbtLogManager.rb 2007-07-16 12:15:43 UTC (rev 351) @@ -1,305 +0,0 @@ -#!/usr/bin/ruby -w - -## -# AbtLogManager.rb -# -# AbtLogManager class handles all aspects of logging and access to existing logs -# within the AbTLinux system. -# -# Created by Eric D. Schabell <er...@ab...> -# Copyright 2006, GPL. -# -# This file is part of AbTLinux. -# -# AbTLinux is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# AbTLinux is distributed in the hope that it will be useful, but WITHOUT ANY -# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -# details. -# -# You should have received a copy of the GNU General Public License along with -# AbTLinux; if not, write to the Free Software Foundation, Inc., 51 Franklin -# St, Fifth Floor, Boston, MA 02110-1301 USA -## -class AbtLogManager - - protected - - private - - ## - # Returns the path to given packages install log. - # - # <b>PARAM</b> <i>String</i> - Package name. - # - # <b>RETURN</b> <i>String</i> - Full path to install log. - ## - def getLog( package, type ) - require "#{$PACKAGE_PATH}#{package}" - sw = eval( "#{package.capitalize}.new" ) - details = sw.details - - case type - - when 'install' - log = "#{$PACKAGE_INSTALLED}/#{details['Source location']}" + - "/#{details['Source location']}.install" - - when 'integrity' - log = "#{$PACKAGE_INSTALLED}/#{details['Source location']}" + - "/#{details['Source location']}.integrity" - - when 'tmpinstall' - log = "#{$ABT_TMP}/#{details['Source location']}.watch" - - when 'build' - log = "#{$PACKAGE_INSTALLED}/#{details['Source location']}" + - "/#{details['Source location']}.build" - - else - log = "" - - end - - return log - end - - - public - - ## - # Constructor for the AbtLogManager. It ensures all needed logs paths are - # initialized. - # - # - # <b>RETURN</b> <i>AbtLogManager</i> - an initialized AbtLogManager object. - ## - def initialize - [$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 ) - logToJournal << "Created directory: #{dir}." - end - } - end - - ## - # Provides logging of the integrity of all installed files for the given - # package. Will be called as part of the logging done during the install - # phase. - # - # <b>PARAM</b> <i>String</i> - Package name. - # - # <b>RETURN</b> <i>boolean</i> - True if integrity log created successfully, - # otherwise false. - ## - def logPackageIntegrity( package ) - #require "#{$PACKAGE_PATH}#{package}" - #sw = eval( "#{package.capitalize}.new" ) - #details = sw.details - - # our log locations. - installLog = getLog( package, 'install' ) - integrityLog = getLog( package, 'integrity' ) - - # get the installed files from the tmp file - # into our install log. - if ( File.exist?( installLog ) ) - installFile = open( installLog, 'r' ) - integrityFile = open( integrityLog, 'w' ) - - # get the integrity for each file, initially just permissions. - IO.foreach( installLog ) do |line| - status = File.stat( line.chomp ) - octal = sprintf( "%o", status.mode ) - integrityFile << "#{line.chomp}:#{octal}\n" - end - - installFile.close - integrityFile.close - else - return false # no install log! - end - - return true; - end - - ## - # Provides logging of all files installed by given package. Should be called - # as part of the install phase of the build. - # - # <b>PARAM</b> <i>String</i> - Package name. - # - # <b>RETURN</b> <i>boolean</i> - True if install log created successfully, - # otherwise false. - ## - def logPackageInstall( package ) - # some dirs we will not add to an install log. - excluded_pattern = - Regexp.new( "^(/dev|/proc|/tmp|/var/tmp|/usr/src|/sys)+" ) - badLine = false # used to mark excluded lines from installwatch log. - - # our log locations. - installLog = getLog( package, 'install' ) - tmpInstallLog = getLog( package, 'tmpinstall' ) - - # get the installed files from the tmp file - # into our install log. - if ( File.exist?( tmpInstallLog ) ) - installFile = open( installLog, 'w') - - # include only the file names from open calls - # and not part of the excluded range of directories. - IO.foreach( tmpInstallLog ) do |line| - if ( line.split[1] == 'open' ) - if ( line.split[2] =~ excluded_pattern ) - #self.logToJournal( "DEBUG: Found bad logLine!" ) - badLine = true - else - badLine = false - end - - if ( !badLine ) - #self.logToJournal( "DEBUG: adding line to installFile!") - installFile << "#{line.split[2]}\n" - end - end - end - - installFile.close - end - - return true; - end - - ## - # Provides logging of all output produced during the build phase of the - # given package. Should be called as part of the install phase of the build. - # - # <b>PARAM</b> <i>String</i> - Package name. - # - # <b>RETURN</b> <i>boolean</i> - True if build log created successfully, - # otherwise false. - ## - def logPackageBuild( package ) - buildLog = getLog( package, 'build' ) - - # make sure the build file exists. - if ( !File.exist?( buildLog ) ) - return false - end - - return true - end - - ## - # Provides a complete log of the given packages build. Includes everything - # needed to duplicate the build at a later date. - # - # <b>PARAM</b> <i>String</i> - Package name. - # - # <b>RETURN</b> <i>boolean</i> - True if package cache created successfully, - # otherwise false. - ## - def cachePackage( package ) - system = AbtSystemManager.new - - if ( system.packageInstalled( package ) ) - sw = eval( "#{package.capitalize}.new" ) - cachedDir = $PACKAGE_CACHED + "/" + sw.srcDir - sourcePath = $SOURCES_REPOSITORY + "/" + File.basename( sw.srcUrl ) - sourceFile = File.basename( sw.srcUrl ) - installLog = getLog( package, 'install' ) - buildLog = getLog( package, 'install' ) - configureLog = getLog( package, 'install' ) - integrityLog = getLog( package, 'install' ) - packageFile = "#{$PACKAGE_PATH}#{package}.rb" - - - FileUtils.mkdir_p( cachedDir ) - - # collect package source. - if ( FileTest::exist?( sourcePath ) ) - FileUtils.copy_file( sourcePath, "#{cachedDir}/#{sourceFile}" ) - puts "\nCaching copy of #{package} source." - else - puts "\nUnable to cache copy of #{package} source." - end - - # collect package install log. - if ( FileTest::exist?( installLog ) ) - FileUtils.copy_file( installLog, "#{cachedDir}/#{sw.srcDir}.install" ) - puts "\nCaching copy of #{package} install log." - else - puts "\nUnable to cache copy of #{package} install log." - end - - # collect package build log. - if ( FileTest::exist?( buildLog ) ) - FileUtils.copy_file( buildLog, "#{cachedDir}/#{sw.srcDir}.build" ) - puts "\nCaching copy of #{package} build log." - else - puts "\nUnable to cache copy of #{package} build log." - end - - # collect package configure log. - if ( FileTest::exist?( configureLog ) ) - FileUtils.copy_file( configureLog, "#{cachedDir}/#{sw.srcDir}.configure" ) - puts "\nCaching copy of #{package} configure log." - else - puts "\nUnable to cache copy of #{package} configure log." - end - - # collect package integrity log. - if ( FileTest::exist?( integrityLog ) ) - FileUtils.copy_file( integrityLog, "#{cachedDir}/#{sw.srcDir}.integrity" ) - puts "\nCaching copy of #{package} integrity log." - else - puts "\nUnable to cache copy of #{package} integrity log." - end - - # collect package description (class file). - if ( FileTest::exist?( packageFile ) ) - FileUtils.copy_file( packageFile, "#{cachedDir}/#{package}.rb" ) - puts "\nCaching copy of #{package} package description." - else - puts "\nUnable to cache copy of #{package} package description, from location #{packageFile}" - end - - # tar and bzip this directory (package-cache-version.tar.bz2) - Dir.chdir( $PACKAGE_CACHED ) - if ( system( "tar -cf #{sw.srcDir}.tar #{sw.srcDir}" ) && - system( "bzip2 -f #{sw.srcDir}.tar" ) ) - # last but not least, remove our tarball directory - FileUtils.rm_rf( cachedDir ) - return true - end - end - - return false # package not installed, can't cache it. - end - - ## - # Provides logging of given message to the AbTLinux journal. Message logged - # with date timestamp. - # - # <b>PARAM</b> <i>String</i> - Message to be added to the log. - # - # <b>RETURN</b> <i>boolean</i> True if logged, otherwise false. - ## - def logToJournal( message ) - if ( log = File.new( $JOURNAL, "a+" ) ) - log << "#{$TIMESTAMP} : #{message}\n" - log.close - return true - end - - return false - end -end Modified: src/trunk/TestAbtLogManager.rb =================================================================== --- src/trunk/TestAbtLogManager.rb 2007-07-16 12:11:36 UTC (rev 350) +++ src/trunk/TestAbtLogManager.rb 2007-07-16 12:15:43 UTC (rev 351) @@ -3,7 +3,6 @@ require 'test/unit/testcase' require 'test/unit/autorunner' require 'abtconfig' -require 'AbtLogManager' ## # TestAbtLogManager.rb Modified: src/trunk/TestAbtQueueManager.rb =================================================================== --- src/trunk/TestAbtQueueManager.rb 2007-07-16 12:11:36 UTC (rev 350) +++ src/trunk/TestAbtQueueManager.rb 2007-07-16 12:15:43 UTC (rev 351) @@ -3,8 +3,6 @@ require 'test/unit/testcase' require 'test/unit/autorunner' require 'abtconfig' -require 'AbtQueueManager' -require 'AbtLogManager' ## # TestAbtQueueManager.rb Modified: src/trunk/abtconfig.rb =================================================================== --- src/trunk/abtconfig.rb 2007-07-16 12:11:36 UTC (rev 350) +++ src/trunk/abtconfig.rb 2007-07-16 12:15:43 UTC (rev 351) @@ -27,7 +27,7 @@ # global requires. require 'abtdownloadmanager' -require 'AbtLogManager' +require 'abtlogmanager' require 'AbtPackageManager' require 'AbtQueueManager' require 'AbtReportManager' Copied: src/trunk/abtlogmanager.rb (from rev 350, src/trunk/AbtLogManager.rb) =================================================================== --- src/trunk/abtlogmanager.rb (rev 0) +++ src/trunk/abtlogmanager.rb 2007-07-16 12:15:43 UTC (rev 351) @@ -0,0 +1,305 @@ +#!/usr/bin/ruby -w + +## +# AbtLogManager.rb +# +# AbtLogManager class handles all aspects of logging and access to existing logs +# within the AbTLinux system. +# +# Created by Eric D. Schabell <er...@ab...> +# Copyright 2006, GPL. +# +# This file is part of AbTLinux. +# +# AbTLinux is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# AbTLinux is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# AbTLinux; if not, write to the Free Software Foundation, Inc., 51 Franklin +# St, Fifth Floor, Boston, MA 02110-1301 USA +## +class AbtLogManager + + protected + + private + + ## + # Returns the path to given packages install log. + # + # <b>PARAM</b> <i>String</i> - Package name. + # + # <b>RETURN</b> <i>String</i> - Full path to install log. + ## + def getLog( package, type ) + require "#{$PACKAGE_PATH}#{package}" + sw = eval( "#{package.capitalize}.new" ) + details = sw.details + + case type + + when 'install' + log = "#{$PACKAGE_INSTALLED}/#{details['Source location']}" + + "/#{details['Source location']}.install" + + when 'integrity' + log = "#{$PACKAGE_INSTALLED}/#{details['Source location']}" + + "/#{details['Source location']}.integrity" + + when 'tmpinstall' + log = "#{$ABT_TMP}/#{details['Source location']}.watch" + + when 'build' + log = "#{$PACKAGE_INSTALLED}/#{details['Source location']}" + + "/#{details['Source location']}.build" + + else + log = "" + + end + + return log + end + + + public + + ## + # Constructor for the AbtLogManager. It ensures all needed logs paths are + # initialized. + # + # + # <b>RETURN</b> <i>AbtLogManager</i> - an initialized AbtLogManager object. + ## + def initialize + [$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 ) + logToJournal << "Created directory: #{dir}." + end + } + end + + ## + # Provides logging of the integrity of all installed files for the given + # package. Will be called as part of the logging done during the install + # phase. + # + # <b>PARAM</b> <i>String</i> - Package name. + # + # <b>RETURN</b> <i>boolean</i> - True if integrity log created successfully, + # otherwise false. + ## + def logPackageIntegrity( package ) + #require "#{$PACKAGE_PATH}#{package}" + #sw = eval( "#{package.capitalize}.new" ) + #details = sw.details + + # our log locations. + installLog = getLog( package, 'install' ) + integrityLog = getLog( package, 'integrity' ) + + # get the installed files from the tmp file + # into our install log. + if ( File.exist?( installLog ) ) + installFile = open( installLog, 'r' ) + integrityFile = open( integrityLog, 'w' ) + + # get the integrity for each file, initially just permissions. + IO.foreach( installLog ) do |line| + status = File.stat( line.chomp ) + octal = sprintf( "%o", status.mode ) + integrityFile << "#{line.chomp}:#{octal}\n" + end + + installFile.close + integrityFile.close + else + return false # no install log! + end + + return true; + end + + ## + # Provides logging of all files installed by given package. Should be called + # as part of the install phase of the build. + # + # <b>PARAM</b> <i>String</i> - Package name. + # + # <b>RETURN</b> <i>boolean</i> - True if install log created successfully, + # otherwise false. + ## + def logPackageInstall( package ) + # some dirs we will not add to an install log. + excluded_pattern = + Regexp.new( "^(/dev|/proc|/tmp|/var/tmp|/usr/src|/sys)+" ) + badLine = false # used to mark excluded lines from installwatch log. + + # our log locations. + installLog = getLog( package, 'install' ) + tmpInstallLog = getLog( package, 'tmpinstall' ) + + # get the installed files from the tmp file + # into our install log. + if ( File.exist?( tmpInstallLog ) ) + installFile = open( installLog, 'w') + + # include only the file names from open calls + # and not part of the excluded range of directories. + IO.foreach( tmpInstallLog ) do |line| + if ( line.split[1] == 'open' ) + if ( line.split[2] =~ excluded_pattern ) + #self.logToJournal( "DEBUG: Found bad logLine!" ) + badLine = true + else + badLine = false + end + + if ( !badLine ) + #self.logToJournal( "DEBUG: adding line to installFile!") + installFile << "#{line.split[2]}\n" + end + end + end + + installFile.close + end + + return true; + end + + ## + # Provides logging of all output produced during the build phase of the + # given package. Should be called as part of the install phase of the build. + # + # <b>PARAM</b> <i>String</i> - Package name. + # + # <b>RETURN</b> <i>boolean</i> - True if build log created successfully, + # otherwise false. + ## + def logPackageBuild( package ) + buildLog = getLog( package, 'build' ) + + # make sure the build file exists. + if ( !File.exist?( buildLog ) ) + return false + end + + return true + end + + ## + # Provides a complete log of the given packages build. Includes everything + # needed to duplicate the build at a later date. + # + # <b>PARAM</b> <i>String</i> - Package name. + # + # <b>RETURN</b> <i>boolean</i> - True if package cache created successfully, + # otherwise false. + ## + def cachePackage( package ) + system = AbtSystemManager.new + + if ( system.packageInstalled( package ) ) + sw = eval( "#{package.capitalize}.new" ) + cachedDir = $PACKAGE_CACHED + "/" + sw.srcDir + sourcePath = $SOURCES_REPOSITORY + "/" + File.basename( sw.srcUrl ) + sourceFile = File.basename( sw.srcUrl ) + installLog = getLog( package, 'install' ) + buildLog = getLog( package, 'install' ) + configureLog = getLog( package, 'install' ) + integrityLog = getLog( package, 'install' ) + packageFile = "#{$PACKAGE_PATH}#{package}.rb" + + + FileUtils.mkdir_p( cachedDir ) + + # collect package source. + if ( FileTest::exist?( sourcePath ) ) + FileUtils.copy_file( sourcePath, "#{cachedDir}/#{sourceFile}" ) + puts "\nCaching copy of #{package} source." + else + puts "\nUnable to cache copy of #{package} source." + end + + # collect package install log. + if ( FileTest::exist?( installLog ) ) + FileUtils.copy_file( installLog, "#{cachedDir}/#{sw.srcDir}.install" ) + puts "\nCaching copy of #{package} install log." + else + puts "\nUnable to cache copy of #{package} install log." + end + + # collect package build log. + if ( FileTest::exist?( buildLog ) ) + FileUtils.copy_file( buildLog, "#{cachedDir}/#{sw.srcDir}.build" ) + puts "\nCaching copy of #{package} build log." + else + puts "\nUnable to cache copy of #{package} build log." + end + + # collect package configure log. + if ( FileTest::exist?( configureLog ) ) + FileUtils.copy_file( configureLog, "#{cachedDir}/#{sw.srcDir}.configure" ) + puts "\nCaching copy of #{package} configure log." + else + puts "\nUnable to cache copy of #{package} configure log." + end + + # collect package integrity log. + if ( FileTest::exist?( integrityLog ) ) + FileUtils.copy_file( integrityLog, "#{cachedDir}/#{sw.srcDir}.integrity" ) + puts "\nCaching copy of #{package} integrity log." + else + puts "\nUnable to cache copy of #{package} integrity log." + end + + # collect package description (class file). + if ( FileTest::exist?( packageFile ) ) + FileUtils.copy_file( packageFile, "#{cachedDir}/#{package}.rb" ) + puts "\nCaching copy of #{package} package description." + else + puts "\nUnable to cache copy of #{package} package description, from location #{packageFile}" + end + + # tar and bzip this directory (package-cache-version.tar.bz2) + Dir.chdir( $PACKAGE_CACHED ) + if ( system( "tar -cf #{sw.srcDir}.tar #{sw.srcDir}" ) && + system( "bzip2 -f #{sw.srcDir}.tar" ) ) + # last but not least, remove our tarball directory + FileUtils.rm_rf( cachedDir ) + return true + end + end + + return false # package not installed, can't cache it. + end + + ## + # Provides logging of given message to the AbTLinux journal. Message logged + # with date timestamp. + # + # <b>PARAM</b> <i>String</i> - Message to be added to the log. + # + # <b>RETURN</b> <i>boolean</i> True if logged, otherwise false. + ## + def logToJournal( message ) + if ( log = File.new( $JOURNAL, "a+" ) ) + log << "#{$TIMESTAMP} : #{message}\n" + log.close + return true + end + + return false + end +end This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <esc...@us...> - 2007-07-16 12:17:22
|
Revision: 352 http://svn.sourceforge.net/abtlinux/?rev=352&view=rev Author: eschabell Date: 2007-07-16 05:17:21 -0700 (Mon, 16 Jul 2007) Log Message: ----------- Migrated log manager test class and references to rubified file name. Modified Paths: -------------- src/trunk/testSuiteAbt.rb Added Paths: ----------- src/trunk/testabtlogmanager.rb Removed Paths: ------------- src/trunk/TestAbtLogManager.rb Deleted: src/trunk/TestAbtLogManager.rb =================================================================== --- src/trunk/TestAbtLogManager.rb 2007-07-16 12:15:43 UTC (rev 351) +++ src/trunk/TestAbtLogManager.rb 2007-07-16 12:17:21 UTC (rev 352) @@ -1,82 +0,0 @@ -#!/usr/bin/ruby -w - -require 'test/unit/testcase' -require 'test/unit/autorunner' -require 'abtconfig' - -## -# TestAbtLogManager.rb -# -# Unit testing for AbtLogManager class. -# -# Created by Eric D. Schabell <er...@ab...> -# Copyright 2006, GPL. -# -# This file is part of AbTLinux. -# -# AbTLinux is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# AbTLinux is distributed in the hope that it will be useful, but WITHOUT ANY -# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -# details. -# -# You should have received a copy of the GNU General Public License along with -# AbTLinux; if not, write to the Free Software Foundation, Inc., 51 Franklin -# St, Fifth Floor, Boston, MA 02110-1301 USA -## -class TestAbtLogManager < Test::Unit::TestCase - - ## - # setup method for testing AbtLogManager. - ## - def setup - @log = AbtLogManager.new() - end - - ## - # teardown method to cleanup after testing. - ## - def teardown - end - - ## - # Test method for 'AbtLogManager.testLogPackageIntegrity()' - ## - def testLogPackageIntegrity() - assert( @log.logPackageIntegrity( "ipc" ), "testLogPackageIntegrity()" ) - end - - ## - # Test method for 'AbtLogManager.testLogPackageInstall()' - ## - def testLogPackageInstall() - assert( @log.logPackageInstall( "ipc" ), "testLogPackageInstall()" ) - end - - ## - # Test method for 'AbtLogManager.testLogPackageBuild()' - ## - def testLogPackageBuild() - assert( @log.logPackageBuild( "ipc" ), "testLogPackageBuild()" ) - end - - ## - # Test method for 'AbtLogManager.testCachePackage()' - ## - def testCachePackage() - assert( @log.cachePackage( "ipc" ), "testCachePackage()" ) - end - - ## - # Test method for 'AbtLogManager.testLogToJournal()' - ## - def testLogToJournal() - assert( @log.logToJournal( "Test message from AbtTestSuite." ), - "testLogToJournal()" ) - end - -end Modified: src/trunk/testSuiteAbt.rb =================================================================== --- src/trunk/testSuiteAbt.rb 2007-07-16 12:15:43 UTC (rev 351) +++ src/trunk/testSuiteAbt.rb 2007-07-16 12:17:21 UTC (rev 352) @@ -23,7 +23,7 @@ manager.installPackage( "ipc" ) require 'TestAbtPackageManager' -require 'TestAbtLogManager' +require 'testabtlogmanager' require 'testabtdownloadmanager' require 'TestAbtPackage' require 'TestAbtQueueManager' Copied: src/trunk/testabtlogmanager.rb (from rev 351, src/trunk/TestAbtLogManager.rb) =================================================================== --- src/trunk/testabtlogmanager.rb (rev 0) +++ src/trunk/testabtlogmanager.rb 2007-07-16 12:17:21 UTC (rev 352) @@ -0,0 +1,82 @@ +#!/usr/bin/ruby -w + +require 'test/unit/testcase' +require 'test/unit/autorunner' +require 'abtconfig' + +## +# TestAbtLogManager.rb +# +# Unit testing for AbtLogManager class. +# +# Created by Eric D. Schabell <er...@ab...> +# Copyright 2006, GPL. +# +# This file is part of AbTLinux. +# +# AbTLinux is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# AbTLinux is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# AbTLinux; if not, write to the Free Software Foundation, Inc., 51 Franklin +# St, Fifth Floor, Boston, MA 02110-1301 USA +## +class TestAbtLogManager < Test::Unit::TestCase + + ## + # setup method for testing AbtLogManager. + ## + def setup + @log = AbtLogManager.new() + end + + ## + # teardown method to cleanup after testing. + ## + def teardown + end + + ## + # Test method for 'AbtLogManager.testLogPackageIntegrity()' + ## + def testLogPackageIntegrity() + assert( @log.logPackageIntegrity( "ipc" ), "testLogPackageIntegrity()" ) + end + + ## + # Test method for 'AbtLogManager.testLogPackageInstall()' + ## + def testLogPackageInstall() + assert( @log.logPackageInstall( "ipc" ), "testLogPackageInstall()" ) + end + + ## + # Test method for 'AbtLogManager.testLogPackageBuild()' + ## + def testLogPackageBuild() + assert( @log.logPackageBuild( "ipc" ), "testLogPackageBuild()" ) + end + + ## + # Test method for 'AbtLogManager.testCachePackage()' + ## + def testCachePackage() + assert( @log.cachePackage( "ipc" ), "testCachePackage()" ) + end + + ## + # Test method for 'AbtLogManager.testLogToJournal()' + ## + def testLogToJournal() + assert( @log.logToJournal( "Test message from AbtTestSuite." ), + "testLogToJournal()" ) + end + +end This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <esc...@us...> - 2007-07-16 12:26:53
|
Revision: 353 http://svn.sourceforge.net/abtlinux/?rev=353&view=rev Author: eschabell Date: 2007-07-16 05:26:55 -0700 (Mon, 16 Jul 2007) Log Message: ----------- Migrated package manager class and test class along with references to rubified file names. Modified Paths: -------------- src/trunk/abtconfig.rb src/trunk/testSuiteAbt.rb Added Paths: ----------- src/trunk/abtpackagemanager.rb src/trunk/testabtpackagemanager.rb Removed Paths: ------------- src/trunk/AbtPackageManager.rb src/trunk/TestAbtPackageManager.rb Deleted: src/trunk/AbtPackageManager.rb =================================================================== --- src/trunk/AbtPackageManager.rb 2007-07-16 12:17:21 UTC (rev 352) +++ src/trunk/AbtPackageManager.rb 2007-07-16 12:26:55 UTC (rev 353) @@ -1,290 +0,0 @@ -#!/usr/bin/ruby -w - -## -# AbtPackageManager.rb -# -# AbtPackageManager class will take care of the installation, removal, updating, -# downgrading and freezing of AbTLinux software packages. -# -# Created by Eric D. Schabell <er...@ab...> -# Copyright 2006, GPL. -# -# This file is part of AbTLinux. -# -# AbTLinux is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# AbTLinux is distributed in the hope that it will be useful, but WITHOUT ANY -# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -# details. -# -# You should have received a copy of the GNU General Public License along with -# AbTLinux; if not, write to the Free Software Foundation, Inc., 51 Franklin -# St, Fifth Floor, Boston, MA 02110-1301 USA -## -class AbtPackageManager - - protected - - private - - ## - # Attempts to roll back a type of action. Current supported types are - # install. Removes installed files and logs as needed. - # - # <b>PARAM</b> <i>String</i> - the type of rollback option to attempt. - # <b>PARAM</b> <i>Array</i> - The details of the package for which the - # rollback action is being called. - # - # <b>RETURN</b> <i>boolean</i> - True if the action rolls back, otherwise - # false. - ## - def rollBack( type, details ) - logFile = "#{$PACKAGE_INSTALLED}/#{details['Source location']}/" - - case type - when "install" - logFile = logFile + "#{details['Source location']}.install" - - file = File.new( logFile, "r" ) - while ( line = file.gets ) - #puts "DEBUG: about to remove ***#{line.chomp}***" - if ( File.file?( line.chomp ) ) - File.delete( line.chomp ) - else - puts "DEBUG: file not exist? ***#{File.basename( line.chomp )}***" - end - end - file.close - - # cleanup install log as it is incomplete. - File.delete( logFile ) - else - puts "DEBUG: attempt to use APM:rollBack( type ) incorrectly, " + - "unsupported type?" - return false - end - - return true - end - - - public - - ## - # Constructor for AbtPackageManager. - # - # <b>RETURN</b> <i>AbtPackageManager</i> - an initialized - # AbtPackageManager object. - ## - def initialize - end - - ## - # Installs a given package. - # - # <b>PARAM</b> <i>String</i> - the name of the package to be installed. - # <b>PARAM</b> <i>boolean</i> - true for verbose output from the process, - # otherwise false. Default is true. - # - # <b>RETURN</b> <i>boolean</i> - True if the package is installed, otherwise - # false. - ## - def installPackage( package, verbose=true ) - - # first check if installed. - system = AbtSystemManager.new - if ( system.packageInstalled( package ) ) - puts "\n*** Package #{package} is installed, might want to try reinstall? ***" - puts "'abt reinstall #{package}'" - return true - end - - require "#{$PACKAGE_PATH}#{package}" - sw = eval( "#{package.capitalize}.new" ) - queuer = AbtQueueManager.new - logger = AbtLogManager.new - - # get package details. - details = sw.details - - # TODO: check deps - - # add to install queue. - puts "\n*** Adding #{package} to the INSTALL QUEUE. ***" if ( verbose ) - - if ( !queuer.actionPackageQueue( package, "install", "add" ) ) - logger.logToJournal( "Failed to add #{package} to install queue." ) - return false - end - - # pre section. - puts "\n*** Processing the PRE section for #{package}. ***" if (verbose ) - - if ( !sw.pre ) - logger.logToJournal( "Failed to process pre-section in the " + - "package description of #{package}." ) - return false - else - logger.logToJournal( "DEBUG: finished #{package} pre section." ) - end - - # configure section. - puts "\n*** Processing the CONFIGURE section for #{package}. ***" if ( verbose ) - - if ( !sw.configure( verbose ) ) - logger.logToJournal( "Failed to process configure section in the " + - "package description of #{package}." ) - return false - else - logger.logToJournal( "DEBUG: finished #{package} configure section." ) - end - - # build section. - puts "\n*** Processing the BUILD section for #{package}. ***" if ( verbose ) - - if ( !sw.build( verbose ) ) - logger.logToJournal( "Failed to process build section in the " + - "package description of #{package}." ) - return false - else - if ( !logger.logPackageBuild( sw.name.downcase ) ) - logger.logToJournal( "Failed to create a package build log." ) - return false - end - logger.logToJournal( "DEBUG: finished #{package} build section." ) - end - - # preinstall section. - puts "\n*** Processing the PREINSTALL section for #{package}. ***" if ( verbose ) - - if ( !sw.preinstall ) - logger.logToJournal( "Failed to process preinstall section in the " + - "package description of #{package}." ) - return false - else - logger.logToJournal( "DEBUG: finished #{package} preinstall section." ) - end - - # install section. - puts "\n*** Processing the INSTALL section for #{package}. ***" if ( verbose ) - - if ( !sw.install ) - # rollback installed files if any and remove install log. - logger.logToJournal( "Failed to process install section in the " + - "package description of #{package}." ) - logger.logPackageInstall( sw.name.downcase ) - logger.logToJournal( - "***Starting rollback of #{package} install and removing install log." ) - self.rollBack( "install", details ) - return false - else - logger.logPackageInstall( sw.name.downcase ) - logger.logPackageIntegrity( sw.name.downcase ) - - # cleanup tmp files from installwatch. - File.delete( "#{$ABT_TMP}/#{details['Source location']}.watch" ) - - logger.logToJournal( "DEBUG: finished #{package} install section." ) - end - - # post section. - puts "\n*** Processing the POST section for #{package}. ***" if ( verbose ) - - if ( !sw.post ) - logger.logToJournal( "Failed to process post section in the " + - "package description of #{package}." ) - return false - else - logger.logToJournal( "DEBUG: finished #{package} post section." ) - end - - # clean out build sources. - puts "\n*** Cleaning up the sources for #{package}. ***" if ( verbose ) - - if ( !sw.removeBuild ) - logger.logToJournal( "Failed to remove the build sources for " + - "#{package}." ) - #return false # commented out as this is not a reason to fail. - end - - # remove pacakge from install queue. - if ( !queuer.actionPackageQueue( sw.name.downcase, "install", "remove" ) ) - logger.logToJournal( "Failed to remove #{sw.name.donwcase} " + - "from install queue." ) - end - - return true # install completed! - end - - ## - # Reinstalls a given package. - # - # <b>PARAM</b> <i>String</i> - the name of the package to be reinstalled. - # - # <b>RETURN</b> <i>boolean</i> - True if the package is reinstalled, - # otherwise false. - ## - def reinstallPackage( package ) - end - - ## - # Removes a given package. - # - # <b>PARAM</b> <i>String</i> - the name of the package to be removed. - # - # <b>RETURN</b> <i>boolean</i> - True if the package is removed, otherwise - # false. - ## - def removePackage( package ) - end - - ## - # Downgrades a given package. - # - # <b>PARAM</b> <i>String</i> - the name of the package to be downgraded. - # - # <b>PARAM</b> <i>String</i> - the version number to be downgraded to. - # - # <b>RETURN</b> <i>boolean</i> - True if the package is downgraded, otherwise - # false. - ## - def downgradePackage( package, version ) - end - - ## - # Freezes a given package. If successful will add give package to the frozen - # list. - # - # <b>PARAM</b> <i>String</i> - the name of the package to be frozen. - # - # <b>RETURN</b> <i>boolean</i> - True if the package is frozen, otherwise - # false. - ## - def freezePackage( package ) - end - - ## - # Provides for a log through for root access using su. - # - # <b>PARAM</b> <i>Array</i> - the arguments passed to abt. - # - # <b>RETURN</b> <i>void</i> - ## - def rootLogin( arguments ) - if ( Process.uid != 0 ) - args = "" - puts "\nEnter root password:" - - for i in 0...ARGV.length - args = args + " " + ARGV[i] - end - - system( 'su -c "./abt ' + args + '" root' ) - exit - end - end -end Deleted: src/trunk/TestAbtPackageManager.rb =================================================================== --- src/trunk/TestAbtPackageManager.rb 2007-07-16 12:17:21 UTC (rev 352) +++ src/trunk/TestAbtPackageManager.rb 2007-07-16 12:26:55 UTC (rev 353) @@ -1,83 +0,0 @@ -#!/usr/bin/ruby -w - -require 'test/unit/testcase' -require 'test/unit/autorunner' -require 'abtconfig' - -## -# TestAbtPackageManager.rb -# -# Unit testing for AbtPackageManager class. -# -# Created by Eric D. Schabell <er...@ab...> -# Copyright 2006, GPL. -# -# This file is part of AbTLinux. -# -# AbTLinux is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# AbTLinux is distributed in the hope that it will be useful, but WITHOUT ANY -# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -# details. -# -# You should have received a copy of the GNU General Public License along with -# AbTLinux; if not, write to the Free Software Foundation, Inc., 51 Franklin -# St, Fifth Floor, Boston, MA 02110-1301 USA -## -class TestAbtPackageManager < Test::Unit::TestCase - - $verbose = false; # quiets testing output. - - ## - # setup method for testing AbtPackageManager. - ## - def setup - @pkgMgr = AbtPackageManager.new() - end - - ## - # teardown method to cleanup after testing. - ## - def teardown - end - - ## - # Test method for 'AbtPackageManager.testInstallPackage()' - ## - def testInstallPackage - assert( @pkgMgr.installPackage( "ipc", $verbose ), "testInstallPackage()" ) - end - - ## - # Test method for 'AbtPackageManager.testReinstallPackage()' - ## - def testReinstallPackage - assert( @pkgMgr.reinstallPackage( "ipc" ), "testReinstallPackage()" ) - end - - ## - # Test method for 'AbtPackageManager.testRemovePackage()' - ## - def testRemovePackage - assert( @pkgMgr.removePackage( "ipc" ), "testRemovePackage()" ) - end - - ## - # Test method for 'AbtPackageManager.testDowngradePackage()' - ## - def testDowngradePackage - assert( @pkgMgr.downgradePackage( "ipc", "1.2" ), "testDowngradePackage()" ) - end - - ## - # Test method for 'AbtPackageManager.testFreezePackage()' - ## - def testFreezePackage - assert( @pkgMgr.freezePackage( "ipc" ), "testFreezePackage()" ) - end - -end Modified: src/trunk/abtconfig.rb =================================================================== --- src/trunk/abtconfig.rb 2007-07-16 12:17:21 UTC (rev 352) +++ src/trunk/abtconfig.rb 2007-07-16 12:26:55 UTC (rev 353) @@ -28,7 +28,7 @@ # global requires. require 'abtdownloadmanager' require 'abtlogmanager' -require 'AbtPackageManager' +require 'abtpackagemanager' require 'AbtQueueManager' require 'AbtReportManager' require 'AbtSystemManager' Copied: src/trunk/abtpackagemanager.rb (from rev 350, src/trunk/AbtPackageManager.rb) =================================================================== --- src/trunk/abtpackagemanager.rb (rev 0) +++ src/trunk/abtpackagemanager.rb 2007-07-16 12:26:55 UTC (rev 353) @@ -0,0 +1,290 @@ +#!/usr/bin/ruby -w + +## +# AbtPackageManager.rb +# +# AbtPackageManager class will take care of the installation, removal, updating, +# downgrading and freezing of AbTLinux software packages. +# +# Created by Eric D. Schabell <er...@ab...> +# Copyright 2006, GPL. +# +# This file is part of AbTLinux. +# +# AbTLinux is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# AbTLinux is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# AbTLinux; if not, write to the Free Software Foundation, Inc., 51 Franklin +# St, Fifth Floor, Boston, MA 02110-1301 USA +## +class AbtPackageManager + + protected + + private + + ## + # Attempts to roll back a type of action. Current supported types are + # install. Removes installed files and logs as needed. + # + # <b>PARAM</b> <i>String</i> - the type of rollback option to attempt. + # <b>PARAM</b> <i>Array</i> - The details of the package for which the + # rollback action is being called. + # + # <b>RETURN</b> <i>boolean</i> - True if the action rolls back, otherwise + # false. + ## + def rollBack( type, details ) + logFile = "#{$PACKAGE_INSTALLED}/#{details['Source location']}/" + + case type + when "install" + logFile = logFile + "#{details['Source location']}.install" + + file = File.new( logFile, "r" ) + while ( line = file.gets ) + #puts "DEBUG: about to remove ***#{line.chomp}***" + if ( File.file?( line.chomp ) ) + File.delete( line.chomp ) + else + puts "DEBUG: file not exist? ***#{File.basename( line.chomp )}***" + end + end + file.close + + # cleanup install log as it is incomplete. + File.delete( logFile ) + else + puts "DEBUG: attempt to use APM:rollBack( type ) incorrectly, " + + "unsupported type?" + return false + end + + return true + end + + + public + + ## + # Constructor for AbtPackageManager. + # + # <b>RETURN</b> <i>AbtPackageManager</i> - an initialized + # AbtPackageManager object. + ## + def initialize + end + + ## + # Installs a given package. + # + # <b>PARAM</b> <i>String</i> - the name of the package to be installed. + # <b>PARAM</b> <i>boolean</i> - true for verbose output from the process, + # otherwise false. Default is true. + # + # <b>RETURN</b> <i>boolean</i> - True if the package is installed, otherwise + # false. + ## + def installPackage( package, verbose=true ) + + # first check if installed. + system = AbtSystemManager.new + if ( system.packageInstalled( package ) ) + puts "\n*** Package #{package} is installed, might want to try reinstall? ***" + puts "'abt reinstall #{package}'" + return true + end + + require "#{$PACKAGE_PATH}#{package}" + sw = eval( "#{package.capitalize}.new" ) + queuer = AbtQueueManager.new + logger = AbtLogManager.new + + # get package details. + details = sw.details + + # TODO: check deps + + # add to install queue. + puts "\n*** Adding #{package} to the INSTALL QUEUE. ***" if ( verbose ) + + if ( !queuer.actionPackageQueue( package, "install", "add" ) ) + logger.logToJournal( "Failed to add #{package} to install queue." ) + return false + end + + # pre section. + puts "\n*** Processing the PRE section for #{package}. ***" if (verbose ) + + if ( !sw.pre ) + logger.logToJournal( "Failed to process pre-section in the " + + "package description of #{package}." ) + return false + else + logger.logToJournal( "DEBUG: finished #{package} pre section." ) + end + + # configure section. + puts "\n*** Processing the CONFIGURE section for #{package}. ***" if ( verbose ) + + if ( !sw.configure( verbose ) ) + logger.logToJournal( "Failed to process configure section in the " + + "package description of #{package}." ) + return false + else + logger.logToJournal( "DEBUG: finished #{package} configure section." ) + end + + # build section. + puts "\n*** Processing the BUILD section for #{package}. ***" if ( verbose ) + + if ( !sw.build( verbose ) ) + logger.logToJournal( "Failed to process build section in the " + + "package description of #{package}." ) + return false + else + if ( !logger.logPackageBuild( sw.name.downcase ) ) + logger.logToJournal( "Failed to create a package build log." ) + return false + end + logger.logToJournal( "DEBUG: finished #{package} build section." ) + end + + # preinstall section. + puts "\n*** Processing the PREINSTALL section for #{package}. ***" if ( verbose ) + + if ( !sw.preinstall ) + logger.logToJournal( "Failed to process preinstall section in the " + + "package description of #{package}." ) + return false + else + logger.logToJournal( "DEBUG: finished #{package} preinstall section." ) + end + + # install section. + puts "\n*** Processing the INSTALL section for #{package}. ***" if ( verbose ) + + if ( !sw.install ) + # rollback installed files if any and remove install log. + logger.logToJournal( "Failed to process install section in the " + + "package description of #{package}." ) + logger.logPackageInstall( sw.name.downcase ) + logger.logToJournal( + "***Starting rollback of #{package} install and removing install log." ) + self.rollBack( "install", details ) + return false + else + logger.logPackageInstall( sw.name.downcase ) + logger.logPackageIntegrity( sw.name.downcase ) + + # cleanup tmp files from installwatch. + File.delete( "#{$ABT_TMP}/#{details['Source location']}.watch" ) + + logger.logToJournal( "DEBUG: finished #{package} install section." ) + end + + # post section. + puts "\n*** Processing the POST section for #{package}. ***" if ( verbose ) + + if ( !sw.post ) + logger.logToJournal( "Failed to process post section in the " + + "package description of #{package}." ) + return false + else + logger.logToJournal( "DEBUG: finished #{package} post section." ) + end + + # clean out build sources. + puts "\n*** Cleaning up the sources for #{package}. ***" if ( verbose ) + + if ( !sw.removeBuild ) + logger.logToJournal( "Failed to remove the build sources for " + + "#{package}." ) + #return false # commented out as this is not a reason to fail. + end + + # remove pacakge from install queue. + if ( !queuer.actionPackageQueue( sw.name.downcase, "install", "remove" ) ) + logger.logToJournal( "Failed to remove #{sw.name.donwcase} " + + "from install queue." ) + end + + return true # install completed! + end + + ## + # Reinstalls a given package. + # + # <b>PARAM</b> <i>String</i> - the name of the package to be reinstalled. + # + # <b>RETURN</b> <i>boolean</i> - True if the package is reinstalled, + # otherwise false. + ## + def reinstallPackage( package ) + end + + ## + # Removes a given package. + # + # <b>PARAM</b> <i>String</i> - the name of the package to be removed. + # + # <b>RETURN</b> <i>boolean</i> - True if the package is removed, otherwise + # false. + ## + def removePackage( package ) + end + + ## + # Downgrades a given package. + # + # <b>PARAM</b> <i>String</i> - the name of the package to be downgraded. + # + # <b>PARAM</b> <i>String</i> - the version number to be downgraded to. + # + # <b>RETURN</b> <i>boolean</i> - True if the package is downgraded, otherwise + # false. + ## + def downgradePackage( package, version ) + end + + ## + # Freezes a given package. If successful will add give package to the frozen + # list. + # + # <b>PARAM</b> <i>String</i> - the name of the package to be frozen. + # + # <b>RETURN</b> <i>boolean</i> - True if the package is frozen, otherwise + # false. + ## + def freezePackage( package ) + end + + ## + # Provides for a log through for root access using su. + # + # <b>PARAM</b> <i>Array</i> - the arguments passed to abt. + # + # <b>RETURN</b> <i>void</i> + ## + def rootLogin( arguments ) + if ( Process.uid != 0 ) + args = "" + puts "\nEnter root password:" + + for i in 0...ARGV.length + args = args + " " + ARGV[i] + end + + system( 'su -c "./abt ' + args + '" root' ) + exit + end + end +end Modified: src/trunk/testSuiteAbt.rb =================================================================== --- src/trunk/testSuiteAbt.rb 2007-07-16 12:17:21 UTC (rev 352) +++ src/trunk/testSuiteAbt.rb 2007-07-16 12:26:55 UTC (rev 353) @@ -22,7 +22,7 @@ manager = AbtPackageManager.new manager.installPackage( "ipc" ) -require 'TestAbtPackageManager' +require 'testabtpackagemanager' require 'testabtlogmanager' require 'testabtdownloadmanager' require 'TestAbtPackage' Copied: src/trunk/testabtpackagemanager.rb (from rev 350, src/trunk/TestAbtPackageManager.rb) =================================================================== --- src/trunk/testabtpackagemanager.rb (rev 0) +++ src/trunk/testabtpackagemanager.rb 2007-07-16 12:26:55 UTC (rev 353) @@ -0,0 +1,83 @@ +#!/usr/bin/ruby -w + +require 'test/unit/testcase' +require 'test/unit/autorunner' +require 'abtconfig' + +## +# TestAbtPackageManager.rb +# +# Unit testing for AbtPackageManager class. +# +# Created by Eric D. Schabell <er...@ab...> +# Copyright 2006, GPL. +# +# This file is part of AbTLinux. +# +# AbTLinux is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# AbTLinux is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# AbTLinux; if not, write to the Free Software Foundation, Inc., 51 Franklin +# St, Fifth Floor, Boston, MA 02110-1301 USA +## +class TestAbtPackageManager < Test::Unit::TestCase + + $verbose = false; # quiets testing output. + + ## + # setup method for testing AbtPackageManager. + ## + def setup + @pkgMgr = AbtPackageManager.new() + end + + ## + # teardown method to cleanup after testing. + ## + def teardown + end + + ## + # Test method for 'AbtPackageManager.testInstallPackage()' + ## + def testInstallPackage + assert( @pkgMgr.installPackage( "ipc", $verbose ), "testInstallPackage()" ) + end + + ## + # Test method for 'AbtPackageManager.testReinstallPackage()' + ## + def testReinstallPackage + assert( @pkgMgr.reinstallPackage( "ipc" ), "testReinstallPackage()" ) + end + + ## + # Test method for 'AbtPackageManager.testRemovePackage()' + ## + def testRemovePackage + assert( @pkgMgr.removePackage( "ipc" ), "testRemovePackage()" ) + end + + ## + # Test method for 'AbtPackageManager.testDowngradePackage()' + ## + def testDowngradePackage + assert( @pkgMgr.downgradePackage( "ipc", "1.2" ), "testDowngradePackage()" ) + end + + ## + # Test method for 'AbtPackageManager.testFreezePackage()' + ## + def testFreezePackage + assert( @pkgMgr.freezePackage( "ipc" ), "testFreezePackage()" ) + end + +end This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <esc...@us...> - 2007-07-16 12:50:58
|
Revision: 355 http://svn.sourceforge.net/abtlinux/?rev=355&view=rev Author: eschabell Date: 2007-07-16 05:51:00 -0700 (Mon, 16 Jul 2007) Log Message: ----------- Some comments adjusted in the class descriptions, they needed the new file names. Modified Paths: -------------- src/trunk/abtconfig.rb src/trunk/abtdepengine.rb src/trunk/abtdownloadmanager.rb src/trunk/abtlogmanager.rb src/trunk/abtpackagemanager.rb src/trunk/packages/ipc.rb src/trunk/testSuiteAbt.rb src/trunk/testabtdepengine.rb src/trunk/testabtlogmanager.rb src/trunk/testabtpackagemanager.rb Added Paths: ----------- src/trunk/testabtpackage.rb Removed Paths: ------------- src/trunk/TestAbtPackage.rb Deleted: src/trunk/TestAbtPackage.rb =================================================================== --- src/trunk/TestAbtPackage.rb 2007-07-16 12:30:36 UTC (rev 354) +++ src/trunk/TestAbtPackage.rb 2007-07-16 12:51:00 UTC (rev 355) @@ -1,145 +0,0 @@ -#!/usr/bin/ruby -w - -require "test/unit/testcase" -require "test/unit/autorunner" -require "abtconfig" -require "#{$PACKAGE_PATH}ipc" - -## -# TestAbtPackage.rb -# -# Unit testing for AbtPackage class. -# -# Created by Eric D. Schabell <er...@ab...> -# Copyright 2006, GPL. -# -# This file is part of AbTLinux. -# -# AbTLinux is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# AbTLinux is distributed in the hope that it will be useful, but WITHOUT ANY -# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -# details. -# -# You should have received a copy of the GNU General Public License along with -# AbTLinux; if not, write to the Free Software Foundation, Inc., 51 Franklin -# St, Fifth Floor, Boston, MA 02110-1301 USA -## -class TestAbtPackage < Test::Unit::TestCase - - $nameTest = "Ipc" - $versionTest = "1.4" - $verbose = false - $srcDirTest = "#{$nameTest.downcase}-#{$versionTest}" - - $dataTest = { - 'name' => $nameTest, - 'execName' => $nameTest.downcase, - 'version' => $versionTest, - 'srcDir' => $srcDirTest, - 'homepage' => "http://isotopatcalc.sourceforge.net/" - } - - ## - # setup method for testing AbtPackage. - ## - def setup - @ipc = Ipc.new - end - - ## - # teardown method to cleanup after testing. - ## - def teardown - end - - ## - # Test method for 'AbtPackage.testDetails()' - ## - def testDetails - assert_equal( $dataTest['name'], @ipc.details['Package name'], - "testDetails()" ) - assert_equal( $dataTest['execName'], @ipc.details['Executable'], - "testDetails()" ) - assert_equal( $dataTest['version'], @ipc.details['Version'], - "testDetails()" ) - assert_equal( $dataTest['srcDir'], @ipc.details['Source location'], - "testDetails()" ) - assert_equal( $dataTest['homepage'], @ipc.details['Homepage'], - "testDetails()" ) - end - - ## - # Test method for 'AbtPackage.testPre()' - ## - def testPre - assert( @ipc.pre( $verbose ), "testPre()" ) - end - - ## - # Test method for 'AbtPackage.testConfigure()' - ## - def testConfigure - if ( !@ipc.pre( $verbose ) ) - assert_equals( true, false, "testConfigure()" ) - end - assert( @ipc.configure( $verbose ), "testConfigure()" ) - end - - ## - # Test method for 'AbtPackage.testBuild()' - ## - def testBuild - if ( !@ipc.pre( $verbose ) ) - assert_equals( true, false, "testBuild()" ) - end - if ( !@ipc.configure( $verbose ) ) - assert_equals( true, false, "testBuild()" ) - end - assert( @ipc.build( $verbose ), "testBuild()" ) - end - - ## - # Test method for 'AbtPackage.testPreinstall()' - ## - def testPreinstall - assert( @ipc.preinstall( $verbose ), "testPreinstall()" ) - end - - ## - # Test method for 'AbtPackage.testInstall()' - ## - def testInstall - - if ( !@ipc.pre( $verbose ) ) - assert_equals( true, false, "testInstall()" ) - end - if ( !@ipc.configure( $verbose ) ) - assert_equals( true, false, "testInstall()" ) - end - if ( !@ipc.build( $verbose ) ) - assert_equals( true, false, "testInstall()" ) - end - if ( !@ipc.preinstall( $verbose ) ) - assert_equals( true, false, "testInstall()" ) - end - assert( @ipc.install( $verbose ), "testInstall()" ) - end - - ## - # Test method for 'AbtPackage.testPost()' - ## - def testPost - assert_equals( true, false, "testPost()" ) if ( !@ipc.pre( $verbose ) ) - assert_equals( true, false, "testPost()" ) if ( !@ipc.configure( $verbose ) ) - assert_equals( true, false, "testPost()" ) if ( !@ipc.build( $verbose ) ) - assert_equals( true, false, "testPost()" ) if ( !@ipc.preinstall( $verbose ) ) - assert_equals( true, false, "testPost()" ) if ( !@ipc.install( $verbose ) ) - assert( @ipc.post( $verbose ), "testPost()" ) - end - -end Modified: src/trunk/abtconfig.rb =================================================================== --- src/trunk/abtconfig.rb 2007-07-16 12:30:36 UTC (rev 354) +++ src/trunk/abtconfig.rb 2007-07-16 12:51:00 UTC (rev 355) @@ -30,6 +30,7 @@ require 'abtlogmanager' require 'abtpackagemanager' require 'abtpackage' +require 'abtdepengine' require 'AbtQueueManager' require 'AbtReportManager' require 'AbtSystemManager' Modified: src/trunk/abtdepengine.rb =================================================================== --- src/trunk/abtdepengine.rb 2007-07-16 12:30:36 UTC (rev 354) +++ src/trunk/abtdepengine.rb 2007-07-16 12:51:00 UTC (rev 355) @@ -1,7 +1,7 @@ #!/usr/bin/ruby -w ## -# AbtDepEngine.rb +# abtdepengine.rb # # AbtDepEngine class handles all dependency aspects of the AbTLinux system. It is # part of a sub-project with it's own requirements document. @@ -41,4 +41,4 @@ def initialize end -end \ No newline at end of file +end Modified: src/trunk/abtdownloadmanager.rb =================================================================== --- src/trunk/abtdownloadmanager.rb 2007-07-16 12:30:36 UTC (rev 354) +++ src/trunk/abtdownloadmanager.rb 2007-07-16 12:51:00 UTC (rev 355) @@ -1,7 +1,7 @@ #!/usr/bin/ruby -w ## -# AbtDownloadManager.rb +# abtdownloadmanager.rb # # AbtDownloadManager class handles all downloading of components needed for # AbTLinux. Modified: src/trunk/abtlogmanager.rb =================================================================== --- src/trunk/abtlogmanager.rb 2007-07-16 12:30:36 UTC (rev 354) +++ src/trunk/abtlogmanager.rb 2007-07-16 12:51:00 UTC (rev 355) @@ -1,7 +1,7 @@ #!/usr/bin/ruby -w ## -# AbtLogManager.rb +# abtlogmanager.rb # # AbtLogManager class handles all aspects of logging and access to existing logs # within the AbTLinux system. Modified: src/trunk/abtpackagemanager.rb =================================================================== --- src/trunk/abtpackagemanager.rb 2007-07-16 12:30:36 UTC (rev 354) +++ src/trunk/abtpackagemanager.rb 2007-07-16 12:51:00 UTC (rev 355) @@ -1,7 +1,7 @@ #!/usr/bin/ruby -w ## -# AbtPackageManager.rb +# abtpackagemanager.rb # # AbtPackageManager class will take care of the installation, removal, updating, # downgrading and freezing of AbTLinux software packages. Modified: src/trunk/packages/ipc.rb =================================================================== --- src/trunk/packages/ipc.rb 2007-07-16 12:30:36 UTC (rev 354) +++ src/trunk/packages/ipc.rb 2007-07-16 12:51:00 UTC (rev 355) @@ -1,6 +1,6 @@ #!/usr/bin/ruby -w -require "AbtPackage" +require "abtpackage" ## # ipc.rb Modified: src/trunk/testSuiteAbt.rb =================================================================== --- src/trunk/testSuiteAbt.rb 2007-07-16 12:30:36 UTC (rev 354) +++ src/trunk/testSuiteAbt.rb 2007-07-16 12:51:00 UTC (rev 355) @@ -25,7 +25,7 @@ require 'testabtpackagemanager' require 'testabtlogmanager' require 'testabtdownloadmanager' -require 'TestAbtPackage' +require 'testabtpackage' require 'TestAbtQueueManager' require 'TestAbtReportManager' require 'TestAbtSystemManager' Modified: src/trunk/testabtdepengine.rb =================================================================== --- src/trunk/testabtdepengine.rb 2007-07-16 12:30:36 UTC (rev 354) +++ src/trunk/testabtdepengine.rb 2007-07-16 12:51:00 UTC (rev 355) @@ -2,10 +2,10 @@ require 'test/unit/testcase' require 'test/unit/autorunner' -require 'abtdepengine' +require 'abtconfig' ## -# TestAbtDepEngine.rb +# testabtdepengine.rb # # Unit testing for AbtDepEngine class. # Modified: src/trunk/testabtlogmanager.rb =================================================================== --- src/trunk/testabtlogmanager.rb 2007-07-16 12:30:36 UTC (rev 354) +++ src/trunk/testabtlogmanager.rb 2007-07-16 12:51:00 UTC (rev 355) @@ -5,7 +5,7 @@ require 'abtconfig' ## -# TestAbtLogManager.rb +# testabtlogmanager.rb # # Unit testing for AbtLogManager class. # Copied: src/trunk/testabtpackage.rb (from rev 354, src/trunk/TestAbtPackage.rb) =================================================================== --- src/trunk/testabtpackage.rb (rev 0) +++ src/trunk/testabtpackage.rb 2007-07-16 12:51:00 UTC (rev 355) @@ -0,0 +1,145 @@ +#!/usr/bin/ruby -w + +require "test/unit/testcase" +require "test/unit/autorunner" +require "abtconfig" +require "#{$PACKAGE_PATH}ipc" + +## +# testabtpackage.rb +# +# Unit testing for AbtPackage class. +# +# Created by Eric D. Schabell <er...@ab...> +# Copyright 2006, GPL. +# +# This file is part of AbTLinux. +# +# AbTLinux is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# AbTLinux is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# AbTLinux; if not, write to the Free Software Foundation, Inc., 51 Franklin +# St, Fifth Floor, Boston, MA 02110-1301 USA +## +class TestAbtPackage < Test::Unit::TestCase + + $nameTest = "Ipc" + $versionTest = "1.4" + $verbose = false + $srcDirTest = "#{$nameTest.downcase}-#{$versionTest}" + + $dataTest = { + 'name' => $nameTest, + 'execName' => $nameTest.downcase, + 'version' => $versionTest, + 'srcDir' => $srcDirTest, + 'homepage' => "http://isotopatcalc.sourceforge.net/" + } + + ## + # setup method for testing AbtPackage. + ## + def setup + @ipc = Ipc.new + end + + ## + # teardown method to cleanup after testing. + ## + def teardown + end + + ## + # Test method for 'AbtPackage.testDetails()' + ## + def testDetails + assert_equal( $dataTest['name'], @ipc.details['Package name'], + "testDetails()" ) + assert_equal( $dataTest['execName'], @ipc.details['Executable'], + "testDetails()" ) + assert_equal( $dataTest['version'], @ipc.details['Version'], + "testDetails()" ) + assert_equal( $dataTest['srcDir'], @ipc.details['Source location'], + "testDetails()" ) + assert_equal( $dataTest['homepage'], @ipc.details['Homepage'], + "testDetails()" ) + end + + ## + # Test method for 'AbtPackage.testPre()' + ## + def testPre + assert( @ipc.pre( $verbose ), "testPre()" ) + end + + ## + # Test method for 'AbtPackage.testConfigure()' + ## + def testConfigure + if ( !@ipc.pre( $verbose ) ) + assert_equals( true, false, "testConfigure()" ) + end + assert( @ipc.configure( $verbose ), "testConfigure()" ) + end + + ## + # Test method for 'AbtPackage.testBuild()' + ## + def testBuild + if ( !@ipc.pre( $verbose ) ) + assert_equals( true, false, "testBuild()" ) + end + if ( !@ipc.configure( $verbose ) ) + assert_equals( true, false, "testBuild()" ) + end + assert( @ipc.build( $verbose ), "testBuild()" ) + end + + ## + # Test method for 'AbtPackage.testPreinstall()' + ## + def testPreinstall + assert( @ipc.preinstall( $verbose ), "testPreinstall()" ) + end + + ## + # Test method for 'AbtPackage.testInstall()' + ## + def testInstall + + if ( !@ipc.pre( $verbose ) ) + assert_equals( true, false, "testInstall()" ) + end + if ( !@ipc.configure( $verbose ) ) + assert_equals( true, false, "testInstall()" ) + end + if ( !@ipc.build( $verbose ) ) + assert_equals( true, false, "testInstall()" ) + end + if ( !@ipc.preinstall( $verbose ) ) + assert_equals( true, false, "testInstall()" ) + end + assert( @ipc.install( $verbose ), "testInstall()" ) + end + + ## + # Test method for 'AbtPackage.testPost()' + ## + def testPost + assert_equals( true, false, "testPost()" ) if ( !@ipc.pre( $verbose ) ) + assert_equals( true, false, "testPost()" ) if ( !@ipc.configure( $verbose ) ) + assert_equals( true, false, "testPost()" ) if ( !@ipc.build( $verbose ) ) + assert_equals( true, false, "testPost()" ) if ( !@ipc.preinstall( $verbose ) ) + assert_equals( true, false, "testPost()" ) if ( !@ipc.install( $verbose ) ) + assert( @ipc.post( $verbose ), "testPost()" ) + end + +end Modified: src/trunk/testabtpackagemanager.rb =================================================================== --- src/trunk/testabtpackagemanager.rb 2007-07-16 12:30:36 UTC (rev 354) +++ src/trunk/testabtpackagemanager.rb 2007-07-16 12:51:00 UTC (rev 355) @@ -5,7 +5,7 @@ require 'abtconfig' ## -# TestAbtPackageManager.rb +# testabtpackagemanager.rb # # Unit testing for AbtPackageManager class. # This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <esc...@us...> - 2007-07-16 13:01:55
|
Revision: 356 http://svn.sourceforge.net/abtlinux/?rev=356&view=rev Author: eschabell Date: 2007-07-16 06:01:57 -0700 (Mon, 16 Jul 2007) Log Message: ----------- Migrated queue manager class and test class, including references to rubified file names. Modified Paths: -------------- src/trunk/abtconfig.rb src/trunk/testSuiteAbt.rb Added Paths: ----------- src/trunk/abtqueuemanager.rb src/trunk/testabtqueuemanager.rb Removed Paths: ------------- src/trunk/AbtQueueManager.rb src/trunk/TestAbtQueueManager.rb Deleted: src/trunk/AbtQueueManager.rb =================================================================== --- src/trunk/AbtQueueManager.rb 2007-07-16 12:51:00 UTC (rev 355) +++ src/trunk/AbtQueueManager.rb 2007-07-16 13:01:57 UTC (rev 356) @@ -1,116 +0,0 @@ -#!/usr/bin/ruby -w - -## -# AbtQueueManager.rb -# -# AbtQueueManager class handles all AbTLinux queue interaction. -# -# Created by Eric D. Schabell <er...@ab...> -# Copyright 2006, GPL. -# -# This file is part of AbTLinux. -# -# AbTLinux is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# AbTLinux is distributed in the hope that it will be useful, but WITHOUT ANY -# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -# details. -# -# You should have received a copy of the GNU General Public License along with -# AbTLinux; if not, write to the Free Software Foundation, Inc., 51 Franklin -# St, Fifth Floor, Boston, MA 02110-1301 USA -## -class AbtQueueManager - - protected - - private - - public - - ## - # Constructor for the AbtQueueManager class. - # - # <b>RETURN</b> <i>AbtQueueManager</i> - an initialized - # AbtQueueManager object. - ## - def initialize - end - - ## - # Add/Remove a given package to the given queue. - # If adding a package already in the queue then it will not - # be added twice and return succes. - # - # <b>PARAM</b> <i>String</i> - the package to be added/removed. - # <b>PARAM</b> <i>String</i> - the queue. - # - # <b>RETURN</b> <i>boolean</i> - true if action succeeds, otherwise false. - ## - def actionPackageQueue( package, queue, action="add" ) - require 'fileutils' - logger = AbtLogManager.new - queueFile = "" # used to hold the queue location. - - # want to name install queue differently from log files. - if ( queue == 'install' ) - queueFile = "#{$ABT_LOGS}/#{queue}.queue" - else - queueFile = "#{$ABT_LOGS}/#{queue}.log" - end - - if ( action == "add") - if ( - log = File.new( - queueFile, File::WRONLY|File::APPEND|File::CREAT, 0644 ) ) - # pickup queue contents to ensure no duplicates. - checkingQueue = IO.readlines( queueFile ) - - # check if package exists, otherwise add. - if ( - !checkingQueue.collect{ |i| i.split( '|' )[0] }.include?( - package ) ) - log.puts "#{package}|#{$TIMESTAMP}" - logger.logToJournal( "Added #{package} to #{queue} queue." ) - else - logger.logToJournal( - "Did not add #{package} to #{queue}, already exists." ) - end - - log.close - return true - end - end - - if ( action == "remove" ) - # remove entry from given queue. - if ( - log = File.new( - queueFile, File::WRONLY|File::APPEND|File::CREAT, 0644 ) ) - # use temp file to filter out entry to be removed. - temp = File.new(queueFile + ".tmp", "a+") - - # now check for line to be removed. - IO.foreach( queueFile ) do |line| - entryName = line.split( '|' )[0] - if ( entryName != package.downcase ) - temp.puts line - end - end - - temp.close - FileUtils.mv( temp.path, queueFile ) - end - - log.close - return true - end - - logger.logToJournal( "Failed to open #{queueFile}." ) - return false - end -end Deleted: src/trunk/TestAbtQueueManager.rb =================================================================== --- src/trunk/TestAbtQueueManager.rb 2007-07-16 12:51:00 UTC (rev 355) +++ src/trunk/TestAbtQueueManager.rb 2007-07-16 13:01:57 UTC (rev 356) @@ -1,54 +0,0 @@ -#!/usr/bin/ruby -w - -require 'test/unit/testcase' -require 'test/unit/autorunner' -require 'abtconfig' - -## -# TestAbtQueueManager.rb -# -# Unit testing for AbtQueueManager class. -# -# Created by Eric D. Schabell <er...@ab...> -# Copyright 2006, GPL. -# -# This file is part of AbTLinux. -# -# AbTLinux is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# AbTLinux is distributed in the hope that it will be useful, but WITHOUT ANY -# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -# details. -# -# You should have received a copy of the GNU General Public License along with -# AbTLinux; if not, write to the Free Software Foundation, Inc., 51 Franklin -# St, Fifth Floor, Boston, MA 02110-1301 USA -## -class TestAbtQueueManager < Test::Unit::TestCase - - ## - # setup method for testing AbtQueueManager. - ## - def setup - @queue = AbtQueueManager.new() - end - - ## - # teardown method to cleanup after testing. - ## - def teardown - end - - ## - # Test method for 'AbtQueueManager.actionPackageQueue()' - ## - def testActionPackageQueue - assert( @queue.actionPackageQueue( "ipc", "install", "add" ), - "testQueueManager()" ) - end - -end Modified: src/trunk/abtconfig.rb =================================================================== --- src/trunk/abtconfig.rb 2007-07-16 12:51:00 UTC (rev 355) +++ src/trunk/abtconfig.rb 2007-07-16 13:01:57 UTC (rev 356) @@ -31,7 +31,7 @@ require 'abtpackagemanager' require 'abtpackage' require 'abtdepengine' -require 'AbtQueueManager' +require 'abtqueuemanager' require 'AbtReportManager' require 'AbtSystemManager' require 'AbtUsage' Copied: src/trunk/abtqueuemanager.rb (from rev 353, src/trunk/AbtQueueManager.rb) =================================================================== --- src/trunk/abtqueuemanager.rb (rev 0) +++ src/trunk/abtqueuemanager.rb 2007-07-16 13:01:57 UTC (rev 356) @@ -0,0 +1,116 @@ +#!/usr/bin/ruby -w + +## +# AbtQueueManager.rb +# +# AbtQueueManager class handles all AbTLinux queue interaction. +# +# Created by Eric D. Schabell <er...@ab...> +# Copyright 2006, GPL. +# +# This file is part of AbTLinux. +# +# AbTLinux is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# AbTLinux is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# AbTLinux; if not, write to the Free Software Foundation, Inc., 51 Franklin +# St, Fifth Floor, Boston, MA 02110-1301 USA +## +class AbtQueueManager + + protected + + private + + public + + ## + # Constructor for the AbtQueueManager class. + # + # <b>RETURN</b> <i>AbtQueueManager</i> - an initialized + # AbtQueueManager object. + ## + def initialize + end + + ## + # Add/Remove a given package to the given queue. + # If adding a package already in the queue then it will not + # be added twice and return succes. + # + # <b>PARAM</b> <i>String</i> - the package to be added/removed. + # <b>PARAM</b> <i>String</i> - the queue. + # + # <b>RETURN</b> <i>boolean</i> - true if action succeeds, otherwise false. + ## + def actionPackageQueue( package, queue, action="add" ) + require 'fileutils' + logger = AbtLogManager.new + queueFile = "" # used to hold the queue location. + + # want to name install queue differently from log files. + if ( queue == 'install' ) + queueFile = "#{$ABT_LOGS}/#{queue}.queue" + else + queueFile = "#{$ABT_LOGS}/#{queue}.log" + end + + if ( action == "add") + if ( + log = File.new( + queueFile, File::WRONLY|File::APPEND|File::CREAT, 0644 ) ) + # pickup queue contents to ensure no duplicates. + checkingQueue = IO.readlines( queueFile ) + + # check if package exists, otherwise add. + if ( + !checkingQueue.collect{ |i| i.split( '|' )[0] }.include?( + package ) ) + log.puts "#{package}|#{$TIMESTAMP}" + logger.logToJournal( "Added #{package} to #{queue} queue." ) + else + logger.logToJournal( + "Did not add #{package} to #{queue}, already exists." ) + end + + log.close + return true + end + end + + if ( action == "remove" ) + # remove entry from given queue. + if ( + log = File.new( + queueFile, File::WRONLY|File::APPEND|File::CREAT, 0644 ) ) + # use temp file to filter out entry to be removed. + temp = File.new(queueFile + ".tmp", "a+") + + # now check for line to be removed. + IO.foreach( queueFile ) do |line| + entryName = line.split( '|' )[0] + if ( entryName != package.downcase ) + temp.puts line + end + end + + temp.close + FileUtils.mv( temp.path, queueFile ) + end + + log.close + return true + end + + logger.logToJournal( "Failed to open #{queueFile}." ) + return false + end +end Modified: src/trunk/testSuiteAbt.rb =================================================================== --- src/trunk/testSuiteAbt.rb 2007-07-16 12:51:00 UTC (rev 355) +++ src/trunk/testSuiteAbt.rb 2007-07-16 13:01:57 UTC (rev 356) @@ -26,7 +26,7 @@ require 'testabtlogmanager' require 'testabtdownloadmanager' require 'testabtpackage' -require 'TestAbtQueueManager' +require 'testabtqueuemanager' require 'TestAbtReportManager' require 'TestAbtSystemManager' require 'testabtdepengine' Copied: src/trunk/testabtqueuemanager.rb (from rev 353, src/trunk/TestAbtQueueManager.rb) =================================================================== --- src/trunk/testabtqueuemanager.rb (rev 0) +++ src/trunk/testabtqueuemanager.rb 2007-07-16 13:01:57 UTC (rev 356) @@ -0,0 +1,54 @@ +#!/usr/bin/ruby -w + +require 'test/unit/testcase' +require 'test/unit/autorunner' +require 'abtconfig' + +## +# TestAbtQueueManager.rb +# +# Unit testing for AbtQueueManager class. +# +# Created by Eric D. Schabell <er...@ab...> +# Copyright 2006, GPL. +# +# This file is part of AbTLinux. +# +# AbTLinux is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# AbTLinux is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# AbTLinux; if not, write to the Free Software Foundation, Inc., 51 Franklin +# St, Fifth Floor, Boston, MA 02110-1301 USA +## +class TestAbtQueueManager < Test::Unit::TestCase + + ## + # setup method for testing AbtQueueManager. + ## + def setup + @queue = AbtQueueManager.new() + end + + ## + # teardown method to cleanup after testing. + ## + def teardown + end + + ## + # Test method for 'AbtQueueManager.actionPackageQueue()' + ## + def testActionPackageQueue + assert( @queue.actionPackageQueue( "ipc", "install", "add" ), + "testQueueManager()" ) + end + +end This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <esc...@us...> - 2007-07-16 13:20:13
|
Revision: 358 http://svn.sourceforge.net/abtlinux/?rev=358&view=rev Author: eschabell Date: 2007-07-16 06:20:14 -0700 (Mon, 16 Jul 2007) Log Message: ----------- Migrated report manager class and test class to rubified file names. Modified Paths: -------------- src/trunk/abtconfig.rb src/trunk/testSuiteAbt.rb Added Paths: ----------- src/trunk/abtreportmanager.rb src/trunk/testabtreportmanager.rb Removed Paths: ------------- src/trunk/AbtReportManager.rb src/trunk/TestAbtReportManager.rb Deleted: src/trunk/AbtReportManager.rb =================================================================== --- src/trunk/AbtReportManager.rb 2007-07-16 13:03:02 UTC (rev 357) +++ src/trunk/AbtReportManager.rb 2007-07-16 13:20:14 UTC (rev 358) @@ -1,247 +0,0 @@ -#!/usr/bin/ruby -w - -## -# AbtReportManager.rb -# -# AbtReportManager class handles all sort of report and query generation within -# the AbTLinux system. -# -# Created by Eric D. Schabell <er...@ab...> -# Copyright 2006, GPL. -# -# This file is part of AbTLinux. -# -# AbTLinux is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# AbTLinux is distributed in the hope that it will be useful, but WITHOUT ANY -# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -# details. -# -# You should have received a copy of the GNU General Public License along with -# AbTLinux; if not, write to the Free Software Foundation, Inc., 51 Franklin -# St, Fifth Floor, Boston, MA 02110-1301 USA -## -class AbtReportManager - - protected - - private - - public - - ## - # Constructor for the AbtReportManager. - # - # <b>RETURN</b> <i>AbtReportManager</i> - an initialized - # Report1Manager object. - ## - def initialize - end - - ## - # Display all data for a given package. - # - # <b>PARAM</b> <i>String</i> - Package name. - # - # <b>RETURN</b> <i>boolean</i> - True if completes without error, - # otherwise false. - ## - def showPackageDetails( package ) - require "#{$PACKAGE_PATH}#{package}" - - if ( package = eval( "#{package.capitalize}.new" ) ) - details = package.details - - puts "|=====================================" - puts "| Package name\t: #{details['Package name']}" - details.delete( "Package name" ) - puts "| Version\t: #{details['Version']}" - details.delete( "Version" ) - puts "| Homepage\t: #{details['Homepage']}" - details.delete( "Homepage" ) - puts "| Executable\t: #{details['Executable']}" - details.delete( "Executable" ) - puts "| Source uri\t: #{details['Source uri']}" - details.delete( "Source uri" ) - puts "| Description\t: #{details['Description']}" - details.delete( "Description" ) - puts "|=====================================" - puts "|=====================================" - - details.each do |name, value| - print "| #{name}\t" - - if ( name.length < 14 ) - print "\t" - end - - puts ": #{value}" - end - - puts "|=====================================" - return true - end - - logger.logToJournal( "[AbtReportManger::showPackageDetails] - failed" + - "to show details for ${package}." ) - return false - end - - ## - # Display all packages installed and tracked by AbTLinux. - # - # <b>RETURN</b> <i>void.</i> - ## - def showInstalledPackages - end - - ## - # Display the contents of the requested log for a given package. Possible - # log types are; install, build and integrity. - # - # <b>PARAM</b> <i>String</i> - Package name. - # - # <b>PARAM</b> <i>String</i> - log type. - # - # <b>RETURN</b> <i>void.</i> - ## - def showPackageLog( package, logType ) - # install log - # build log - # integrity log - end - - ## - # Display a list of the packages found in the frozen list. - # - # <b>RETURN</b> <i>void.</i> - ## - def showFrozenPackages - end - - ## - # Provides access to dependency checking via the AbTLinux DepEngine. (This - # portal to the DepEngine will be expanded in apart sub-project, more - # details at a later date.) - # - # <b>PARAM</b> <i>String</i> - Package name. - # - # <b>RETURN</b> <i>hash</i> - Empty hash if no problems found, otherwise - # hash of problem files and their encountered errors. - ## - def showPackageDependencies( package ) - end - - ## - # Display all files not part of any installed AbTLinux package. This - # delivers a list of files that are not tracked by AbTLinux package - # management. - # - # <b>RETURN</b> <i>void.</i> - ## - def showUntrackedFiles - end - - ## - # Display the AbTLinux journal file. - # - # <b> PARAM</b> <i>string</i> The complete path of the file to display. - # - # <b>RETURN</b> <i>iboolean</i> True if journal shown, otherwise false. - ## - def showJournal( fileName ) - if ( File.exist?( fileName ) ) - puts "\n\n" - puts "AbTLinux log:" - puts "=============" - log = IO.readlines( fileName ) - log.each{ |entry| puts entry } - puts "\n\n" - else - puts "\n\n" - puts "AbtLinux log ( #{File.basename( fileName )} ) " + - "is empty at this time." - puts "\n\n" - end - - return true - end - - ## - # Display the name of the package(s) that own the given file. - # - # <b>PARAM</b> <i>String</i> - a file name. - # - # <b>RETURN</b> <i>void.</i> - ## - def showFileOwner( file ) - end - - ## - # Searches the installed package trees package descriptions for matching - # occurrances of the given search text. - # - # <b>PARAM</b> <i>String</i> - a search text. - # - # <b>RETURN</b> <i>hash</i> - a hash of the search results, keys are package - # names and values are matching descriptions. - ## - def searchPackageDescriptions( searchText ) - end - - ## - # Displays the contents of the current queue based on the given queue. - # - # <b>PARAM</b> <i>String</i> - the type of queue to display such as install - # queue. - # - # <b>RETURN</b> <i>void.</i> - ## - def showQueue( queueType ) - - case queueType - - when "install" - if ( File.exist?( "#{$ABT_LOGS}/#{queueType}.queue" ) ) - puts "\n\n" - puts "AbTLinux #{queueType} queue:" - puts "=======================" - queue = IO.readlines( "#{$ABT_LOGS}/#{queueType}.queue" ) - queue.each{ |entry| puts entry } - puts "\n\n" - else - puts "\n\n" - puts "AbtLinux #{queueType} is empty at this time." - puts "\n\n" - end - else - puts "#{queueType.capitalize} is not an AbTLinux queue." - end - end - - ## - # Reports available updates for a given package or package tree based on the - # current system. - # - # <b>PARAM</b> <i>String</i> - the target of the update check, either a - # package name or a package tree name. - # - # <b>RETURN</b> <i>boolean</i> - True if completes without error, otherwise - # false. - ## - def showUpdates( target ) - end - - ## - # Generates an HTML page of installed packages from installed packages list. - # - # <b>RETURN</b> <i>void.</i> - ## - def generateHTMLPackageListing - end - -end Deleted: src/trunk/TestAbtReportManager.rb =================================================================== --- src/trunk/TestAbtReportManager.rb 2007-07-16 13:03:02 UTC (rev 357) +++ src/trunk/TestAbtReportManager.rb 2007-07-16 13:20:14 UTC (rev 358) @@ -1,141 +0,0 @@ -#!/usr/bin/ruby -w - -require 'test/unit/testcase' -require 'test/unit/autorunner' -require 'abtconfig' -require 'AbtReportManager' - -## -# TestAbtReportManager.rb -# -# Unit testing for AbtReportManager class. -# -# Created by Eric D. Schabell <er...@ab...> -# Copyright 2006, GPL. -# -# This file is part of AbTLinux. -# -# AbTLinux is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# AbTLinux is distributed in the hope that it will be useful, but WITHOUT ANY -# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -# details. -# -# You should have received a copy of the GNU General Public License along with -# AbTLinux; if not, write to the Free Software Foundation, Inc., 51 Franklin -# St, Fifth Floor, Boston, MA 02110-1301 USA -## -class TestAbtReportManager < Test::Unit::TestCase - - ## - # setup method for testing AbtReportManager. - ## - def setup - @report = AbtReportManager.new() - end - - ## - # teardown method to cleanup after testing. - ## - def teardown - end - - ## - # Test method for 'AbtReportManager.testShowPackageDetails()' - ## - def testShowPackageDetails - assert( @report.showPackageDetails( "ipc" ), "testShowPackageDetails()" ) - end - - ## - # Test method for 'AbtReportManager.testShowInstalledPackages()' - ## - def testShowInstalledPackages - assert( @report.showInstalledPackages(), "testShowInstalledPackages()" ) - end - - ## - # Test method for 'AbtReportManager.testShowPackageLog()' - ## - def testShowPackageLog - assert( @report.showPackageLog( "ipc", "install" ), - "testShowPackageLog()" ) - assert( @report.showPackageLog( "ipc", "build" ), "testShowPackageLog()" ) - assert( @report.showPackageLog( "ipc", "integrity" ), - "testShowPackageLog()" ) - end - - ## - # Test method for 'AbtReportManager.testShowFrozenPackages()' - ## - def testShowFrozenPackages - assert( @report.showFrozenPackages(), "testShowFrozenPackages()" ) - end - - ## - # Test method for 'AbtReportManager.testShowPackageDependencies()' - ## - def testShowPackageDependencies - assert( false, "testShowPackageDependencies()" ) - end - - ## - # Test method for 'AbtReportManager.testShowUntrackedFiles()' - ## - def testShowUntrackedFiles - assert( @report.showUntrackedFiles(), "testShowUntrackedFiles()" ) - end - - ## - # Test method for 'AbtReportManager.testShowJournal()' - ## - def testShowJournal - assert( @report.showJournal( $JOURNAL ), "testShowJournal()" ) - end - - ## - # Test method for 'AbtReportManager.testShowFileOwner()' - ## - def testShowFileOwner - assert( @report.showFileOwner( "ipcFile" ), "testShowFileOwner()" ) - end - - ## - # Test method for 'AbtReportManager.testSearchPackageDescriptions()' - ## - def testSearchPackageDescriptions - assert( @report.searchPackageDescriptions( "Special text" ), - "testSearchPackageDescriptions()" ) - end - - ## - # Test method for 'AbtReportManager.testShowQueue()' - ## - def testShowQueue - if ( @report.showQueue( "install" ) ) - assert(false, "testShowQueue()") - else - assert(true, "testShowQueue()") - end - end - - ## - # Test method for 'AbtReportManager.testShowUpdates()' - ## - def testShowUpdates - assert( @report.showUpdates( "ipc" ), "testShowUpdates()" ) - end - - ## - # Test method for 'AbtReportManager.testGenerateHTMLPackageListing()' - ## - def testGenerateHTMLPackageListing - assert( @report.generateHTMLPackageListing(), - "testGenerateHTMLPackageListing()" ) - end - -end Modified: src/trunk/abtconfig.rb =================================================================== --- src/trunk/abtconfig.rb 2007-07-16 13:03:02 UTC (rev 357) +++ src/trunk/abtconfig.rb 2007-07-16 13:20:14 UTC (rev 358) @@ -32,7 +32,7 @@ require 'abtpackage' require 'abtdepengine' require 'abtqueuemanager' -require 'AbtReportManager' +require 'abtreportmanager' require 'AbtSystemManager' require 'AbtUsage' Copied: src/trunk/abtreportmanager.rb (from rev 357, src/trunk/AbtReportManager.rb) =================================================================== --- src/trunk/abtreportmanager.rb (rev 0) +++ src/trunk/abtreportmanager.rb 2007-07-16 13:20:14 UTC (rev 358) @@ -0,0 +1,247 @@ +#!/usr/bin/ruby -w + +## +# abtreportmanager.rb +# +# AbtReportManager class handles all sort of report and query generation within +# the AbTLinux system. +# +# Created by Eric D. Schabell <er...@ab...> +# Copyright 2006, GPL. +# +# This file is part of AbTLinux. +# +# AbTLinux is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# AbTLinux is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# AbTLinux; if not, write to the Free Software Foundation, Inc., 51 Franklin +# St, Fifth Floor, Boston, MA 02110-1301 USA +## +class AbtReportManager + + protected + + private + + public + + ## + # Constructor for the AbtReportManager. + # + # <b>RETURN</b> <i>AbtReportManager</i> - an initialized + # Report1Manager object. + ## + def initialize + end + + ## + # Display all data for a given package. + # + # <b>PARAM</b> <i>String</i> - Package name. + # + # <b>RETURN</b> <i>boolean</i> - True if completes without error, + # otherwise false. + ## + def showPackageDetails( package ) + require "#{$PACKAGE_PATH}#{package}" + + if ( package = eval( "#{package.capitalize}.new" ) ) + details = package.details + + puts "|=====================================" + puts "| Package name\t: #{details['Package name']}" + details.delete( "Package name" ) + puts "| Version\t: #{details['Version']}" + details.delete( "Version" ) + puts "| Homepage\t: #{details['Homepage']}" + details.delete( "Homepage" ) + puts "| Executable\t: #{details['Executable']}" + details.delete( "Executable" ) + puts "| Source uri\t: #{details['Source uri']}" + details.delete( "Source uri" ) + puts "| Description\t: #{details['Description']}" + details.delete( "Description" ) + puts "|=====================================" + puts "|=====================================" + + details.each do |name, value| + print "| #{name}\t" + + if ( name.length < 14 ) + print "\t" + end + + puts ": #{value}" + end + + puts "|=====================================" + return true + end + + logger.logToJournal( "[AbtReportManger::showPackageDetails] - failed" + + "to show details for ${package}." ) + return false + end + + ## + # Display all packages installed and tracked by AbTLinux. + # + # <b>RETURN</b> <i>void.</i> + ## + def showInstalledPackages + end + + ## + # Display the contents of the requested log for a given package. Possible + # log types are; install, build and integrity. + # + # <b>PARAM</b> <i>String</i> - Package name. + # + # <b>PARAM</b> <i>String</i> - log type. + # + # <b>RETURN</b> <i>void.</i> + ## + def showPackageLog( package, logType ) + # install log + # build log + # integrity log + end + + ## + # Display a list of the packages found in the frozen list. + # + # <b>RETURN</b> <i>void.</i> + ## + def showFrozenPackages + end + + ## + # Provides access to dependency checking via the AbTLinux DepEngine. (This + # portal to the DepEngine will be expanded in apart sub-project, more + # details at a later date.) + # + # <b>PARAM</b> <i>String</i> - Package name. + # + # <b>RETURN</b> <i>hash</i> - Empty hash if no problems found, otherwise + # hash of problem files and their encountered errors. + ## + def showPackageDependencies( package ) + end + + ## + # Display all files not part of any installed AbTLinux package. This + # delivers a list of files that are not tracked by AbTLinux package + # management. + # + # <b>RETURN</b> <i>void.</i> + ## + def showUntrackedFiles + end + + ## + # Display the AbTLinux journal file. + # + # <b> PARAM</b> <i>string</i> The complete path of the file to display. + # + # <b>RETURN</b> <i>iboolean</i> True if journal shown, otherwise false. + ## + def showJournal( fileName ) + if ( File.exist?( fileName ) ) + puts "\n\n" + puts "AbTLinux log:" + puts "=============" + log = IO.readlines( fileName ) + log.each{ |entry| puts entry } + puts "\n\n" + else + puts "\n\n" + puts "AbtLinux log ( #{File.basename( fileName )} ) " + + "is empty at this time." + puts "\n\n" + end + + return true + end + + ## + # Display the name of the package(s) that own the given file. + # + # <b>PARAM</b> <i>String</i> - a file name. + # + # <b>RETURN</b> <i>void.</i> + ## + def showFileOwner( file ) + end + + ## + # Searches the installed package trees package descriptions for matching + # occurrances of the given search text. + # + # <b>PARAM</b> <i>String</i> - a search text. + # + # <b>RETURN</b> <i>hash</i> - a hash of the search results, keys are package + # names and values are matching descriptions. + ## + def searchPackageDescriptions( searchText ) + end + + ## + # Displays the contents of the current queue based on the given queue. + # + # <b>PARAM</b> <i>String</i> - the type of queue to display such as install + # queue. + # + # <b>RETURN</b> <i>void.</i> + ## + def showQueue( queueType ) + + case queueType + + when "install" + if ( File.exist?( "#{$ABT_LOGS}/#{queueType}.queue" ) ) + puts "\n\n" + puts "AbTLinux #{queueType} queue:" + puts "=======================" + queue = IO.readlines( "#{$ABT_LOGS}/#{queueType}.queue" ) + queue.each{ |entry| puts entry } + puts "\n\n" + else + puts "\n\n" + puts "AbtLinux #{queueType} is empty at this time." + puts "\n\n" + end + else + puts "#{queueType.capitalize} is not an AbTLinux queue." + end + end + + ## + # Reports available updates for a given package or package tree based on the + # current system. + # + # <b>PARAM</b> <i>String</i> - the target of the update check, either a + # package name or a package tree name. + # + # <b>RETURN</b> <i>boolean</i> - True if completes without error, otherwise + # false. + ## + def showUpdates( target ) + end + + ## + # Generates an HTML page of installed packages from installed packages list. + # + # <b>RETURN</b> <i>void.</i> + ## + def generateHTMLPackageListing + end + +end Modified: src/trunk/testSuiteAbt.rb =================================================================== --- src/trunk/testSuiteAbt.rb 2007-07-16 13:03:02 UTC (rev 357) +++ src/trunk/testSuiteAbt.rb 2007-07-16 13:20:14 UTC (rev 358) @@ -27,6 +27,6 @@ require 'testabtdownloadmanager' require 'testabtpackage' require 'testabtqueuemanager' -require 'TestAbtReportManager' +require 'testabtreportmanager' require 'TestAbtSystemManager' require 'testabtdepengine' Copied: src/trunk/testabtreportmanager.rb (from rev 357, src/trunk/TestAbtReportManager.rb) =================================================================== --- src/trunk/testabtreportmanager.rb (rev 0) +++ src/trunk/testabtreportmanager.rb 2007-07-16 13:20:14 UTC (rev 358) @@ -0,0 +1,140 @@ +#!/usr/bin/ruby -w + +require 'test/unit/testcase' +require 'test/unit/autorunner' +require 'abtconfig' + +## +# testabtreportmanager.rb +# +# Unit testing for AbtReportManager class. +# +# Created by Eric D. Schabell <er...@ab...> +# Copyright 2006, GPL. +# +# This file is part of AbTLinux. +# +# AbTLinux is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# AbTLinux is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# AbTLinux; if not, write to the Free Software Foundation, Inc., 51 Franklin +# St, Fifth Floor, Boston, MA 02110-1301 USA +## +class TestAbtReportManager < Test::Unit::TestCase + + ## + # setup method for testing AbtReportManager. + ## + def setup + @report = AbtReportManager.new() + end + + ## + # teardown method to cleanup after testing. + ## + def teardown + end + + ## + # Test method for 'AbtReportManager.testShowPackageDetails()' + ## + def testShowPackageDetails + assert( @report.showPackageDetails( "ipc" ), "testShowPackageDetails()" ) + end + + ## + # Test method for 'AbtReportManager.testShowInstalledPackages()' + ## + def testShowInstalledPackages + assert( @report.showInstalledPackages(), "testShowInstalledPackages()" ) + end + + ## + # Test method for 'AbtReportManager.testShowPackageLog()' + ## + def testShowPackageLog + assert( @report.showPackageLog( "ipc", "install" ), + "testShowPackageLog()" ) + assert( @report.showPackageLog( "ipc", "build" ), "testShowPackageLog()" ) + assert( @report.showPackageLog( "ipc", "integrity" ), + "testShowPackageLog()" ) + end + + ## + # Test method for 'AbtReportManager.testShowFrozenPackages()' + ## + def testShowFrozenPackages + assert( @report.showFrozenPackages(), "testShowFrozenPackages()" ) + end + + ## + # Test method for 'AbtReportManager.testShowPackageDependencies()' + ## + def testShowPackageDependencies + assert( false, "testShowPackageDependencies()" ) + end + + ## + # Test method for 'AbtReportManager.testShowUntrackedFiles()' + ## + def testShowUntrackedFiles + assert( @report.showUntrackedFiles(), "testShowUntrackedFiles()" ) + end + + ## + # Test method for 'AbtReportManager.testShowJournal()' + ## + def testShowJournal + assert( @report.showJournal( $JOURNAL ), "testShowJournal()" ) + end + + ## + # Test method for 'AbtReportManager.testShowFileOwner()' + ## + def testShowFileOwner + assert( @report.showFileOwner( "ipcFile" ), "testShowFileOwner()" ) + end + + ## + # Test method for 'AbtReportManager.testSearchPackageDescriptions()' + ## + def testSearchPackageDescriptions + assert( @report.searchPackageDescriptions( "Special text" ), + "testSearchPackageDescriptions()" ) + end + + ## + # Test method for 'AbtReportManager.testShowQueue()' + ## + def testShowQueue + if ( @report.showQueue( "install" ) ) + assert(false, "testShowQueue()") + else + assert(true, "testShowQueue()") + end + end + + ## + # Test method for 'AbtReportManager.testShowUpdates()' + ## + def testShowUpdates + assert( @report.showUpdates( "ipc" ), "testShowUpdates()" ) + end + + ## + # Test method for 'AbtReportManager.testGenerateHTMLPackageListing()' + ## + def testGenerateHTMLPackageListing + assert( @report.generateHTMLPackageListing(), + "testGenerateHTMLPackageListing()" ) + end + +end This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <esc...@us...> - 2007-07-16 13:24:02
|
Revision: 359 http://svn.sourceforge.net/abtlinux/?rev=359&view=rev Author: eschabell Date: 2007-07-16 06:24:01 -0700 (Mon, 16 Jul 2007) Log Message: ----------- Migrated system manager class and test class to rubified file names. Modified Paths: -------------- src/trunk/abtconfig.rb src/trunk/testSuiteAbt.rb Added Paths: ----------- src/trunk/abtsystemmanager.rb src/trunk/testabtsystemmanager.rb Removed Paths: ------------- src/trunk/AbtSystemManager.rb src/trunk/TestAbtSystemManager.rb Deleted: src/trunk/AbtSystemManager.rb =================================================================== --- src/trunk/AbtSystemManager.rb 2007-07-16 13:20:14 UTC (rev 358) +++ src/trunk/AbtSystemManager.rb 2007-07-16 13:24:01 UTC (rev 359) @@ -1,191 +0,0 @@ -#!/usr/bin/ruby -w - -## -# AbtSystemManager.rb -# -# AbtSystemManager class handles all aspects of the AbTLinux system. It takes -# care of such tasks as cleanup, fixing, verification and management of -# settings within the system. -# -# Created by Eric D. Schabell <er...@ab...> -# Copyright 2006, GPL. -# -# This file is part of AbTLinux. -# -# AbTLinux is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# AbTLinux is distributed in the hope that it will be useful, but WITHOUT ANY -# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -# details. -# -# You should have received a copy of the GNU General Public License along with -# AbTLinux; if not, write to the Free Software Foundation, Inc., 51 Franklin -# St, Fifth Floor, Boston, MA 02110-1301 USA -## -class AbtSystemManager - - protected - - private - - ## - # Determines if given file is in given directory. - # - # <b>PARAM</b> <i>String</i> - directory path to search. - # <b>PARAM</b> <i>String</i> - entry we are looking for in given directory. - # - # <b>RETURN</b> <i>boolean</i> - True if entry found in given directory, - # otherwise false. - ## - def foundEntry( directory, name ) - Find.find( directory ) do |path| - - Find.prune if [".", ".."].include? path - case name - when String - return true if File.basename( path ) == name - else - raise ArgumentError - end - - end - - return false # match not found. - end - - public - - ## - # Constructor for the System manager - # - # <b>RETURN</b> <i>AbtSystemManager</i> - an initialized - # AbtSystemManager object. - ## - def initialize - end - - ## - # Removes all sources for packages that are not currently installed. Makes - # use of install listing to determine package sources to keep. - # - # <b>RETURN</b> <i>boolean</i> - True if completes without error, otherwise - # false. - ## - def cleanupPackageSources - end - - ## - # All logs for packages not in install list are cleaned off the system. - # - # <b>RETURN</b> <i>boolean</i> - True if completes without error, otherwise - # false. - ## - def cleanupLogs - end - - ## - # Checks if files from given package install list are actually installed. - # - # <b>PARAM</b> <i>String</i> - Package name. - # - # <b>RETURN</b> <i>boolean</i> - True if no installed files are missing, - # otherwise false. - ## - def verifyInstalledFiles( package ) - end - - ## - # Checks if given packages installed symlinks are broken or missing. - # - # <b>PARAM</b> <i>String</i> - Package name. - # - # <b>RETURN</b> <i>boolean</i> - True if no symlinks found missing - # or broken, otherwise false. - ## - def verifySymlinks( package ) - end - - ## - # Checks the given packages dependencies for missing or broken dependencies. - # - # <b>PARAM</b> <i>String</i> - Package name. - # - # <b>RETURN</b> <i>boolean</i> - True if dependencies intact, otherwise - # false. - ## - def verifyPackageDepends( package ) - end - - ## - # Checks the given packages installed files against the integrity log for - # changes to installed files. - # - # <b>PARAM</b> <i>String</i> - Package name. - # - # <b>RETURN</b> <i>hash</i> - Empty hash if no problems found, otherwise - # hash of problem files and their encountered errors. - ## - def verifyPackageIntegrity( package ) - end - - ## - # Fixes the given package. - # - # <b>PARAM</b> <i>String</i> - Package name. - # - # <b>RETURN</b> <i>boolean</i> - True if completes without error, otherwise - # false. - ## - def fixPackage( package ) - end - - ## - # Sets the URI of a central repository for pre-compiled packages. - # - # <b>PARAM</b> <i>String</i> - the URI where the central repository is - # located. - # - # <b>RETURN</b> <i>boolean</i> - True if the URI is set, otherwise false. - ## - def setCentralRepo( uri ) - end - - ## - # Sets the location where the package tree is to be downloaded from, can be - # set to a local location. - # - # <b>PARAM</b> <i>String</i> - the location of the package tree. - # - # <b>RETURN</b> <i>boolean</i> - True if the package tree location is set, - # otherwise false. - ## - def setPackageTreeLocation( location ) - end - - ## - # Checks if the given package is installed by checking for entry in the - # installed directory. - # - # <b>PARAM</b> <i>String</i> - Package name. - # - # <b>RETURN</b> <i>boolean</i> - True if package installed, otherwise - # false. - ## - def packageInstalled( package ) - require "#{$PACKAGE_PATH}#{package}" - sw = eval( "#{package.capitalize}.new" ) - details = sw.details - - if ( foundEntry( $PACKAGE_INSTALLED, sw.srcDir ) ) - return true - end - - - return false - end - -end \ No newline at end of file Deleted: src/trunk/TestAbtSystemManager.rb =================================================================== --- src/trunk/TestAbtSystemManager.rb 2007-07-16 13:20:14 UTC (rev 358) +++ src/trunk/TestAbtSystemManager.rb 2007-07-16 13:24:01 UTC (rev 359) @@ -1,118 +0,0 @@ -#!/usr/bin/ruby -w - -require 'test/unit/testcase' -require 'test/unit/autorunner' -require 'abtconfig' - -## -# TestAbtSystemManager.rb -# -# Unit testing for AbtSystemManager class. -# -# Created by Eric D. Schabell <er...@ab...> -# Copyright 2006, GPL. -# -# This file is part of AbTLinux. -# -# AbTLinux is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# AbTLinux is distributed in the hope that it will be useful, but WITHOUT ANY -# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -# details. -# -# You should have received a copy of the GNU General Public License along with -# AbTLinux; if not, write to the Free Software Foundation, Inc., 51 Franklin -# St, Fifth Floor, Boston, MA 02110-1301 USA -## -class TestAbtSystemManager < Test::Unit::TestCase - - ## - # setup method for testing AbtSystemManager. - ## - def setup - @sys = AbtSystemManager.new() - end - - ## - # teardown method to cleanup after testing. - ## - def teardown - end - - ## - # Test method for 'AbtSystemManager.testCleanupPackageSources()' - ## - def testCleanupPackageSources - assert( @sys.cleanupPackageSources(), "testCleanupPackageSources()" ) - end - - ## - # Test method for 'AbtSystemManager.testCleanupLogs()' - ## - def testCleanupLogs - assert( @sys.cleanupLogs(), "testCleanupLogs()" ) - end - - ## - # Test method for 'AbtSystemManager.testVerifyInstalledFiles()' - ## - def testVerifyInstalledFiles - assert( @sys.verifyInstalledFiles( "dummy" ), "testVerifyInstalledFiles()" ) - end - - ## - # Test method for 'AbtSystemManager.testVerifySymlinks()' - ## - def testVerifySymlinks - assert( @sys.verifySymlinks( "dummy" ), "testVerifySymlinks()" ) - end - - ## - # Test method for 'AbtSystemManager.testVerifyPackageDepends()' - ## - def testVerifyPackageDepends - assert( @sys.verifyPackageDepends( "dummy" ), "testVerifyPackageDepends()" ) - end - - ## - # Test method for 'AbtSystemManager.testVerifyPackageIntegrity()' - ## - def testVerifyPackageIntegrity - assert( @sys.verifyPackageIntegrity( "dummy" ), - "testVerifyPackageIntegrity()" ) - end - - ## - # Test method for 'AbtSystemManager.testFixPackage()' - ## - def testFixPackage - assert( @sys.fixPackage( "dummy" ), "testFixPackage()" ) - end - - ## - # Test method for 'AbtSystemManager.testSetCentralRepo()' - ## - def testSetCentralRepo - assert( @sys.setCentralRepo( "http://localhost" ), "testSetCentralRepo()" ) - end - - ## - # Test method for 'AbtSystemManager.testSetPackageTreeLocation()' - ## - def testSetPackageTreeLocation - assert( @sys.setPackageTreeLocation( "/var/lib/ericsPackages" ), - "testSetPackageTreeLocation()" ) - end - - ## - # Test method for 'AbtSystemManager.testPackageInstalled()' - ## - def testPackageInstalled - assert( @sys.packageInstalled( "ipc" ), "testPackageInstalled()" ) - end - -end Modified: src/trunk/abtconfig.rb =================================================================== --- src/trunk/abtconfig.rb 2007-07-16 13:20:14 UTC (rev 358) +++ src/trunk/abtconfig.rb 2007-07-16 13:24:01 UTC (rev 359) @@ -33,7 +33,7 @@ require 'abtdepengine' require 'abtqueuemanager' require 'abtreportmanager' -require 'AbtSystemManager' +require 'abtsystemmanager' require 'AbtUsage' require 'fileutils' Copied: src/trunk/abtsystemmanager.rb (from rev 358, src/trunk/AbtSystemManager.rb) =================================================================== --- src/trunk/abtsystemmanager.rb (rev 0) +++ src/trunk/abtsystemmanager.rb 2007-07-16 13:24:01 UTC (rev 359) @@ -0,0 +1,191 @@ +#!/usr/bin/ruby -w + +## +# abtsystemmanager.rb +# +# AbtSystemManager class handles all aspects of the AbTLinux system. It takes +# care of such tasks as cleanup, fixing, verification and management of +# settings within the system. +# +# Created by Eric D. Schabell <er...@ab...> +# Copyright 2006, GPL. +# +# This file is part of AbTLinux. +# +# AbTLinux is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# AbTLinux is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# AbTLinux; if not, write to the Free Software Foundation, Inc., 51 Franklin +# St, Fifth Floor, Boston, MA 02110-1301 USA +## +class AbtSystemManager + + protected + + private + + ## + # Determines if given file is in given directory. + # + # <b>PARAM</b> <i>String</i> - directory path to search. + # <b>PARAM</b> <i>String</i> - entry we are looking for in given directory. + # + # <b>RETURN</b> <i>boolean</i> - True if entry found in given directory, + # otherwise false. + ## + def foundEntry( directory, name ) + Find.find( directory ) do |path| + + Find.prune if [".", ".."].include? path + case name + when String + return true if File.basename( path ) == name + else + raise ArgumentError + end + + end + + return false # match not found. + end + + public + + ## + # Constructor for the System manager + # + # <b>RETURN</b> <i>AbtSystemManager</i> - an initialized + # AbtSystemManager object. + ## + def initialize + end + + ## + # Removes all sources for packages that are not currently installed. Makes + # use of install listing to determine package sources to keep. + # + # <b>RETURN</b> <i>boolean</i> - True if completes without error, otherwise + # false. + ## + def cleanupPackageSources + end + + ## + # All logs for packages not in install list are cleaned off the system. + # + # <b>RETURN</b> <i>boolean</i> - True if completes without error, otherwise + # false. + ## + def cleanupLogs + end + + ## + # Checks if files from given package install list are actually installed. + # + # <b>PARAM</b> <i>String</i> - Package name. + # + # <b>RETURN</b> <i>boolean</i> - True if no installed files are missing, + # otherwise false. + ## + def verifyInstalledFiles( package ) + end + + ## + # Checks if given packages installed symlinks are broken or missing. + # + # <b>PARAM</b> <i>String</i> - Package name. + # + # <b>RETURN</b> <i>boolean</i> - True if no symlinks found missing + # or broken, otherwise false. + ## + def verifySymlinks( package ) + end + + ## + # Checks the given packages dependencies for missing or broken dependencies. + # + # <b>PARAM</b> <i>String</i> - Package name. + # + # <b>RETURN</b> <i>boolean</i> - True if dependencies intact, otherwise + # false. + ## + def verifyPackageDepends( package ) + end + + ## + # Checks the given packages installed files against the integrity log for + # changes to installed files. + # + # <b>PARAM</b> <i>String</i> - Package name. + # + # <b>RETURN</b> <i>hash</i> - Empty hash if no problems found, otherwise + # hash of problem files and their encountered errors. + ## + def verifyPackageIntegrity( package ) + end + + ## + # Fixes the given package. + # + # <b>PARAM</b> <i>String</i> - Package name. + # + # <b>RETURN</b> <i>boolean</i> - True if completes without error, otherwise + # false. + ## + def fixPackage( package ) + end + + ## + # Sets the URI of a central repository for pre-compiled packages. + # + # <b>PARAM</b> <i>String</i> - the URI where the central repository is + # located. + # + # <b>RETURN</b> <i>boolean</i> - True if the URI is set, otherwise false. + ## + def setCentralRepo( uri ) + end + + ## + # Sets the location where the package tree is to be downloaded from, can be + # set to a local location. + # + # <b>PARAM</b> <i>String</i> - the location of the package tree. + # + # <b>RETURN</b> <i>boolean</i> - True if the package tree location is set, + # otherwise false. + ## + def setPackageTreeLocation( location ) + end + + ## + # Checks if the given package is installed by checking for entry in the + # installed directory. + # + # <b>PARAM</b> <i>String</i> - Package name. + # + # <b>RETURN</b> <i>boolean</i> - True if package installed, otherwise + # false. + ## + def packageInstalled( package ) + require "#{$PACKAGE_PATH}#{package}" + sw = eval( "#{package.capitalize}.new" ) + details = sw.details + + if ( foundEntry( $PACKAGE_INSTALLED, sw.srcDir ) ) + return true + end + + + return false + end + +end Modified: src/trunk/testSuiteAbt.rb =================================================================== --- src/trunk/testSuiteAbt.rb 2007-07-16 13:20:14 UTC (rev 358) +++ src/trunk/testSuiteAbt.rb 2007-07-16 13:24:01 UTC (rev 359) @@ -28,5 +28,5 @@ require 'testabtpackage' require 'testabtqueuemanager' require 'testabtreportmanager' -require 'TestAbtSystemManager' +require 'testabtsystemmanager' require 'testabtdepengine' Copied: src/trunk/testabtsystemmanager.rb (from rev 358, src/trunk/TestAbtSystemManager.rb) =================================================================== --- src/trunk/testabtsystemmanager.rb (rev 0) +++ src/trunk/testabtsystemmanager.rb 2007-07-16 13:24:01 UTC (rev 359) @@ -0,0 +1,118 @@ +#!/usr/bin/ruby -w + +require 'test/unit/testcase' +require 'test/unit/autorunner' +require 'abtconfig' + +## +# testabtsystemmanager.rb +# +# Unit testing for AbtSystemManager class. +# +# Created by Eric D. Schabell <er...@ab...> +# Copyright 2006, GPL. +# +# This file is part of AbTLinux. +# +# AbTLinux is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# AbTLinux is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# AbTLinux; if not, write to the Free Software Foundation, Inc., 51 Franklin +# St, Fifth Floor, Boston, MA 02110-1301 USA +## +class TestAbtSystemManager < Test::Unit::TestCase + + ## + # setup method for testing AbtSystemManager. + ## + def setup + @sys = AbtSystemManager.new() + end + + ## + # teardown method to cleanup after testing. + ## + def teardown + end + + ## + # Test method for 'AbtSystemManager.testCleanupPackageSources()' + ## + def testCleanupPackageSources + assert( @sys.cleanupPackageSources(), "testCleanupPackageSources()" ) + end + + ## + # Test method for 'AbtSystemManager.testCleanupLogs()' + ## + def testCleanupLogs + assert( @sys.cleanupLogs(), "testCleanupLogs()" ) + end + + ## + # Test method for 'AbtSystemManager.testVerifyInstalledFiles()' + ## + def testVerifyInstalledFiles + assert( @sys.verifyInstalledFiles( "dummy" ), "testVerifyInstalledFiles()" ) + end + + ## + # Test method for 'AbtSystemManager.testVerifySymlinks()' + ## + def testVerifySymlinks + assert( @sys.verifySymlinks( "dummy" ), "testVerifySymlinks()" ) + end + + ## + # Test method for 'AbtSystemManager.testVerifyPackageDepends()' + ## + def testVerifyPackageDepends + assert( @sys.verifyPackageDepends( "dummy" ), "testVerifyPackageDepends()" ) + end + + ## + # Test method for 'AbtSystemManager.testVerifyPackageIntegrity()' + ## + def testVerifyPackageIntegrity + assert( @sys.verifyPackageIntegrity( "dummy" ), + "testVerifyPackageIntegrity()" ) + end + + ## + # Test method for 'AbtSystemManager.testFixPackage()' + ## + def testFixPackage + assert( @sys.fixPackage( "dummy" ), "testFixPackage()" ) + end + + ## + # Test method for 'AbtSystemManager.testSetCentralRepo()' + ## + def testSetCentralRepo + assert( @sys.setCentralRepo( "http://localhost" ), "testSetCentralRepo()" ) + end + + ## + # Test method for 'AbtSystemManager.testSetPackageTreeLocation()' + ## + def testSetPackageTreeLocation + assert( @sys.setPackageTreeLocation( "/var/lib/ericsPackages" ), + "testSetPackageTreeLocation()" ) + end + + ## + # Test method for 'AbtSystemManager.testPackageInstalled()' + ## + def testPackageInstalled + assert( @sys.packageInstalled( "ipc" ), "testPackageInstalled()" ) + end + +end This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <esc...@us...> - 2007-07-16 13:32:47
|
Revision: 361 http://svn.sourceforge.net/abtlinux/?rev=361&view=rev Author: eschabell Date: 2007-07-16 06:32:49 -0700 (Mon, 16 Jul 2007) Log Message: ----------- Migrated dog generation and usage classes to rubified file names. Modified Paths: -------------- src/trunk/abtconfig.rb Added Paths: ----------- src/trunk/abtusage.rb src/trunk/docgen.sh Removed Paths: ------------- src/trunk/AbtUsage.rb src/trunk/docGen.sh Deleted: src/trunk/AbtUsage.rb =================================================================== --- src/trunk/AbtUsage.rb 2007-07-16 13:31:07 UTC (rev 360) +++ src/trunk/AbtUsage.rb 2007-07-16 13:32:49 UTC (rev 361) @@ -1,158 +0,0 @@ -#!/usr/bin/ruby -I./packages - -## -# AbtUsage.rb -# -# The usage reporting class for AbTLinux. -# -# Created by Eric D. Schabell <er...@ab...> -# Copyright November 2006, GPL. -# -# This file is part of AbTLinux. -# -# AbTLinux is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# AbTLinux is distributed in the hope that it will be useful, but WITHOUT ANY -# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -# details. -# -# You should have received a copy of the GNU General Public License along with -# AbTLinux; if not, write to the Free Software Foundation, Inc., 51 Franklin -# St, Fifth Floor, Boston, MA 02110-1301 USA -## -class AbtUsage - - ## - # The main usage method, displays either a given section or all sections. - # - # <b>PARAM</b> <i>String</i> - the name of the help section to be shown. - # - # <b>RETURN</b> <i>void</i> - ## - def usage( section ) - puts "Usage: abt.rb [options]\n\n" - - case section - - when "packages" - usagePackages - - when "queries" - usageQueries - - when "generation" - usageGeneration - - when "downloads" - usageDownloads - - when "fix" - usageFix - - when "maintenance" - usageMaintenance - - else - usagePackages - usageQueries - usageGeneration - usageDownloads - usageFix - usageMaintenance - end - end - - ## - # The usage information for the packages commands. - # - # <b>RETURN</b> <i>void</i> - ## - def usagePackages - puts "\npackages:" - puts " -i, install [package]\t\tInstall given package." - puts " -ri, reinstall [package]\t\tReinstall given package." - puts " -r, remove [package]\t\tRemove given package." - puts " -dg, downgrade [version] [package]\tDowngrade given package to given version." - puts " -f, freeze [package]\t\tHolds given package at current version, prevents upgrades.\n" - end - - ## - # The usage information for the query commands. - # - # <b>RETURN</b> <i>void</i> - ## - def usageQueries - puts "\nqueries:" - puts " -s, search [string | regexp ]\tSearch package descriptions for given input." - puts " -v, --version\t\t\tShow abt package manager version." - puts " show-details [package]\t\tShow give package details." - puts " show-build [package]\t\tShow build log of given package." - puts " show-depends [package]\t\tShow the dependency tree of given package." - puts " show-files [package]\t\tShow all installed files from given package." - puts " show-owner [file]\t\tShow the package owning given file." - puts " show-installed\t\t\tShow list of all installed packages." - puts " show-frozen\t\t\t\tShow list of all frozen packages." - puts " show-untracked\t\t\tShow all files on system not tracked by AbTLinux." - puts " show-journal\t\t\t\tShow the system journal." - puts " show-iqueue\t\t\t\tShow the contents of the install queue." - puts " show-patches\t\t\t\tShow the current available patches for installed package tree.\n" - end - - ## - # The usage information for the generation commands. - # - # <b>RETURN</b> <i>void</i> - ## - def usageGeneration - puts "\ngeneration:" - puts " show-updates\t\tShow a package listing with available update versions." - puts " html\t\t\tGenerate HTML page from installed packages:" - puts " \t\t\t\t(package name with hyperlink to package website and version installed)\n" - end - - ## - # The usage information for the download commands. - # - # <b>RETURN</b> <i>void</i> - ## - def usageDownloads - puts "\ndownloads:" - puts " -d, download [package]\t\tRetrieve given package sources." - puts " -u, update [package]|[tree]\tUpdate given package or tree from AbTLinux repository." - puts " -n, news\t\t\t\tDisplays newsfeeds from AbTLinux website.\n" - end - - ## - # The usage information for the fix commands. - # - # <b>RETURN</b> <i>void</i> - ## - def usageFix - puts "\nfix:" - puts " purge-src\t\t\t\tRemove source caches for packages no longer installed." - puts " purge-logs\t\t\t\tRemove log files for packages no longer installed." - puts " verify-files [package]\t\tInstalled files are verified for given package." - puts " verify-symlinks [package]\t\tSymlinks verified for given package." - puts " verify-deps [package]\t\tDependency tree is verified for given package." - puts " verify-integrity [package]\t\tVerify integrity of installed files for given package." - puts " fix [package]\t\tGiven package is verified and fixed if needed.\n" - end - - ## - # The usage information for the maintenance commands. - # - # <b>RETURN</b> <i>void</i> - ## - def usageMaintenance - puts "\nmaintenance:" - puts " build-location [host]\t\tSets global location (default: localhost) for retrieving cached package builds." - puts " package-repo [add|remove|list] [URI]" - puts " add - add package repository to list." - puts " remove - remove a package repository from list." - puts " list - display current repository list.\n" - end -end Modified: src/trunk/abtconfig.rb =================================================================== --- src/trunk/abtconfig.rb 2007-07-16 13:31:07 UTC (rev 360) +++ src/trunk/abtconfig.rb 2007-07-16 13:32:49 UTC (rev 361) @@ -34,7 +34,7 @@ require 'abtqueuemanager' require 'abtreportmanager' require 'abtsystemmanager' -require 'AbtUsage' +require 'abtusage' require 'fileutils' require 'find' Copied: src/trunk/abtusage.rb (from rev 358, src/trunk/AbtUsage.rb) =================================================================== --- src/trunk/abtusage.rb (rev 0) +++ src/trunk/abtusage.rb 2007-07-16 13:32:49 UTC (rev 361) @@ -0,0 +1,158 @@ +#!/usr/bin/ruby -I./packages + +## +# abtusage.rb +# +# The usage reporting class for AbTLinux. +# +# Created by Eric D. Schabell <er...@ab...> +# Copyright November 2006, GPL. +# +# This file is part of AbTLinux. +# +# AbTLinux is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# AbTLinux is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# AbTLinux; if not, write to the Free Software Foundation, Inc., 51 Franklin +# St, Fifth Floor, Boston, MA 02110-1301 USA +## +class AbtUsage + + ## + # The main usage method, displays either a given section or all sections. + # + # <b>PARAM</b> <i>String</i> - the name of the help section to be shown. + # + # <b>RETURN</b> <i>void</i> + ## + def usage( section ) + puts "Usage: abt.rb [options]\n\n" + + case section + + when "packages" + usagePackages + + when "queries" + usageQueries + + when "generation" + usageGeneration + + when "downloads" + usageDownloads + + when "fix" + usageFix + + when "maintenance" + usageMaintenance + + else + usagePackages + usageQueries + usageGeneration + usageDownloads + usageFix + usageMaintenance + end + end + + ## + # The usage information for the packages commands. + # + # <b>RETURN</b> <i>void</i> + ## + def usagePackages + puts "\npackages:" + puts " -i, install [package]\t\tInstall given package." + puts " -ri, reinstall [package]\t\tReinstall given package." + puts " -r, remove [package]\t\tRemove given package." + puts " -dg, downgrade [version] [package]\tDowngrade given package to given version." + puts " -f, freeze [package]\t\tHolds given package at current version, prevents upgrades.\n" + end + + ## + # The usage information for the query commands. + # + # <b>RETURN</b> <i>void</i> + ## + def usageQueries + puts "\nqueries:" + puts " -s, search [string | regexp ]\tSearch package descriptions for given input." + puts " -v, --version\t\t\tShow abt package manager version." + puts " show-details [package]\t\tShow give package details." + puts " show-build [package]\t\tShow build log of given package." + puts " show-depends [package]\t\tShow the dependency tree of given package." + puts " show-files [package]\t\tShow all installed files from given package." + puts " show-owner [file]\t\tShow the package owning given file." + puts " show-installed\t\t\tShow list of all installed packages." + puts " show-frozen\t\t\t\tShow list of all frozen packages." + puts " show-untracked\t\t\tShow all files on system not tracked by AbTLinux." + puts " show-journal\t\t\t\tShow the system journal." + puts " show-iqueue\t\t\t\tShow the contents of the install queue." + puts " show-patches\t\t\t\tShow the current available patches for installed package tree.\n" + end + + ## + # The usage information for the generation commands. + # + # <b>RETURN</b> <i>void</i> + ## + def usageGeneration + puts "\ngeneration:" + puts " show-updates\t\tShow a package listing with available update versions." + puts " html\t\t\tGenerate HTML page from installed packages:" + puts " \t\t\t\t(package name with hyperlink to package website and version installed)\n" + end + + ## + # The usage information for the download commands. + # + # <b>RETURN</b> <i>void</i> + ## + def usageDownloads + puts "\ndownloads:" + puts " -d, download [package]\t\tRetrieve given package sources." + puts " -u, update [package]|[tree]\tUpdate given package or tree from AbTLinux repository." + puts " -n, news\t\t\t\tDisplays newsfeeds from AbTLinux website.\n" + end + + ## + # The usage information for the fix commands. + # + # <b>RETURN</b> <i>void</i> + ## + def usageFix + puts "\nfix:" + puts " purge-src\t\t\t\tRemove source caches for packages no longer installed." + puts " purge-logs\t\t\t\tRemove log files for packages no longer installed." + puts " verify-files [package]\t\tInstalled files are verified for given package." + puts " verify-symlinks [package]\t\tSymlinks verified for given package." + puts " verify-deps [package]\t\tDependency tree is verified for given package." + puts " verify-integrity [package]\t\tVerify integrity of installed files for given package." + puts " fix [package]\t\tGiven package is verified and fixed if needed.\n" + end + + ## + # The usage information for the maintenance commands. + # + # <b>RETURN</b> <i>void</i> + ## + def usageMaintenance + puts "\nmaintenance:" + puts " build-location [host]\t\tSets global location (default: localhost) for retrieving cached package builds." + puts " package-repo [add|remove|list] [URI]" + puts " add - add package repository to list." + puts " remove - remove a package repository from list." + puts " list - display current repository list.\n" + end +end Deleted: src/trunk/docGen.sh =================================================================== --- src/trunk/docGen.sh 2007-07-16 13:31:07 UTC (rev 360) +++ src/trunk/docGen.sh 2007-07-16 13:32:49 UTC (rev 361) @@ -1,53 +0,0 @@ -#!/bin/bash -#=============================================================================== -# -# FILE: docgen.sh -# -# USAGE: ./docgen.sh -# -# DESCRIPTION: Generates AbTLinux Package Manager API documentation. -# -# BUGS: --- -# NOTES: --- -# AUTHOR: Eric D. Schabell <er...@ab...> -# VERSION: 1.0 -# CREATED: 05/14/2006 10:31:24 AM CEST -# REVISION: --- -#=============================================================================== - -TEMPLATE="./abttemplate.rb"; -FILES="abtdepengine.rb - abtdownloadmanager.rb - abtlogmanager.rb - abtpackage.rb - abtpackagemanager.rb - abtqueuemanager.rb - abtreportmanager.rb - abtsystemmanager.rb - abtusage.rb - testabtdepengine.rb - testabtdownloadmanager.rb - testabtlogmanager.rb - testabtpackage.rb - testabtpackagemanager.rb - testabtqueuemanager.rb - testabtreportmanager.rb - testabtsystemmanager.rb - "; - -# run the actual doc generation. -rdoc --diagram \ - --template $TEMPLATE \ - --fileboxes \ - --inline-source \ - --line-numbers \ - --main AbtPackageManager \ - --title "AbTLinux Package Manager API" \ - $FILES - -# remove old tarball and refresh with new docs. -#rm ./doc.tar.bz2 -#tar cf doc.tar ./doc -#bzip2 doc.tar - -# end docGen.sh Copied: src/trunk/docgen.sh (from rev 360, src/trunk/docGen.sh) =================================================================== --- src/trunk/docgen.sh (rev 0) +++ src/trunk/docgen.sh 2007-07-16 13:32:49 UTC (rev 361) @@ -0,0 +1,53 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: docgen.sh +# +# USAGE: ./docgen.sh +# +# DESCRIPTION: Generates AbTLinux Package Manager API documentation. +# +# BUGS: --- +# NOTES: --- +# AUTHOR: Eric D. Schabell <er...@ab...> +# VERSION: 1.0 +# CREATED: 05/14/2006 10:31:24 AM CEST +# REVISION: --- +#=============================================================================== + +TEMPLATE="./abttemplate.rb"; +FILES="abtdepengine.rb + abtdownloadmanager.rb + abtlogmanager.rb + abtpackage.rb + abtpackagemanager.rb + abtqueuemanager.rb + abtreportmanager.rb + abtsystemmanager.rb + abtusage.rb + testabtdepengine.rb + testabtdownloadmanager.rb + testabtlogmanager.rb + testabtpackage.rb + testabtpackagemanager.rb + testabtqueuemanager.rb + testabtreportmanager.rb + testabtsystemmanager.rb + "; + +# run the actual doc generation. +rdoc --diagram \ + --template $TEMPLATE \ + --fileboxes \ + --inline-source \ + --line-numbers \ + --main AbtPackageManager \ + --title "AbTLinux Package Manager API" \ + $FILES + +# remove old tarball and refresh with new docs. +#rm ./doc.tar.bz2 +#tar cf doc.tar ./doc +#bzip2 doc.tar + +# end docGen.sh This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <esc...@us...> - 2007-07-16 13:33:34
|
Revision: 362 http://svn.sourceforge.net/abtlinux/?rev=362&view=rev Author: eschabell Date: 2007-07-16 06:33:36 -0700 (Mon, 16 Jul 2007) Log Message: ----------- Migrated dog generation template to rubified file name. Added Paths: ----------- src/trunk/abttemplate.rb Removed Paths: ------------- src/trunk/abtTemplate.rb Deleted: src/trunk/abtTemplate.rb =================================================================== --- src/trunk/abtTemplate.rb 2007-07-16 13:32:49 UTC (rev 361) +++ src/trunk/abtTemplate.rb 2007-07-16 13:33:36 UTC (rev 362) @@ -1,590 +0,0 @@ -module RDoc -module Page - -FONTS = "\"Bitstream Vera Sans\", Verdana, Arial, Helvetica, sans-serif" - -STYLE = <<CSS -a { - color: #00F; - text-decoration: none; -} - -a:hover { - color: #77F; - text-decoration: underline; -} - -body, td, p { - font-family: %fonts%; - background: #FFF; - color: #000; - margin: 0px; - font-size: small; -} - -#content { - margin: 2em; -} - -#description p { - margin-bottom: 0.5em; -} - -.sectiontitle { - margin-top: 1em; - margin-bottom: 1em; - padding: 0.5em; - padding-left: 2em; - background: #005; - color: #FFF; - font-weight: bold; - border: 1px dotted black; -} - -.attr-rw { - padding-left: 1em; - padding-right: 1em; - text-align: center; - color: #055; -} - -.attr-name { - font-weight: bold; -} - -.attr-desc { -} - -.attr-value { - font-family: monospace; -} - -.file-title-prefix { - font-size: large; -} - -.file-title { - font-size: large; - font-weight: bold; - background: #005; - color: #FFF; -} - -.banner { - background: #005; - color: #FFF; - border: 1px solid black; - padding: 1em; -} - -.banner td { - background: transparent; - color: #FFF; -} - -h1 a, h2 a, .sectiontitle a, .banner a { - color: #FF0; -} - -h1 a:hover, h2 a:hover, .sectiontitle a:hover, .banner a:hover { - color: #FF7; -} - -.dyn-source { - display: none; - background: #FFE; - color: #000; - border: 1px dotted black; - margin: 0.5em 2em 0.5em 2em; - padding: 0.5em; -} - -.dyn-source .cmt { - color: #00F; - font-style: italic; -} - -.dyn-source .kw { - color: #070; - font-weight: bold; -} - -.method { - margin-left: 1em; - margin-right: 1em; - margin-bottom: 1em; -} - -.description pre { - padding: 0.5em; - border: 1px dotted black; - background: #FFE; -} - -.method .title { - font-family: monospace; - font-size: large; - border-bottom: 1px dashed black; - margin-bottom: 0.3em; - padding-bottom: 0.1em; -} - -.method .description, .method .sourcecode { - margin-left: 1em; -} - -.description p, .sourcecode p { - margin-bottom: 0.5em; -} - -.method .sourcecode p.source-link { - text-indent: 0em; - margin-top: 0.5em; -} - -.method .aka { - margin-top: 0.3em; - margin-left: 1em; - font-style: italic; - text-indent: 2em; -} - -h1 { - padding: 1em; - border: 1px solid black; - font-size: x-large; - font-weight: bold; - color: #FFF; - background: #007; -} - -h2 { - padding: 0.5em 1em 0.5em 1em; - border: 1px solid black; - font-size: large; - font-weight: bold; - color: #FFF; - background: #009; -} - -h3, h4, h5, h6 { - padding: 0.2em 1em 0.2em 1em; - border: 1px dashed black; - color: #000; - background: #AAF; -} - -.sourcecode > pre { - padding: 0.5em; - border: 1px dotted black; - background: #FFE; -} - -CSS - -XHTML_PREAMBLE = %{<?xml version="1.0" encoding="%charset%"?> -<!DOCTYPE html - PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -} - -HEADER = XHTML_PREAMBLE + <<ENDHEADER -<html> - <head> - <title>%title%</title> - <meta http-equiv="Content-Type" content="text/html; charset=%charset%" /> - <link rel="stylesheet" href="%style_url%" type="text/css" media="screen" /> - - <script language="JavaScript" type="text/javascript"> - // <![CDATA[ - - function toggleSource( id ) - { - var elem - var link - - if( document.getElementById ) - { - elem = document.getElementById( id ) - link = document.getElementById( "l_" + id ) - } - else if ( document.all ) - { - elem = eval( "document.all." + id ) - link = eval( "document.all.l_" + id ) - } - else - return false; - - if( elem.style.display == "block" ) - { - elem.style.display = "none" - link.innerHTML = "show source" - } - else - { - elem.style.display = "block" - link.innerHTML = "hide source" - } - } - - function openCode( url ) - { - window.open( url, "SOURCE_CODE", "width=400,height=400,scrollbars=yes" ) - } - // ]]> - </script> - </head> - - <body> -ENDHEADER - -FILE_PAGE = <<HTML -<table border='0' cellpadding='0' cellspacing='0' width="100%" class='banner'> - <tr><td> - <table width="100%" border='0' cellpadding='0' cellspacing='0'><tr> - <td class="file-title" colspan="2"><span class="file-title-prefix">File</span><br />%short_name%</td> - <td align="right"> - <table border='0' cellspacing="0" cellpadding="2"> - <tr> - <td>Path:</td> - <td>%full_path% -IF:cvsurl - (<a href="%cvsurl%">CVS</a>) -ENDIF:cvsurl - </td> - </tr> - <tr> - <td>Modified:</td> - <td>%dtm_modified%</td> - </tr> - </table> - </td></tr> - </table> - </td></tr> -</table><br> -HTML - -################################################################### - -CLASS_PAGE = <<HTML -<table width="100%" border='0' cellpadding='0' cellspacing='0' class='banner'><tr> - <td class="file-title"><span class="file-title-prefix">%classmod%</span><br />%full_name%</td> - <td align="right"> - <table cellspacing=0 cellpadding=2> - <tr valign="top"> - <td>In:</td> - <td> -START:infiles -HREF:full_path_url:full_path: -IF:cvsurl - (<a href="%cvsurl%">CVS</a>) -ENDIF:cvsurl -END:infiles - </td> - </tr> -IF:parent - <tr> - <td>Parent:</td> - <td> -IF:par_url - <a href="%par_url%"> -ENDIF:par_url -%parent% -IF:par_url - </a> -ENDIF:par_url - </td> - </tr> -ENDIF:parent - </table> - </td> - </tr> - </table> -HTML - -################################################################### - -METHOD_LIST = <<HTML - <div id="content"> -IF:diagram - <table cellpadding='0' cellspacing='0' border='0' width="100%"><tr><td align="center"> - %diagram% - </td></tr></table> -ENDIF:diagram - -IF:description - <div class="description">%description%</div> -ENDIF:description - -IF:requires - <div class="sectiontitle">Required Files</div> - <ul> -START:requires - <li>HREF:aref:name:</li> -END:requires - </ul> -ENDIF:requires - -IF:toc - <div class="sectiontitle">Contents</div> - <ul> -START:toc - <li><a href="#%href%">%secname%</a></li> -END:toc - </ul> -ENDIF:toc - -IF:methods - <div class="sectiontitle">Methods</div> - <ul> -START:methods - <li>HREF:aref:name:</li> -END:methods - </ul> -ENDIF:methods - -IF:includes -<div class="sectiontitle">Included Modules</div> -<ul> -START:includes - <li>HREF:aref:name:</li> -END:includes -</ul> -ENDIF:includes - -START:sections -IF:sectitle -<div class="sectiontitle"><a name="%secsequence%">%sectitle%</a></div> -IF:seccomment -<div class="description"> -%seccomment% -</div> -ENDIF:seccomment -ENDIF:sectitle - -IF:classlist - <div class="sectiontitle">Classes and Modules</div> - %classlist% -ENDIF:classlist - -IF:constants - <div class="sectiontitle">Constants</div> - <table border='0' cellpadding='5'> -START:constants - <tr valign='top'> - <td class="attr-name">%name%</td> - <td>=</td> - <td class="attr-value">%value%</td> - </tr> -IF:desc - <tr valign='top'> - <td> </td> - <td colspan="2" class="attr-desc">%desc%</td> - </tr> -ENDIF:desc -END:constants - </table> -ENDIF:constants - -IF:attributes - <div class="sectiontitle">Attributes</div> - <table border='0' cellpadding='5'> -START:attributes - <tr valign='top'> - <td class='attr-rw'> -IF:rw -[%rw%] -ENDIF:rw - </td> - <td class='attr-name'>%name%</td> - <td class='attr-desc'>%a_desc%</td> - </tr> -END:attributes - </table> -ENDIF:attributes - -IF:method_list -START:method_list -IF:methods -<div class="sectiontitle">%type% %category% methods</div> -START:methods -<div class="method"> - <div class="title"> -IF:callseq - <a name="%aref%"></a><b>%callseq%</b> -ENDIF:callseq -IFNOT:callseq - <a name="%aref%"></a><b>%name%</b>%params% -ENDIF:callseq -IF:codeurl -[ <a href="javascript:openCode('%codeurl%')">source</a> ] -ENDIF:codeurl - </div> -IF:m_desc - <div class="description"> - %m_desc% - </div> -ENDIF:m_desc -IF:aka -<div class="aka"> - This method is also aliased as -START:aka - <a href="%aref%">%name%</a> -END:aka -</div> -ENDIF:aka -IF:sourcecode -<div class="sourcecode"> - <p class="source-link">[ <a href="javascript:toggleSource('%aref%_source')" id="l_%aref%_source">show source</a> ]</p> - <div id="%aref%_source" class="dyn-source"> -<pre> -%sourcecode% -</pre> - </div> -</div> -ENDIF:sourcecode -</div> -END:methods -ENDIF:methods -END:method_list -ENDIF:method_list -END:sections -</div> -HTML - -FOOTER = <<ENDFOOTER - </body> -</html> -ENDFOOTER - -BODY = HEADER + <<ENDBODY - !INCLUDE! <!-- banner header --> - - <div id="bodyContent"> - #{METHOD_LIST} - </div> - - #{FOOTER} -ENDBODY - -########################## Source code ########################## - -SRC_PAGE = XHTML_PREAMBLE + <<HTML -<html> -<head><title>%title%</title> -<meta http-equiv="Content-Type" content="text/html; charset=%charset%"> -<style> -.ruby-comment { color: green; font-style: italic } -.ruby-constant { color: #4433aa; font-weight: bold; } -.ruby-identifier { color: #222222; } -.ruby-ivar { color: #2233dd; } -.ruby-keyword { color: #3333FF; font-weight: bold } -.ruby-node { color: #777777; } -.ruby-operator { color: #111111; } -.ruby-regexp { color: #662222; } -.ruby-value { color: #662222; font-style: italic } - .kw { color: #3333FF; font-weight: bold } - .cmt { color: green; font-style: italic } - .str { color: #662222; font-style: italic } - .re { color: #662222; } -</style> -</head> -<body bgcolor="white"> -<pre>%code%</pre> -</body> -</html> -HTML - -########################## Index ################################ - -FR_INDEX_BODY = <<HTML -!INCLUDE! -HTML - -FILE_INDEX = XHTML_PREAMBLE + <<HTML -<html> -<head> -<meta http-equiv="Content-Type" content="text/html; charset=%charset%"> -<style> -<!-- - body { - background-color: #EEE; - font-family: #{FONTS}; - color: #000; - margin: 0px; - } - .banner { - background: #005; - color: #FFF; - padding: 0.2em; - font-size: small; - font-weight: bold; - text-align: center; - } - .entries { - margin: 0.25em 1em 0 1em; - font-size: x-small; - } - a { - color: #00F; - text-decoration: none; - white-space: nowrap; - } - a:hover { - color: #77F; - text-decoration: underline; - } ---> -</style> -<base target="docwin"> -</head> -<body> -<div class="banner">%list_title%</div> -<div class="entries"> -START:entries -<a href="%href%">%name%</a><br> -END:entries -</div> -</body></html> -HTML - -CLASS_INDEX = FILE_INDEX -METHOD_INDEX = FILE_INDEX - -INDEX = XHTML_PREAMBLE + <<HTML -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head> - <title>%title%</title> - <meta http-equiv="Content-Type" content="text/html; charset=%charset%"> -</head> - -<frameset cols="20%,*"> - <frameset rows="15%,35%,50%"> - <frame src="fr_file_index.html" title="Files" name="Files" /> - <frame src="fr_class_index.html" name="Classes" /> - <frame src="fr_method_index.html" name="Methods" /> - </frameset> -IF:inline_source - <frame src="%initial_page%" name="docwin"> -ENDIF:inline_source -IFNOT:inline_source - <frameset rows="80%,20%"> - <frame src="%initial_page%" name="docwin"> - <frame src="blank.html" name="source"> - </frameset> -ENDIF:inline_source - <noframes> - <body bgcolor="white"> - Click <a href="html/index.html">here</a> for a non-frames - version of this page. - </body> - </noframes> -</frameset> - -</html> -HTML - -end -end - Copied: src/trunk/abttemplate.rb (from rev 358, src/trunk/abtTemplate.rb) =================================================================== --- src/trunk/abttemplate.rb (rev 0) +++ src/trunk/abttemplate.rb 2007-07-16 13:33:36 UTC (rev 362) @@ -0,0 +1,590 @@ +module RDoc +module Page + +FONTS = "\"Bitstream Vera Sans\", Verdana, Arial, Helvetica, sans-serif" + +STYLE = <<CSS +a { + color: #00F; + text-decoration: none; +} + +a:hover { + color: #77F; + text-decoration: underline; +} + +body, td, p { + font-family: %fonts%; + background: #FFF; + color: #000; + margin: 0px; + font-size: small; +} + +#content { + margin: 2em; +} + +#description p { + margin-bottom: 0.5em; +} + +.sectiontitle { + margin-top: 1em; + margin-bottom: 1em; + padding: 0.5em; + padding-left: 2em; + background: #005; + color: #FFF; + font-weight: bold; + border: 1px dotted black; +} + +.attr-rw { + padding-left: 1em; + padding-right: 1em; + text-align: center; + color: #055; +} + +.attr-name { + font-weight: bold; +} + +.attr-desc { +} + +.attr-value { + font-family: monospace; +} + +.file-title-prefix { + font-size: large; +} + +.file-title { + font-size: large; + font-weight: bold; + background: #005; + color: #FFF; +} + +.banner { + background: #005; + color: #FFF; + border: 1px solid black; + padding: 1em; +} + +.banner td { + background: transparent; + color: #FFF; +} + +h1 a, h2 a, .sectiontitle a, .banner a { + color: #FF0; +} + +h1 a:hover, h2 a:hover, .sectiontitle a:hover, .banner a:hover { + color: #FF7; +} + +.dyn-source { + display: none; + background: #FFE; + color: #000; + border: 1px dotted black; + margin: 0.5em 2em 0.5em 2em; + padding: 0.5em; +} + +.dyn-source .cmt { + color: #00F; + font-style: italic; +} + +.dyn-source .kw { + color: #070; + font-weight: bold; +} + +.method { + margin-left: 1em; + margin-right: 1em; + margin-bottom: 1em; +} + +.description pre { + padding: 0.5em; + border: 1px dotted black; + background: #FFE; +} + +.method .title { + font-family: monospace; + font-size: large; + border-bottom: 1px dashed black; + margin-bottom: 0.3em; + padding-bottom: 0.1em; +} + +.method .description, .method .sourcecode { + margin-left: 1em; +} + +.description p, .sourcecode p { + margin-bottom: 0.5em; +} + +.method .sourcecode p.source-link { + text-indent: 0em; + margin-top: 0.5em; +} + +.method .aka { + margin-top: 0.3em; + margin-left: 1em; + font-style: italic; + text-indent: 2em; +} + +h1 { + padding: 1em; + border: 1px solid black; + font-size: x-large; + font-weight: bold; + color: #FFF; + background: #007; +} + +h2 { + padding: 0.5em 1em 0.5em 1em; + border: 1px solid black; + font-size: large; + font-weight: bold; + color: #FFF; + background: #009; +} + +h3, h4, h5, h6 { + padding: 0.2em 1em 0.2em 1em; + border: 1px dashed black; + color: #000; + background: #AAF; +} + +.sourcecode > pre { + padding: 0.5em; + border: 1px dotted black; + background: #FFE; +} + +CSS + +XHTML_PREAMBLE = %{<?xml version="1.0" encoding="%charset%"?> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +} + +HEADER = XHTML_PREAMBLE + <<ENDHEADER +<html> + <head> + <title>%title%</title> + <meta http-equiv="Content-Type" content="text/html; charset=%charset%" /> + <link rel="stylesheet" href="%style_url%" type="text/css" media="screen" /> + + <script language="JavaScript" type="text/javascript"> + // <![CDATA[ + + function toggleSource( id ) + { + var elem + var link + + if( document.getElementById ) + { + elem = document.getElementById( id ) + link = document.getElementById( "l_" + id ) + } + else if ( document.all ) + { + elem = eval( "document.all." + id ) + link = eval( "document.all.l_" + id ) + } + else + return false; + + if( elem.style.display == "block" ) + { + elem.style.display = "none" + link.innerHTML = "show source" + } + else + { + elem.style.display = "block" + link.innerHTML = "hide source" + } + } + + function openCode( url ) + { + window.open( url, "SOURCE_CODE", "width=400,height=400,scrollbars=yes" ) + } + // ]]> + </script> + </head> + + <body> +ENDHEADER + +FILE_PAGE = <<HTML +<table border='0' cellpadding='0' cellspacing='0' width="100%" class='banner'> + <tr><td> + <table width="100%" border='0' cellpadding='0' cellspacing='0'><tr> + <td class="file-title" colspan="2"><span class="file-title-prefix">File</span><br />%short_name%</td> + <td align="right"> + <table border='0' cellspacing="0" cellpadding="2"> + <tr> + <td>Path:</td> + <td>%full_path% +IF:cvsurl + (<a href="%cvsurl%">CVS</a>) +ENDIF:cvsurl + </td> + </tr> + <tr> + <td>Modified:</td> + <td>%dtm_modified%</td> + </tr> + </table> + </td></tr> + </table> + </td></tr> +</table><br> +HTML + +################################################################### + +CLASS_PAGE = <<HTML +<table width="100%" border='0' cellpadding='0' cellspacing='0' class='banner'><tr> + <td class="file-title"><span class="file-title-prefix">%classmod%</span><br />%full_name%</td> + <td align="right"> + <table cellspacing=0 cellpadding=2> + <tr valign="top"> + <td>In:</td> + <td> +START:infiles +HREF:full_path_url:full_path: +IF:cvsurl + (<a href="%cvsurl%">CVS</a>) +ENDIF:cvsurl +END:infiles + </td> + </tr> +IF:parent + <tr> + <td>Parent:</td> + <td> +IF:par_url + <a href="%par_url%"> +ENDIF:par_url +%parent% +IF:par_url + </a> +ENDIF:par_url + </td> + </tr> +ENDIF:parent + </table> + </td> + </tr> + </table> +HTML + +################################################################### + +METHOD_LIST = <<HTML + <div id="content"> +IF:diagram + <table cellpadding='0' cellspacing='0' border='0' width="100%"><tr><td align="center"> + %diagram% + </td></tr></table> +ENDIF:diagram + +IF:description + <div class="description">%description%</div> +ENDIF:description + +IF:requires + <div class="sectiontitle">Required Files</div> + <ul> +START:requires + <li>HREF:aref:name:</li> +END:requires + </ul> +ENDIF:requires + +IF:toc + <div class="sectiontitle">Contents</div> + <ul> +START:toc + <li><a href="#%href%">%secname%</a></li> +END:toc + </ul> +ENDIF:toc + +IF:methods + <div class="sectiontitle">Methods</div> + <ul> +START:methods + <li>HREF:aref:name:</li> +END:methods + </ul> +ENDIF:methods + +IF:includes +<div class="sectiontitle">Included Modules</div> +<ul> +START:includes + <li>HREF:aref:name:</li> +END:includes +</ul> +ENDIF:includes + +START:sections +IF:sectitle +<div class="sectiontitle"><a name="%secsequence%">%sectitle%</a></div> +IF:seccomment +<div class="description"> +%seccomment% +</div> +ENDIF:seccomment +ENDIF:sectitle + +IF:classlist + <div class="sectiontitle">Classes and Modules</div> + %classlist% +ENDIF:classlist + +IF:constants + <div class="sectiontitle">Constants</div> + <table border='0' cellpadding='5'> +START:constants + <tr valign='top'> + <td class="attr-name">%name%</td> + <td>=</td> + <td class="attr-value">%value%</td> + </tr> +IF:desc + <tr valign='top'> + <td> </td> + <td colspan="2" class="attr-desc">%desc%</td> + </tr> +ENDIF:desc +END:constants + </table> +ENDIF:constants + +IF:attributes + <div class="sectiontitle">Attributes</div> + <table border='0' cellpadding='5'> +START:attributes + <tr valign='top'> + <td class='attr-rw'> +IF:rw +[%rw%] +ENDIF:rw + </td> + <td class='attr-name'>%name%</td> + <td class='attr-desc'>%a_desc%</td> + </tr> +END:attributes + </table> +ENDIF:attributes + +IF:method_list +START:method_list +IF:methods +<div class="sectiontitle">%type% %category% methods</div> +START:methods +<div class="method"> + <div class="title"> +IF:callseq + <a name="%aref%"></a><b>%callseq%</b> +ENDIF:callseq +IFNOT:callseq + <a name="%aref%"></a><b>%name%</b>%params% +ENDIF:callseq +IF:codeurl +[ <a href="javascript:openCode('%codeurl%')">source</a> ] +ENDIF:codeurl + </div> +IF:m_desc + <div class="description"> + %m_desc% + </div> +ENDIF:m_desc +IF:aka +<div class="aka"> + This method is also aliased as +START:aka + <a href="%aref%">%name%</a> +END:aka +</div> +ENDIF:aka +IF:sourcecode +<div class="sourcecode"> + <p class="source-link">[ <a href="javascript:toggleSource('%aref%_source')" id="l_%aref%_source">show source</a> ]</p> + <div id="%aref%_source" class="dyn-source"> +<pre> +%sourcecode% +</pre> + </div> +</div> +ENDIF:sourcecode +</div> +END:methods +ENDIF:methods +END:method_list +ENDIF:method_list +END:sections +</div> +HTML + +FOOTER = <<ENDFOOTER + </body> +</html> +ENDFOOTER + +BODY = HEADER + <<ENDBODY + !INCLUDE! <!-- banner header --> + + <div id="bodyContent"> + #{METHOD_LIST} + </div> + + #{FOOTER} +ENDBODY + +########################## Source code ########################## + +SRC_PAGE = XHTML_PREAMBLE + <<HTML +<html> +<head><title>%title%</title> +<meta http-equiv="Content-Type" content="text/html; charset=%charset%"> +<style> +.ruby-comment { color: green; font-style: italic } +.ruby-constant { color: #4433aa; font-weight: bold; } +.ruby-identifier { color: #222222; } +.ruby-ivar { color: #2233dd; } +.ruby-keyword { color: #3333FF; font-weight: bold } +.ruby-node { color: #777777; } +.ruby-operator { color: #111111; } +.ruby-regexp { color: #662222; } +.ruby-value { color: #662222; font-style: italic } + .kw { color: #3333FF; font-weight: bold } + .cmt { color: green; font-style: italic } + .str { color: #662222; font-style: italic } + .re { color: #662222; } +</style> +</head> +<body bgcolor="white"> +<pre>%code%</pre> +</body> +</html> +HTML + +########################## Index ################################ + +FR_INDEX_BODY = <<HTML +!INCLUDE! +HTML + +FILE_INDEX = XHTML_PREAMBLE + <<HTML +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=%charset%"> +<style> +<!-- + body { + background-color: #EEE; + font-family: #{FONTS}; + color: #000; + margin: 0px; + } + .banner { + background: #005; + color: #FFF; + padding: 0.2em; + font-size: small; + font-weight: bold; + text-align: center; + } + .entries { + margin: 0.25em 1em 0 1em; + font-size: x-small; + } + a { + color: #00F; + text-decoration: none; + white-space: nowrap; + } + a:hover { + color: #77F; + text-decoration: underline; + } +--> +</style> +<base target="docwin"> +</head> +<body> +<div class="banner">%list_title%</div> +<div class="entries"> +START:entries +<a href="%href%">%name%</a><br> +END:entries +</div> +</body></html> +HTML + +CLASS_INDEX = FILE_INDEX +METHOD_INDEX = FILE_INDEX + +INDEX = XHTML_PREAMBLE + <<HTML +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head> + <title>%title%</title> + <meta http-equiv="Content-Type" content="text/html; charset=%charset%"> +</head> + +<frameset cols="20%,*"> + <frameset rows="15%,35%,50%"> + <frame src="fr_file_index.html" title="Files" name="Files" /> + <frame src="fr_class_index.html" name="Classes" /> + <frame src="fr_method_index.html" name="Methods" /> + </frameset> +IF:inline_source + <frame src="%initial_page%" name="docwin"> +ENDIF:inline_source +IFNOT:inline_source + <frameset rows="80%,20%"> + <frame src="%initial_page%" name="docwin"> + <frame src="blank.html" name="source"> + </frameset> +ENDIF:inline_source + <noframes> + <body bgcolor="white"> + Click <a href="html/index.html">here</a> for a non-frames + version of this page. + </body> + </noframes> +</frameset> + +</html> +HTML + +end +end + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <esc...@us...> - 2007-07-16 13:34:11
|
Revision: 363 http://svn.sourceforge.net/abtlinux/?rev=363&view=rev Author: eschabell Date: 2007-07-16 06:34:14 -0700 (Mon, 16 Jul 2007) Log Message: ----------- Migrated test suite file to rubified file name. Added Paths: ----------- src/trunk/testsuiteabt.rb Removed Paths: ------------- src/trunk/testSuiteAbt.rb Deleted: src/trunk/testSuiteAbt.rb =================================================================== --- src/trunk/testSuiteAbt.rb 2007-07-16 13:33:36 UTC (rev 362) +++ src/trunk/testSuiteAbt.rb 2007-07-16 13:34:14 UTC (rev 363) @@ -1,32 +0,0 @@ -#!/usr/bin/ruby -w - -if ( Process.uid != 0 ) - puts "Enter root password:" - system( 'su -c ./testSuiteAbt.rb root' ) - exit -end - -require 'test/unit' -require 'abtconfig' - -# By ensuring an install of the test package ipc -# is done prior to running unit tests, we are able -# to ensure that all needed directories, logs, etc -# are created prior to running the tests. If ipc is -# already installed, this process is not repleated. -# -# This speeds up the test suit by more than 10 sec -# on my machine. I get avg runs of around 17,5 sec. -# -logger = AbtLogManager.new -manager = AbtPackageManager.new -manager.installPackage( "ipc" ) - -require 'testabtpackagemanager' -require 'testabtlogmanager' -require 'testabtdownloadmanager' -require 'testabtpackage' -require 'testabtqueuemanager' -require 'testabtreportmanager' -require 'testabtsystemmanager' -require 'testabtdepengine' Copied: src/trunk/testsuiteabt.rb (from rev 359, src/trunk/testSuiteAbt.rb) =================================================================== --- src/trunk/testsuiteabt.rb (rev 0) +++ src/trunk/testsuiteabt.rb 2007-07-16 13:34:14 UTC (rev 363) @@ -0,0 +1,32 @@ +#!/usr/bin/ruby -w + +if ( Process.uid != 0 ) + puts "Enter root password:" + system( 'su -c ./testSuiteAbt.rb root' ) + exit +end + +require 'test/unit' +require 'abtconfig' + +# By ensuring an install of the test package ipc +# is done prior to running unit tests, we are able +# to ensure that all needed directories, logs, etc +# are created prior to running the tests. If ipc is +# already installed, this process is not repleated. +# +# This speeds up the test suit by more than 10 sec +# on my machine. I get avg runs of around 17,5 sec. +# +logger = AbtLogManager.new +manager = AbtPackageManager.new +manager.installPackage( "ipc" ) + +require 'testabtpackagemanager' +require 'testabtlogmanager' +require 'testabtdownloadmanager' +require 'testabtpackage' +require 'testabtqueuemanager' +require 'testabtreportmanager' +require 'testabtsystemmanager' +require 'testabtdepengine' This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <esc...@us...> - 2007-07-16 20:22:28
|
Revision: 367 http://svn.sourceforge.net/abtlinux/?rev=367&view=rev Author: eschabell Date: 2007-07-16 13:22:31 -0700 (Mon, 16 Jul 2007) Log Message: ----------- Massive refactoring of the abt api method names, coverted all occurances to ruby standard naming (lowercase names with underscores for word separation). Modified Paths: -------------- src/trunk/abt.rb src/trunk/abtdownloadmanager.rb src/trunk/abtlogmanager.rb src/trunk/abtpackage.rb src/trunk/abtpackagemanager.rb src/trunk/abtqueuemanager.rb src/trunk/abtreportmanager.rb src/trunk/abtsystemmanager.rb src/trunk/abtusage.rb src/trunk/testabtdepengine.rb src/trunk/testabtdownloadmanager.rb src/trunk/testabtlogmanager.rb src/trunk/testabtpackage.rb src/trunk/testabtpackagemanager.rb src/trunk/testabtqueuemanager.rb src/trunk/testabtreportmanager.rb src/trunk/testabtsystemmanager.rb src/trunk/testsuiteabt.rb Modified: src/trunk/abt.rb =================================================================== --- src/trunk/abt.rb 2007-07-16 14:28:21 UTC (rev 366) +++ src/trunk/abt.rb 2007-07-16 20:22:31 UTC (rev 367) @@ -42,7 +42,7 @@ end # login as root for the rest. -manager.rootLogin( ARGV ) +manager.root_login( ARGV ) # parse arguments. case ARGV[0] @@ -51,25 +51,25 @@ when "install", "-i" if ( ARGV.length == 2 && File.exist?( "#{$PACKAGE_PATH}#{ARGV[1]}.rb" ) ) options['package'] = ARGV[1] - logger.logToJournal( "Starting to install #{options['package']}" ) + logger.to_journal( "Starting to install #{options['package']}" ) # return if already installed. require "#{$PACKAGE_PATH}#{options['package']}" sw = eval( "#{options['package'].capitalize}.new" ) - if ( manager.installPackage( options['package'] ) ) + if ( manager.install_package( options['package'] ) ) puts "\n\n" puts "*** Completed install of #{options['package']}. ***" puts "\n\n" - logger.logToJournal( "Completed install of #{options['package']}." ) + logger.to_journal( "Completed install of #{options['package']}." ) - if ( logger.cachePackage( options['package'] ) ) + if ( logger.cache_package( options['package'] ) ) puts "\n\n" puts "*** Completed caching of package #{options['package']}. ***" puts "\n\n" - logger.logToJournal( "\nCaching completed for package #{options['package']}." ) + logger.to_ournal( "\nCaching completed for package #{options['package']}." ) else - logger.logToJournal( "\nCaching of package #{options['package']} failed.") + logger.to_journal( "\nCaching of package #{options['package']} failed.") end else puts "*** #{options['package'].capitalize} install failed, " + @@ -143,10 +143,10 @@ when "show-details" if ( ARGV.length == 2 && File.exist?( $PACKAGE_PATH + ARGV[1] + ".rb" ) ) options['pkg'] = ARGV[1] - logger.logToJournal( "Starting show details for #{options['pkg']}" ) + logger.to_journal( "Starting show details for #{options['pkg']}" ) - if ( reporter.showPackageDetails( options['pkg'] ) ) - logger.logToJournal( "Completed show details for #{options['pkg']}" ) + if ( reporter.show_package_details( options['pkg'] ) ) + logger.to_journal( "Completed show details for #{options['pkg']}" ) else puts "Problems processing the details for #{options['pkg']}." end @@ -205,10 +205,10 @@ # abt show-journal when "show-journal" - reporter.showJournal( $JOURNAL ) + reporter.show_journal( $JOURNAL ) when "show-iqueue" - reporter.showQueue( "install" ) + reporter.show_queue( "install" ) when "show-patches" puts "Display currently available patches for installed package tree." @@ -225,45 +225,45 @@ # abt news | -n when "news", "-n" - logger.logToJournal( "Starting to retrieve AbTLinux news." ) + logger.to_journal( "Starting to retrieve AbTLinux news." ) # abtlinux.org news feeds. puts "\n" - if ( !downloader.retrieveNewsFeed( $ABTNEWS ) ) + if ( !downloader.retrieve_news_feed( $ABTNEWS ) ) puts "Failed to retrieve the AbTLinux news feed." end puts "\n" - if ( !downloader.retrieveNewsFeed( $ABTNEWS_THREADS, false ) ) + if ( !downloader.retrieve_news_feed( $ABTNEWS_THREADS, false ) ) puts "Failed to retrieve the AbTLinux forum threads news feed." end puts "\n" - if ( !downloader.retrieveNewsFeed( $ABTNEWS_POSTS, false ) ) + if ( !downloader.retrieve_news_feed( $ABTNEWS_POSTS, false ) ) puts "Failed to retrieve the AbTLinux new posts news feed." end # display the file contents. - reporter.showJournal( $ABTNEWS_LOG ) + reporter.show_journal( $ABTNEWS_LOG ) - logger.logToJournal( "Completed the retrieval of AbTLinux news." ) + logger.to_journal( "Completed the retrieval of AbTLinux news." ) # abt [-d | download ] <package> when "download", "-d" if ( ARGV.length == 2 && File.exist?( $PACKAGE_PATH + ARGV[1] + ".rb" ) ) options['pkg'] = ARGV[1] - logger.logToJournal( "Starting to download " + options['pkg'] ) + logger.to_journal( "Starting to download " + options['pkg'] ) manager = AbtDownloadManager.new - if ( manager.retrievePackageSource( options['pkg'], $SOURCES_REPOSITORY ) ) - logger.logToJournal( "Finished download for " + options['pkg'] ) + if ( manager.retrieve_package_source( options['pkg'], $SOURCES_REPOSITORY ) ) + logger.to_journal( "Finished download for " + options['pkg'] ) puts "\n"; print "Downloading of #{options['pkg']} to #{$SOURCES_REPOSITORY} " puts "completed." puts "\n\n" else - logger.logToJournal( "FAILURE to download " + options['pkg'] ) + logger.to_journal( "FAILURE to download " + options['pkg'] ) puts "\n" puts "DOWNLOADING - failed to download source for #{options['pkg']}" puts "\n\n" Modified: src/trunk/abtdownloadmanager.rb =================================================================== --- src/trunk/abtdownloadmanager.rb 2007-07-16 14:28:21 UTC (rev 366) +++ src/trunk/abtdownloadmanager.rb 2007-07-16 20:22:31 UTC (rev 367) @@ -53,19 +53,19 @@ # <b>RETURN</b> <i>boolean</i> - True if the package source has been # downloaded, otherwise false. ## - def retrievePackageSource( packageName, destination ) + def retrieve_package_source( packageName, destination ) require "#{$PACKAGE_PATH}#{packageName}" logger = AbtLogManager.new package = eval( packageName.capitalize + '.new' ) if ( File.exist?( "#{destination}/#{File.basename( package.srcUrl )}" ) ) - logger.logToJournal( "Download not needed, existing source found for #{packageName}" ) + logger.to_journal( "Download not needed, existing source found for #{packageName}" ) return true end Dir.chdir( destination ) if ( system( "wget #{package.srcUrl}" ) ) - logger.logToJournal( "Download completed for #{packageName}" ) + logger.to_journal( "Download completed for #{packageName}" ) return true end @@ -80,7 +80,7 @@ # <b>RETURN</b> <i>boolean</i> - True if the package tree is retrieved, # otherwise false. ## - def retrievePackageTree( packageTreeName ) + def retrieve_package_tree( packageTreeName ) end ## @@ -92,7 +92,7 @@ # <b>RETURN</b> <i>boolean</i> - True if the AbTLinux news feed has been # retrieved, otherwise false. ## - def retrieveNewsFeed( uri, cleanLog=true ) + def retrieve_news_feed( uri, cleanLog=true ) require 'net/http' require 'uri' require 'rss/1.0' @@ -109,7 +109,7 @@ # pick up the abtlinux.org news feed. if ( !news = Net::HTTP.get( URI.parse( uri ) ) ) - logger.logToJournal( "Failed to retrieve news feed #{uri}." ) + logger.to_journal( "Failed to retrieve news feed #{uri}." ) return false end @@ -121,7 +121,7 @@ end if ( rss.nil? ) - logger.logToJournal( "Failed to display news feed as feed #{uri} " + + logger.to_journal( "Failed to display news feed as feed #{uri} " + "is not RSS 1.0/2.0." ) return false else @@ -147,7 +147,7 @@ # <b>RETURN</b> <i>boolean</i> - True if the given package has been updated, # otherwise false. ## - def updatePackage + def update_package end ## @@ -156,7 +156,7 @@ # <b>RETURN</b> <i>boolean</i> - True if the package tree has been updated, # otherwise false. ## - def updatePackageTree + def update_package_tree end end Modified: src/trunk/abtlogmanager.rb =================================================================== --- src/trunk/abtlogmanager.rb 2007-07-16 14:28:21 UTC (rev 366) +++ src/trunk/abtlogmanager.rb 2007-07-16 20:22:31 UTC (rev 367) @@ -38,7 +38,7 @@ # # <b>RETURN</b> <i>String</i> - Full path to install log. ## - def getLog( package, type ) + def get_log( package, type ) require "#{$PACKAGE_PATH}#{package}" sw = eval( "#{package.capitalize}.new" ) details = sw.details @@ -84,7 +84,7 @@ if ( ! File.directory?( dir ) ) FileUtils.mkdir_p( dir ) - logToJournal << "Created directory: #{dir}." + to_journal << "Created directory: #{dir}." end } end @@ -99,14 +99,14 @@ # <b>RETURN</b> <i>boolean</i> - True if integrity log created successfully, # otherwise false. ## - def logPackageIntegrity( package ) + def log_package_integrity( package ) #require "#{$PACKAGE_PATH}#{package}" #sw = eval( "#{package.capitalize}.new" ) #details = sw.details # our log locations. - installLog = getLog( package, 'install' ) - integrityLog = getLog( package, 'integrity' ) + installLog = get_log( package, 'install' ) + integrityLog = get_log( package, 'integrity' ) # get the installed files from the tmp file # into our install log. @@ -139,15 +139,14 @@ # <b>RETURN</b> <i>boolean</i> - True if install log created successfully, # otherwise false. ## - def logPackageInstall( package ) + def log_package_install( package ) # some dirs we will not add to an install log. - excluded_pattern = - Regexp.new( "^(/dev|/proc|/tmp|/var/tmp|/usr/src|/sys)+" ) + excluded_pattern = Regexp.new( "^(/dev|/proc|/tmp|/var/tmp|/usr/src|/sys)+" ) badLine = false # used to mark excluded lines from installwatch log. # our log locations. - installLog = getLog( package, 'install' ) - tmpInstallLog = getLog( package, 'tmpinstall' ) + installLog = get_log( package, 'install' ) + tmpInstallLog = get_log( package, 'tmpinstall' ) # get the installed files from the tmp file # into our install log. @@ -166,7 +165,7 @@ end if ( !badLine ) - #self.logToJournal( "DEBUG: adding line to installFile!") + #self.to_journal( "DEBUG: adding line to installFile!") installFile << "#{line.split[2]}\n" end end @@ -187,8 +186,8 @@ # <b>RETURN</b> <i>boolean</i> - True if build log created successfully, # otherwise false. ## - def logPackageBuild( package ) - buildLog = getLog( package, 'build' ) + def log_package_build( package ) + buildLog = get_log( package, 'build' ) # make sure the build file exists. if ( !File.exist?( buildLog ) ) @@ -207,18 +206,18 @@ # <b>RETURN</b> <i>boolean</i> - True if package cache created successfully, # otherwise false. ## - def cachePackage( package ) + def cache_package( package ) system = AbtSystemManager.new - if ( system.packageInstalled( package ) ) + if ( system.package_installed( package ) ) sw = eval( "#{package.capitalize}.new" ) cachedDir = $PACKAGE_CACHED + "/" + sw.srcDir sourcePath = $SOURCES_REPOSITORY + "/" + File.basename( sw.srcUrl ) sourceFile = File.basename( sw.srcUrl ) - installLog = getLog( package, 'install' ) - buildLog = getLog( package, 'install' ) - configureLog = getLog( package, 'install' ) - integrityLog = getLog( package, 'install' ) + installLog = get_log( package, 'install' ) + buildLog = get_log( package, 'install' ) + configureLog = get_log( package, 'install' ) + integrityLog = get_log( package, 'install' ) packageFile = "#{$PACKAGE_PATH}#{package}.rb" @@ -293,7 +292,7 @@ # # <b>RETURN</b> <i>boolean</i> True if logged, otherwise false. ## - def logToJournal( message ) + def to_journal( message ) if ( log = File.new( $JOURNAL, "a+" ) ) log << "#{$TIMESTAMP} : #{message}\n" log.close Modified: src/trunk/abtpackage.rb =================================================================== --- src/trunk/abtpackage.rb 2007-07-16 14:28:21 UTC (rev 366) +++ src/trunk/abtpackage.rb 2007-07-16 20:22:31 UTC (rev 367) @@ -37,7 +37,7 @@ # <b>RETURNS:</b> <i>boolean</i> - True if the completes sucessfully, # otherwise false. ## - def unpackSources + def unpack_sources srcFile = File.basename( @srcUrl ) sourcesToUnpack = "#{$SOURCES_REPOSITORY}/#{srcFile}" unpackTool = "" @@ -76,11 +76,7 @@ # unsupported format. return false end - - # DEBUG: - #logger = AbtLogManager.new - #logger.logToJournal( "DEBUG: unpack tool will be '#{unpackTool}'." ) - + Dir.chdir( $BUILD_LOCATION ) if ( !system( "#{unpackTool} #{sourcesToUnpack}" ) ) return false @@ -208,12 +204,12 @@ downloader = AbtDownloadManager.new # download sources. - if ( !downloader.retrievePackageSource( @name.downcase, $SOURCES_REPOSITORY ) ) + if ( !downloader.retrieve_package_source( @name.downcase, $SOURCES_REPOSITORY ) ) return false end # unpack sources. - if ( !self.unpackSources ) + if ( !unpack_sources ) return false end @@ -244,11 +240,9 @@ ## def configure( verbose=true ) if ( verbose ) - command = "./configure --prefix=#{$DEFAULT_PREFIX} | tee " + - "#{$PACKAGE_INSTALLED}/#{@srcDir}/#{@srcDir}.configure" + command = "./configure --prefix=#{$DEFAULT_PREFIX} | tee #{$PACKAGE_INSTALLED}/#{@srcDir}/#{@srcDir}.configure" else - command = "./configure --prefix=#{$DEFAULT_PREFIX} 1> " + - "#{$PACKAGE_INSTALLED}/#{@srcDir}/#{@srcDir}.configure 2>&1" + command = "./configure --prefix=#{$DEFAULT_PREFIX} 1> #{$PACKAGE_INSTALLED}/#{@srcDir}/#{@srcDir}.configure 2>&1" end Dir.chdir( "#{$BUILD_LOCATION}/#{@srcDir}" ) @@ -359,7 +353,7 @@ # <b>RETURNS:</b> <i>boolean</i> - True if the completes sucessfully, # otherwise false. ## - def removeBuild + def remove_build puts "Removings build..." if ( $REMOVE_BUILD_SOURCES ) buildSourcesLocation = "#{$BUILD_LOCATION}/#{srcDir}" Modified: src/trunk/abtpackagemanager.rb =================================================================== --- src/trunk/abtpackagemanager.rb 2007-07-16 14:28:21 UTC (rev 366) +++ src/trunk/abtpackagemanager.rb 2007-07-16 20:22:31 UTC (rev 367) @@ -42,7 +42,7 @@ # <b>RETURN</b> <i>boolean</i> - True if the action rolls back, otherwise # false. ## - def rollBack( type, details ) + def roll_back( type, details ) logFile = "#{$PACKAGE_INSTALLED}/#{details['Source location']}/" case type @@ -93,11 +93,11 @@ # <b>RETURN</b> <i>boolean</i> - True if the package is installed, otherwise # false. ## - def installPackage( package, verbose=true ) + def install_package( package, verbose=true ) # first check if installed. system = AbtSystemManager.new - if ( system.packageInstalled( package ) ) + if ( system.package_installed( package ) ) puts "\n*** Package #{package} is installed, might want to try reinstall? ***" puts "'abt reinstall #{package}'" return true @@ -116,8 +116,8 @@ # add to install queue. puts "\n*** Adding #{package} to the INSTALL QUEUE. ***" if ( verbose ) - if ( !queuer.actionPackageQueue( package, "install", "add" ) ) - logger.logToJournal( "Failed to add #{package} to install queue." ) + if ( !queuer.action_package_queue( package, "install", "add" ) ) + logger.to_journal( "Failed to add #{package} to install queue." ) return false end @@ -125,48 +125,48 @@ puts "\n*** Processing the PRE section for #{package}. ***" if (verbose ) if ( !sw.pre ) - logger.logToJournal( "Failed to process pre-section in the " + + logger.to_journal( "Failed to process pre-section in the " + "package description of #{package}." ) return false else - logger.logToJournal( "DEBUG: finished #{package} pre section." ) + logger.to_journal( "DEBUG: finished #{package} pre section." ) end # configure section. puts "\n*** Processing the CONFIGURE section for #{package}. ***" if ( verbose ) if ( !sw.configure( verbose ) ) - logger.logToJournal( "Failed to process configure section in the " + + logger.to_journal( "Failed to process configure section in the " + "package description of #{package}." ) return false else - logger.logToJournal( "DEBUG: finished #{package} configure section." ) + logger.to_journal( "DEBUG: finished #{package} configure section." ) end # build section. puts "\n*** Processing the BUILD section for #{package}. ***" if ( verbose ) if ( !sw.build( verbose ) ) - logger.logToJournal( "Failed to process build section in the " + + logger.to_journal( "Failed to process build section in the " + "package description of #{package}." ) return false else - if ( !logger.logPackageBuild( sw.name.downcase ) ) - logger.logToJournal( "Failed to create a package build log." ) + if ( !logger.log_package_build( sw.name.downcase ) ) + logger.to_journal( "Failed to create a package build log." ) return false end - logger.logToJournal( "DEBUG: finished #{package} build section." ) + logger.to_journal( "DEBUG: finished #{package} build section." ) end # preinstall section. puts "\n*** Processing the PREINSTALL section for #{package}. ***" if ( verbose ) if ( !sw.preinstall ) - logger.logToJournal( "Failed to process preinstall section in the " + + logger.to_journal( "Failed to process preinstall section in the " + "package description of #{package}." ) return false else - logger.logToJournal( "DEBUG: finished #{package} preinstall section." ) + logger.to_journal( "DEBUG: finished #{package} preinstall section." ) end # install section. @@ -174,47 +174,43 @@ if ( !sw.install ) # rollback installed files if any and remove install log. - logger.logToJournal( "Failed to process install section in the " + + logger.to_journal( "Failed to process install section in the " + "package description of #{package}." ) - logger.logPackageInstall( sw.name.downcase ) - logger.logToJournal( - "***Starting rollback of #{package} install and removing install log." ) - self.rollBack( "install", details ) + logger.log_package_install( sw.name.downcase ) + logger.to_journal( "***Starting rollback of #{package} install and removing install log." ) + roll_back( "install", details ) return false else - logger.logPackageInstall( sw.name.downcase ) - logger.logPackageIntegrity( sw.name.downcase ) + logger.log_package_install( sw.name.downcase ) + logger.log_package_integrity( sw.name.downcase ) # cleanup tmp files from installwatch. File.delete( "#{$ABT_TMP}/#{details['Source location']}.watch" ) - logger.logToJournal( "DEBUG: finished #{package} install section." ) + logger.to_journal( "DEBUG: finished #{package} install section." ) end # post section. puts "\n*** Processing the POST section for #{package}. ***" if ( verbose ) if ( !sw.post ) - logger.logToJournal( "Failed to process post section in the " + - "package description of #{package}." ) + logger.to_journal( "Failed to process post section in the package description of #{package}." ) return false else - logger.logToJournal( "DEBUG: finished #{package} post section." ) + logger.to_journal( "DEBUG: finished #{package} post section." ) end # clean out build sources. puts "\n*** Cleaning up the sources for #{package}. ***" if ( verbose ) - if ( !sw.removeBuild ) - logger.logToJournal( "Failed to remove the build sources for " + - "#{package}." ) + if ( !sw.remove_build ) + logger.to_journal( "Failed to remove the build sources for #{package}." ) #return false # commented out as this is not a reason to fail. end # remove pacakge from install queue. - if ( !queuer.actionPackageQueue( sw.name.downcase, "install", "remove" ) ) - logger.logToJournal( "Failed to remove #{sw.name.donwcase} " + - "from install queue." ) + if ( !queuer.action_package_queue( sw.name.downcase, "install", "remove" ) ) + logger.to_journal( "Failed to remove #{sw.name.donwcase} from install queue." ) end return true # install completed! @@ -228,7 +224,7 @@ # <b>RETURN</b> <i>boolean</i> - True if the package is reinstalled, # otherwise false. ## - def reinstallPackage( package ) + def reinstall_package( package ) end ## @@ -239,7 +235,7 @@ # <b>RETURN</b> <i>boolean</i> - True if the package is removed, otherwise # false. ## - def removePackage( package ) + def remove_package( package ) end ## @@ -252,7 +248,7 @@ # <b>RETURN</b> <i>boolean</i> - True if the package is downgraded, otherwise # false. ## - def downgradePackage( package, version ) + def downgrade_package( package, version ) end ## @@ -264,7 +260,7 @@ # <b>RETURN</b> <i>boolean</i> - True if the package is frozen, otherwise # false. ## - def freezePackage( package ) + def freeze_package( package ) end ## @@ -274,7 +270,7 @@ # # <b>RETURN</b> <i>void</i> ## - def rootLogin( arguments ) + def root_login( arguments ) if ( Process.uid != 0 ) args = "" puts "\nEnter root password:" Modified: src/trunk/abtqueuemanager.rb =================================================================== --- src/trunk/abtqueuemanager.rb 2007-07-16 14:28:21 UTC (rev 366) +++ src/trunk/abtqueuemanager.rb 2007-07-16 20:22:31 UTC (rev 367) @@ -51,7 +51,7 @@ # # <b>RETURN</b> <i>boolean</i> - true if action succeeds, otherwise false. ## - def actionPackageQueue( package, queue, action="add" ) + def action_package_queue( package, queue, action="add" ) require 'fileutils' logger = AbtLogManager.new queueFile = "" # used to hold the queue location. @@ -65,8 +65,7 @@ if ( action == "add") if ( - log = File.new( - queueFile, File::WRONLY|File::APPEND|File::CREAT, 0644 ) ) + log = File.new( queueFile, File::WRONLY|File::APPEND|File::CREAT, 0644 ) ) # pickup queue contents to ensure no duplicates. checkingQueue = IO.readlines( queueFile ) @@ -75,9 +74,9 @@ !checkingQueue.collect{ |i| i.split( '|' )[0] }.include?( package ) ) log.puts "#{package}|#{$TIMESTAMP}" - logger.logToJournal( "Added #{package} to #{queue} queue." ) + logger.to_journal( "Added #{package} to #{queue} queue." ) else - logger.logToJournal( + logger.to_journal( "Did not add #{package} to #{queue}, already exists." ) end @@ -89,8 +88,7 @@ if ( action == "remove" ) # remove entry from given queue. if ( - log = File.new( - queueFile, File::WRONLY|File::APPEND|File::CREAT, 0644 ) ) + log = File.new( queueFile, File::WRONLY|File::APPEND|File::CREAT, 0644 ) ) # use temp file to filter out entry to be removed. temp = File.new(queueFile + ".tmp", "a+") @@ -110,7 +108,7 @@ return true end - logger.logToJournal( "Failed to open #{queueFile}." ) + logger.to_journal( "Failed to open #{queueFile}." ) return false end end Modified: src/trunk/abtreportmanager.rb =================================================================== --- src/trunk/abtreportmanager.rb 2007-07-16 14:28:21 UTC (rev 366) +++ src/trunk/abtreportmanager.rb 2007-07-16 20:22:31 UTC (rev 367) @@ -50,7 +50,7 @@ # <b>RETURN</b> <i>boolean</i> - True if completes without error, # otherwise false. ## - def showPackageDetails( package ) + def show_package_details( package ) require "#{$PACKAGE_PATH}#{package}" if ( package = eval( "#{package.capitalize}.new" ) ) @@ -86,8 +86,7 @@ return true end - logger.logToJournal( "[AbtReportManger::showPackageDetails] - failed" + - "to show details for ${package}." ) + logger.to_journal( "[AbtReportManger::showPackageDetails] - failed to show details for ${package}." ) return false end @@ -96,7 +95,7 @@ # # <b>RETURN</b> <i>void.</i> ## - def showInstalledPackages + def show_installed_packages end ## @@ -109,7 +108,7 @@ # # <b>RETURN</b> <i>void.</i> ## - def showPackageLog( package, logType ) + def show_package_log( package, logType ) # install log # build log # integrity log @@ -120,7 +119,7 @@ # # <b>RETURN</b> <i>void.</i> ## - def showFrozenPackages + def show_frozen_packages end ## @@ -133,7 +132,7 @@ # <b>RETURN</b> <i>hash</i> - Empty hash if no problems found, otherwise # hash of problem files and their encountered errors. ## - def showPackageDependencies( package ) + def show_package_dependencies( package ) end ## @@ -143,7 +142,7 @@ # # <b>RETURN</b> <i>void.</i> ## - def showUntrackedFiles + def show_untracked_files end ## @@ -153,7 +152,7 @@ # # <b>RETURN</b> <i>iboolean</i> True if journal shown, otherwise false. ## - def showJournal( fileName ) + def show_journal( fileName ) if ( File.exist?( fileName ) ) puts "\n\n" puts "AbTLinux log:" @@ -178,7 +177,7 @@ # # <b>RETURN</b> <i>void.</i> ## - def showFileOwner( file ) + def show_file_owner( file ) end ## @@ -190,7 +189,7 @@ # <b>RETURN</b> <i>hash</i> - a hash of the search results, keys are package # names and values are matching descriptions. ## - def searchPackageDescriptions( searchText ) + def search_package_descriptions( searchText ) end ## @@ -201,7 +200,7 @@ # # <b>RETURN</b> <i>void.</i> ## - def showQueue( queueType ) + def show_queue( queueType ) case queueType @@ -233,7 +232,7 @@ # <b>RETURN</b> <i>boolean</i> - True if completes without error, otherwise # false. ## - def showUpdates( target ) + def show_updates( target ) end ## @@ -241,7 +240,6 @@ # # <b>RETURN</b> <i>void.</i> ## - def generateHTMLPackageListing - end - + def generate_HTML_package_listing + end end Modified: src/trunk/abtsystemmanager.rb =================================================================== --- src/trunk/abtsystemmanager.rb 2007-07-16 14:28:21 UTC (rev 366) +++ src/trunk/abtsystemmanager.rb 2007-07-16 20:22:31 UTC (rev 367) @@ -41,7 +41,7 @@ # <b>RETURN</b> <i>boolean</i> - True if entry found in given directory, # otherwise false. ## - def foundEntry( directory, name ) + def found_entry( directory, name ) Find.find( directory ) do |path| Find.prune if [".", ".."].include? path @@ -75,7 +75,7 @@ # <b>RETURN</b> <i>boolean</i> - True if completes without error, otherwise # false. ## - def cleanupPackageSources + def cleanup_package_sources end ## @@ -84,7 +84,7 @@ # <b>RETURN</b> <i>boolean</i> - True if completes without error, otherwise # false. ## - def cleanupLogs + def cleanup_logs end ## @@ -95,7 +95,7 @@ # <b>RETURN</b> <i>boolean</i> - True if no installed files are missing, # otherwise false. ## - def verifyInstalledFiles( package ) + def verify_installed_files( package ) end ## @@ -106,7 +106,7 @@ # <b>RETURN</b> <i>boolean</i> - True if no symlinks found missing # or broken, otherwise false. ## - def verifySymlinks( package ) + def verify_symlinks( package ) end ## @@ -117,7 +117,7 @@ # <b>RETURN</b> <i>boolean</i> - True if dependencies intact, otherwise # false. ## - def verifyPackageDepends( package ) + def verify_package_depends( package ) end ## @@ -129,7 +129,7 @@ # <b>RETURN</b> <i>hash</i> - Empty hash if no problems found, otherwise # hash of problem files and their encountered errors. ## - def verifyPackageIntegrity( package ) + def verify_package_integrity( package ) end ## @@ -140,7 +140,7 @@ # <b>RETURN</b> <i>boolean</i> - True if completes without error, otherwise # false. ## - def fixPackage( package ) + def fix_package( package ) end ## @@ -151,7 +151,7 @@ # # <b>RETURN</b> <i>boolean</i> - True if the URI is set, otherwise false. ## - def setCentralRepo( uri ) + def set_central_repo( uri ) end ## @@ -163,7 +163,7 @@ # <b>RETURN</b> <i>boolean</i> - True if the package tree location is set, # otherwise false. ## - def setPackageTreeLocation( location ) + def set_package_tree_location( location ) end ## @@ -175,12 +175,12 @@ # <b>RETURN</b> <i>boolean</i> - True if package installed, otherwise # false. ## - def packageInstalled( package ) + def package_installed( package ) require "#{$PACKAGE_PATH}#{package}" sw = eval( "#{package.capitalize}.new" ) details = sw.details - if ( foundEntry( $PACKAGE_INSTALLED, sw.srcDir ) ) + if ( found_entry( $PACKAGE_INSTALLED, sw.srcDir ) ) return true end Modified: src/trunk/abtusage.rb =================================================================== --- src/trunk/abtusage.rb 2007-07-16 14:28:21 UTC (rev 366) +++ src/trunk/abtusage.rb 2007-07-16 20:22:31 UTC (rev 367) @@ -39,30 +39,30 @@ case section when "packages" - usagePackages + usage_packages when "queries" - usageQueries + usage_queries when "generation" - usageGeneration + usage_generation when "downloads" - usageDownloads + usage_downloads when "fix" - usageFix + usage_fix when "maintenance" - usageMaintenance + usage_maintenance else - usagePackages - usageQueries - usageGeneration - usageDownloads - usageFix - usageMaintenance + usage_packages + usage_queries + usage_generation + usage_downloads + usage_fix + usage_maintenance end end @@ -71,7 +71,7 @@ # # <b>RETURN</b> <i>void</i> ## - def usagePackages + def usage_packages puts "\npackages:" puts " -i, install [package]\t\tInstall given package." puts " -ri, reinstall [package]\t\tReinstall given package." @@ -85,7 +85,7 @@ # # <b>RETURN</b> <i>void</i> ## - def usageQueries + def usage_queries puts "\nqueries:" puts " -s, search [string | regexp ]\tSearch package descriptions for given input." puts " -v, --version\t\t\tShow abt package manager version." @@ -107,7 +107,7 @@ # # <b>RETURN</b> <i>void</i> ## - def usageGeneration + def usage_generation puts "\ngeneration:" puts " show-updates\t\tShow a package listing with available update versions." puts " html\t\t\tGenerate HTML page from installed packages:" @@ -119,7 +119,7 @@ # # <b>RETURN</b> <i>void</i> ## - def usageDownloads + def usage_downloads puts "\ndownloads:" puts " -d, download [package]\t\tRetrieve given package sources." puts " -u, update [package]|[tree]\tUpdate given package or tree from AbTLinux repository." @@ -131,7 +131,7 @@ # # <b>RETURN</b> <i>void</i> ## - def usageFix + def usage_fix puts "\nfix:" puts " purge-src\t\t\t\tRemove source caches for packages no longer installed." puts " purge-logs\t\t\t\tRemove log files for packages no longer installed." @@ -147,7 +147,7 @@ # # <b>RETURN</b> <i>void</i> ## - def usageMaintenance + def usage_maintenance puts "\nmaintenance:" puts " build-location [host]\t\tSets global location (default: localhost) for retrieving cached package builds." puts " package-repo [add|remove|list] [URI]" Modified: src/trunk/testabtdepengine.rb =================================================================== --- src/trunk/testabtdepengine.rb 2007-07-16 14:28:21 UTC (rev 366) +++ src/trunk/testabtdepengine.rb 2007-07-16 20:22:31 UTC (rev 367) @@ -44,10 +44,10 @@ end ## - # Test method for 'AbtDepEngine.testDepEngine()' + # Test method for 'AbtDepEngine.test_dep_engine()' ## - def testDepEngine - assert_equal( false, true, "testDepEngine()" ) + def test_dep_engine + assert_equal( false, true, "test_dep_engine()" ) end end Modified: src/trunk/testabtdownloadmanager.rb =================================================================== --- src/trunk/testabtdownloadmanager.rb 2007-07-16 14:28:21 UTC (rev 366) +++ src/trunk/testabtdownloadmanager.rb 2007-07-16 20:22:31 UTC (rev 367) @@ -44,39 +44,38 @@ end ## - # Test method for 'AbtDownloadManager.testRetrievePackageSource()' + # Test method for 'AbtDownloadManager.test_retrieve_package_source()' ## - def testRetrievePackageSource() - assert( @download.retrievePackageSource( "ipc", "#{$SOURCES_REPOSITORY}" ), - "testRetrievePackageSource()" ) + def test_retrieve_package_source() + assert( + @download.retrieve_package_source( "ipc", "#{$SOURCES_REPOSITORY}" ), "test_retrieve_package_source()" ) end ## - # Test method for 'AbtDownloadManager.testRetrievePackageTree()' + # Test method for 'AbtDownloadManager.test_retrieve_package_tree()' ## - def testRetrievePackageTree() - assert( @download.retrievePackageTree( "dummy" ), - "testRetrievePackageTree()" ) + def test_retrieve_package_tree() + assert( @download.retrieve_package_tree( "dummy" ), "test_retrieve_package_tree()" ) end ## - # Test method for 'AbtDownloadManager.testRetrieveNewsFeed()' + # Test method for 'AbtDownloadManager.test_retrieve_news_feed()' ## - def testRetrieveNewsFeed() - assert( @download.retrieveNewsFeed( $ABTNEWS ), "testRetrieveNewsFeed()" ) + def test_retrieve_news_feed() + assert( @download.retrieve_news_feed( $ABTNEWS ), "test_retrieve_news_feed()" ) end ## - # Test method for 'AbtDownloadManager.testUpdatePackage()' + # Test method for 'AbtDownloadManager.test_update_package()' ## - def testUpdatePackage() - assert( @download.updatePackage(), "testUpdatePackage()" ) + def test_update_package() + assert( @download.update_package(), "test_update_package()" ) end ## - # Test method for 'AbtDownloadManager.testUpdatePackageTree()' + # Test method for 'AbtDownloadManager.test_update_package_tree()' ## - def testUpdatePackageTree() - assert( @download.updatePackageTree(), "testUpdatePackageTree()" ) + def test_update_package_tree() + assert( @download.update_package_tree(), "test_update_package_tree()" ) end end Modified: src/trunk/testabtlogmanager.rb =================================================================== --- src/trunk/testabtlogmanager.rb 2007-07-16 14:28:21 UTC (rev 366) +++ src/trunk/testabtlogmanager.rb 2007-07-16 20:22:31 UTC (rev 367) @@ -44,39 +44,38 @@ end ## - # Test method for 'AbtLogManager.testLogPackageIntegrity()' + # Test method for 'AbtLogManager.test_log_package_integrity()' ## - def testLogPackageIntegrity() - assert( @log.logPackageIntegrity( "ipc" ), "testLogPackageIntegrity()" ) + def test_log_package_integrity() + assert( @log.log_package_integrity( "ipc" ), "test_log_package_integrity()" ) end ## - # Test method for 'AbtLogManager.testLogPackageInstall()' + # Test method for 'AbtLogManager.test_log_package_install()' ## - def testLogPackageInstall() - assert( @log.logPackageInstall( "ipc" ), "testLogPackageInstall()" ) + def test_log_package_install() + assert( @log.log_package_install( "ipc" ), "test_log_package_install()" ) end ## - # Test method for 'AbtLogManager.testLogPackageBuild()' + # Test method for 'AbtLogManager.test_log_package_build()' ## - def testLogPackageBuild() - assert( @log.logPackageBuild( "ipc" ), "testLogPackageBuild()" ) + def test_log_package_build() + assert( @log.log_package_build( "ipc" ), "test_log_package_build()" ) end ## - # Test method for 'AbtLogManager.testCachePackage()' + # Test method for 'AbtLogManager.test_cache_package()' ## - def testCachePackage() - assert( @log.cachePackage( "ipc" ), "testCachePackage()" ) + def test_cache_package() + assert( @log.cache_package( "ipc" ), "test_cache_package()" ) end ## - # Test method for 'AbtLogManager.testLogToJournal()' + # Test method for 'AbtLogManager.test_to_journal()' ## - def testLogToJournal() - assert( @log.logToJournal( "Test message from AbtTestSuite." ), - "testLogToJournal()" ) + def test_to_journal() + assert( @log.to_journal( "Test message from AbtTestSuite." ), "test_to_journal()" ) end end Modified: src/trunk/testabtpackage.rb =================================================================== --- src/trunk/testabtpackage.rb 2007-07-16 14:28:21 UTC (rev 366) +++ src/trunk/testabtpackage.rb 2007-07-16 20:22:31 UTC (rev 367) @@ -58,88 +58,83 @@ end ## - # Test method for 'AbtPackage.testDetails()' + # Test method for 'AbtPackage.test_details()' ## - def testDetails - assert_equal( $dataTest['name'], @ipc.details['Package name'], - "testDetails()" ) - assert_equal( $dataTest['execName'], @ipc.details['Executable'], - "testDetails()" ) - assert_equal( $dataTest['version'], @ipc.details['Version'], - "testDetails()" ) - assert_equal( $dataTest['srcDir'], @ipc.details['Source location'], - "testDetails()" ) - assert_equal( $dataTest['homepage'], @ipc.details['Homepage'], - "testDetails()" ) + def test_details + assert_equal( $dataTest['name'], @ipc.details['Package name'], "test_details(name)" ) + assert_equal( $dataTest['execName'], @ipc.details['Executable'], "test_details(execName)" ) + assert_equal( $dataTest['version'], @ipc.details['Version'], "test_details(version)" ) + assert_equal( $dataTest['srcDir'], @ipc.details['Source location'], "test_details(srcDir)" ) + assert_equal( $dataTest['homepage'], @ipc.details['Homepage'], "test_details(homepage)" ) end ## - # Test method for 'AbtPackage.testPre()' + # Test method for 'AbtPackage.test_pre()' ## - def testPre - assert( @ipc.pre( $verbose ), "testPre()" ) + def test_pre + assert( @ipc.pre( $verbose ), "test_pre()" ) end ## - # Test method for 'AbtPackage.testConfigure()' + # Test method for 'AbtPackage.test_configure()' ## - def testConfigure + def test_configure if ( !@ipc.pre( $verbose ) ) - assert_equals( true, false, "testConfigure()" ) + assert_equals( true, false, "test_configure(pre)" ) end - assert( @ipc.configure( $verbose ), "testConfigure()" ) + assert( @ipc.configure( $verbose ), "test_configure(configure)" ) end ## - # Test method for 'AbtPackage.testBuild()' + # Test method for 'AbtPackage.test_build()' ## - def testBuild + def test_build if ( !@ipc.pre( $verbose ) ) - assert_equals( true, false, "testBuild()" ) + assert_equals( true, false, "test_build(pre)" ) end if ( !@ipc.configure( $verbose ) ) - assert_equals( true, false, "testBuild()" ) + assert_equals( true, false, "test_build(configure)" ) end - assert( @ipc.build( $verbose ), "testBuild()" ) + assert( @ipc.build( $verbose ), "test_build(build)" ) end ## - # Test method for 'AbtPackage.testPreinstall()' + # Test method for 'AbtPackage.test_preinstall()' ## - def testPreinstall - assert( @ipc.preinstall( $verbose ), "testPreinstall()" ) + def test_preinstall + assert( @ipc.preinstall( $verbose ), "test_preinstall()" ) end ## - # Test method for 'AbtPackage.testInstall()' + # Test method for 'AbtPackage.test_install()' ## - def testInstall + def test_install if ( !@ipc.pre( $verbose ) ) - assert_equals( true, false, "testInstall()" ) + assert_equals( true, false, "test_install(pre)" ) end if ( !@ipc.configure( $verbose ) ) - assert_equals( true, false, "testInstall()" ) + assert_equals( true, false, "test_install(configure)" ) end if ( !@ipc.build( $verbose ) ) - assert_equals( true, false, "testInstall()" ) + assert_equals( true, false, "test_install(build)" ) end if ( !@ipc.preinstall( $verbose ) ) - assert_equals( true, false, "testInstall()" ) + assert_equals( true, false, "test_install(install)" ) end - assert( @ipc.install( $verbose ), "testInstall()" ) + assert( @ipc.install( $verbose ), "test_install(install)" ) end ## - # Test method for 'AbtPackage.testPost()' + # Test method for 'AbtPackage.test_post()' ## - def testPost - assert_equals( true, false, "testPost()" ) if ( !@ipc.pre( $verbose ) ) - assert_equals( true, false, "testPost()" ) if ( !@ipc.configure( $verbose ) ) - assert_equals( true, false, "testPost()" ) if ( !@ipc.build( $verbose ) ) - assert_equals( true, false, "testPost()" ) if ( !@ipc.preinstall( $verbose ) ) - assert_equals( true, false, "testPost()" ) if ( !@ipc.install( $verbose ) ) - assert( @ipc.post( $verbose ), "testPost()" ) + def test_post + assert_equals( true, false, "test_post(pre)" ) if ( !@ipc.pre( $verbose ) ) + assert_equals( true, false, "test_post(configure)" ) if ( !@ipc.configure( $verbose ) ) + assert_equals( true, false, "test_post(build)" ) if ( !@ipc.build( $verbose ) ) + assert_equals( true, false, "test_post(preinstall)" ) if ( !@ipc.preinstall( $verbose ) ) + assert_equals( true, false, "test_post(install)" ) if ( !@ipc.install( $verbose ) ) + assert( @ipc.post( $verbose ), "test_post(post)" ) end end Modified: src/trunk/testabtpackagemanager.rb =================================================================== --- src/trunk/testabtpackagemanager.rb 2007-07-16 14:28:21 UTC (rev 366) +++ src/trunk/testabtpackagemanager.rb 2007-07-16 20:22:31 UTC (rev 367) @@ -46,38 +46,38 @@ end ## - # Test method for 'AbtPackageManager.testInstallPackage()' + # Test method for 'AbtPackageManager.test_install_package()' ## - def testInstallPackage - assert( @pkgMgr.installPackage( "ipc", $verbose ), "testInstallPackage()" ) + def test_install_package + assert( @pkgMgr.install_package( "ipc", $verbose ), "test_install_package()" ) end ## - # Test method for 'AbtPackageManager.testReinstallPackage()' + # Test method for 'AbtPackageManager.test_reinstall_package()' ## - def testReinstallPackage - assert( @pkgMgr.reinstallPackage( "ipc" ), "testReinstallPackage()" ) + def test_reinstall_package + assert( @pkgMgr.reinstall_package( "ipc" ), "test_reinstall_package()" ) end ## - # Test method for 'AbtPackageManager.testRemovePackage()' + # Test method for 'AbtPackageManager.test_remove_package()' ## - def testRemovePackage - assert( @pkgMgr.removePackage( "ipc" ), "testRemovePackage()" ) + def test_remove_package + assert( @pkgMgr.remove_package( "ipc" ), "test_remove_package()" ) end ## - # Test method for 'AbtPackageManager.testDowngradePackage()' + # Test method for 'AbtPackageManager.test_downgrade_package()' ## - def testDowngradePackage - assert( @pkgMgr.downgradePackage( "ipc", "1.2" ), "testDowngradePackage()" ) + def test_downgrade_package + assert( @pkgMgr.downgrade_package( "ipc", "1.2" ), "test_downgrade_package()" ) end ## - # Test method for 'AbtPackageManager.testFreezePackage()' + # Test method for 'AbtPackageManager.test_freeze_package()' ## - def testFreezePackage - assert( @pkgMgr.freezePackage( "ipc" ), "testFreezePackage()" ) + def test_freeze_package + assert( @pkgMgr.freeze_package( "ipc" ), "test_freeze_package()" ) end end Modified: src/trunk/testabtqueuemanager.rb =================================================================== --- src/trunk/testabtqueuemanager.rb 2007-07-16 14:28:21 UTC (rev 366) +++ src/trunk/testabtqueuemanager.rb 2007-07-16 20:22:31 UTC (rev 367) @@ -44,11 +44,10 @@ end ## - # Test method for 'AbtQueueManager.actionPackageQueue()' + # Test method for 'AbtQueueManager.action_package_queue()' ## - def testActionPackageQueue - assert( @queue.actionPackageQueue( "ipc", "install", "add" ), - "testQueueManager()" ) + def test_action_package_queue + assert( @queue.action_package_queue( "ipc", "install", "add" ), "test_action_package_queue()" ) end end Modified: src/trunk/testabtreportmanager.rb =================================================================== --- src/trunk/testabtreportmanager.rb 2007-07-16 14:28:21 UTC (rev 366) +++ src/trunk/testabtreportmanager.rb 2007-07-16 20:22:31 UTC (rev 367) @@ -44,97 +44,93 @@ end ## - # Test method for 'AbtReportManager.testShowPackageDetails()' + # Test method for 'AbtReportManager.test_show_package_details()' ## - def testShowPackageDetails - assert( @report.showPackageDetails( "ipc" ), "testShowPackageDetails()" ) + def test_show_package_details + assert( @report.show_package_details( "ipc" ), "test_show_package_details()" ) end ## - # Test method for 'AbtReportManager.testShowInstalledPackages()' + # Test method for 'AbtReportManager.test_show_installed_packages()' ## - def testShowInstalledPackages - assert( @report.showInstalledPackages(), "testShowInstalledPackages()" ) + def test_show_installed_packages + assert( @report.show_installed_packages(), "test_show_installed_packages()" ) end ## - # Test method for 'AbtReportManager.testShowPackageLog()' + # Test method for 'AbtReportManager.test_show_package_log()' ## - def testShowPackageLog - assert( @report.showPackageLog( "ipc", "install" ), - "testShowPackageLog()" ) - assert( @report.showPackageLog( "ipc", "build" ), "testShowPackageLog()" ) - assert( @report.showPackageLog( "ipc", "integrity" ), - "testShowPackageLog()" ) + def test_show_package_log + assert( @report.show_package_log( "ipc", "install" ), "test_show_package_log(install)" ) + assert( @report.show_package_log( "ipc", "build" ), "test_show_package_log(build)" ) + assert( @report.show_package_log( "ipc", "integrity" ), "test_show_package_log(integrity)" ) end ## - # Test method for 'AbtReportManager.testShowFrozenPackages()' + # Test method for 'AbtReportManager.test_show_frozen_packages()' ## - def testShowFrozenPackages - assert( @report.showFrozenPackages(), "testShowFrozenPackages()" ) + def test_show_frozen_packages + assert( @report.show_frozen_packages(), "test_show_frozen_packages()" ) end ## - # Test method for 'AbtReportManager.testShowPackageDependencies()' + # Test method for 'AbtReportManager.test_show_package_dependencies()' ## - def testShowPackageDependencies - assert( false, "testShowPackageDependencies()" ) + def test_show_package_dependencies + assert( false, "test_show_package_dependencies()" ) end ## - # Test method for 'AbtReportManager.testShowUntrackedFiles()' + # Test method for 'AbtReportManager.test_show_untracked_files()' ## - def testShowUntrackedFiles - assert( @report.showUntrackedFiles(), "testShowUntrackedFiles()" ) + def test_show_untracked_files + assert( @report.show_untracked_files(), "test_show_untracked_files()" ) end ## - # Test method for 'AbtReportManager.testShowJournal()' + # Test method for 'AbtReportManager.test_show_journal()' ## - def testShowJournal - assert( @report.showJournal( $JOURNAL ), "testShowJournal()" ) + def test_show_journal + assert( @report.show_journal( $JOURNAL ), "test_show_journal()" ) end ## - # Test method for 'AbtReportManager.testShowFileOwner()' + # Test method for 'AbtReportManager.test_show_file_owner()' ## - def testShowFileOwner - assert( @report.showFileOwner( "ipcFile" ), "testShowFileOwner()" ) + def test_show_file_owner + assert( @report.show_file_owner( "ipcFile" ), "test_show_file_owner()" ) end ## - # Test method for 'AbtReportManager.testSearchPackageDescriptions()' + # Test method for 'AbtReportManager.test_search_package_descriptions()' ## - def testSearchPackageDescriptions - assert( @report.searchPackageDescriptions( "Special text" ), - "testSearchPackageDescriptions()" ) + def test_search_package_descriptions + assert( @report.search_package_descriptions( "Special text" ), "test_search_package_descriptions()" ) end ## - # Test method for 'AbtReportManager.testShowQueue()' + # Test method for 'AbtReportManager.test_show_queue()' ## - def testShowQueue - if ( @report.showQueue( "install" ) ) - assert(false, "testShowQueue()") + def test_show_queue + if ( @report.show_queue( "install" ) ) + assert(false, "test_show_queue()") else - assert(true, "testShowQueue()") + assert(true, "test_show_queue()") end end ## - # Test method for 'AbtReportManager.testShowUpdates()' + # Test method for 'AbtReportManager.test_show_updates()' ## - def testShowUpdates - assert( @report.showUpdates( "ipc" ), "testShowUpdates()" ) + def test_show_updates + assert( @report.show_updates( "ipc" ), "test_show_updates()" ) end ## - # Test method for 'AbtReportManager.testGenerateHTMLPackageListing()' + # Test method for 'AbtReportManager.test_generate_HTML_package_listing()' ## - def testGenerateHTMLPackageListing - assert( @report.generateHTMLPackageListing(), - "testGenerateHTMLPackageListing()" ) + def test_generate_HTML_package_listing + assert( @report.generate_HTML_package_listing(), "test_generate_HTML_package_listing()" ) end end Modified: src/trunk/testabtsystemmanager.rb =================================================================== --- src/trunk/testabtsystemmanager.rb 2007-07-16 14:28:21 UTC (rev 366) +++ src/trunk/testabtsystemmanager.rb 2007-07-16 20:22:31 UTC (rev 367) @@ -44,75 +44,73 @@ end ## - # Test method for 'AbtSystemManager.testCleanupPackageSources()' + # Test method for 'AbtSystemManager.test_cleanup_package_sources()' ## - def testCleanupPackageSources - assert( @sys.cleanupPackageSources(), "testCleanupPackageSources()" ) + def test_cleanup_package_sources + assert( @sys.cleanup_package_sources(), "test_cleanup_package_sources()" ) end ## - # Test method for 'AbtSystemManager.testCleanupLogs()' + # Test method for 'AbtSystemManager.test_cleanup_logs()' ## - def testCleanupLogs - assert( @sys.cleanupLogs(), "testCleanupLogs()" ) + def test_cleanup_logs + assert( @sys.cleanup_logs(), "test_cleanup_logs()" ) end ## - # Test method for 'AbtSystemManager.testVerifyInstalledFiles()' + # Test method for 'AbtSystemManager.test_verify_installed_files()' ## - def testVerifyInstalledFiles - assert( @sys.verifyInstalledFiles( "dummy" ), "testVerifyInstalledFiles()" ) + def test_verify_installed_files + assert( @sys.verify_installed_files( "dummy" ), "test_verify_installed_files()" ) end ## - # Test method for 'AbtSystemManager.testVerifySymlinks()' + # Test method for 'AbtSystemManager.test_verify_symlinks()' ## - def testVerifySymlinks - assert( @sys.verifySymlinks( "dummy" ), "testVerifySymlinks()" ) + def test_verify_symlinks + assert( @sys.verify_symlinks( "dummy" ), "test_verify_symlinks()" ) end ## - # Test method for 'AbtSystemManager.testVerifyPackageDepends()' + # Test method for 'AbtSystemManager.test_verify_package_depends()' ## - def testVerifyPackageDepends - assert( @sys.verifyPackageDepends( "dummy" ), "testVerifyPackageDepends()" ) + def test_verify_package_depends + assert( @sys.verify_package_depends( "dummy" ), "test_verify_package_depends()" ) end ## - # Test method for 'AbtSystemManager.testVerifyPackageIntegrity()' + # Test method for 'AbtSystemManager.test_verify_package_integrity()' ## - def testVerifyPackageIntegrity - assert( @sys.verifyPackageIntegrity( "dummy" ), - "testVerifyPackageIntegrity()" ) + def test_verify_package_integrity + assert( @sys.verify_package_integrity( "dummy" ), "test_verify_package_integrity()" ) end ## - # Test method for 'AbtSystemManager.testFixPackage()' + # Test method for 'AbtSystemManager.test_fix_package()' ## - def testFixPackage - assert( @sys.fixPackage( "dummy" ), "testFixPackage()" ) + def test_fix_package + assert( @sys.fix_package( "dummy" ), "test_fix_package()" ) end ## - # Test method for 'AbtSystemManager.testSetCentralRepo()' + # Test method for 'AbtSystemManager.test_set_central_repo()' ## - def testSetCentralRepo - assert( @sys.setCentralRepo( "http://localhost" ), "testSetCentralRepo()" ) + def test_set_central_repo + assert( @sys.set_central_repo( "http://localhost" ), "test_set_central_repo()" ) end ## - # Test method for 'AbtSystemManager.testSetPackageTreeLocation()' + # Test method for 'AbtSystemManager.test_set_package_tree_location()' ## - def testSetPackageTreeLocation - assert( @sys.setPackageTreeLocation( "/var/lib/ericsPackages" ), - "testSetPackageTreeLocation()" ) + def test_set_package_tree_location + assert( @sys.set_package_tree_location( "/var/lib/ericsPackages" ), "test_set_package_tree_location()" ) end ## - # Test method for 'AbtSystemManager.testPackageInstalled()' + # Test method for 'AbtSystemManager.test_package_installed()' ## - def testPackageInstalled - assert( @sys.packageInstalled( "ipc" ), "testPackageInstalled()" ) + def test_package_installed + assert( @sys.package_installed( "ipc" ), "test_package_installed()" ) end end Modified: src/trunk/testsuiteabt.rb =================================================================== --- src/trunk/testsuiteabt.rb 2007-07-16 14:28:21 UTC (rev 366) +++ src/trunk/testsuiteabt.rb 2007-07-16 20:22:31 UTC (rev 367) @@ -21,8 +21,8 @@ logger = AbtLogManager.new manager = AbtPackageManager.new system = AbtSystemManager.new -if !system.packageInstalled( "ipc" ) - manager.installPackage << "ipc" +if !system.package_installed( "ipc" ) + manager.install_package << "ipc" end require 'testabtpackagemanager' This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <esc...@us...> - 2007-07-17 17:31:35
|
Revision: 370 http://svn.sourceforge.net/abtlinux/?rev=370&view=rev Author: eschabell Date: 2007-07-17 10:31:31 -0700 (Tue, 17 Jul 2007) Log Message: ----------- Refactored code for suggesting reinstall when install called on existing package out of package manager and into the calling abt file. This reduces complexity within package manager, no longer depending on system class. Added code for remove package call in abt file. Placeholder print line added to package manager remove pacakge method. Modified Paths: -------------- src/trunk/abt.rb src/trunk/abtpackagemanager.rb Modified: src/trunk/abt.rb =================================================================== --- src/trunk/abt.rb 2007-07-17 15:00:47 UTC (rev 369) +++ src/trunk/abt.rb 2007-07-17 17:31:31 UTC (rev 370) @@ -30,9 +30,10 @@ # Setup needed classes and get ready to parse arguments. ## manager = AbtPackageManager.new -logger = AbtLogManager.new # initialized all needed paths. +logger = AbtLogManager.new # initializes all needed paths. reporter = AbtReportManager.new downloader = AbtDownloadManager.new +system = AbtSystemManager.new options = Hash.new show = AbtUsage.new @@ -54,8 +55,12 @@ logger.to_journal( "Starting to install #{options['package']}" ) # return if already installed. - require "#{$PACKAGE_PATH}#{options['package']}" - sw = eval( "#{options['package'].capitalize}.new" ) + if ( system.package_installed( options['package'] ) ) + puts "\n*** Package #{options['package']} is installed, might want to try reinstall? ***" + puts "\n\tabt reinstall #{options['package']}\n\n" + logger.to_journal( "Completed install of #{options['package']}." ) + exit + end if ( manager.install_package( options['package'] ) ) puts "\n\n" @@ -75,9 +80,6 @@ puts "*** #{options['package'].capitalize} install failed, " + "see journal. ***" end - - - #reporter.showQueue( "install" ); # DEBUG. else show.usage( "packages" ) exit @@ -95,7 +97,24 @@ when "remove", "-r" if ( ARGV.length == 2 ) options['package'] = ARGV[1] - puts "Removing package : " + options['package'] + logger.to_journal( "Starting to remove #{options['package']}" ) + + # return if not installed. + if ( !( system.package_installed( options['package'] ) ) ) + puts "\n\n" + puts "*** No need to remove #{options['package']}, it was not installed! ***" + puts "\n\n" + logger.to_journal( "Completed removal of #{options['package']}." ) + exit + end + + # is installed, remove package. + if ( manager.remove_package( options['package'] ) ) + puts "\n\n" + puts "*** Completed removal of #{options['package']}. ***" + puts "\n\n" + logger.to_journal( "Completed removal of #{options['package']}." ) + end else show.usage( "packages" ) exit Modified: src/trunk/abtpackagemanager.rb =================================================================== --- src/trunk/abtpackagemanager.rb 2007-07-17 15:00:47 UTC (rev 369) +++ src/trunk/abtpackagemanager.rb 2007-07-17 17:31:31 UTC (rev 370) @@ -95,14 +95,6 @@ ## def install_package( package, verbose=true ) - # first check if installed. - system = AbtSystemManager.new - if ( system.package_installed( package ) ) - puts "\n*** Package #{package} is installed, might want to try reinstall? ***" - puts "'abt reinstall #{package}'" - return true - end - require "#{$PACKAGE_PATH}#{package}" sw = eval( "#{package.capitalize}.new" ) queuer = AbtQueueManager.new @@ -236,6 +228,7 @@ # false. ## def remove_package( package ) + puts "Removing #{package} now..." end ## This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <esc...@us...> - 2007-07-18 14:52:57
|
Revision: 380 http://svn.sourceforge.net/abtlinux/?rev=380&view=rev Author: eschabell Date: 2007-07-18 07:52:59 -0700 (Wed, 18 Jul 2007) Log Message: ----------- Implemented reinstall package, completes another unit test, 25 to go! Modified Paths: -------------- src/trunk/abt.rb src/trunk/abtpackagemanager.rb Modified: src/trunk/abt.rb =================================================================== --- src/trunk/abt.rb 2007-07-17 21:32:45 UTC (rev 379) +++ src/trunk/abt.rb 2007-07-18 14:52:59 UTC (rev 380) @@ -77,8 +77,7 @@ logger.to_journal( "Caching of package #{options['package']} failed.") end else - puts "*** #{options['package'].capitalize} install failed, " + - "see journal. ***" + puts "*** #{options['package'].capitalize} install failed, see journal. ***" end else show.usage( "packages" ) @@ -86,9 +85,42 @@ end when "reinstall", "-ri" - if ( ARGV.length == 2 ) + if ( ARGV.length == 2 && File.exist?( "#{$PACKAGE_PATH}#{ARGV[1]}.rb" ) ) options['package'] = ARGV[1] - puts "Reinstalling package : " + options['package'] + logger.to_journal( "Starting to reinstall #{options['package']}" ) + + # check if already installed. + if ( system.package_installed( options['package'] ) ) + puts "\n*** Package #{options['package']} is already installed! ***\n" + puts "Are you sure you want to proceed with a reinstall? (y/n)" + + while answer = STDIN.gets + answer.chomp! + if answer == "y" + break + elsif answer == "n" + exit + else + puts "Are you sure you want to reinstall #{options['package']}? (y/n)" + end + end + else + puts "\n*** Package #{options['package']} is not installed, we will install it for you now! ***\n" + puts "Hit enter to continue..." + while continue = STDIN.gets + continue.chomp! + break + end + end + + if ( manager.reinstall_package( options['package'] ) ) + puts "\n\n" + puts "*** Completed reinstall of #{options['package']}. ***" + puts "\n\n" + logger.to_journal( "Completed reinstall of #{options['package']}." ) + else + puts "*** #{options['package'].capitalize} reinstall failed, see journal. ***" + end else show.usage( "packages" ) exit Modified: src/trunk/abtpackagemanager.rb =================================================================== --- src/trunk/abtpackagemanager.rb 2007-07-17 21:32:45 UTC (rev 379) +++ src/trunk/abtpackagemanager.rb 2007-07-18 14:52:59 UTC (rev 380) @@ -218,6 +218,25 @@ # otherwise false. ## def reinstall_package( package ) + logger = AbtLogManager.new + + if ( install_package( package ) ) + puts "\n\n" + puts "*** Completed reinstall of #{package}. ***" + puts "\n\n" + logger.to_journal( "Completed reinstall of #{package}." ) + + if ( logger.cache_package( package ) ) + puts "\n\n" + puts "*** Completed caching of package #{package}. ***" + puts "\n\n" + logger.to_journal( "Caching completed for package #{package}." ) + return true + else + logger.to_journal( "Caching of package #{package} failed.") + end + end + return false end This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <esc...@us...> - 2007-07-19 19:23:32
|
Revision: 384 http://svn.sourceforge.net/abtlinux/?rev=384&view=rev Author: eschabell Date: 2007-07-19 12:23:35 -0700 (Thu, 19 Jul 2007) Log Message: ----------- Implemented source validation method in download manager using sha1 standard ruby library. This is a simple implementation, with absolute failure if hashes don't match for now. Modified Paths: -------------- src/trunk/abtconfig.rb src/trunk/abtdownloadmanager.rb src/trunk/abtpackage.rb src/trunk/testabtdownloadmanager.rb Modified: src/trunk/abtconfig.rb =================================================================== --- src/trunk/abtconfig.rb 2007-07-19 18:56:55 UTC (rev 383) +++ src/trunk/abtconfig.rb 2007-07-19 19:23:35 UTC (rev 384) @@ -38,6 +38,7 @@ require 'fileutils' require 'find' +require 'digest/sha1' # default paths / locations. $ABT_LOGS = "/var/log/abt" Modified: src/trunk/abtdownloadmanager.rb =================================================================== --- src/trunk/abtdownloadmanager.rb 2007-07-19 18:56:55 UTC (rev 383) +++ src/trunk/abtdownloadmanager.rb 2007-07-19 19:23:35 UTC (rev 384) @@ -159,4 +159,26 @@ def update_package_tree end + ## + # Validates the sources based on package hash value. + # + # <b>PARAM</b> <i>String</i> - security hash value from the packages description. + # <b>PARAM</b> <i>String</i> - source tarball location to be checked. + # + # <b>RETURNS:</b> <i>boolean</i> - True if the completes sucessfully, + # otherwise false. + ## + def validated( hashvalue, path ) + logger = AbtLogManager.new + + if hashvalue == Digest::SHA1.hexdigest( path ) + puts "Source hash validated successfully..." + logger.to_journal( "Validated sources successfully..." ) + return true + end + + puts "Source hash failed validation..." + logger.to_journal( "Validating sources failed..." ) + return false + end end Modified: src/trunk/abtpackage.rb =================================================================== --- src/trunk/abtpackage.rb 2007-07-19 18:56:55 UTC (rev 383) +++ src/trunk/abtpackage.rb 2007-07-19 19:23:35 UTC (rev 384) @@ -208,6 +208,11 @@ return false end + # validate sources sha1. + if ( !downloader.validated( @hashCheck, "#{$SOURCES_REPOSITORY}/#{File.basename( @srcUrl )}" ) ) + return false + end + # unpack sources. if ( !unpack_sources ) return false Modified: src/trunk/testabtdownloadmanager.rb =================================================================== --- src/trunk/testabtdownloadmanager.rb 2007-07-19 18:56:55 UTC (rev 383) +++ src/trunk/testabtdownloadmanager.rb 2007-07-19 19:23:35 UTC (rev 384) @@ -69,7 +69,7 @@ # Test method for 'AbtDownloadManager.test_update_package()' ## def test_update_package() - assert( @download.update_package(), "test_update_package()" ) + assert( @download.update_package() , "test_update_package()" ) end ## @@ -78,4 +78,11 @@ def test_update_package_tree() assert( @download.update_package_tree(), "test_update_package_tree()" ) end + + ## + # Test method for 'AbtDownloadManager.test_validated()' + ## + def test_validated() + assert( @download.validated( 'e81278607b1d65dcb18c3613ec00fbf588b50319', "#{$SOURCES_REPOSITORY}/ipc-1.4.tar.gz" ), "test_validated" ) + end end This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <esc...@us...> - 2007-07-19 21:34:16
|
Revision: 386 http://svn.sourceforge.net/abtlinux/?rev=386&view=rev Author: eschabell Date: 2007-07-19 14:34:14 -0700 (Thu, 19 Jul 2007) Log Message: ----------- Implemented show installed packages and updated unit test to properly deal with a void method. Another test passed, 24 to go. Modified Paths: -------------- src/trunk/abt.rb src/trunk/abtreportmanager.rb src/trunk/testabtreportmanager.rb Modified: src/trunk/abt.rb =================================================================== --- src/trunk/abt.rb 2007-07-19 19:26:52 UTC (rev 385) +++ src/trunk/abt.rb 2007-07-19 21:34:14 UTC (rev 386) @@ -244,8 +244,12 @@ end when "show-installed" - puts "Display all installed packages." - show.usage( "queries" ) + if ( ARGV.length == 1 ) + reporter.show_installed_packages() + else + show.usage( "queries" ) + exit + end when "show-frozen" puts "Display all packages frozen at current version." Modified: src/trunk/abtreportmanager.rb =================================================================== --- src/trunk/abtreportmanager.rb 2007-07-19 19:26:52 UTC (rev 385) +++ src/trunk/abtreportmanager.rb 2007-07-19 21:34:14 UTC (rev 386) @@ -96,6 +96,14 @@ # <b>RETURN</b> <i>void.</i> ## def show_installed_packages + if ( Dir.entries( $PACKAGE_INSTALLED ) - [ '.', '..' ] ).empty? + puts "\nNo AbTLinux packages are listed as installed, is your #{$PACKAGE_INSTALLED} empty?\n\n" + else + puts "\nInstalled AbTLinux packages:" + puts "============================" + Dir.foreach( $PACKAGE_INSTALLED ) { |package| puts package if package != "." && package != ".." } + puts "\n" + end end ## Modified: src/trunk/testabtreportmanager.rb =================================================================== --- src/trunk/testabtreportmanager.rb 2007-07-19 19:26:52 UTC (rev 385) +++ src/trunk/testabtreportmanager.rb 2007-07-19 21:34:14 UTC (rev 386) @@ -54,7 +54,7 @@ # Test method for 'AbtReportManager.test_show_installed_packages()' ## def test_show_installed_packages - assert( @report.show_installed_packages(), "test_show_installed_packages()" ) + assert_nil( @report.show_installed_packages(), "test_show_installed_packages()" ) end ## This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <esc...@us...> - 2007-07-20 12:15:13
|
Revision: 388 http://svn.sourceforge.net/abtlinux/?rev=388&view=rev Author: eschabell Date: 2007-07-20 05:15:15 -0700 (Fri, 20 Jul 2007) Log Message: ----------- Expanded to include show-config, show-install, and show-build logs for a package. Usage updated to reflect these options. Modified Paths: -------------- src/trunk/abt.rb src/trunk/abtusage.rb Modified: src/trunk/abt.rb =================================================================== --- src/trunk/abt.rb 2007-07-19 21:35:25 UTC (rev 387) +++ src/trunk/abt.rb 2007-07-20 12:15:15 UTC (rev 388) @@ -206,16 +206,54 @@ show.usage( "queries" ) end +when "show-config" + if ( ARGV.length == 2 ) + options['package'] = ARGV[1] + if !system.package_installed( options['package'] ) + puts "\nThe package #{options['package']} is not installed, can't show the configure log." + exit + end + + puts "\nDisplay configure log for package : #{options['package']}" + puts "===============================\n\n" + reporter.show_package_log( options['package'], "configure" ) + else + show.usage( "queries" ) + exit + end + when "show-build" if ( ARGV.length == 2 ) options['package'] = ARGV[1] - puts "Display build log for package : " + options['package'] + if !system.package_installed( options['package'] ) + puts "\nThe package #{options['package']} is not installed, can't show the build log." + exit + end + + puts "\nDisplay build log for package : #{options['package']}" + puts "===============================\n\n" + reporter.show_package_log( options['package'], "build" ) else show.usage( "queries" ) exit end - - + + when "show-install" + if ( ARGV.length == 2 ) + options['package'] = ARGV[1] + if !system.package_installed( options['package'] ) + puts "\nThe package #{options['package']} is not installed, can't show the install log." + exit + end + + puts "\nDisplay install log for package : #{options['package']}" + puts "===============================\n\n" + reporter.show_package_log( options['package'], "install" ) + else + show.usage( "queries" ) + exit + end + when "show-depends" if ( ARGV.length == 2 ) options['package'] = ARGV[1] Modified: src/trunk/abtusage.rb =================================================================== --- src/trunk/abtusage.rb 2007-07-19 21:35:25 UTC (rev 387) +++ src/trunk/abtusage.rb 2007-07-20 12:15:15 UTC (rev 388) @@ -90,7 +90,9 @@ puts " -s, search [string | regexp ]\tSearch package descriptions for given input." puts " -v, --version\t\t\tShow abt package manager version." puts " show-details [package]\t\tShow give package details." + puts " show-config [package]\t\tShow configure log of given package." puts " show-build [package]\t\tShow build log of given package." + puts " show-install [package]\t\tShow install log of given package." puts " show-depends [package]\t\tShow the dependency tree of given package." puts " show-files [package]\t\tShow all installed files from given package." puts " show-owner [file]\t\tShow the package owning given file." This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <esc...@us...> - 2007-07-20 13:29:39
|
Revision: 390 http://svn.sourceforge.net/abtlinux/?rev=390&view=rev Author: eschabell Date: 2007-07-20 06:29:38 -0700 (Fri, 20 Jul 2007) Log Message: ----------- Added show-integrity option and usage entry. Modified Paths: -------------- src/trunk/abt.rb src/trunk/abtusage.rb Modified: src/trunk/abt.rb =================================================================== --- src/trunk/abt.rb 2007-07-20 12:17:19 UTC (rev 389) +++ src/trunk/abt.rb 2007-07-20 13:29:38 UTC (rev 390) @@ -254,6 +254,22 @@ exit end + when "show-integrity" + if ( ARGV.length == 2 ) + options['package'] = ARGV[1] + if !system.package_installed( options['package'] ) + puts "\nThe package #{options['package']} is not installed, can't show the integrity log." + exit + end + + puts "\nDisplay integrity log for package : #{options['package']}" + puts "===============================\n\n" + reporter.show_package_log( options['package'], "integrity" ) + else + show.usage( "queries" ) + exit + end + when "show-depends" if ( ARGV.length == 2 ) options['package'] = ARGV[1] Modified: src/trunk/abtusage.rb =================================================================== --- src/trunk/abtusage.rb 2007-07-20 12:17:19 UTC (rev 389) +++ src/trunk/abtusage.rb 2007-07-20 13:29:38 UTC (rev 390) @@ -93,6 +93,7 @@ puts " show-config [package]\t\tShow configure log of given package." puts " show-build [package]\t\tShow build log of given package." puts " show-install [package]\t\tShow install log of given package." + puts " show-integrity [package]\t\tShow integrity log of given package." puts " show-depends [package]\t\tShow the dependency tree of given package." puts " show-files [package]\t\tShow all installed files from given package." puts " show-owner [file]\t\tShow the package owning given file." This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <esc...@us...> - 2007-07-20 17:05:26
|
Revision: 393 http://svn.sourceforge.net/abtlinux/?rev=393&view=rev Author: eschabell Date: 2007-07-20 10:05:20 -0700 (Fri, 20 Jul 2007) Log Message: ----------- Verify files option implemented. 21 unit tests to go! Filled empty system manager methods (to be done) with returning false. Ensures unit test failures. Modified Paths: -------------- src/trunk/abt.rb src/trunk/abtsystemmanager.rb src/trunk/testabtsystemmanager.rb Modified: src/trunk/abt.rb =================================================================== --- src/trunk/abt.rb 2007-07-20 13:33:49 UTC (rev 392) +++ src/trunk/abt.rb 2007-07-20 17:05:20 UTC (rev 393) @@ -403,7 +403,16 @@ when "verify-files" if ( ARGV.length == 2 ) options['package'] = ARGV[1] - puts "Installed files verified for package : " + options['package'] + logger.to_journal( "Starting verifcation of files for package : #{options['package']}.") + + if system.verify_installed_files( options['package'] ) + puts "/nInstalled files verified for package : #{options['package']}" + logger.to_journal( "Finished verifcation of files for package : #{options['package']}.") + exit + end + + logger.to_journal( "Finished verifcation of files for package : #{options['package']}.") + puts "/nInstalled files verification for package : #{options['package']} failed, see journal." else show.usage( "fix" ) exit Modified: src/trunk/abtsystemmanager.rb =================================================================== --- src/trunk/abtsystemmanager.rb 2007-07-20 13:33:49 UTC (rev 392) +++ src/trunk/abtsystemmanager.rb 2007-07-20 17:05:20 UTC (rev 393) @@ -76,6 +76,7 @@ # false. ## def cleanup_package_sources + return false end ## @@ -85,6 +86,7 @@ # false. ## def cleanup_logs + return false end ## @@ -96,6 +98,30 @@ # otherwise false. ## def verify_installed_files( package ) + logger = AbtLogManager.new + system = AbtSystemManager.new + + if !system.package_installed( package ) + logger.to_journal( "Unable to verify installed files for #{package}, it's not installed!") + return false + end + + if !File.exist?( logger.get_log( package, 'install' ) ) + logger.to_journal( "Unable to verify installed files for #{package}, installed package but install log missing!" ) + return false + end + + failure = false # marker after checking all files to determine failure. + File.open( logger.get_log( package, "install" ) ).each { |line| + if !File.exist?( line.chomp ) + logger.to_journal( "The file : #{line.chomp} is missing for #{package}." ) + failure = true + end + } + return false if failure + + # all files passed check. + return true end ## @@ -107,6 +133,7 @@ # or broken, otherwise false. ## def verify_symlinks( package ) + return false end ## @@ -118,6 +145,7 @@ # false. ## def verify_package_depends( package ) + return false end ## @@ -130,6 +158,7 @@ # hash of problem files and their encountered errors. ## def verify_package_integrity( package ) + return false end ## @@ -141,6 +170,7 @@ # false. ## def fix_package( package ) + return false end ## @@ -152,6 +182,7 @@ # <b>RETURN</b> <i>boolean</i> - True if the URI is set, otherwise false. ## def set_central_repo( uri ) + return false end ## @@ -164,6 +195,7 @@ # otherwise false. ## def set_package_tree_location( location ) + return false end ## @@ -183,8 +215,7 @@ if ( found_entry( $PACKAGE_INSTALLED, sw.srcDir ) ) return true end - - + return false end Modified: src/trunk/testabtsystemmanager.rb =================================================================== --- src/trunk/testabtsystemmanager.rb 2007-07-20 13:33:49 UTC (rev 392) +++ src/trunk/testabtsystemmanager.rb 2007-07-20 17:05:20 UTC (rev 393) @@ -61,7 +61,7 @@ # Test method for 'AbtSystemManager.test_verify_installed_files()' ## def test_verify_installed_files - assert( @sys.verify_installed_files( "dummy" ), "test_verify_installed_files()" ) + assert( @sys.verify_installed_files( "ipc" ), "test_verify_installed_files()" ) end ## This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <esc...@us...> - 2007-07-23 07:17:13
|
Revision: 395 http://svn.sourceforge.net/abtlinux/?rev=395&view=rev Author: eschabell Date: 2007-07-23 00:17:15 -0700 (Mon, 23 Jul 2007) Log Message: ----------- Cleaned up DEBUG statements left over from the early days of development. Modified Paths: -------------- src/trunk/abtlogmanager.rb src/trunk/abtpackage.rb src/trunk/abtpackagemanager.rb Modified: src/trunk/abtlogmanager.rb =================================================================== --- src/trunk/abtlogmanager.rb 2007-07-20 17:06:28 UTC (rev 394) +++ src/trunk/abtlogmanager.rb 2007-07-23 07:17:15 UTC (rev 395) @@ -157,14 +157,12 @@ IO.foreach( tmpInstallLog ) do |line| if ( line.split[1] == 'open' ) if ( line.split[2] =~ excluded_pattern ) - #self.logToJournal( "DEBUG: Found bad logLine!" ) badLine = true else badLine = false end if ( !badLine ) - #self.to_journal( "DEBUG: adding line to installFile!") installFile << "#{line.split[2]}\n" end end Modified: src/trunk/abtpackage.rb =================================================================== --- src/trunk/abtpackage.rb 2007-07-20 17:06:28 UTC (rev 394) +++ src/trunk/abtpackage.rb 2007-07-23 07:17:15 UTC (rev 395) @@ -253,11 +253,11 @@ Dir.chdir( "#{$BUILD_LOCATION}/#{@srcDir}" ) if ( !system( command ) ) - puts "DEBUG: [AbtPackage.configure] - configure section failed." + puts "[AbtPackage.configure] - configure section failed." return false end - puts "\nDEBUG: [AbtPackage.configure] - configure section completed!" if (verbose ) + puts "[AbtPackage.configure] - configure section completed!" if (verbose ) return true end @@ -281,11 +281,11 @@ Dir.chdir( "#{$BUILD_LOCATION}/#{@srcDir}" ) if( !system( command ) ) - puts "DEBUG: [AbtPackage.build] - build section failed." + puts "[AbtPackage.build] - build section failed." return false end - puts "DEBUG: [AbtPackage.build] - build section completed!" if ( verbose ) + puts "[AbtPackage.build] - build section completed!" if ( verbose ) return true end @@ -329,11 +329,11 @@ Dir.chdir( "#{$BUILD_LOCATION}/#{@srcDir}" ) if( !system( command ) ) - puts "DEBUG: [AbtPackage.install] - install section failed." + puts "[AbtPackage.install] - install section failed." return false end - puts "DEBUG: [AbtPackage.install] - install section completed!" if ( verbose ) + puts "[AbtPackage.install] - install section completed!" if ( verbose ) return true end Modified: src/trunk/abtpackagemanager.rb =================================================================== --- src/trunk/abtpackagemanager.rb 2007-07-20 17:06:28 UTC (rev 394) +++ src/trunk/abtpackagemanager.rb 2007-07-23 07:17:15 UTC (rev 395) @@ -51,11 +51,8 @@ file = File.new( logFile, "r" ) while ( line = file.gets ) - #puts "DEBUG: about to remove ***#{line.chomp}***" if ( File.file?( line.chomp ) ) File.delete( line.chomp ) - else - puts "DEBUG: file not exist? ***#{File.basename( line.chomp )}***" end end file.close @@ -63,8 +60,6 @@ # cleanup install log as it is incomplete. File.delete( logFile ) else - puts "DEBUG: attempt to use APM:rollBack( type ) incorrectly, " + - "unsupported type?" return false end @@ -120,7 +115,7 @@ "package description of #{package}." ) return false else - logger.to_journal( "DEBUG: finished #{package} pre section." ) + logger.to_journal( "Finished #{package} pre section." ) end # configure section. @@ -131,7 +126,7 @@ "package description of #{package}." ) return false else - logger.to_journal( "DEBUG: finished #{package} configure section." ) + logger.to_journal( "Finished #{package} configure section." ) end # build section. @@ -146,7 +141,7 @@ logger.to_journal( "Failed to create a package build log." ) return false end - logger.to_journal( "DEBUG: finished #{package} build section." ) + logger.to_journal( "Finished #{package} build section." ) end # preinstall section. @@ -157,7 +152,7 @@ "package description of #{package}." ) return false else - logger.to_journal( "DEBUG: finished #{package} preinstall section." ) + logger.to_journal( "Finished #{package} preinstall section." ) end # install section. @@ -178,7 +173,7 @@ # cleanup tmp files from installwatch. File.delete( "#{$ABT_TMP}/#{details['Source location']}.watch" ) - logger.to_journal( "DEBUG: finished #{package} install section." ) + logger.to_journal( "Finished #{package} install section." ) end # post section. @@ -188,7 +183,7 @@ logger.to_journal( "Failed to process post section in the package description of #{package}." ) return false else - logger.to_journal( "DEBUG: finished #{package} post section." ) + logger.to_journal( "Finished #{package} post section." ) end # clean out build sources. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <esc...@us...> - 2007-07-23 09:34:16
|
Revision: 397 http://svn.sourceforge.net/abtlinux/?rev=397&view=rev Author: eschabell Date: 2007-07-23 02:34:17 -0700 (Mon, 23 Jul 2007) Log Message: ----------- Implemented very simplistic SINGLE WORD pacakge search. Updated unit test to look for a correct existing hash result. 20 unit tests left to go! Modified Paths: -------------- src/trunk/abt.rb src/trunk/abtreportmanager.rb src/trunk/testabtreportmanager.rb Modified: src/trunk/abt.rb =================================================================== --- src/trunk/abt.rb 2007-07-23 09:32:10 UTC (rev 396) +++ src/trunk/abt.rb 2007-07-23 09:34:17 UTC (rev 397) @@ -176,7 +176,19 @@ when "search", "-s" if ( ARGV.length == 2 ) options['searchString'] = ARGV[1] - puts "Searching package descriptions for : #{options['searchString']}" + logger.to_journal( "Starting search of package descriptions for : #{options['searchString']}" ) + searchResults = reporter.search_package_descriptions( options['searchString'].chomp ) + if ( searchResults.empty? ) + puts "\nNothing found matching your search query." + exit + else + # we have results hash! + puts "\nSearch results for : #{options['searchString']} " + puts "====================" + searchResults.each_pair { |name, description| puts "#{name} \t: #{description}" } + end + + logger.to_journal( "Completed search of package descriptions for : #{options['searchString']}" ) else show.usage( "queries" ) exit Modified: src/trunk/abtreportmanager.rb =================================================================== --- src/trunk/abtreportmanager.rb 2007-07-23 09:32:10 UTC (rev 396) +++ src/trunk/abtreportmanager.rb 2007-07-23 09:34:17 UTC (rev 397) @@ -136,6 +136,7 @@ # <b>RETURN</b> <i>void.</i> ## def show_frozen_packages + return false end ## @@ -149,6 +150,7 @@ # hash of problem files and their encountered errors. ## def show_package_dependencies( package ) + return false end ## @@ -159,6 +161,7 @@ # <b>RETURN</b> <i>void.</i> ## def show_untracked_files + return false end ## @@ -194,6 +197,7 @@ # <b>RETURN</b> <i>void.</i> ## def show_file_owner( file ) + return false end ## @@ -206,6 +210,39 @@ # names and values are matching descriptions. ## def search_package_descriptions( searchText ) + packageHash = Hash.new # has for values found. + + # TODO: get packages installed list + if ( Dir.entries( $PACKAGE_INSTALLED ) - [ '.', '..' ] ).empty? + return packageHash # empty hash, no entries. + else + Dir.foreach( $PACKAGE_INSTALLED ) { |package| + if ( package != "." && package != "..") + # split the installed entry into two parts, + # the package name and the version number. + packageArray = package.split( "-" ) + packageName = packageArray[0] + + # check for match to name and description if the package file exists. + if ( File.exist?( "#{$PACKAGE_PATH}#{packageName}.rb" ) ) + require "#{$PACKAGE_PATH}#{packageName}" + sw = eval( "#{packageName.capitalize}.new" ) + + # add if matches name or description entries. + matchesArray = sw.description.scan( searchText ) + matchesArray = matchesArray.concat( packageName.scan( searchText ) ) + + if ( matchesArray.length > 0 ) + # matches so add to hash. + packageHash = packageHash.merge( Hash[ "#{package}" => "#{sw.description}" ] ) + end + end + end + } + end + + # finished search results. + return packageHash end ## @@ -249,6 +286,7 @@ # false. ## def show_updates( target ) + return false end ## @@ -257,5 +295,6 @@ # <b>RETURN</b> <i>void.</i> ## def generate_HTML_package_listing + return false end end Modified: src/trunk/testabtreportmanager.rb =================================================================== --- src/trunk/testabtreportmanager.rb 2007-07-23 09:32:10 UTC (rev 396) +++ src/trunk/testabtreportmanager.rb 2007-07-23 09:34:17 UTC (rev 397) @@ -111,7 +111,8 @@ # Test method for 'AbtReportManager.test_search_package_descriptions()' ## def test_search_package_descriptions - assert( @report.search_package_descriptions( "Special text" ), "test_search_package_descriptions()" ) + expectedHash = Hash[ "ipc-1.4" => "IPC is a program that calculates the isotopic distribution of a given chemical formula."] + assert_equal( @report.search_package_descriptions( "ipc" ), expectedHash, "test_search_package_descriptions()" ) end ## This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |