snapshot name check when multiple package server sync 47/26347/1
authorHyoun Jiil <jiil.hyoun@samsung.com>
Thu, 21 Aug 2014 06:04:57 +0000 (15:04 +0900)
committerHyoun Jiil <jiil.hyoun@samsung.com>
Thu, 21 Aug 2014 06:04:57 +0000 (15:04 +0900)
- avoid snapshot name 'sync_sync_xxxx'

Change-Id: I3f7cbc9a267f024bceec4b393adf21e50eb5e8e5

package/changelog
package/pkginfo.manifest
src/pkg_server/client.rb
src/pkg_server/packageServer.rb

index 42380073a3027baaec91128c9a757ef6d5517451..b7c6ca6e9eab4b60a7516a180cf8866ae4cd5205 100644 (file)
@@ -1,3 +1,7 @@
+* 2.2.4
+- snapshot name check when multiple package server sync
+-- avoid snapshot name 'sync_sync_xxxx'
+== hyoun jiil <jiil.hyoun@samsung.com> 2014-08-21
 * 2.2.3
 - multiple package server sync is no good design
 -- Now package server can sync only one depth
index 2247994eccca80b9af879d676f54679caeaa7600..03ae0253736f6e6bbf85e20ed29e00122961f1c3 100644 (file)
@@ -1,5 +1,5 @@
 Source : dibs
-Version :2.2.3
+Version :2.2.4
 Maintainer : taejun ha<taejun.ha@samsung.com>, jiil hyoun <jiil.hyoun@samsung.com>, donghyuk yang <donghyouk.yang@samsung.com>, donghee yang <donghee.yang@samsung.com>, sungmin kim <dev.sungmin.kim@samsung.com, jonghwan park <jonghwan2.park@samsung.com>
 
 Package : tizen-dibs-test
index 7a61e97230dd7a5e23b2e3f6b3847e0c1d7a4ddb..b6ca1b74537786e683e15fc8cff9a0b226622dd2 100644 (file)
@@ -1612,36 +1612,6 @@ class Client
         return pkg_all_list.sort
     end
 
-    public
-    # check_syncable_server?
-    # from_server : if true, update from server
-    def check_syncable_server?()
-        ssinfo_file = "snapshot.info"
-        file_url = File.join(@server_addr, ssinfo_file)
-        if @is_server_remote then
-            if not FileDownLoader.download(file_url, @config_dist_path, @log) then
-                @log.error "Server does not have \"#{ssinfo_file}\" file."
-                return false
-            end
-        else
-            if File.exist? file_url then 
-                FileUtils.cp(file_url, @config_dist_path)
-            else 
-                @log.error "Server does not have \"#{ssinfo_file}\" file."
-                return false
-            end
-        end
-
-        file_path = File.join(@config_dist_path, ssinfo_file)
-        if not File.exist? file_path then return false end
-
-        contents = File.open(file_path, "r").read
-
-        _list = contents.split("\n\n")
-        snapshot_list = _list.map {|x| x.split("\n").first.split(":")[1].strip }
-
-        return (snapshot_list.index{|x| /sync_.*/ =~ x}.nil?)
-    end
 
     private
     def get_build_dependency_arr(pkg_name, os, n)
index 487597ab9591e08c83af08736fbab9f6a059d4a7..ea8f7b505d78f55f9a9b331f9310df875bfbfe23 100644 (file)
@@ -130,18 +130,6 @@ class PackageServer
                create_distribution_struct( dist_name, server_url )
                Utils.file_unlock(lock_file)
 
-        # remote server check
-        if (not server_url.empty?) then
-            client = Client.create(server_url.strip, "#{@location}/binary", @log);
-            if client.nil? or not client.check_syncable_server? then
-                # remove configs
-                FileUtils.rm_rf @location
-                FileUtils.rm_rf @config_dir
-                @log.error( "#{server_url} is invalid or not synchronizable package server",Log::LV_USER)
-                return nil
-            end
-        end
-
                @log.output( "package server [#{@id}] created successfully", Log::LV_USER )
                @log.output( " - server location : #{@location}", Log::LV_USER )
                @log.output( " - server configure file : #{@config_file_path}", Log::LV_USER )
@@ -326,20 +314,20 @@ class PackageServer
                        return
                end
 
-        client = Client.create(distribution.server_url, "#{@location}/binary", @log);
-        if client.nil? or not client.check_syncable_server? then 
-            @log.error( "#{distribution.server_url} is invalid or not synchronizable package server", Log::LV_USER)
-        else
-            begin
-                update, snapshot = distribution.sync(mode, snapshot)
-                if update then
-                    distribution.generate_snapshot("sync_#{snapshot}", "", false, distribution.last_sync_changes)
+        begin
+            update, snapshot = distribution.sync(mode, snapshot)
+            if update then
+              snapshotName = nil;
+                if snapshot =~ /sync_.*/ then
+                    snapshotName = snapshot
+                else
+                    snapshotName = "sync_#{snapshot}"
                 end
-
-                @log.output( "package server [#{@id}]'s distribution [#{dist_name}] has been synchronized.", Log::LV_USER )
-            rescue => e
-                @log.error( e.message, Log::LV_USER)
+                distribution.generate_snapshot(snapshotName, "", false, distribution.last_sync_changes)
             end
+            @log.output( "package server [#{@id}]'s distribution [#{dist_name}] has been synchronized.", Log::LV_USER )
+        rescue => e
+            @log.error( e.message, Log::LV_USER)
         end
     end