Update Tizen 2.0 SDK source code
[sdk/tools/sdk-build.git] / pkg-clean
1 #!/usr/bin/ruby 
2
3 =begin
4  
5  pkg-clean
6
7 Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
8
9 Contact:
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>
14
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
18
19 http://www.apache.org/licenses/LICENSE-2.0
20
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.
26
27 Contributors:
28 - S-Core Co., Ltd
29 =end
30
31 $LOAD_PATH.unshift File.dirname(__FILE__)+"/src/common"
32 $LOAD_PATH.unshift File.dirname(__FILE__)+"/src/pkg_server"
33 $LOAD_PATH.unshift File.dirname(__FILE__)+"/src/builder"
34 require "utils"
35 require "packageServer"
36 require "Builder"
37 require "CleanOptionParser"
38
39 path = Dir.pwd
40 if not File.exist? "package" then 
41     puts "current dirctory \"#{path}\" is not package root directory"
42     exit 1
43 end 
44
45 option = parse
46
47 #generate server when local package server is not set
48
49 # check HOST OS
50 if not Utils.check_host_OS() then
51         puts "Error: Your host OS is not supported!"
52         exit 1
53 end
54
55 begin 
56         builder = Builder.get("default")  
57 rescue
58         puts "Default builder does not exist! Creating new builder..."
59         builder = Builder.create("default", "http://172.21.111.132/pkgserver/unstable",nil)  
60 end
61
62 #build project
63 if not builder.clean( Utils::WORKING_DIR ) then
64         puts "Clean failed!"
65 else
66         puts "Clean succeeded!"
67 end
68