[Title] installer bug fix when meta file install in windows system
authorjiil.hyoun <jiil.hyoun@samsung.com>
Tue, 11 Dec 2012 11:10:59 +0000 (20:10 +0900)
committerjiil.hyoun <jiil.hyoun@samsung.com>
Tue, 11 Dec 2012 11:10:59 +0000 (20:10 +0900)
[Type] Bugfix
[Module] Toolchain /
[Priority] Major
[Jira#]
[Redmine#]
[Problem]
[Cause]
[Solution]
[TestCase]

Change-Id: I39e6d9a991345b7af1029475438841281642c604

src/pkg_server/installer.rb

index 1ec43ebb23736aa3520dd175b9ca0d0ddc2a6887..58febe91ab98f3ab5cba408248d79ec000ff72b6 100644 (file)
@@ -310,22 +310,24 @@ class FileInstaller
                else FileUtils.cp pkginfo_path, config_path end
 
                if File.exist? data_path then
-                       # if os is linux, use cpio. it is faster than cp
-                       if Utils.is_linux_like_os( Utils::HOST_OS ) then
-                               absolute_path = `readlink -f #{target_path}`
-                               result = Utils.execute_shell_return("cd #{data_path}; find . -depth | cpio -pldm #{absolute_path}")
-                       else
-                               result = Utils.execute_shell_return("cp -r #{data_path}/* #{target_path}")
-                       end
-                       if result.nil? then
-                               logger.error "Failed to move files"
-                               logger.info "  [from: #{source_path}]"
-                               logger.info "  [to:  #{target_path}]"
-                               return nil
+                       if Dir.entries(data_path).count > 2 then
+                               # if os is linux, use cpio. it is faster than cp
+                               if Utils.is_linux_like_os( Utils::HOST_OS ) then
+                                       absolute_path = `readlink -f #{target_path}`
+                                       result = Utils.execute_shell_return("cd #{data_path}; find . -depth | cpio -pldm #{absolute_path}")
+                               else
+                                       result = Utils.execute_shell_return("cp -r #{data_path}/* #{target_path}")
+                               end
+                               if result.nil? then
+                                       logger.error "Failed to move files"
+                                       logger.info "  [from: #{source_path}]"
+                                       logger.info "  [to:  #{target_path}]"
+                                       return nil
+                               end
+                               logger.info "Moved files.. OK"
+                               log = log + "[from: #{source_path}]\n"
+                               log = log + "[to:  #{target_path}]\n"
                        end
-                       logger.info "Moved files.. OK"
-                       log = log + "[from: #{source_path}]\n"
-                       log = log + "[to:  #{target_path}]\n"
                else logger.warn "\"data\" directory does not exist." end
 
                return log