[Title] remove download packages (package client)
authorjiil.hyoun <jiil.hyoun@samsung.com>
Thu, 10 Jan 2013 08:17:43 +0000 (17:17 +0900)
committerjiil.hyoun <jiil.hyoun@samsung.com>
Thu, 10 Jan 2013 08:17:43 +0000 (17:17 +0900)
[Type] Bugfix
[Module] Toolchain /
[Priority] Critical
[Jira#]
[Redmine#] 8005
[Problem]
[Cause]
[Solution]
[TestCase]

Change-Id: Ia69a15338ef653ded8b8a773db35efe0881f7416

src/build_server/PackageSync.rb
src/pkg_server/client.rb

index a88eb06c9262d65511aff3a5505ce0ce8243094d..afc2598842173c7177ecd23bba82891e968833dc 100644 (file)
@@ -58,11 +58,11 @@ class PackageSyncAction < Action
                if File.exist? @download_path then
                        FileUtils.rm_rf @download_path
                        FileUtils.rm_rf @original_path
-               else
-                       FileUtils.mkdir_p @download_path
-                       FileUtils.mkdir_p @original_path
                end
 
+               FileUtils.mkdir_p @download_path
+               FileUtils.mkdir_p @original_path
+
                # create client
                @pkgsvr_client = Client.new( @pkgsvr_url, @download_path, @server.log )
 
@@ -96,8 +96,11 @@ class PackageSyncAction < Action
                pkgs.each do  |pkg|
                        pkg_name=pkg[0]; os=pkg[1]; prj=pkg[2]
 
-                       downloaded_files = @pkgsvr_client.download(pkg_name, os, false)
-                       downloaded_files.each do  |file_path|
+                       file_paths = @pkgsvr_client.download(pkg_name, os, false)
+                       if file_paths.nil? then next end
+                       downloaded_files += file_paths
+
+                       file_paths.each do |file_path|
                                @server.log.info "Creating new job for registering \"#{file_path}\""
                                new_job = @server.jobmgr.create_new_register_job( file_path, @dist_name )
                                if new_job.nil? then
@@ -105,7 +108,7 @@ class PackageSyncAction < Action
                                        next
                                end
                                new_job.priority = CommonJob::AUTO_JOB_PRIORITY
-                               new_job.create_logger( nil ) 
+                               new_job.create_logger( nil )
 
                                # add
                                @server.jobmgr.add_job( new_job )
index f1407f55f73e5dce027a986e687848ab36d92a6f..6130eb9a65b79e69ac97aea5c8a6e75b0bed1770 100644 (file)
@@ -210,6 +210,8 @@ class Client
 
                if loc.nil? then loc = @location end
 
+               if not File.exist? loc then FileUtils.mkdir_p "#{loc}" end
+
                dependent_pkg_list = []
 
                # get dependent list
@@ -238,6 +240,9 @@ class Client
                        filename = pkg_path.split('/')[-1]
 
                        if not FileDownLoader.download(url, loc, @log) then
+                               @log.Error "File Download Failed!!"
+                               @log.Error "* #{url} -> #{loc}"
+                               return nil
                        end
 
                        file_path = File.join(loc, filename)