From: jiil.hyoun Date: Thu, 14 Mar 2013 09:20:49 +0000 (+0900) Subject: [Title] remove linux dependent func ( du / sha256sum) X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2424dfc7db00749eca24a33119219b263207a9e7;p=sdk%2Ftools%2Fsdk-build.git [Title] remove linux dependent func ( du / sha256sum) [Type] Feature [Module] Toolchain / [Priority] Minor [Jira#] [Redmine#] [Problem] [Cause] [Solution] [TestCase] Change-Id: Ib99ca26f91465f855a4b030f9981cfff399ae870 --- diff --git a/src/pkg_server/client.rb b/src/pkg_server/client.rb index a9a3b61..db0ac3e 100644 --- a/src/pkg_server/client.rb +++ b/src/pkg_server/client.rb @@ -43,6 +43,7 @@ require "Version" require "BuildComm" require "FileTransferViaFTP" require "FileTransferViaDirect" +require 'digest' $update_mutex = Mutex.new @@ -344,12 +345,10 @@ class Client downloaded_file_path = nil begin lock = Utils.file_lock(File.join(CONFIG_PATH,"cache_lock")) - if Utils.is_linux_like_os( Utils::HOST_OS ) then - cached_filepath = get_cached_filepath(filename, pkg_checksum, pkg_size) - if not cached_filepath.nil? then - FileUtils.cp(cached_filepath, location) - downloaded_file_path = File.join(location, File.basename(cached_filepath)) - end + cached_filepath = get_cached_filepath(filename, pkg_checksum, pkg_size) + if not cached_filepath.nil? then + FileUtils.cp(cached_filepath, location) + downloaded_file_path = File.join(location, File.basename(cached_filepath)) end rescue Exception => e @log.error( e.message, Log::LV_USER) @@ -402,9 +401,9 @@ class Client cached_filepath = "#{@download_path}/#{pkg_filename}" if File.exist? cached_filepath then FileUtils.touch cached_filepath - checksum = `sha256sum #{cached_filepath}`.split(" ")[0] - size = `du -b #{cached_filepath}`.split[0].strip - if checksum.eql? pkg_checksum and size.eql? pkg_size then + checksum = Digest::SHA256.file(cached_filepath).hexdigest + size = File.size cached_filepath + if checksum.to_s.eql? pkg_checksum and size.to_s.eql? pkg_size then return cached_filepath end end