[Title] Fixed not to hang on "pkg-build"
authordonghee yang <donghee.yang@samsung.com>
Tue, 16 Oct 2012 09:09:47 +0000 (18:09 +0900)
committerdonghee yang <donghee.yang@samsung.com>
Tue, 16 Oct 2012 09:09:47 +0000 (18:09 +0900)
src/build_server/GitBuildJob.rb
src/builder/Builder.rb
src/common/execute_with_log.rb
src/common/utils.rb
src/pkg_server/downloader.rb

index 516b5cd69121bc1e68b42e27a16618ddfc510bc4..306995fbe89a5f49f111bbef29f10d9801b951c8 100644 (file)
@@ -281,7 +281,7 @@ class GitBuildJob < BuildJob
         build_command = "cd \"#{working_dir}\";#{@server.git_bin_path} #{cmd}"
 
                pid, status = execute_command( build_command )
-               if status.exitstatus != 0 then 
+               if not status.nil? and status.exitstatus != 0 then 
                        return false 
                else
                        return true
index a94b4b66b5f98e17fe837302683d763156c0f568..e85415f88b2de492950b711058477fe3f9043d71 100644 (file)
@@ -48,6 +48,7 @@ class Builder
                @host_os = Utils::HOST_OS
                @buildroot_dir = buildroot_dir
                @cache_dir = cache_dir
+               @job = nil
                if not log_path.nil? then
                        @log = Log.new(log_path)
                else
@@ -473,7 +474,7 @@ VERSION=\"#{version}\" "
                        pid, status = Utils.execute_shell_with_log( build_command, @log.path )
                end
 
-               if status.exitstatus != 0 then
+               if not status.nil? and status.exitstatus != 0 then
                        @log.error( "Failed on build script: \"#{target}\"", Log::LV_USER)
                        return false
                else
index f98a8fc15ec5b6b4d15002359424f5cfa58e393d..e82676ddc2383a9117100efe9e436b81c3141116 100755 (executable)
@@ -37,7 +37,7 @@ log_path = ARGV[1]
 
 # create logger
 if log_path.nil? or log_path.empty? then
-       log = Logger.new(STDOUT)
+       log = DummyLog.new
 else
        log = Logger.new(log_path)
 end
index 78a5cb348562be99bbd2c3e611804d661ac2bc5d..4cad345b454334bc6ecf3a02337be73bfd4630d9 100644 (file)
@@ -199,6 +199,10 @@ class Utils
        # can decide whether wait or not
        def Utils.execute_shell_with_log(cmd, log_path, wait=true)
 
+               if log_path.nil? or log_path.empty? then
+                       return execute_shell_with_stdout(cmd, nil)
+               end
+
                ruby_path=File.join(Config::CONFIG["bindir"],
                                   Config::CONFIG["RUBY_INSTALL_NAME"] +
                                   Config::CONFIG["EXEEXT"])
@@ -221,6 +225,24 @@ class Utils
        end
 
 
+       def Utils.execute_shell_with_stdout(cmd, os_category = nil)
+
+               logger = Logger.new(STDOUT)
+               
+               # generate command
+               cmd = generate_shell_command(cmd, os_category)
+
+               # print log
+               pipe = IO.popen("#{cmd} 2>&1") { |io|
+                       io.each do |line|
+                               logger.info line
+                       end
+               }
+
+               return [nil, nil]
+       end
+
+
     def Utils.spawn(cmd, os_category = nil)
                
                if os_category.nil? then os_category = get_os_category( HOST_OS ) end
index a01bd248cd236d59ba1f2c7a51e89cda2b2546bf..9bdeeb9aa97183de893356a3cf72c5b5926ada92 100644 (file)
@@ -46,7 +46,7 @@ class FileDownLoader
                logger.info "Downloading #{url}"
         if is_remote then
             pid,status = Utils.execute_shell_with_log( "wget #{url} -O #{fullpath} -nv", logger.path )
-                       ret = status.exitstatus != 0 ? false : true
+                       ret = (not status.nil? and status.exitstatus) != 0 ? false : true
             #ret = Utils.execute_shell( "wget #{url} -O #{fullpath} -q")
         else
             if not File.exist? url then