[Abtlinux-svn] SF.net SVN: abtlinux: [209] src/trunk/AbtPackage.rb
Status: Alpha
Brought to you by:
eschabell
From: <esc...@us...> - 2006-11-18 19:14:40
|
Revision: 209 http://svn.sourceforge.net/abtlinux/?rev=209&view=rev Author: eschabell Date: 2006-11-18 11:14:41 -0800 (Sat, 18 Nov 2006) Log Message: ----------- Added two new helper methods to unpack and cleanup package sources. Also worked out some of the pre section. Modified Paths: -------------- src/trunk/AbtPackage.rb Modified: src/trunk/AbtPackage.rb =================================================================== --- src/trunk/AbtPackage.rb 2006-11-18 18:16:14 UTC (rev 208) +++ src/trunk/AbtPackage.rb 2006-11-18 19:14:41 UTC (rev 209) @@ -142,6 +142,22 @@ # <b>RETURNS:</b> <i>boolean</i> - True if completes sucessfully, otherwise false. ## def pre + downloader = AbtDownloadManager.new + + # download sources. + if ( !downloader.retrievePackageSource( @name.downcase, $SOURCES_REPOSITORY ) ) + return false + end + + # unpack sources. + if ( !unpackSources ) + return false + end + + # TODO: retrieve patches? + # TODO: apply patches? + + return true end ## @@ -188,4 +204,42 @@ ## def post end + + ## + # Unpacks this packages source file into the standard build location. + # + # <b>RETURNS:</b> <i>boolean</i> - True if the completes sucessfully, otherwise false. + ## + def unpackSources + sourcesToUnpack = "#{$SOURCES_REPOSITORY}/#{File.basename( srcUrl )}" + + if ( !File.exist?( sourcesToUnpack ) ) + return false + end + + # TODO: system call removal? + if ( !system( "cd #{$BUILD_LOCATION}; tar xzvf #{sourcesToUnpack}" ) ) + return false + end + + return true + end + + ## + # Cleans up this packages source build directory. + # + # <b>RETURNS:</b> <i>boolean</i> - True if the completes sucessfully, otherwise false. + ## + def removeBuildSources + buildSourcesLocation = "#{$BUILD_LOCATION}/#{srcDir}" + + if ( !File.directory?( buildSourcesLocation ) ) + return true + end + + # TODO: system call removal? + if ( !FileUtils.rm_rf buildSourcesLocation, :verbose => true ) + return false + end + end end This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |