build-tool 0.1.4 → 0.2
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +2 -3
- data/History.txt +29 -0
- data/Manifest.txt +39 -10
- data/README.txt +5 -8
- data/Rakefile +14 -6
- data/bin/build-tool +3 -35
- data/db/migrations/001_command_histories.rb +20 -0
- data/db/migrations/002_module_events.rb +24 -0
- data/db/migrations/003_command_histories_add_logfile.rb +19 -0
- data/lib/build-tool.rb +1 -1
- data/lib/build-tool/application.rb +103 -30
- data/lib/build-tool/build-system/autoconf.rb +69 -6
- data/lib/build-tool/build-system/base.rb +2 -25
- data/lib/build-tool/build-system/custom.rb +6 -19
- data/lib/build-tool/build-system/kdel10n.rb +39 -0
- data/lib/build-tool/build-system/none.rb +82 -0
- data/lib/build-tool/cfg/lexer.rb +133 -7
- data/lib/build-tool/cfg/lexer.rex +58 -6
- data/lib/build-tool/cfg/node.rb +13 -1
- data/lib/build-tool/cfg/parser.rb +519 -333
- data/lib/build-tool/cfg/parser.y +74 -11
- data/lib/build-tool/cfg/visitor.rb +182 -20
- data/lib/build-tool/command_actions.rb +202 -0
- data/lib/build-tool/commands.rb +193 -49
- data/lib/build-tool/commands/build.rb +13 -8
- data/lib/build-tool/commands/configure.rb +8 -3
- data/lib/build-tool/commands/environments.rb +4 -8
- data/lib/build-tool/commands/environments/list.rb +8 -0
- data/lib/build-tool/commands/fetch.rb +7 -2
- data/lib/build-tool/commands/gc.rb +53 -0
- data/lib/build-tool/commands/history.rb +111 -0
- data/lib/build-tool/commands/install.rb +6 -1
- data/lib/build-tool/commands/lsfeatures.rb +73 -0
- data/lib/build-tool/commands/modules.rb +3 -7
- data/lib/build-tool/commands/modules/info.rb +15 -6
- data/lib/build-tool/commands/modules/list.rb +10 -5
- data/lib/build-tool/commands/rebase.rb +6 -1
- data/lib/build-tool/commands/recipes.rb +3 -7
- data/lib/build-tool/configuration.rb +24 -1
- data/lib/build-tool/environment.rb +17 -3
- data/lib/build-tool/feature.rb +47 -0
- data/lib/build-tool/history.rb +173 -0
- data/lib/build-tool/module.rb +49 -90
- data/lib/build-tool/recipe.rb +5 -0
- data/lib/build-tool/vcs/archive.rb +140 -0
- data/lib/build-tool/vcs/base.rb +5 -5
- data/lib/build-tool/vcs/git-svn.rb +4 -0
- data/lib/build-tool/vcs/git.rb +4 -0
- data/lib/mj/logging.rb +11 -0
- data/recipes/{kdeqt4.6 → kde}/custom/qt/qtscriptgenerator/compile.sh +0 -0
- data/recipes/{kdeqt4.6 → kde}/custom/qt/qtscriptgenerator/configure.sh +0 -0
- data/recipes/{kdeqt4.6 → kde}/custom/qt/qtscriptgenerator/install.sh +0 -0
- data/recipes/kde/custom/scripting/pyqt4/compile.sh +10 -0
- data/recipes/kde/custom/scripting/pyqt4/configure.sh +14 -0
- data/recipes/kde/custom/scripting/pyqt4/install.sh +10 -0
- data/recipes/kde/custom/scripting/sip/compile.sh +10 -0
- data/recipes/kde/custom/scripting/sip/configure.sh +13 -0
- data/recipes/kde/custom/scripting/sip/install.sh +10 -0
- data/recipes/kde/files/xsession +8 -4
- data/recipes/kde/kde-bindings.recipe +22 -0
- data/recipes/kde/kde-core.recipe +104 -0
- data/recipes/kde/kde-devel.recipe +38 -0
- data/recipes/kde/kde-finance.recipe +17 -0
- data/recipes/kde/kde-graphics.recipe +27 -0
- data/recipes/kde/kde-kdevelop.recipe +116 -0
- data/recipes/kde/kde-l10n.recipe +14 -0
- data/recipes/kde/kde-multimedia.recipe +31 -0
- data/recipes/kde/kde-network.recipe +55 -0
- data/recipes/kde/kde-office.recipe +28 -0
- data/recipes/kde/kde-plasma.recipe +117 -0
- data/recipes/{kdeqt4.6/recipe → kde/kde-qt.recipe} +25 -57
- data/recipes/kde/kde-scripting.recipe +63 -0
- data/recipes/kde/kde-support.recipe +73 -0
- data/recipes/kde/kde-utils.recipe +22 -0
- data/recipes/kde/kde-webdev.recipe +41 -0
- data/recipes/kde/recipe +92 -532
- data/recipes/kde/recipe-local +58 -2
- data/recipes/kde/settings.yaml +17 -0
- data/recipes/kde43/recipe-local +58 -2
- data/test/test_configuration_parser.rb +76 -21
- data/test/test_feature.rb +34 -0
- data/test/test_history.rb +149 -0
- metadata +185 -30
- metadata.gz.sig +0 -0
- data/lib/build-tool/pluginbase.rb +0 -43
- data/recipes/kdeqt4.6/info.yaml +0 -7
- data/recipes/kdeqt4.6/recipe-local +0 -30
- data/recipes/kdeqt4.6/settings.yaml +0 -27
- data/tasks/rdoc.rake +0 -34
- data/test.rb +0 -28
@@ -12,12 +12,17 @@ module BuildTool; module Commands; module Modules
|
|
12
12
|
cmdalias "lsmods"
|
13
13
|
|
14
14
|
def initialize_options
|
15
|
+
@template = false
|
15
16
|
@all = false
|
16
17
|
|
17
|
-
options.on( "--all", "Include
|
18
|
+
options.on( "--all", "Include inactive modules." ) {
|
18
19
|
@all = true
|
19
20
|
}
|
20
21
|
|
22
|
+
options.on( "--template", "Include template modules." ) {
|
23
|
+
@template = true
|
24
|
+
}
|
25
|
+
|
21
26
|
super
|
22
27
|
|
23
28
|
end
|
@@ -26,16 +31,16 @@ module BuildTool; module Commands; module Modules
|
|
26
31
|
# *TODO* listing local and remote recipes
|
27
32
|
if args.length == 0
|
28
33
|
configuration.modules.each do |mod|
|
29
|
-
if @
|
30
|
-
say "%-30s : %s" % [ mod.name, mod.description ]
|
34
|
+
if @template or not mod.is_template?
|
35
|
+
say "%-30s : %s" % [ mod.name, mod.description ] if ( mod.active? || @all )
|
31
36
|
end
|
32
37
|
end
|
33
38
|
else
|
34
39
|
args.each do |arg|
|
35
|
-
mods = complete_modules( arg, @
|
40
|
+
mods = complete_modules( arg, @template )
|
36
41
|
next if !mods
|
37
42
|
mods.each do |mod|
|
38
|
-
say "%-30s : %s" % [ mod.name, mod.description ]
|
43
|
+
say "%-30s : %s" % [ mod.name, mod.description ] if ( mod.active? || @all )
|
39
44
|
end
|
40
45
|
end
|
41
46
|
end
|
@@ -14,6 +14,11 @@ module BuildTool; module Commands;
|
|
14
14
|
name "rebase"
|
15
15
|
description "rebase local checkout against previously fetched remote changes."
|
16
16
|
|
17
|
+
# Log this command if $noop is not active
|
18
|
+
def log?
|
19
|
+
! $noop
|
20
|
+
end
|
21
|
+
|
17
22
|
def applicable?
|
18
23
|
BuildTool::Application.instance.name != "build-tool"
|
19
24
|
end
|
@@ -32,7 +37,7 @@ module BuildTool; module Commands;
|
|
32
37
|
|
33
38
|
def do_execute_module( mod )
|
34
39
|
if mod.checkedout?
|
35
|
-
|
40
|
+
rebase( mod )
|
36
41
|
else
|
37
42
|
logger.info "Not checked out. Skipping"
|
38
43
|
end
|
@@ -1,11 +1,11 @@
|
|
1
1
|
require 'build-tool/commands'
|
2
2
|
|
3
|
-
module BuildTool; module Commands;
|
3
|
+
module BuildTool; module Commands;
|
4
4
|
|
5
5
|
#
|
6
6
|
# BuildCommand
|
7
7
|
#
|
8
|
-
class
|
8
|
+
class RecipesCLI < Commands::SubCommands
|
9
9
|
|
10
10
|
name "recipes"
|
11
11
|
description "build recipe related commands"
|
@@ -24,9 +24,5 @@ module BuildTool; module Commands; module Recipes
|
|
24
24
|
|
25
25
|
end # class CLI
|
26
26
|
|
27
|
-
|
28
|
-
cmd = CLI.new( *args )
|
29
|
-
end
|
30
|
-
|
31
|
-
end; end; end # module BuildTool::Commands::Recipes
|
27
|
+
end; end # module BuildTool::Commands::RecipesCLI
|
32
28
|
|
@@ -1,11 +1,14 @@
|
|
1
1
|
require 'build-tool/vcs/git'
|
2
2
|
require 'build-tool/vcs/git-svn'
|
3
3
|
require 'build-tool/vcs/svn'
|
4
|
+
require 'build-tool/vcs/archive'
|
4
5
|
|
5
6
|
require 'build-tool/build-system/cmake'
|
6
7
|
require 'build-tool/build-system/qt'
|
7
8
|
require 'build-tool/build-system/autoconf'
|
8
9
|
require 'build-tool/build-system/custom'
|
10
|
+
require 'build-tool/build-system/none'
|
11
|
+
require 'build-tool/build-system/kdel10n'
|
9
12
|
|
10
13
|
|
11
14
|
module BuildTool
|
@@ -15,13 +18,15 @@ module BuildTool
|
|
15
18
|
attr_reader :recipe
|
16
19
|
attr_reader :modules
|
17
20
|
attr_reader :environments
|
21
|
+
attr_reader :features
|
22
|
+
attr_accessor :active_feature
|
18
23
|
|
19
24
|
def log_directory
|
20
25
|
return @log_directory if @log_directory
|
21
26
|
raise BuildTool::ConfigurationError, "No log directory configured"
|
22
27
|
end
|
23
28
|
def log_directory=( path )
|
24
|
-
@log_directory = File.expand_path( path, "~" )
|
29
|
+
@log_directory = Pathname.new( File.expand_path( path, "~" ) )
|
25
30
|
end
|
26
31
|
|
27
32
|
def environment( name )
|
@@ -32,6 +37,14 @@ module BuildTool
|
|
32
37
|
@environments[env.name] = env
|
33
38
|
end
|
34
39
|
|
40
|
+
def feature( name )
|
41
|
+
@features[name]
|
42
|
+
end
|
43
|
+
|
44
|
+
def add_feature( feature )
|
45
|
+
@features[feature.path] = feature
|
46
|
+
end
|
47
|
+
|
35
48
|
def module( name )
|
36
49
|
@module[name]
|
37
50
|
end
|
@@ -75,6 +88,8 @@ module BuildTool
|
|
75
88
|
@build_system = {}
|
76
89
|
@repository = {}
|
77
90
|
@sshkey = {}
|
91
|
+
@active_feature = nil
|
92
|
+
@features = {}
|
78
93
|
end
|
79
94
|
|
80
95
|
def vcs( name )
|
@@ -85,6 +100,8 @@ module BuildTool
|
|
85
100
|
return BuildTool::VCS::GitConfiguration.new
|
86
101
|
when "svn"
|
87
102
|
return BuildTool::VCS::SvnConfiguration.new
|
103
|
+
when "archive"
|
104
|
+
return BuildTool::VCS::ArchiveConfiguration.new
|
88
105
|
else
|
89
106
|
raise StandardError, "Unknown Version Control System #{name}"
|
90
107
|
end
|
@@ -93,14 +110,20 @@ module BuildTool
|
|
93
110
|
def build_system( name )
|
94
111
|
return @build_system[name] if @build_system[name]
|
95
112
|
case name
|
113
|
+
when "none"
|
114
|
+
return BuildTool::BuildSystem::None.new
|
96
115
|
when "cmake"
|
97
116
|
return BuildTool::BuildSystem::CMake.new
|
117
|
+
when "kdel10n"
|
118
|
+
return BuildTool::BuildSystem::KdeL10n.new
|
98
119
|
when "qt"
|
99
120
|
return BuildTool::BuildSystem::Qt.new
|
100
121
|
when "qmake"
|
101
122
|
return BuildTool::BuildSystem::QMake.new
|
102
123
|
when "custom"
|
103
124
|
return BuildTool::BuildSystem::Custom.new
|
125
|
+
when "autoconf"
|
126
|
+
return BuildTool::BuildSystem::AutoConf.new
|
104
127
|
else
|
105
128
|
raise StandardError, "Unknown Version Control System #{name}"
|
106
129
|
end
|
@@ -15,14 +15,26 @@ module BuildTool
|
|
15
15
|
# Parent environment
|
16
16
|
attr_accessor :parent
|
17
17
|
|
18
|
+
attr_accessor :feature
|
19
|
+
|
18
20
|
# Create a environment object
|
19
21
|
def initialize( name )
|
20
22
|
raise StandardError.new "Environment.name has to be set" if name.nil?
|
21
23
|
@name = name
|
22
24
|
@vars = Hash.new
|
23
25
|
@parent = nil
|
26
|
+
@feature = nil
|
27
|
+
end
|
28
|
+
|
29
|
+
def active?
|
30
|
+
if @feature.nil?
|
31
|
+
true
|
32
|
+
else
|
33
|
+
@feature.active?
|
34
|
+
end
|
24
35
|
end
|
25
36
|
|
37
|
+
|
26
38
|
# Set a environment variable
|
27
39
|
def append( name, value )
|
28
40
|
if @vars.has_key?(name.to_s) and !@vars[name.to_s].empty?
|
@@ -33,7 +45,9 @@ module BuildTool
|
|
33
45
|
end
|
34
46
|
|
35
47
|
# Execute command in a shell with the environment set.
|
36
|
-
def execute( command, wd = nil )
|
48
|
+
def execute( command, wd = nil, env = nil )
|
49
|
+
values = self.values
|
50
|
+
values = values.merge( env ) if env
|
37
51
|
rc = self.class.execute( command.to_s, wd, values )
|
38
52
|
if rc != 0
|
39
53
|
raise StandardError, "#{command.to_s} failed with error code #{rc}";
|
@@ -96,8 +110,8 @@ module BuildTool
|
|
96
110
|
if @parent
|
97
111
|
parentval = @parent[name]
|
98
112
|
end
|
99
|
-
# If we don't know the var return the parents value
|
100
|
-
if !@vars.has_key?( name.to_s )
|
113
|
+
# If we don't know the var or the env is not active return the parents value
|
114
|
+
if !@vars.has_key?( name.to_s ) or !active?
|
101
115
|
return parentval
|
102
116
|
end
|
103
117
|
if parentval.empty?
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module BuildTool
|
2
|
+
|
3
|
+
class Feature
|
4
|
+
|
5
|
+
attr_writer :active
|
6
|
+
attr_accessor :description
|
7
|
+
attr_accessor :long_description
|
8
|
+
attr_reader :modules
|
9
|
+
attr_reader :environments
|
10
|
+
|
11
|
+
def initialize( name = nil, parent = nil, active = true )
|
12
|
+
@name = name
|
13
|
+
@active = active
|
14
|
+
@parent = parent
|
15
|
+
@description = nil
|
16
|
+
@long_description = nil
|
17
|
+
@modules = []
|
18
|
+
@environments = []
|
19
|
+
end
|
20
|
+
|
21
|
+
def active?
|
22
|
+
if @parent.nil?
|
23
|
+
@active
|
24
|
+
else
|
25
|
+
@parent.active? && @active
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def name
|
30
|
+
@name
|
31
|
+
end
|
32
|
+
|
33
|
+
def path
|
34
|
+
if @parent.nil?
|
35
|
+
@name
|
36
|
+
else
|
37
|
+
"%s/%s" % [ @parent.name, @name ]
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def parent
|
42
|
+
@parent
|
43
|
+
end
|
44
|
+
|
45
|
+
end # class Feature
|
46
|
+
|
47
|
+
end # module BuildTool
|
@@ -0,0 +1,173 @@
|
|
1
|
+
require 'sequel'
|
2
|
+
|
3
|
+
module BuildTool
|
4
|
+
|
5
|
+
#
|
6
|
+
# Provide method to add and retrieve entries from the history
|
7
|
+
#
|
8
|
+
module History
|
9
|
+
|
10
|
+
module StateHelper
|
11
|
+
|
12
|
+
# Needed for both Module and Command History
|
13
|
+
STARTED = 0
|
14
|
+
CANCELED_BY_USER = 1
|
15
|
+
FINISHED_SUCCESSFUL = 2
|
16
|
+
FINISHED_WITH_ERRORS = 3
|
17
|
+
|
18
|
+
def state_str
|
19
|
+
case self.state
|
20
|
+
when STARTED
|
21
|
+
"STARTED"
|
22
|
+
when CANCELED_BY_USER
|
23
|
+
"CANCELED"
|
24
|
+
when FINISHED_SUCCESSFUL
|
25
|
+
"SUCCESS"
|
26
|
+
when FINISHED_WITH_ERRORS
|
27
|
+
"ERRORS"
|
28
|
+
else
|
29
|
+
"#{self.state.to_s}?"
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
module ClassMethods
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.included( klass )
|
37
|
+
klass.extend ClassMethods
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
|
42
|
+
# Represents a log entry for a command.
|
43
|
+
class CommandLog < Sequel::Model( :command_logs )
|
44
|
+
|
45
|
+
include StateHelper
|
46
|
+
|
47
|
+
# A command can have many module events
|
48
|
+
one_to_many :module_logs, :order => :id
|
49
|
+
|
50
|
+
def duration
|
51
|
+
if self.finished_at
|
52
|
+
dur = self.finished_at - self.started_at
|
53
|
+
"%02d:%02d" % [ dur.to_i / 60, (dur% 60 ).to_i ]
|
54
|
+
else
|
55
|
+
"-----"
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
# Call this if the command is finished. [:finished] will be set to Time.now,
|
60
|
+
# [:state] to the given value and the object is saved.
|
61
|
+
def finished( state )
|
62
|
+
self.finished_at = Time.now
|
63
|
+
self.state = state
|
64
|
+
save
|
65
|
+
end
|
66
|
+
|
67
|
+
# Call this if the command is started. [:started] will be set to Time.now, [:state]
|
68
|
+
# to STARTED and the object is saved.
|
69
|
+
def started
|
70
|
+
self.started_at = Time.now
|
71
|
+
save
|
72
|
+
end
|
73
|
+
|
74
|
+
# Sequel Hook
|
75
|
+
#
|
76
|
+
# Make sure a finished command has one of the accepted finished states.
|
77
|
+
def before_update
|
78
|
+
super
|
79
|
+
if !self.finished_at.nil?
|
80
|
+
raise StandardError, "Wrong state for finished Command" if ! [ FINISHED_SUCCESSFUL, FINISHED_WITH_ERRORS, CANCELED_BY_USER ].include? self.state
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
# Class Methods
|
85
|
+
class << self
|
86
|
+
|
87
|
+
# Loads the most recents entry from the database
|
88
|
+
def most_recent( offset = nil )
|
89
|
+
if offset.nil?
|
90
|
+
return where( "id = (SELECT MAX(id) FROM #{table_name})" ).first
|
91
|
+
else
|
92
|
+
return order( :id.desc ).limit( 1, offset ).first
|
93
|
+
end
|
94
|
+
end # def most_recent
|
95
|
+
|
96
|
+
# Get the last :count issued commands
|
97
|
+
#
|
98
|
+
# @param [Integer] count Number of commands to return
|
99
|
+
# @return [Array] List containing the last count issued commands
|
100
|
+
def last( count = 50 )
|
101
|
+
order(:id.desc).limit(count).all
|
102
|
+
end
|
103
|
+
|
104
|
+
# Get the last :count command entries containing module :modname.
|
105
|
+
def last_by_module( modname, count = 3 )
|
106
|
+
where( 'id in ( select distinct command_log_id from module_logs where module = ? )', modname ).order( :id.desc ).first( count );
|
107
|
+
end
|
108
|
+
|
109
|
+
# Get all commands older than :days
|
110
|
+
def older_than
|
111
|
+
where( 'finished_at < ?', Date.today - 10 )
|
112
|
+
end
|
113
|
+
|
114
|
+
|
115
|
+
end # ClassMethods
|
116
|
+
|
117
|
+
end
|
118
|
+
|
119
|
+
# Represents a module event.
|
120
|
+
#
|
121
|
+
# A module event is updating, compiling etc. a module.
|
122
|
+
class ModuleLog < Sequel::Model( :module_logs )
|
123
|
+
|
124
|
+
include StateHelper
|
125
|
+
|
126
|
+
# A module event belongs to a command
|
127
|
+
many_to_one :command_log
|
128
|
+
|
129
|
+
def duration
|
130
|
+
if self.finished_at
|
131
|
+
dur = self.finished_at - self.started_at
|
132
|
+
"%02d:%02d" % [ dur.to_i / 60, (dur% 60 ).to_i ]
|
133
|
+
else
|
134
|
+
"-----"
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
# Call this if the command is finished. [:finished] will be set to Time.now,
|
139
|
+
# [:state] to the given value and the object is saved.
|
140
|
+
def finished( state )
|
141
|
+
self.finished_at = Time.now
|
142
|
+
self.state = state
|
143
|
+
save
|
144
|
+
end
|
145
|
+
|
146
|
+
# Call this when the command is started. [:started] will be set to Time.now and
|
147
|
+
# the object is saved.
|
148
|
+
def started
|
149
|
+
self.started_at = Time.now
|
150
|
+
save
|
151
|
+
end
|
152
|
+
|
153
|
+
# Sequel Hook
|
154
|
+
#
|
155
|
+
# Make sure a finished command has one of the accepted finished states.
|
156
|
+
def before_update
|
157
|
+
super
|
158
|
+
if !self.finished_at.nil?
|
159
|
+
raise StandardError, "Wrong state for finished Command" if ! [ FINISHED_SUCCESSFUL, FINISHED_WITH_ERRORS, CANCELED_BY_USER ].include? self.state
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
class << self
|
164
|
+
|
165
|
+
end # class self
|
166
|
+
|
167
|
+
end
|
168
|
+
|
169
|
+
end # module BuildTool::History
|
170
|
+
|
171
|
+
end # module BuildTool
|
172
|
+
|
173
|
+
|
data/lib/build-tool/module.rb
CHANGED
@@ -1,7 +1,5 @@
|
|
1
|
-
# require 'gbs_signal_slot'
|
2
|
-
require 'mj/tools/ssh'
|
3
1
|
require 'ftools'
|
4
|
-
|
2
|
+
require 'mj/tools/ssh'
|
5
3
|
|
6
4
|
module BuildTool
|
7
5
|
|
@@ -15,6 +13,7 @@ module BuildTool
|
|
15
13
|
if name.nil?
|
16
14
|
raise StandardError, "Module name is required!"
|
17
15
|
end
|
16
|
+
@active = nil
|
18
17
|
@name = name
|
19
18
|
@parent = parent
|
20
19
|
@local_path = nil
|
@@ -26,11 +25,27 @@ module BuildTool
|
|
26
25
|
@install_prefix = nil
|
27
26
|
@is_template = false
|
28
27
|
@vcs_configuration = nil
|
28
|
+
@feature = nil
|
29
29
|
end
|
30
30
|
|
31
31
|
#
|
32
32
|
### ATTRIBUTES
|
33
33
|
#
|
34
|
+
attr_writer :feature
|
35
|
+
attr_writer :active
|
36
|
+
|
37
|
+
def active?
|
38
|
+
# If the module is activated that wins
|
39
|
+
if @active.nil?
|
40
|
+
if @feature.nil?
|
41
|
+
return true
|
42
|
+
else
|
43
|
+
return @feature.active?
|
44
|
+
end
|
45
|
+
else
|
46
|
+
return @active
|
47
|
+
end
|
48
|
+
end
|
34
49
|
|
35
50
|
# not inherited
|
36
51
|
def build_directory
|
@@ -88,7 +103,11 @@ module BuildTool
|
|
88
103
|
end
|
89
104
|
|
90
105
|
def configured?
|
91
|
-
|
106
|
+
if build_system
|
107
|
+
return build_system.configured?
|
108
|
+
else
|
109
|
+
return false
|
110
|
+
end
|
92
111
|
end
|
93
112
|
|
94
113
|
def description
|
@@ -113,6 +132,11 @@ module BuildTool
|
|
113
132
|
raise ConfigurationError, "No environment configured for #{name}!"
|
114
133
|
end
|
115
134
|
|
135
|
+
# Garbage collect
|
136
|
+
def gc
|
137
|
+
vcs.gc
|
138
|
+
end
|
139
|
+
|
116
140
|
# Installation prefix
|
117
141
|
def install_prefix=( path )
|
118
142
|
if path
|
@@ -227,85 +251,49 @@ module BuildTool
|
|
227
251
|
#
|
228
252
|
### ACTIONS
|
229
253
|
#
|
230
|
-
def clean(
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
build_system_required.make( "clean" )
|
238
|
-
end
|
254
|
+
def clean( remove_build_directory = false )
|
255
|
+
if remove_build_directory
|
256
|
+
logger.info "Removing build directory."
|
257
|
+
build_system_required.remove_build_directory
|
258
|
+
else
|
259
|
+
logger.info "Cleaning build directory."
|
260
|
+
build_system_required.make( "clean" )
|
239
261
|
end
|
240
262
|
end
|
241
263
|
|
242
264
|
|
243
265
|
# Clone the repository.
|
244
|
-
def clone
|
245
|
-
|
246
|
-
logger.info "Creating local checkout."
|
247
|
-
vcs_required.clone
|
248
|
-
end
|
266
|
+
def clone
|
267
|
+
vcs_required.clone
|
249
268
|
end
|
250
269
|
|
251
270
|
# Fetch changes from the remote repository. Do not change the local
|
252
271
|
# checkout.
|
253
|
-
def fetch
|
254
|
-
|
255
|
-
logger.info "Fetching/Rebase not supported by vcs #{vcs.name}. Doing it in one step."
|
256
|
-
end
|
257
|
-
while_logging_to logdir, '20_fetch' do
|
258
|
-
logger.info "Fetching remote changes."
|
259
|
-
vcs.fetch
|
260
|
-
end
|
272
|
+
def fetch
|
273
|
+
vcs_required.fetch
|
261
274
|
end
|
262
275
|
|
263
276
|
# Update the local changes with remote changes. Do not fetch changes
|
264
277
|
# from the remote repository.
|
265
|
-
def rebase
|
266
|
-
|
267
|
-
logger.info "Fetching not supported by vcs #{vcs.name}."
|
268
|
-
return
|
269
|
-
end
|
270
|
-
while_logging_to logdir, '30_rebase' do
|
271
|
-
logger.info "Rebasing against remote changes."
|
272
|
-
vcs.rebase
|
273
|
-
end
|
278
|
+
def rebase
|
279
|
+
vcs_required.rebase
|
274
280
|
end
|
275
281
|
|
276
|
-
def configure
|
277
|
-
|
278
|
-
logger.info "Configuring."
|
279
|
-
if !$noop and !vcs_required.checkedout?
|
280
|
-
raise ConfigurationError, "Failed to configure: Module is not checked out."
|
281
|
-
end
|
282
|
-
build_system_required.configure
|
283
|
-
end
|
282
|
+
def configure
|
283
|
+
build_system_required.configure
|
284
284
|
end
|
285
285
|
|
286
|
-
def reconfigure
|
287
|
-
|
288
|
-
logger.info "Recreating configuration."
|
289
|
-
if !$noop and !vcs_required.checkedout?
|
290
|
-
raise ConfigurationError, "Module is not checked out. Enable updating."
|
291
|
-
end
|
292
|
-
build_system_required.reconfigure
|
293
|
-
end
|
286
|
+
def reconfigure
|
287
|
+
build_system_required.reconfigure
|
294
288
|
end
|
295
289
|
|
296
290
|
# Call make
|
297
|
-
def make(
|
298
|
-
|
299
|
-
logger.info "Building module."
|
300
|
-
build_system_required.make( target )
|
301
|
-
end
|
291
|
+
def make( target = nil )
|
292
|
+
build_system_required.make( target )
|
302
293
|
end
|
303
294
|
|
304
|
-
def install(
|
305
|
-
|
306
|
-
logger.info "Installing module."
|
307
|
-
build_system_required.install( fast )
|
308
|
-
end
|
295
|
+
def install( fast = false )
|
296
|
+
build_system_required.install( fast )
|
309
297
|
end
|
310
298
|
|
311
299
|
# Check if an ssh-key is required and active it if necessary
|
@@ -331,35 +319,6 @@ module BuildTool
|
|
331
319
|
return true
|
332
320
|
end
|
333
321
|
|
334
|
-
#########
|
335
|
-
protected
|
336
|
-
#########
|
337
|
-
|
338
|
-
def while_logging_to( logdir, fname, level = :trace, &block )
|
339
|
-
dirname = "#{logdir}/#{name}"
|
340
|
-
FileUtils.mkdir_p( dirname )
|
341
|
-
Logging.logger['root'].add_appenders(
|
342
|
-
Logging.appenders.file(
|
343
|
-
fname,
|
344
|
-
:filename => dirname + '/' + fname,
|
345
|
-
:layout => Logging::Layouts::Pattern.new( :pattern => '%m\n' ),
|
346
|
-
:level => level ))
|
347
|
-
|
348
|
-
begin
|
349
|
-
yield
|
350
|
-
rescue Interrupt => e
|
351
|
-
logger.error "User Interrupt!"
|
352
|
-
raise e
|
353
|
-
rescue Exception => e
|
354
|
-
logger.error "#{e.class}:#{e.message}"
|
355
|
-
got_exception = true
|
356
|
-
raise e
|
357
|
-
ensure
|
358
|
-
Logging.logger['root'].remove_appenders( fname )
|
359
|
-
logger.info("More information in #{dirname}/#{fname}") if got_exception
|
360
|
-
end
|
361
|
-
end
|
362
|
-
|
363
322
|
end # Module
|
364
323
|
|
365
324
|
|