[Title] Fixed bug that "--rebuild" option is not working when source changes
authordonghee yang <donghee.yang@samsung.com>
Tue, 26 Mar 2013 04:54:42 +0000 (13:54 +0900)
committerdonghee yang <donghee.yang@samsung.com>
Tue, 26 Mar 2013 04:54:42 +0000 (13:54 +0900)
src/build_server/BuildJob.rb
src/build_server/CommonProject.rb

index 490c93b6f9f257853bd5f04e420b61973ccea5af..c44f93949b050fa912525e14361a4cd872f74158 100644 (file)
@@ -581,7 +581,9 @@ class BuildJob < CommonJob
                # check if version is same and source_info is different
                ver_local = @pkginfo.packages[0].version
                old_source_info = @project.get_source_info( ver_local )
-               if not old_source_info.nil? and old_source_info != source_info then
+               if ( not @force_rebuild and 
+                        not old_source_info.nil? and old_source_info != source_info ) then
+
                        @log.error( "Source code has been changed without increasing version!", Log::LV_USER)
                        @log.error( " * Version : #{ver_local}", Log::LV_USER)
                        @log.error( " * Before  : #{old_source_info}", Log::LV_USER)
@@ -598,8 +600,10 @@ class BuildJob < CommonJob
                        if ver_svr.nil? then next end
 
                        # compare version
-                       if Version.new(ver_local) < Version.new(ver_svr) or
-                               ( not @force_rebuild and Version.new(ver_local) == Version.new(ver_svr) )  then
+                       if ( not @force_rebuild and 
+                               ( Version.new(ver_local) < Version.new(ver_svr) or
+                                 Version.new(ver_local) == Version.new(ver_svr) ) ) then
+
                                @log.error( "Version must be increased : #{ver_local} <= #{ver_svr}", Log::LV_USER)
                                return false
                        end
index a2b46accfcf5726999ee3712b15328c709b6f2ed..9d896452efd51c07559bdef25613e4f5de25b02b 100644 (file)
@@ -299,6 +299,9 @@ class CommonProject
                if row1.nil? then
                        db.do "INSERT INTO sources(project_id, pkg_ver,location) 
                                VALUES(#{@prj_id},'#{src_ver}','#{info}')"
+               else
+                       db.do "UPDATE sources SET location='#{info}' "+
+                                       "WHERE project_id=#{@prj_id} and pkg_ver='#{src_ver}'"
                end
        end