build-tool 0.0.3 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data.tar.gz.sig +0 -0
- data/History.txt +28 -1
- data/Manifest.txt +91 -52
- data/README.txt +63 -0
- data/Rakefile +20 -23
- data/bin/build-tool +53 -0
- data/lib/build-tool.rb +7 -0
- data/lib/build-tool/GUI.rb +360 -0
- data/lib/build-tool/application.rb +84 -0
- data/lib/build-tool/build-system/autoconf.rb +60 -0
- data/lib/build-tool/build-system/base.rb +142 -0
- data/lib/build-tool/build-system/cmake.rb +119 -0
- data/lib/build-tool/build-system/custom.rb +115 -0
- data/lib/build-tool/build-system/qt.rb +113 -0
- data/lib/build-tool/cfg/lexer.rb +558 -0
- data/lib/build-tool/cfg/lexer.rex +248 -0
- data/lib/build-tool/cfg/lexer_base.rb +82 -0
- data/lib/build-tool/cfg/node.rb +94 -0
- data/lib/build-tool/cfg/parser.rb +871 -0
- data/lib/build-tool/cfg/parser.y +279 -0
- data/lib/build-tool/cfg/visitor.rb +471 -0
- data/lib/build-tool/commands.rb +639 -0
- data/lib/build-tool/commands/build.rb +120 -0
- data/lib/build-tool/commands/configure.rb +73 -0
- data/lib/build-tool/commands/ctags.rb +46 -0
- data/lib/build-tool/commands/environments.rb +29 -0
- data/lib/build-tool/commands/environments/list.rb +37 -0
- data/lib/build-tool/commands/environments/set.rb +33 -0
- data/lib/build-tool/commands/fetch.rb +50 -0
- data/lib/build-tool/commands/files.rb +73 -0
- data/lib/build-tool/commands/help.rb +22 -0
- data/lib/build-tool/commands/info.rb +48 -0
- data/lib/build-tool/commands/install.rb +56 -0
- data/lib/build-tool/commands/modules.rb +29 -0
- data/lib/build-tool/commands/modules/info.rb +75 -0
- data/lib/build-tool/commands/modules/list.rb +49 -0
- data/lib/build-tool/commands/modules/shell.rb +40 -0
- data/lib/build-tool/commands/rebase.rb +46 -0
- data/lib/build-tool/commands/recipes.rb +32 -0
- data/lib/build-tool/commands/recipes/info.rb +46 -0
- data/lib/build-tool/commands/recipes/install.rb +184 -0
- data/lib/build-tool/commands/recipes/list.rb +33 -0
- data/lib/build-tool/configuration.rb +115 -0
- data/lib/build-tool/environment.rb +119 -0
- data/lib/build-tool/errors.rb +9 -0
- data/lib/build-tool/module.rb +366 -0
- data/lib/build-tool/pluginbase.rb +43 -0
- data/lib/build-tool/recipe.rb +180 -0
- data/lib/build-tool/repository.rb +59 -0
- data/lib/build-tool/server.rb +43 -0
- data/lib/build-tool/singleton.rb +50 -0
- data/lib/build-tool/sshkey.rb +22 -0
- data/lib/build-tool/vcs/base.rb +105 -0
- data/lib/build-tool/vcs/git-svn.rb +154 -0
- data/lib/build-tool/vcs/git.rb +187 -0
- data/lib/build-tool/vcs/svn.rb +136 -0
- data/lib/mj/logging.rb +31 -0
- data/lib/mj/tools/ssh.rb +64 -0
- data/lib/{kde-build → mj/tools}/subprocess.rb +21 -16
- data/lib/mj/visitor.rb +21 -0
- data/recipes/kde/files/finish_installation.sh +16 -0
- data/recipes/kde/files/kde4.desktop +22 -0
- data/recipes/kde/files/xsession +89 -0
- data/recipes/kde/info.yaml +10 -0
- data/recipes/kde/recipe +585 -0
- data/recipes/kde/recipe-local +90 -0
- data/recipes/kde/settings.yaml +52 -0
- data/recipes/kde43/info.yaml +10 -0
- data/recipes/kde43/recipe +256 -0
- data/recipes/kde43/recipe-local +90 -0
- data/recipes/kde43/settings.yaml +32 -0
- data/recipes/kdeqt4.6/custom/qt/qtscriptgenerator/compile.sh +77 -0
- data/recipes/kdeqt4.6/custom/qt/qtscriptgenerator/configure.sh +70 -0
- data/recipes/kdeqt4.6/custom/qt/qtscriptgenerator/install.sh +39 -0
- data/recipes/kdeqt4.6/info.yaml +7 -0
- data/recipes/kdeqt4.6/recipe +155 -0
- data/recipes/kdeqt4.6/recipe-local +30 -0
- data/recipes/kdeqt4.6/settings.yaml +27 -0
- data/tags +745 -0
- data/tasks/genfiles.rake +28 -0
- data/tasks/rdoc.rake +34 -0
- data/tasks/rspec.rake +21 -0
- data/test.rb +28 -0
- data/test/commands/test_build.rb +29 -0
- data/test/test_build_system.rb +98 -0
- data/test/test_cli.rb +61 -0
- data/test/test_command.rb +175 -0
- data/test/test_configuration_parser.rb +542 -0
- data/test/test_environment.rb +82 -0
- data/test/test_helper.rb +39 -7
- data/test/test_module.rb +158 -0
- data/test/test_repository.rb +75 -0
- data/test/test_singleton.rb +51 -0
- data/test/test_ssh_key.rb +14 -0
- data/test/test_svn_parser.rb +28 -0
- data/test/test_vcs.rb +33 -0
- metadata +139 -90
- metadata.gz.sig +0 -0
- data/PostInstall.txt +0 -3
- data/TODO +0 -2
- data/bin/kde-build.rb +0 -21
- data/config/website.yml +0 -2
- data/config/website.yml.sample +0 -2
- data/lib/kde-build.rb +0 -18
- data/lib/kde-build/application.rb +0 -270
- data/lib/kde-build/build_system.rb +0 -28
- data/lib/kde-build/build_system/autoconf.rb +0 -108
- data/lib/kde-build/build_system/base.rb +0 -139
- data/lib/kde-build/build_system/cmake.rb +0 -94
- data/lib/kde-build/build_system/qtcopy.rb +0 -127
- data/lib/kde-build/command.rb +0 -42
- data/lib/kde-build/command/build.rb +0 -106
- data/lib/kde-build/command/compile.rb +0 -39
- data/lib/kde-build/command/configure.rb +0 -48
- data/lib/kde-build/command/ctags.rb +0 -41
- data/lib/kde-build/command/fetch.rb +0 -33
- data/lib/kde-build/command/help.rb +0 -71
- data/lib/kde-build/command/info.rb +0 -45
- data/lib/kde-build/command/install.rb +0 -39
- data/lib/kde-build/command/module_based.rb +0 -44
- data/lib/kde-build/command/rebase.rb +0 -50
- data/lib/kde-build/command/version.rb +0 -43
- data/lib/kde-build/configuration.rb +0 -209
- data/lib/kde-build/exception.rb +0 -6
- data/lib/kde-build/metaaid.rb +0 -18
- data/lib/kde-build/module.rb +0 -227
- data/lib/kde-build/module_configuration.rb +0 -107
- data/lib/kde-build/moduleregistry.rb +0 -85
- data/lib/kde-build/tools/ctags.rb +0 -59
- data/lib/kde-build/tools/logging.rb +0 -49
- data/lib/kde-build/tools/make.rb +0 -58
- data/lib/kde-build/tools/ssh.rb +0 -47
- data/lib/kde-build/vcs.rb +0 -28
- data/lib/kde-build/vcs/base.rb +0 -85
- data/lib/kde-build/vcs/git-svn.rb +0 -139
- data/lib/kde-build/vcs/git.rb +0 -121
- data/lib/kde-build/vcs/svn.rb +0 -102
- data/script/console +0 -10
- data/script/destroy +0 -14
- data/script/generate +0 -14
- data/script/txt2html +0 -71
- data/test.yaml.tmpl +0 -632
- data/test/test_kde-build.rb +0 -11
- data/test/test_vcs_svn.rb +0 -44
- data/website/index.html +0 -84
- data/website/index.txt +0 -59
- data/website/javascripts/rounded_corners_lite.inc.js +0 -285
- data/website/stylesheets/screen.css +0 -159
- data/website/template.html.erb +0 -50
@@ -1,44 +0,0 @@
|
|
1
|
-
require 'kde-build/command'
|
2
|
-
|
3
|
-
module BuildTool
|
4
|
-
|
5
|
-
class ModuleBasedCommand < Command
|
6
|
-
|
7
|
-
def execute( args )
|
8
|
-
|
9
|
-
# If no argument is given show the help and quit.
|
10
|
-
if args.length == 0
|
11
|
-
show_help
|
12
|
-
return
|
13
|
-
end
|
14
|
-
|
15
|
-
# Map the command line to real modules
|
16
|
-
real_modules = []
|
17
|
-
ModuleRegistry.get_modules( args ) do |mod|
|
18
|
-
# Check if the module is fit for the command
|
19
|
-
if is_module_ready( mod )
|
20
|
-
real_modules.push( mod )
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
# Execute the command for each module
|
25
|
-
real_modules.each do |mod|
|
26
|
-
begin
|
27
|
-
|
28
|
-
execute_for_module( mod )
|
29
|
-
|
30
|
-
rescue Interrupt => e
|
31
|
-
$log.info("SIGBREAK recieved.")
|
32
|
-
return
|
33
|
-
|
34
|
-
rescue Exception => e
|
35
|
-
$log.info("error: #{e.class}: #{e.message}")
|
36
|
-
puts e.backtrace if $verbose
|
37
|
-
end
|
38
|
-
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
end
|
43
|
-
|
44
|
-
end
|
@@ -1,50 +0,0 @@
|
|
1
|
-
require 'kde-build/command/module_based'
|
2
|
-
|
3
|
-
module BuildTool
|
4
|
-
|
5
|
-
class RebaseCommand < ModuleBasedCommand
|
6
|
-
|
7
|
-
def initialize
|
8
|
-
super( 'rebase', false )
|
9
|
-
self.short_desc = "Rebase the local repository."
|
10
|
-
self.description = <<-"EOS"
|
11
|
-
Rebases the local repository against the changes made in the remote
|
12
|
-
repository. The changes will be first fetched and then the rebase is done. If
|
13
|
-
the vcs doesn't support that separation fetch and rebase are done in one step.
|
14
|
-
|
15
|
-
If --no-update is present only a rebase is done. Remember that svn doesn't
|
16
|
-
support that separation and will still fetch changes.
|
17
|
-
EOS
|
18
|
-
@update = true
|
19
|
-
self.options = CmdParse::OptionParserWrapper.new do |opt|
|
20
|
-
opt.separator "Options:"
|
21
|
-
opt.on( "--no-update", "Do not update from the repository" ) { |t|
|
22
|
-
@update = false
|
23
|
-
}
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
def is_module_ready( mod )
|
28
|
-
mod.activate_ssh_key
|
29
|
-
true
|
30
|
-
end
|
31
|
-
|
32
|
-
def execute_for_module( mod )
|
33
|
-
|
34
|
-
$log.info( "###############################################################" )
|
35
|
-
$log.info( "### Rebasing module #{mod.name}" )
|
36
|
-
$log.info( "###############################################################" )
|
37
|
-
|
38
|
-
if mod.checkedout?
|
39
|
-
mod.fetch if @update
|
40
|
-
mod.rebase
|
41
|
-
else
|
42
|
-
mod.init
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
end
|
47
|
-
|
48
|
-
|
49
|
-
end
|
50
|
-
|
@@ -1,43 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
#
|
3
|
-
require 'kde-build/command'
|
4
|
-
|
5
|
-
module BuildTool
|
6
|
-
|
7
|
-
|
8
|
-
# The default version command. It adds the options "-v" and "--version" to the global options of
|
9
|
-
# the associated +CommandParser+. When specified on the command line, it shows the version of the
|
10
|
-
# program.
|
11
|
-
class VersionCommand < Command
|
12
|
-
|
13
|
-
def initialize
|
14
|
-
super( 'version', false )
|
15
|
-
self.short_desc = "Show the version of the program"
|
16
|
-
end
|
17
|
-
|
18
|
-
def init
|
19
|
-
case commandparser.main_command.options
|
20
|
-
when CmdParse::OptionParserWrapper
|
21
|
-
commandparser.main_command.options.instance do |opt|
|
22
|
-
opt.on_tail( "--version", "-v", "Show the version of the program" ) do
|
23
|
-
execute( [] )
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
def usage
|
30
|
-
"Usage: #{commandparser.program_name} version"
|
31
|
-
end
|
32
|
-
|
33
|
-
def execute( args )
|
34
|
-
version = commandparser.program_version
|
35
|
-
version = version.join( '.' ) if version.instance_of?( Array )
|
36
|
-
puts commandparser.banner + "\n" if commandparser.banner
|
37
|
-
puts version
|
38
|
-
end
|
39
|
-
|
40
|
-
end
|
41
|
-
|
42
|
-
|
43
|
-
end
|
@@ -1,209 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
#
|
3
|
-
|
4
|
-
require 'kde-build/metaaid'
|
5
|
-
|
6
|
-
module MJ;
|
7
|
-
|
8
|
-
class ConfigurationError < Exception
|
9
|
-
end
|
10
|
-
|
11
|
-
module Configuration
|
12
|
-
|
13
|
-
class Option
|
14
|
-
|
15
|
-
attr_accessor :name, :attribute, :description, :default
|
16
|
-
|
17
|
-
def initialize( obj, name, description )
|
18
|
-
@name = name
|
19
|
-
@attribute =self.class.sanitize name
|
20
|
-
@description = description
|
21
|
-
@default = nil
|
22
|
-
@one_of = nil
|
23
|
-
@on_read = nil
|
24
|
-
@on_write = nil
|
25
|
-
@required = false
|
26
|
-
|
27
|
-
install obj
|
28
|
-
end
|
29
|
-
|
30
|
-
def default=( value )
|
31
|
-
@default = value
|
32
|
-
self
|
33
|
-
end
|
34
|
-
|
35
|
-
def self.sanitize( name )
|
36
|
-
name.gsub( /[^a-zA-Z_]/, '_' )
|
37
|
-
end
|
38
|
-
|
39
|
-
def install( obj )
|
40
|
-
attribute = @attribute
|
41
|
-
|
42
|
-
obj.class_def( attribute ) do
|
43
|
-
opt = self.class.__options__[attribute]
|
44
|
-
value = self.values[attribute]
|
45
|
-
end
|
46
|
-
|
47
|
-
obj.class_def( "#{attribute}=" ) do
|
48
|
-
|value|
|
49
|
-
opt = self.class.__options__[attribute]
|
50
|
-
|
51
|
-
if !opt
|
52
|
-
puts self
|
53
|
-
puts self.class.__options__.inspect
|
54
|
-
raise Exception, "????"
|
55
|
-
end
|
56
|
-
# First validate the value
|
57
|
-
opt.validate(value)
|
58
|
-
value = opt.write(value)
|
59
|
-
|
60
|
-
# Then call the custom on_write method
|
61
|
-
self.values[attribute] = value
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
def validate( value )
|
66
|
-
if @one_of and !@one_of.include? value
|
67
|
-
raise ConfigurationError, "Value #{value} is invalid for #{@name}."
|
68
|
-
end
|
69
|
-
if @required and value === nil || value.empty?
|
70
|
-
raise ConfigurationError, "Required option #{@name} is not set."
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
def one_of( options )
|
75
|
-
@one_of = options
|
76
|
-
self
|
77
|
-
end
|
78
|
-
|
79
|
-
def on_write( &block )
|
80
|
-
@on_write = block
|
81
|
-
end
|
82
|
-
|
83
|
-
def required
|
84
|
-
@required = true
|
85
|
-
self
|
86
|
-
end
|
87
|
-
|
88
|
-
def write( value )
|
89
|
-
begin
|
90
|
-
return @on_write.call( value ) if @on_write
|
91
|
-
value
|
92
|
-
rescue Exception => e
|
93
|
-
$log.error("Error while setting #{@name} to #{value}")
|
94
|
-
raise e
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
def on_read( &block )
|
99
|
-
@on_read = block
|
100
|
-
end
|
101
|
-
|
102
|
-
def read( value )
|
103
|
-
return @on_read.call( value ) if @on_read
|
104
|
-
value
|
105
|
-
end
|
106
|
-
|
107
|
-
end
|
108
|
-
|
109
|
-
def flatten_values( val, &block )
|
110
|
-
if val.instance_of?( Array )
|
111
|
-
val.each do |i|
|
112
|
-
flatten_values( i, &block )
|
113
|
-
end
|
114
|
-
elsif val.instance_of?( Hash )
|
115
|
-
val.each do |k, v|
|
116
|
-
yield k, v
|
117
|
-
end
|
118
|
-
else
|
119
|
-
puts o.class
|
120
|
-
puts o.inspect
|
121
|
-
raise Exception, "??????????"
|
122
|
-
end
|
123
|
-
end
|
124
|
-
module_function :flatten_values
|
125
|
-
|
126
|
-
|
127
|
-
module Configurable
|
128
|
-
|
129
|
-
def self.included( klass )
|
130
|
-
klass.extend( ClassMethods )
|
131
|
-
klass.send( :class_variable_set, '@@__options__', Hash.new )
|
132
|
-
end
|
133
|
-
|
134
|
-
module ClassMethods
|
135
|
-
|
136
|
-
def __options__
|
137
|
-
class_variable_get( '@@__options__' )
|
138
|
-
end
|
139
|
-
|
140
|
-
def option( name, description )
|
141
|
-
opt = Option.new( self, name, description )
|
142
|
-
self.__options__[opt.attribute] = opt
|
143
|
-
opt
|
144
|
-
end
|
145
|
-
|
146
|
-
|
147
|
-
end
|
148
|
-
|
149
|
-
|
150
|
-
def values
|
151
|
-
return @values if @values
|
152
|
-
@values = Hash.new
|
153
|
-
self.class.__options__.each_pair do |name, opt|
|
154
|
-
@values[name] = opt.default
|
155
|
-
end
|
156
|
-
@values
|
157
|
-
end
|
158
|
-
|
159
|
-
def set( key, val )
|
160
|
-
begin
|
161
|
-
# puts "Options = #{self.class.options.inspect}"
|
162
|
-
self.send( "#{Option.sanitize( key )}=", val )
|
163
|
-
rescue BuildTool::VCS::UnknownVcsError => e
|
164
|
-
$log.warn( "Unknown vcs '#{key}' configured for #{self.name}:#{self.class}" )
|
165
|
-
raise e
|
166
|
-
rescue NameError => e
|
167
|
-
$log.warn( "Unknown option #{key} configured for #{self.name}:#{self.class}" )
|
168
|
-
raise e
|
169
|
-
rescue Exception => e
|
170
|
-
$log.warn( "Caught exception #{e.message} for #{self.inspect}:#{self.class} while setting #{key} to #{val.inspect}" )
|
171
|
-
raise e
|
172
|
-
end
|
173
|
-
end
|
174
|
-
|
175
|
-
def validate
|
176
|
-
begin
|
177
|
-
self.class.__options__.each_pair do |name, opt|
|
178
|
-
opt.validate( self.values[opt.attribute] )
|
179
|
-
end
|
180
|
-
rescue ConfigurationError => e
|
181
|
-
$log.error( "Validation for #{self.class} (#{self.to_s}) failed: #{e}" )
|
182
|
-
puts e.backtrace if $verbose
|
183
|
-
raise e
|
184
|
-
end
|
185
|
-
end
|
186
|
-
|
187
|
-
def parse( val )
|
188
|
-
# If it is a array we expect it to only contain hashes
|
189
|
-
if val.instance_of?( Array )
|
190
|
-
val.each { |i| parse( i ) }
|
191
|
-
elsif val.instance_of?( Hash )
|
192
|
-
val.each_pair {
|
193
|
-
|k, v|
|
194
|
-
begin
|
195
|
-
# puts "#{self.class}.#{k} = #{v}"
|
196
|
-
send "#{Option.sanitize k}=", v
|
197
|
-
rescue NameError => e
|
198
|
-
$log.warn( "Unknown option '#{k}' for #{self.class} in #{self.name}: #{e}" )
|
199
|
-
end
|
200
|
-
}
|
201
|
-
else
|
202
|
-
raise Exception, "FIXME"
|
203
|
-
end
|
204
|
-
self
|
205
|
-
end
|
206
|
-
end
|
207
|
-
end
|
208
|
-
end
|
209
|
-
|
data/lib/kde-build/exception.rb
DELETED
data/lib/kde-build/metaaid.rb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
class Object
|
4
|
-
|
5
|
-
# The hidden singleton lurks behind everyone
|
6
|
-
def metaclass; class << self; self; end; end
|
7
|
-
def meta_eval &blk; metaclass.instance_eval( &blk ); end
|
8
|
-
|
9
|
-
# Adds methods to a metaclass
|
10
|
-
def meta_def name, &blk
|
11
|
-
meta_eval { define_method name, &blk }
|
12
|
-
end
|
13
|
-
|
14
|
-
# Defines an instance method within a class
|
15
|
-
def class_def name, &blk
|
16
|
-
class_eval { define_method name, &blk }
|
17
|
-
end
|
18
|
-
end
|
data/lib/kde-build/module.rb
DELETED
@@ -1,227 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
#
|
3
|
-
require 'kde-build/tools/ssh.rb'
|
4
|
-
require 'kde-build/tools/logging.rb'
|
5
|
-
|
6
|
-
module BuildTool
|
7
|
-
|
8
|
-
class ConfigureError < Exception
|
9
|
-
end
|
10
|
-
|
11
|
-
class BuildError < Exception
|
12
|
-
end
|
13
|
-
|
14
|
-
class Module
|
15
|
-
|
16
|
-
def initialize(config)
|
17
|
-
@config = config
|
18
|
-
@build_system = nil
|
19
|
-
@vcs = nil
|
20
|
-
end
|
21
|
-
|
22
|
-
def activate_ssh_key
|
23
|
-
# No key, no cookies
|
24
|
-
return if !@config.ssh_key
|
25
|
-
|
26
|
-
ssh = MJ::Tools::SSH.new
|
27
|
-
if !ssh.has_key? ssh_key
|
28
|
-
ssh.add_key(ssh_file)
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
def name
|
33
|
-
@config.name
|
34
|
-
end
|
35
|
-
|
36
|
-
# The build directory
|
37
|
-
def build_directory
|
38
|
-
"#{workdir}/bld/#{local_path}"
|
39
|
-
end
|
40
|
-
|
41
|
-
def local_path
|
42
|
-
@local_path = @config.local_path || @config.remote_path
|
43
|
-
end
|
44
|
-
|
45
|
-
def build( install, clean = false )
|
46
|
-
$log.info("Compiling")
|
47
|
-
rc = nil
|
48
|
-
if clean
|
49
|
-
while_logging_to( name, "50_build" ) do
|
50
|
-
if build_system.make( "clean" ) != 0
|
51
|
-
raise BuildError, "make returned error code #{rc}"
|
52
|
-
end
|
53
|
-
$log.info( "make clean was successful" )
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
while_logging_to( name, "50_build" ) do
|
58
|
-
rc =
|
59
|
-
if install
|
60
|
-
build_system.make( "install" )
|
61
|
-
else
|
62
|
-
build_system.make
|
63
|
-
end
|
64
|
-
|
65
|
-
if rc != 0
|
66
|
-
raise BuildError, "make returned error code #{rc}"
|
67
|
-
end
|
68
|
-
$log.info( "build was successful" )
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
# The build system
|
73
|
-
def build_system
|
74
|
-
if not @build_system
|
75
|
-
if not @config.build_system
|
76
|
-
klass = BuildTool::BuildSystem::Registry.guess( source_directory )
|
77
|
-
if !klass
|
78
|
-
raise ModuleError, "Failed to guess the build system for #{name}"
|
79
|
-
end
|
80
|
-
else
|
81
|
-
klass = BuildTool::BuildSystem::get(@config.build_system.name)
|
82
|
-
end
|
83
|
-
@build_system = klass.new( self )
|
84
|
-
@build_system.configuration = @config.build_system
|
85
|
-
end
|
86
|
-
@build_system
|
87
|
-
end
|
88
|
-
|
89
|
-
|
90
|
-
def remove_build_directory
|
91
|
-
$log.info("removing #{build_directory}")
|
92
|
-
build_system.remove_build_directory
|
93
|
-
end
|
94
|
-
|
95
|
-
|
96
|
-
# Configure the module
|
97
|
-
def reconfigure( clean = false )
|
98
|
-
$log.info("Reconfiguring")
|
99
|
-
while_logging_to( name, "30_configure" ) do
|
100
|
-
if !$noop and !vcs.checkedout?
|
101
|
-
raise ConfigureError, "Module is not checked out."
|
102
|
-
end
|
103
|
-
rc = build_system.reconfigure( clean )
|
104
|
-
if rc != 0
|
105
|
-
raise ConfigureError, "configure returned error code #{rc}"
|
106
|
-
end
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
110
|
-
# Configure the module
|
111
|
-
def configure
|
112
|
-
$log.info("configuring")
|
113
|
-
while_logging_to( name, "30_configure" ) do
|
114
|
-
if !$noop and !vcs.checkedout?
|
115
|
-
raise ConfigureError, "Module is not checked out."
|
116
|
-
end
|
117
|
-
rc = build_system.configure
|
118
|
-
if rc != 0
|
119
|
-
raise ConfigureError, "configure returned error code #{rc}"
|
120
|
-
end
|
121
|
-
end
|
122
|
-
end
|
123
|
-
|
124
|
-
# Is the module already configured?
|
125
|
-
def configured?
|
126
|
-
if !vcs.checkedout?
|
127
|
-
return false
|
128
|
-
end
|
129
|
-
build_system.configured?
|
130
|
-
end
|
131
|
-
|
132
|
-
def checkedout?
|
133
|
-
vcs.checkedout?
|
134
|
-
end
|
135
|
-
|
136
|
-
def env
|
137
|
-
@config.env
|
138
|
-
end
|
139
|
-
|
140
|
-
def fetch
|
141
|
-
$log.info("Fetching from #{remote_path}")
|
142
|
-
while_logging_to( name, "20_fetch" ) do
|
143
|
-
vcs.fetch
|
144
|
-
end
|
145
|
-
end
|
146
|
-
|
147
|
-
def init
|
148
|
-
$log.info("Initializing #{local_path} from #{remote_path}")
|
149
|
-
while_logging_to( name, "10_initialize" ) do
|
150
|
-
vcs.init
|
151
|
-
end
|
152
|
-
end
|
153
|
-
|
154
|
-
def info
|
155
|
-
puts "############### Module #{name}"
|
156
|
-
puts "Repository: #{remote_path}"
|
157
|
-
puts "SSH Key: #{ssh_file}" if ssh_file
|
158
|
-
puts "Local Checkout: #{workdir}/#{local_path} #{configured? ? '(EXISTS)' : '' }"
|
159
|
-
puts "Build Directory: #{build_directory} #{checkedout? ? '(EXISTS)' : '' }"
|
160
|
-
puts "Prefix: #{prefix}"
|
161
|
-
puts "Environment:"
|
162
|
-
env.each do |var, val|
|
163
|
-
puts " %-20s %s" % [ var + ":", val ]
|
164
|
-
end if env
|
165
|
-
vcs.info
|
166
|
-
build_system.info
|
167
|
-
end
|
168
|
-
|
169
|
-
def ssh_key
|
170
|
-
return @config.ssh_key
|
171
|
-
end
|
172
|
-
|
173
|
-
def ssh_file
|
174
|
-
return @config.ssh_file
|
175
|
-
end
|
176
|
-
|
177
|
-
# The root directory for the +/bld+, +/src+ and +/log+ directories
|
178
|
-
def workdir
|
179
|
-
Application::instance.workdir
|
180
|
-
end
|
181
|
-
|
182
|
-
def rebase
|
183
|
-
$log.info("rebasing")
|
184
|
-
while_logging_to( name, "40_rebase" ) do
|
185
|
-
vcs.rebase
|
186
|
-
end
|
187
|
-
end
|
188
|
-
|
189
|
-
# The absolute remote path
|
190
|
-
def remote_path
|
191
|
-
"#{repository}/#{@config.remote_path}"
|
192
|
-
end
|
193
|
-
|
194
|
-
# The repository url
|
195
|
-
def repository
|
196
|
-
@config.repository
|
197
|
-
end
|
198
|
-
|
199
|
-
def prefix
|
200
|
-
@config.prefix
|
201
|
-
end
|
202
|
-
|
203
|
-
# The absolute source directory.
|
204
|
-
def source_directory
|
205
|
-
"#{workdir}/src/#{local_path}"
|
206
|
-
end
|
207
|
-
|
208
|
-
# reimplement
|
209
|
-
def to_yaml_type
|
210
|
-
"!michael-jansen.biz,2009-01-01/Module"
|
211
|
-
end
|
212
|
-
|
213
|
-
# #########
|
214
|
-
# protected
|
215
|
-
# #########
|
216
|
-
|
217
|
-
def vcs
|
218
|
-
if ! @vcs
|
219
|
-
@vcs = VCS::get(@config.vcs.name).new( remote_path, source_directory )
|
220
|
-
@vcs.configuration = @config.vcs
|
221
|
-
end
|
222
|
-
@vcs
|
223
|
-
end
|
224
|
-
|
225
|
-
end
|
226
|
-
|
227
|
-
end
|