[Title] package server sync : download only higher package and print log
authorhataejun <taejun.ha@samsung.com>
Thu, 11 Oct 2012 02:10:55 +0000 (11:10 +0900)
committerhataejun <taejun.ha@samsung.com>
Thu, 11 Oct 2012 02:10:55 +0000 (11:10 +0900)
[Type]
[Module]
[Priority]
[Jira#]
[Redmine#]
[Problem]
[Cause]
[Solution]
[TestCase]

src/pkg_server/distribution.rb

index 182e8080121a59f2021e5b37c48e8a731746717d..4226a32725e85c3f55b1297b6702894033e83b38 100644 (file)
@@ -240,6 +240,7 @@ class Distribution
                        server_pkg_name_list = client.pkg_hash_os[os].keys
                        local_pkg_name_list = @pkg_hash_os[os].keys 
                        full_pkg_name_list = server_pkg_name_list + local_pkg_name_list
+                       full_pkg_name_list.uniq!
 
                        full_pkg_name_list.each do |pkg_name| 
                                ret = sync_package( pkg_name, client, os, force )
@@ -279,6 +280,8 @@ class Distribution
                                        # if package is update when sync time then skip
                                        if Utils.compare_version(local_pkg.version, pkg.version) == -1 then
                                                next
+                                       else 
+                                               @log.info( "update package [#{pkg.package_name}] in #{pkg.os}", Log::LV_USER)
                                        end
                                end
 
@@ -287,6 +290,8 @@ class Distribution
                        when "REMOVE"
                                if not force then
                                        if @pkg_hash_os[os][pkg.package_name].origin.eql? "local" then 
+                                       else 
+                                               @log.info( "remove package [#{pkg.package_name}] in #{pkg.os}", Log::LV_USER)
                                                next
                                        end
                                end
@@ -729,6 +734,11 @@ class Distribution
                                return nil
                        end
 
+                       if ( version_cmp == -1 ) then
+                               # local package's version is higher than server packages's version then skip update
+                               return nil
+                       end
+
                        if ( local_pkg.origin.eql? "local" ) and (not force) then 
                                # local_pkg is generated from local and not force mode then skip update
                                return nil