[Title] Fixed a bug that it does not install secondly-depedent packages when multi-job
authordonghee yang <donghee.yang@samsung.com>
Thu, 16 Aug 2012 16:47:18 +0000 (01:47 +0900)
committerdonghee yang <donghee.yang@samsung.com>
Thu, 16 Aug 2012 16:47:18 +0000 (01:47 +0900)
src/build_server/BuildJob.rb

index 5d4e23cc52b1de5985e7b3bb4a0db452312cbae9..996235559000fd84c69a8103d0d8a5d87f3e7696 100644 (file)
@@ -762,10 +762,11 @@ class BuildJob
                        src_path = @parent.source_path
                        deps = @pkginfo.get_build_dependencies(@os)
                        for dep in deps
-                               pkg = get_local_package_of_dependency( dep, src_path )
-                               if not pkg.nil? then local_pkgs.push pkg end
+                               pkgs = get_local_required_packages( dep, src_path )
+                               local_pkgs += pkgs
                        end
                end
+               local_pkgs.uniq!
 
                #compatable os support
                compat_ok = true
@@ -1146,6 +1147,39 @@ class BuildJob
        end
 
 
+       def get_local_required_packages( dep, src_path )
+               pkgs = []
+
+               # use the target os if not specified
+               if dep.target_os_list.count != 0 then
+                       dep_target_os = dep.target_os_list[0]
+               else
+                       dep_target_os = @os
+               end
+
+               sub_pkgs = @pkgsvr_client.get_install_dependent_packages(dep.package_name, 
+                                       dep_target_os, false, true)
+
+               # search
+               pkg_names = [ dep.package_name ] 
+               pkg_names += sub_pkgs
+               pkg_names.uniq!
+               pkg_names.each { |pkg_name|
+                       binpkgs = Dir.glob("#{src_path}/#{pkg_name}_*_#{dep_target_os}.zip")
+                       if binpkgs.count > 0 then
+                               pkg = binpkgs[0]
+                               if pkg_name == dep.package_name then
+                                       version = Utils.get_version_from_package_file(pkg)
+                                       if not dep.match? version then return [] end
+                               end
+                               pkgs.push pkg
+                       end
+               }
+
+               return pkgs
+       end
+
+
        def remote_package_of_dependency_exist?(dep)
                # use the target os if not specified
                if dep.target_os_list.count != 0 then