[Title] Added build server configuration for package sync period
authordonghee yang <donghee.yang@samsung.com>
Fri, 17 Aug 2012 08:18:31 +0000 (17:18 +0900)
committerdonghee yang <donghee.yang@samsung.com>
Fri, 17 Aug 2012 08:18:31 +0000 (17:18 +0900)
src/build_server/BuildServer.rb
src/build_server/BuildServerController.rb
src/build_server/PackageSync.rb
test/bin/bin_0.0.1_ubuntu-32.zip [new file with mode: 0644]
test/pkgsvr2.init [new file with mode: 0755]

index 6a5ee7626b957d2d9a7cb22b21d8a69c5b7fcd73..551f79b787dca1851ec3048f7969389ea2ad4d65 100644 (file)
@@ -59,6 +59,7 @@ class BuildServer
        attr_accessor :cancel_lock
        attr_accessor :supported_os_list
        attr_accessor :remote_pkg_servers
+       attr_accessor :pkg_sync_period
 
        CONFIG_ROOT = "#{Utils::HOME}/.build_tools/build_server"
        HOST_OS = Utils::HOST_OS
@@ -106,6 +107,8 @@ class BuildServer
                @outgoing_path = "#{@path}/outgoing"
                @cancel_lock = Mutex.new
                @supported_os_list = []
+
+               @pkg_sync_period=600
        end
 
 
index 78ba035efe2086172ce351d2f95d202f418f909d..8b5ca4b0c9a50a5db600002a09e2585e04845305 100644 (file)
@@ -511,6 +511,7 @@ class BuildServerController
             f.puts "FTP_PORT=#{server.ftp_port}"            
                        f.puts "FTP_USERNAME=#{server.ftp_username}"
                        f.puts "FTP_PASSWD=#{server.ftp_passwd}"
+                       f.puts "PKG_SYNC_PERIOD=#{server.pkg_sync_period}"
                end
        end
 
@@ -535,6 +536,7 @@ class BuildServerController
                ftp_port="21"
                ftp_username=""
                ftp_passwd=""
+               pkg_sync_period=600             
 
                # read configuration
                server_dir = "#{BuildServer::CONFIG_ROOT}/#{id}"
@@ -579,6 +581,8 @@ class BuildServerController
                                        ftp_username = l[idx,length].strip
                                elsif l.start_with?("FTP_PASSWD=")
                                        ftp_passwd = l[idx,length].strip
+                               elsif l.start_with?("PKG_SYNC_PERIOD=")
+                                       pkg_sync_period = l[idx,length].strip.to_i
                                else
                                        next    
                                end 
@@ -663,6 +667,9 @@ class BuildServerController
                obj.ftp_username = ftp_username
                obj.ftp_passwd = ftp_passwd
 
+               # pkg synchronization
+               obj.pkg_sync_period = pkg_sync_period
+
                # save config
                write_server_config( obj )
                
index 67fbaab986dd8d6bd0bd68f492145f082931afea..07655ef7c6762b86a6502d7403069a5f6537f287 100644 (file)
@@ -39,7 +39,7 @@ class PackageSyncAction < Action
        @@new_id = 0
        
        def initialize( time, url, proxy, server )
-               super(time, 600)
+               super(time, server.pkg_sync_period)
                my_id = @@new_id
                @@new_id += 1
                @pkgsvr_url = url
diff --git a/test/bin/bin_0.0.1_ubuntu-32.zip b/test/bin/bin_0.0.1_ubuntu-32.zip
new file mode 100644 (file)
index 0000000..9c21aca
Binary files /dev/null and b/test/bin/bin_0.0.1_ubuntu-32.zip differ
diff --git a/test/pkgsvr2.init b/test/pkgsvr2.init
new file mode 100755 (executable)
index 0000000..e97681c
--- /dev/null
@@ -0,0 +1,7 @@
+#!/bin/sh
+rm -rf ~/.build_tools/pkg_server/pkgsvr02
+rm -rf `pwd`/pkgsvr02
+ruby -d ../pkg-svr create -n pkgsvr02 -d unstable
+ruby -d ../pkg-svr add-os -n pkgsvr02 -d unstable -o ubuntu-32
+ruby -d ../pkg-svr add-os -n pkgsvr02 -d unstable -o windows-32
+ruby -d ../pkg-svr start -n pkgsvr02 -p 4444