Thread: [Abtlinux-svn] SF.net SVN: abtlinux: [200] src/trunk/AbtPackageManager.rb
Status: Alpha
Brought to you by:
eschabell
From: <esc...@us...> - 2006-11-18 15:18:54
|
Revision: 200 http://svn.sourceforge.net/abtlinux/?rev=200&view=rev Author: eschabell Date: 2006-11-18 07:18:54 -0800 (Sat, 18 Nov 2006) Log Message: ----------- Adjusted comments for removing the system call one day. Modified Paths: -------------- src/trunk/AbtPackageManager.rb Modified: src/trunk/AbtPackageManager.rb =================================================================== --- src/trunk/AbtPackageManager.rb 2006-11-18 11:57:33 UTC (rev 199) +++ src/trunk/AbtPackageManager.rb 2006-11-18 15:18:54 UTC (rev 200) @@ -115,8 +115,7 @@ args = args + " " + ARGV[i] end - # TODO: remove the ./abt call on deployment. - system( 'su -c "./abt ' + args + '" root' ) + system( 'su -c "./abt ' + args + '" root' ) # TODO: replace system call? exit end end This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <esc...@us...> - 2006-11-18 19:16:44
|
Revision: 211 http://svn.sourceforge.net/abtlinux/?rev=211&view=rev Author: eschabell Date: 2006-11-18 11:16:41 -0800 (Sat, 18 Nov 2006) Log Message: ----------- Install package is now up to unpacking and removal of the build sources into the global build directory. Modified Paths: -------------- src/trunk/AbtPackageManager.rb Modified: src/trunk/AbtPackageManager.rb =================================================================== --- src/trunk/AbtPackageManager.rb 2006-11-18 19:15:21 UTC (rev 210) +++ src/trunk/AbtPackageManager.rb 2006-11-18 19:16:41 UTC (rev 211) @@ -51,33 +51,40 @@ ## def installPackage( package ) require package - packager = eval( "#{package.capitalize}.new" ) + sw = eval( "#{package.capitalize}.new" ) queuer = AbtQueueManager.new logger = AbtLogManager.new # get package details. - details = packager.details + details = sw.details + # TODO: check deps + # add to install queue. if ( !queuer.addPackageToQueue( package, "install" ) ) logger.logToJournal( "Failed to add #{package} to install queue." ) return false end + if ( !sw.pre ) + logger.logToJournal( "Failed to process pre-section in the package description of #{package}." ) + return false + end + + if ( !sw.removeBuildSources ) + logger.logToJournal( "Failed to remove the build sources for #{package}." ) + #return false # commented out as this is not a reason to fail. + end + return true # TODO: finish up the following steps per install scenario: # - # check deps - # add missing deps to install queue - # get details - # pre section # configure section # build section # pre install section # install section # post section - # clean source build directory end ## This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <esc...@us...> - 2006-11-19 13:54:15
|
Revision: 222 http://svn.sourceforge.net/abtlinux/?rev=222&view=rev Author: eschabell Date: 2006-11-19 05:54:12 -0800 (Sun, 19 Nov 2006) Log Message: ----------- Added processing of configure section to install function. Modified Paths: -------------- src/trunk/AbtPackageManager.rb Modified: src/trunk/AbtPackageManager.rb =================================================================== --- src/trunk/AbtPackageManager.rb 2006-11-19 13:53:01 UTC (rev 221) +++ src/trunk/AbtPackageManager.rb 2006-11-19 13:54:12 UTC (rev 222) @@ -67,24 +67,32 @@ return false end + # pre section. if ( !sw.pre ) logger.logToJournal( "Failed to process pre-section in the package description of #{package}." ) return false end - if ( !sw.removeBuildSources ) - logger.logToJournal( "Failed to remove the build sources for #{package}." ) - #return false # commented out as this is not a reason to fail. + # configure section. + if ( !sw.configure ) + logger.logToJournal( "Failed to process configure section in the package description of #{package}." ) + return false end - return true # TODO: finish up the following steps per install scenario: # - # configure section # build section # pre install section # install section # post section + # remove build sources. + # + if ( !sw.removeBuildSources ) + logger.logToJournal( "Failed to remove the build sources for #{package}." ) + #return false # commented out as this is not a reason to fail. + end + + return true end ## This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <esc...@us...> - 2006-11-22 19:55:30
|
Revision: 229 http://svn.sourceforge.net/abtlinux/?rev=229&view=rev Author: eschabell Date: 2006-11-22 11:55:27 -0800 (Wed, 22 Nov 2006) Log Message: ----------- Added some debug lines for pre and configure sections to log completion during package install. Modified Paths: -------------- src/trunk/AbtPackageManager.rb Modified: src/trunk/AbtPackageManager.rb =================================================================== --- src/trunk/AbtPackageManager.rb 2006-11-22 19:34:10 UTC (rev 228) +++ src/trunk/AbtPackageManager.rb 2006-11-22 19:55:27 UTC (rev 229) @@ -71,12 +71,16 @@ 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. if ( !sw.configure ) logger.logToJournal( "Failed to process configure section in the package description of #{package}." ) return false + else + logger.logToJournal( "DEBUG: finished #{package} configure section." ) end # TODO: finish up the following steps per install scenario: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <esc...@us...> - 2006-12-03 12:46:29
|
Revision: 249 http://svn.sourceforge.net/abtlinux/?rev=249&view=rev Author: eschabell Date: 2006-12-03 04:46:29 -0800 (Sun, 03 Dec 2006) Log Message: ----------- Added TODO for arranging proper handling of package install, cache and failure reporting. Modified Paths: -------------- src/trunk/AbtPackageManager.rb Modified: src/trunk/AbtPackageManager.rb =================================================================== --- src/trunk/AbtPackageManager.rb 2006-12-03 11:18:18 UTC (rev 248) +++ src/trunk/AbtPackageManager.rb 2006-12-03 12:46:29 UTC (rev 249) @@ -52,9 +52,13 @@ def installPackage( package ) require package sw = eval( "#{package.capitalize}.new" ) - queuer = AbtQueueManager.new logger = AbtLogManager.new + + # TODO: initialize pkg install directory ($PACKAGE_INSTALLED/@srcDir), + # should this fail we have to clean this dir up, move to failure + # location? + # On success, need to cache contents in cache dir. # get package details. details = sw.details This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <esc...@us...> - 2007-02-26 20:58:53
|
Revision: 305 http://svn.sourceforge.net/abtlinux/?rev=305&view=rev Author: eschabell Date: 2007-02-26 12:58:52 -0800 (Mon, 26 Feb 2007) Log Message: ----------- Added user clarification messages to the install package process. Modified Paths: -------------- src/trunk/AbtPackageManager.rb Modified: src/trunk/AbtPackageManager.rb =================================================================== --- src/trunk/AbtPackageManager.rb 2007-02-26 20:58:07 UTC (rev 304) +++ src/trunk/AbtPackageManager.rb 2007-02-26 20:58:52 UTC (rev 305) @@ -55,23 +55,20 @@ queuer = AbtQueueManager.new logger = AbtLogManager.new - # TODO: initialize pkg install directory ($PACKAGE_INSTALLED/@srcDir), - # should this fail we have to clean this dir up, move to failure - # location? - # On success, need to cache contents in cache dir. - # get package details. details = sw.details # TODO: check deps # add to install queue. + puts "\n*** Adding #{package} to the INSTALL QUEUE. ***" if ( !queuer.addPackageToQueue( package, "install" ) ) logger.logToJournal( "Failed to add #{package} to install queue." ) return false end # pre section. + puts "\n*** Processing the PRE section for #{package}. ***" if ( !sw.pre ) logger.logToJournal( "Failed to process pre-section in the package description of #{package}." ) return false @@ -80,6 +77,7 @@ end # configure section. + puts "\n*** Processing the CONFIGURE section for #{package}. ***" if ( !sw.configure ) logger.logToJournal( "Failed to process configure section in the package description of #{package}." ) return false @@ -88,6 +86,7 @@ end # build section. + puts "\n*** Processing the BUILD section for #{package}. ***" if ( !sw.build ) logger.logToJournal( "Failed to process build section in the package description of #{package}." ) return false @@ -96,6 +95,7 @@ end # preinstall section. + puts "\n*** Processing the PREINSTALL section for #{package}. ***" if ( !sw.preinstall ) logger.logToJournal( "Failed to process preinstall section in the package description of #{package}." ) return false @@ -104,6 +104,7 @@ end # install section. + puts "\n*** Processing the INSTALL section for #{package}. ***" if ( !sw.install ) logger.logToJournal( "Failed to process install section in the package description of #{package}." ) return false @@ -118,6 +119,7 @@ # post section # remove build sources. # + puts "\n*** Cleaning up the sources for #{package}. ***" 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. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <esc...@us...> - 2007-03-05 20:13:42
|
Revision: 321 http://svn.sourceforge.net/abtlinux/?rev=321&view=rev Author: eschabell Date: 2007-03-05 12:13:26 -0800 (Mon, 05 Mar 2007) Log Message: ----------- Created new private method rollBack which ensures proper cleanup on package section failures, currently only for install. Implemented rollback within the installation of a package should install fail somewhere in the middle, removes installed files and removes the install log before aborting installation run. Another test passing, 28 to go! Modified Paths: -------------- src/trunk/AbtPackageManager.rb Modified: src/trunk/AbtPackageManager.rb =================================================================== --- src/trunk/AbtPackageManager.rb 2007-03-05 20:11:00 UTC (rev 320) +++ src/trunk/AbtPackageManager.rb 2007-03-05 20:13:26 UTC (rev 321) @@ -31,6 +31,47 @@ 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 ## @@ -115,9 +156,13 @@ # install section. puts "\n*** Processing the INSTALL section for #{package}. ***" 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}." ) - # FIXME: APM rollback any installed files (use install log). + 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 ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <esc...@us...> - 2007-03-05 20:38:58
|
Revision: 322 http://svn.sourceforge.net/abtlinux/?rev=322&view=rev Author: eschabell Date: 2007-03-05 12:38:59 -0800 (Mon, 05 Mar 2007) Log Message: ----------- Fixed typo, concat of a string must be done with + at end of string and not on the newline. Modified Paths: -------------- src/trunk/AbtPackageManager.rb Modified: src/trunk/AbtPackageManager.rb =================================================================== --- src/trunk/AbtPackageManager.rb 2007-03-05 20:13:26 UTC (rev 321) +++ src/trunk/AbtPackageManager.rb 2007-03-05 20:38:59 UTC (rev 322) @@ -63,8 +63,8 @@ # cleanup install log as it is incomplete. File.delete( logFile ) else - puts "DEBUG: attempt to use APM:rollBack( type ) incorrectly, " - + "unsupported type?" + puts "DEBUG: attempt to use APM:rollBack( type ) incorrectly, " + + "unsupported type?" 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-06-15 11:14:34
|
Revision: 338 http://svn.sourceforge.net/abtlinux/?rev=338&view=rev Author: eschabell Date: 2007-06-15 04:14:36 -0700 (Fri, 15 Jun 2007) Log Message: ----------- Refactored install package method to first check for already installed package, suggests reinstall to user if so. Modified Paths: -------------- src/trunk/AbtPackageManager.rb Modified: src/trunk/AbtPackageManager.rb =================================================================== --- src/trunk/AbtPackageManager.rb 2007-06-15 11:13:46 UTC (rev 337) +++ src/trunk/AbtPackageManager.rb 2007-06-15 11:14:36 UTC (rev 338) @@ -94,6 +94,14 @@ # false. ## def installPackage( package, verbose=true ) + + # first check if installed. + system = AbtSystemManager.new + if ( system.packageInstalled( package ) ) + puts "\nPackage #{package} is installed, might want to try reinstall?" + return true + end + require "packages/#{package}" sw = eval( "#{package.capitalize}.new" ) queuer = AbtQueueManager.new This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |