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"
49 # if option parse error print help message
55 if not Utils.check_host_OS() then
56 puts "Error: Your host OS is not supported!"
59 #if "--os" is not specfied, use host os type
60 if option[:os].nil? then
61 option[:os] = Utils::HOST_OS
66 client = Client.new( option[:url], nil, nil )
69 client = Client.new( nil, option[:loc], nil )
70 client.clean(option[:f])
72 client = Client.new( option[:url], option[:loc], nil )
73 #if not option[:url].nil? then
76 file_loc = client.download( option[:pkg], option[:os], option[:t] )
78 client = Client.new( option[:url], option[:loc], nil )
79 #if not option[:url].nil? then
82 client.install( option[:pkg], option[:os], option[:t], option[:f] )
83 when "install-file" then
84 client = Client.new( option[:url], option[:loc], nil )
85 client.install_local_pkg( option[:pkg], option[:t], option[:f] )
87 client = Client.new( nil, option[:loc], nil )
88 client.uninstall( option[:pkg], option[:t] )
90 client = Client.new( option[:url], option[:loc], nil )
91 #if not option[:url].nil? then
94 client.upgrade( option[:os], option[:t] )
95 when "check-upgrade" then
96 client = Client.new( option[:url], option[:loc], nil )
97 #if not option[:url].nil? then
100 client.check_upgrade( option[:os] )
101 when "show-rpkg" then
102 client = Client.new( option[:url], nil, nil )
103 #if not option[:url].nil? then
106 puts client.show_pkg_info( option[:pkg], option[:os] )
107 when "list-rpkg" then
108 client = Client.new( option[:url], nil, nil )
109 #if not option[:url].nil? then
112 result = client.show_pkg_list( option[:os] )
113 if not result.nil? and not result.empty? then
118 puts name + " (" + version + ")"
121 when "show-lpkg" then
122 client = Client.new( nil, option[:loc], nil )
123 puts client.show_installed_pkg_info( option[:pkg] )
124 when "list-lpkg" then
125 client = Client.new( nil, option[:loc], nil )
126 result = client.show_installed_pkg_list()
127 if not result.nil? and not result.empty? then
132 puts name + " (" + version + ")"
135 puts "Info: There is no any package."
137 when "build-dep" then
138 client = Client.new( nil, nil, nil )
139 result = client.get_build_dependent_packages( option[:pkg], option[:os], true )
142 ret = ret + i + " --> "
147 when "install-dep" then
148 client = Client.new( nil, nil, nil )
149 result = client.get_install_dependent_packages( option[:pkg], option[:os], true, false )
152 ret = ret + i + " --> "
158 raise RuntimeError, "Input is incorrect : #{option[:cmd]}"