7 Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
10 Taejun Ha <taejun.ha@samsung.com>
11 Jiil Hyoun <jiil.hyoun@samsung.com>
12 Donghyuk Yang <donghyuk.yang@samsung.com>
13 DongHee Yang <donghee.yang@samsung.com>
15 Licensed under the Apache License, Version 2.0 (the "License");
16 you may not use this file except in compliance with the License.
17 You may obtain a copy of the License at
19 http://www.apache.org/licenses/LICENSE-2.0
21 Unless required by applicable law or agreed to in writing, software
22 distributed under the License is distributed on an "AS IS" BASIS,
23 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
24 See the License for the specific language governing permissions and
25 limitations under the License.
33 $LOAD_PATH.unshift File.dirname(__FILE__)+"/src/common"
34 $LOAD_PATH.unshift File.dirname(__FILE__)+"/src/pkg_server"
38 require "clientOptParser"
40 require "packageServer"
45 $log = Logger.new('.log', 'monthly')
51 # if option parse error print help message
52 $log.error "option parsing error"
53 system "#{__FILE__} help"
57 #if "--os" is not specfied, use host os type
58 if option[:os].nil? then
59 system_type = `uname -s`
60 case system_type.strip
64 option[:os] = "windows"
66 option[:os] = "darwin"
68 raise RuntimeError, "Unknown OS type : #{system_type}"
74 client = Client.new( option[:url], nil, nil )
77 client = Client.new( nil, option[:loc], nil )
78 client.clean(option[:f])
80 client = Client.new( option[:url], option[:loc], nil )
81 if not option[:url].nil? then
84 file_loc = client.download( option[:pkg], option[:os], option[:t] )
86 client = Client.new( nil, nil, nil )
87 result = client.upload( option[:alias], option[:id], option[:binpkg], option[:srcpkg], false )
88 if not result.nil? then
92 client = Client.new( option[:url], option[:loc], nil )
93 if not option[:url].nil? then
96 client.download_source( option[:pkg], option[:os] )
98 client = Client.new( option[:url], option[:loc], nil )
99 if not option[:url].nil? then
102 client.install( option[:pkg], option[:os], option[:t], option[:f] )
103 when "install-file" then
104 client = Client.new( nil, option[:loc], nil )
105 client.install_local_pkg( option[:pkg], option[:f] )
106 when "uninstall" then
107 client = Client.new( nil, option[:loc], nil )
108 client.uninstall( option[:pkg], option[:t] )
110 client = Client.new( option[:url], option[:loc], nil )
111 if not option[:url].nil? then
114 client.upgrade( option[:os], option[:t] )
115 when "check-upgrade" then
116 client = Client.new( option[:url], option[:loc], nil )
117 if not option[:url].nil? then
120 client.check_upgrade( option[:os] )
121 when "show-rpkg" then
122 client = Client.new( option[:url], nil, nil )
123 if not option[:url].nil? then
126 puts client.show_pkg_info( option[:pkg], option[:os] )
127 when "list-rpkg" then
128 client = Client.new( option[:url], nil, nil )
129 if not option[:url].nil? then
132 result = client.show_pkg_list( option[:os] )
133 if not result.nil? and not result.empty? then
138 puts name + " (" + version + ")"
141 when "show-lpkg" then
142 client = Client.new( nil, option[:loc], nil )
143 puts client.show_installed_pkg_info( option[:pkg] )
144 when "list-lpkg" then
145 client = Client.new( nil, option[:loc], nil )
146 result = client.show_installed_pkg_list()
147 if not result.nil? and not result.empty? then
152 puts name + " (" + version + ")"
155 puts "Info: There is no any package."
157 when "build-dep" then
158 client = Client.new( nil, nil, nil )
159 result = client.get_build_dependent_packages( option[:pkg], option[:os], true )
162 ret = ret + i + " --> "
167 when "install-dep" then
168 client = Client.new( nil, nil, nil )
169 result = client.get_install_dependent_packages( option[:pkg], option[:os], true, false )
172 ret = ret + i + " --> "
178 raise RuntimeError, "input option incorrect : #{option[:cmd]}"