build-tool 0.1.4 → 0.2

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.
Files changed (90) hide show
  1. data.tar.gz.sig +2 -3
  2. data/History.txt +29 -0
  3. data/Manifest.txt +39 -10
  4. data/README.txt +5 -8
  5. data/Rakefile +14 -6
  6. data/bin/build-tool +3 -35
  7. data/db/migrations/001_command_histories.rb +20 -0
  8. data/db/migrations/002_module_events.rb +24 -0
  9. data/db/migrations/003_command_histories_add_logfile.rb +19 -0
  10. data/lib/build-tool.rb +1 -1
  11. data/lib/build-tool/application.rb +103 -30
  12. data/lib/build-tool/build-system/autoconf.rb +69 -6
  13. data/lib/build-tool/build-system/base.rb +2 -25
  14. data/lib/build-tool/build-system/custom.rb +6 -19
  15. data/lib/build-tool/build-system/kdel10n.rb +39 -0
  16. data/lib/build-tool/build-system/none.rb +82 -0
  17. data/lib/build-tool/cfg/lexer.rb +133 -7
  18. data/lib/build-tool/cfg/lexer.rex +58 -6
  19. data/lib/build-tool/cfg/node.rb +13 -1
  20. data/lib/build-tool/cfg/parser.rb +519 -333
  21. data/lib/build-tool/cfg/parser.y +74 -11
  22. data/lib/build-tool/cfg/visitor.rb +182 -20
  23. data/lib/build-tool/command_actions.rb +202 -0
  24. data/lib/build-tool/commands.rb +193 -49
  25. data/lib/build-tool/commands/build.rb +13 -8
  26. data/lib/build-tool/commands/configure.rb +8 -3
  27. data/lib/build-tool/commands/environments.rb +4 -8
  28. data/lib/build-tool/commands/environments/list.rb +8 -0
  29. data/lib/build-tool/commands/fetch.rb +7 -2
  30. data/lib/build-tool/commands/gc.rb +53 -0
  31. data/lib/build-tool/commands/history.rb +111 -0
  32. data/lib/build-tool/commands/install.rb +6 -1
  33. data/lib/build-tool/commands/lsfeatures.rb +73 -0
  34. data/lib/build-tool/commands/modules.rb +3 -7
  35. data/lib/build-tool/commands/modules/info.rb +15 -6
  36. data/lib/build-tool/commands/modules/list.rb +10 -5
  37. data/lib/build-tool/commands/rebase.rb +6 -1
  38. data/lib/build-tool/commands/recipes.rb +3 -7
  39. data/lib/build-tool/configuration.rb +24 -1
  40. data/lib/build-tool/environment.rb +17 -3
  41. data/lib/build-tool/feature.rb +47 -0
  42. data/lib/build-tool/history.rb +173 -0
  43. data/lib/build-tool/module.rb +49 -90
  44. data/lib/build-tool/recipe.rb +5 -0
  45. data/lib/build-tool/vcs/archive.rb +140 -0
  46. data/lib/build-tool/vcs/base.rb +5 -5
  47. data/lib/build-tool/vcs/git-svn.rb +4 -0
  48. data/lib/build-tool/vcs/git.rb +4 -0
  49. data/lib/mj/logging.rb +11 -0
  50. data/recipes/{kdeqt4.6 → kde}/custom/qt/qtscriptgenerator/compile.sh +0 -0
  51. data/recipes/{kdeqt4.6 → kde}/custom/qt/qtscriptgenerator/configure.sh +0 -0
  52. data/recipes/{kdeqt4.6 → kde}/custom/qt/qtscriptgenerator/install.sh +0 -0
  53. data/recipes/kde/custom/scripting/pyqt4/compile.sh +10 -0
  54. data/recipes/kde/custom/scripting/pyqt4/configure.sh +14 -0
  55. data/recipes/kde/custom/scripting/pyqt4/install.sh +10 -0
  56. data/recipes/kde/custom/scripting/sip/compile.sh +10 -0
  57. data/recipes/kde/custom/scripting/sip/configure.sh +13 -0
  58. data/recipes/kde/custom/scripting/sip/install.sh +10 -0
  59. data/recipes/kde/files/xsession +8 -4
  60. data/recipes/kde/kde-bindings.recipe +22 -0
  61. data/recipes/kde/kde-core.recipe +104 -0
  62. data/recipes/kde/kde-devel.recipe +38 -0
  63. data/recipes/kde/kde-finance.recipe +17 -0
  64. data/recipes/kde/kde-graphics.recipe +27 -0
  65. data/recipes/kde/kde-kdevelop.recipe +116 -0
  66. data/recipes/kde/kde-l10n.recipe +14 -0
  67. data/recipes/kde/kde-multimedia.recipe +31 -0
  68. data/recipes/kde/kde-network.recipe +55 -0
  69. data/recipes/kde/kde-office.recipe +28 -0
  70. data/recipes/kde/kde-plasma.recipe +117 -0
  71. data/recipes/{kdeqt4.6/recipe → kde/kde-qt.recipe} +25 -57
  72. data/recipes/kde/kde-scripting.recipe +63 -0
  73. data/recipes/kde/kde-support.recipe +73 -0
  74. data/recipes/kde/kde-utils.recipe +22 -0
  75. data/recipes/kde/kde-webdev.recipe +41 -0
  76. data/recipes/kde/recipe +92 -532
  77. data/recipes/kde/recipe-local +58 -2
  78. data/recipes/kde/settings.yaml +17 -0
  79. data/recipes/kde43/recipe-local +58 -2
  80. data/test/test_configuration_parser.rb +76 -21
  81. data/test/test_feature.rb +34 -0
  82. data/test/test_history.rb +149 -0
  83. metadata +185 -30
  84. metadata.gz.sig +0 -0
  85. data/lib/build-tool/pluginbase.rb +0 -43
  86. data/recipes/kdeqt4.6/info.yaml +0 -7
  87. data/recipes/kdeqt4.6/recipe-local +0 -30
  88. data/recipes/kdeqt4.6/settings.yaml +0 -27
  89. data/tasks/rdoc.rake +0 -34
  90. data/test.rb +0 -28
@@ -11,6 +11,11 @@ module BuildTool; module Commands;
11
11
  name "build"
12
12
  description "Build a module."
13
13
 
14
+ # Log this command if $noop is not active
15
+ def log?
16
+ ! $noop
17
+ end
18
+
14
19
  def initialize_options
15
20
 
16
21
  @clean = false
@@ -73,34 +78,34 @@ module BuildTool; module Commands;
73
78
 
74
79
  def do_execute_module( mod )
75
80
  if @from_scratch or @clean
76
- mod.clean( @log_directory, @from_scratch )
81
+ clean( mod, @from_scratch )
77
82
  end
78
83
 
79
84
  if @update
80
85
  if mod.checkedout?
81
- mod.fetch( @log_directory )
82
- mod.rebase( @log_directory )
86
+ fetch( mod )
87
+ rebase( mod )
83
88
  else
84
- mod.clone( @log_directory )
89
+ clone( mod )
85
90
  end
86
91
  end
87
92
 
88
93
  if $noop or mod.checkedout?
89
94
  if @configure or @reconfigure or !mod.configured?
90
95
  if @reconfigure
91
- mod.reconfigure( @log_directory )
96
+ reconfigure( mod )
92
97
  else
93
98
  # See outer if. @configure or !mod.configured?
94
- mod.configure( @log_directory )
99
+ configure( mod )
95
100
  end
96
101
  end
97
102
 
98
103
  if @build
99
- mod.make( @log_directory )
104
+ make( mod )
100
105
  end
101
106
 
102
107
  if @install
103
- mod.install( @log_directory )
108
+ install( mod, true )
104
109
  end
105
110
 
106
111
  else
@@ -14,6 +14,11 @@ module BuildTool; module Commands;
14
14
  name "configure"
15
15
  description "configure the module"
16
16
 
17
+ # Log this command if $noop is not active
18
+ def log?
19
+ ! $noop
20
+ end
21
+
17
22
  def initialize_options
18
23
 
19
24
  @rmcache = false
@@ -51,13 +56,13 @@ module BuildTool; module Commands;
51
56
  def do_execute_module( mod )
52
57
  if mod.checkedout?
53
58
  if @from_scratch or @clean
54
- mod.clean( @log_directory, @from_scratch )
59
+ clean( mod, @from_scratch )
55
60
  end
56
61
 
57
62
  if @rmcache and !@from_scratch
58
- mod.reconfigure( @log_directory )
63
+ reconfigure( mod )
59
64
  else
60
- mod.configure( @log_directory )
65
+ configure( mod )
61
66
  end
62
67
  else
63
68
  logger.info "Not checked out. Skipping"
@@ -1,8 +1,8 @@
1
1
  require 'build-tool/commands'
2
2
 
3
- module BuildTool; module Commands; module Environments
3
+ module BuildTool; module Commands
4
4
 
5
- class CLI < Commands::SubCommands
5
+ class EnvironmentsCLI < Commands::SubCommands
6
6
 
7
7
  name "environments"
8
8
  description "Environment related commands."
@@ -19,11 +19,7 @@ module BuildTool; module Commands; module Environments
19
19
  raise NotImplementedError
20
20
  end
21
21
 
22
- end # class CLI
22
+ end # class EnvironmentsCLI
23
23
 
24
- def self.create( *args )
25
- cmd = CLI.new( *args )
26
- end
27
-
28
- end; end; end # module BuildTool::Commands::Environments
24
+ end; end # module BuildTool::Commands::EnvironmentsCLI
29
25
 
@@ -11,6 +11,13 @@ module BuildTool; module Commands; module Environments
11
11
  description "List all available environments in alphabetical order."
12
12
  cmdalias "lsenv"
13
13
 
14
+ def initialize_options
15
+ @all = false
16
+ options.on( "--all", "Show inactive environments." ) { |t|
17
+ @all = true
18
+ }
19
+ end
20
+
14
21
  def do_execute( args )
15
22
  if args.length != 0
16
23
  return usage( "To many arguments." )
@@ -20,6 +27,7 @@ module BuildTool; module Commands; module Environments
20
27
  say "------------------------------------------------------------"
21
28
  configuration.environments.keys.sort.each do |name|
22
29
  env = configuration.environment(name)
30
+ next if !env.active? && !@all
23
31
  if env.parent
24
32
  say "%-15s %s" % [ name, env.parent.name ]
25
33
  else
@@ -14,6 +14,11 @@ module BuildTool; module Commands;
14
14
  name "fetch"
15
15
  description "fetch remote changes (if applicable)"
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
@@ -30,9 +35,9 @@ module BuildTool; module Commands;
30
35
  def do_execute_module( mod )
31
36
 
32
37
  if mod.checkedout?
33
- mod.fetch( @log_directory )
38
+ fetch( mod )
34
39
  else
35
- mod.clone( @log_directory )
40
+ clone( mod )
36
41
  end
37
42
 
38
43
  end
@@ -0,0 +1,53 @@
1
+ require 'build-tool/commands'
2
+
3
+ module BuildTool; module Commands;
4
+
5
+ #
6
+ # BuildCommand
7
+ #
8
+ class Gc < ModuleBasedCommand
9
+
10
+ name "gc"
11
+ description "Remove old stuff"
12
+
13
+ def initialize_options
14
+ super
15
+ end
16
+
17
+ def applicable?
18
+ BuildTool::Application.instance.name != "build-tool"
19
+ end
20
+
21
+ def do_execute( args )
22
+ case args.length
23
+
24
+ when 0:
25
+ # Nothing
26
+ #
27
+ else
28
+ super
29
+ end
30
+
31
+ BuildTool::History::CommandLog.older_than.each do |cmd|
32
+ if cmd.logdir
33
+ if $noop
34
+ say "rm -rf #{cmd.logdir}"
35
+ else
36
+ debug("Removing #{cmd.logdir}");
37
+ File.rm_rf( cmd.logdir ) if File.exist?( cmd.logdir )
38
+ end
39
+ end
40
+ cmd.delete
41
+ end
42
+ return 0
43
+ end
44
+
45
+ def do_execute_module( mod )
46
+ mod.gc
47
+ end
48
+
49
+ end # class Info
50
+
51
+ end; end # module BuildTool::Commands
52
+
53
+
@@ -0,0 +1,111 @@
1
+ require 'build-tool/commands'
2
+
3
+ module BuildTool; module Commands;
4
+
5
+ #
6
+ # BuildCommand
7
+ #
8
+ class History < Standard
9
+
10
+ name "history"
11
+ description "show command history"
12
+
13
+ def initialize_options
14
+
15
+ # Show detailed history. Add start time, duration and success/failure
16
+ @long = false
17
+ options.on( "-l", "--long", "Use long list format." ) { |t|
18
+ @long = true
19
+ }
20
+ super
21
+ end
22
+
23
+ def applicable?
24
+ BuildTool::Application.instance.name != "build-tool"
25
+ end
26
+
27
+ def do_execute( args )
28
+ case args.length
29
+
30
+ when 0:
31
+ return show_command_history
32
+ when 1:
33
+ return show_detailed_command_history( args[0] ) if args[0] =~ /^[0-9]+/
34
+ case args[0][0,1]
35
+ when '+':
36
+ return show_detailed_command_history( args[0] )
37
+ else
38
+ return show_module_history( args[0] )
39
+ end
40
+ else
41
+ return usage( "To many arguments" )
42
+ end
43
+ end
44
+
45
+ def show_command( cmd )
46
+ if @long
47
+ say " %04d %s %s # %s [%s]" % [ cmd.id, cmd.started_at.strftime("%x %X"), cmd.duration, cmd.command, cmd.state_str ]
48
+ else
49
+ say " %04d %s [%s]" % [ cmd.id, cmd.command, cmd.state_str ]
50
+ end
51
+ end
52
+
53
+ def show_command_history
54
+ # *TODO* Make the number of printed command configurable
55
+ BuildTool::History::CommandLog.last(50).reverse().each do |cmd|
56
+ show_command cmd
57
+ end
58
+
59
+ return 0
60
+ end
61
+
62
+ def show_module_history( modname )
63
+ mod = Application::instance.configuration.module( modname )
64
+ if mod.nil?
65
+ return usage( "Unknown module #{modname}" )
66
+ end
67
+
68
+ BuildTool::History::CommandLog.last_by_module( modname ).reverse.each do |cmd|
69
+ show_command( cmd )
70
+
71
+ last_module=""
72
+ cmd.module_logs_dataset.filter( :module => modname ).each do |e|
73
+ if e.module != last_module
74
+ say "\t#{e.module}"
75
+ last_module = e.module
76
+ end
77
+ say "\t\t %s %s (%s) [%s]" % [ e.duration, e.event, e.logfile, e.state_str ]
78
+ end
79
+ end
80
+ return 0
81
+ end
82
+
83
+ def show_detailed_command_history( id )
84
+ if id[0,1] == '+'
85
+ cmd = BuildTool::History::CommandLog.most_recent( id.to_i )
86
+ return 0 if cmd.nil?
87
+ else
88
+ cmd = BuildTool::History::CommandLog[id.to_i]
89
+ if cmd.nil?
90
+ logger.error( "No entry with id #{id.to_i} found in history!")
91
+ return -1
92
+ end
93
+ end
94
+ show_command( cmd )
95
+
96
+ last_module=""
97
+ cmd.module_logs.each do |e|
98
+ if e.module != last_module
99
+ say "\t#{e.module}"
100
+ last_module = e.module
101
+ end
102
+ say "\t\t %s %s (%s) [%s]" % [ e.duration, e.event, e.logfile, e.state_str ]
103
+ end
104
+
105
+ return 0
106
+ end
107
+
108
+ end # class Info
109
+
110
+ end; end # module BuildTool::Commands
111
+
@@ -14,6 +14,11 @@ module BuildTool; module Commands;
14
14
  name "install"
15
15
  description "install the module"
16
16
 
17
+ # Log this command if $noop is not active
18
+ def log?
19
+ ! $noop
20
+ end
21
+
17
22
  def initialize_options
18
23
 
19
24
  @fast = false
@@ -40,7 +45,7 @@ module BuildTool; module Commands;
40
45
 
41
46
  def do_execute_module( mod )
42
47
  if mod.checkedout?
43
- mod.install( @log_directory, @fast )
48
+ install( mod, @fast )
44
49
  else
45
50
  logger.info "Not checked out. Skipping"
46
51
  end
@@ -0,0 +1,73 @@
1
+ require 'build-tool/commands'
2
+
3
+ module BuildTool; module Commands;
4
+
5
+ #
6
+ # BuildCommand
7
+ #
8
+ class Lsfeatures < Standard
9
+
10
+ name "lsfeatures"
11
+ description "List all available features."
12
+
13
+ def initialize_options
14
+ super
15
+ end
16
+
17
+ def applicable?
18
+ BuildTool::Application.instance.name != "build-tool"
19
+ end
20
+
21
+ def do_execute( args )
22
+ if args.length > 1
23
+ # *TODO* print better message
24
+ return usage "To many arguments."
25
+ end
26
+
27
+ if args.length == 1
28
+ return show_feature( args[0] )
29
+ else
30
+ return list_features
31
+ end
32
+ end
33
+
34
+ def list_features
35
+ say "%-30s| %s | %s" % [ "Feature", "A", "Description" ]
36
+ say "==========================================================="
37
+ features = configuration.features
38
+ features.keys.sort.each do |name|
39
+ feature = features[name]
40
+ # Skip feature without modules
41
+ next if feature.modules.empty?
42
+ active = "N"
43
+ active = "Y" if feature.active?
44
+ say "%-30s| %s | %s" % [ name, active, feature.description ]
45
+ end
46
+
47
+ return 0
48
+ end
49
+
50
+ def show_feature( name )
51
+ feature = configuration.features[name]
52
+
53
+ if feature.nil?
54
+ logger.error( "Unknown feature '%s'" % name )
55
+ return -1
56
+ end
57
+
58
+ say "Name : %s" % feature.path
59
+ say "Modules"
60
+ say "===================================================="
61
+ feature.modules.each do |mod|
62
+ next if mod.is_template?
63
+ say " %-20s: %s" % [ mod.name, mod.description ]
64
+ end
65
+ return 0
66
+ end
67
+
68
+ end # class Info
69
+
70
+ end; end # module BuildTool::Commands
71
+
72
+
73
+
@@ -1,6 +1,6 @@
1
1
  require 'build-tool/commands'
2
2
 
3
- module BuildTool; module Commands; module Modules
3
+ module BuildTool; module Commands;
4
4
 
5
5
  class CLI < Commands::SubCommands
6
6
 
@@ -19,11 +19,7 @@ module BuildTool; module Commands; module Modules
19
19
  raise NotImplementedError
20
20
  end
21
21
 
22
- end # class CLI
22
+ end # class ModulesCLI
23
23
 
24
- def self.create( *args )
25
- cmd = CLI.new( *args )
26
- end
27
-
28
- end; end; end # module BuildTool::Commands::Modules
24
+ end; end # module BuildTool::Commands::ModulesCLI
29
25
 
@@ -11,6 +11,7 @@ module BuildTool; module Commands; module Modules
11
11
  description "show detailed information about modules."
12
12
 
13
13
  def do_execute_module( mod )
14
+ say "Active: #{mod.active?}"
14
15
 
15
16
  if mod.repository
16
17
  say "Repository: #{mod.repository.url}/#{mod.remote_path}"
@@ -26,7 +27,6 @@ module BuildTool; module Commands; module Modules
26
27
  say "Build Directory #{mod.build_directory} #{mod.configured? ? '(CONFIGURED)' : '(TODO)' }"
27
28
  else
28
29
  say "Local Checkout: build-prefix not configured"
29
- say "Local Checkout: build-prefix not configured"
30
30
  end
31
31
 
32
32
  say "Prefix: #{mod.install_prefix.to_s}"
@@ -43,26 +43,35 @@ module BuildTool; module Commands; module Modules
43
43
  if mod.vcs_configuration
44
44
  case mod.vcs_configuration.name
45
45
  when 'svn'
46
+ when 'archive'
46
47
  when 'git'
47
48
  say " Remote: %s -> %s" % [ "origin", mod.vcs_configuration.repository.url ]
48
49
  mod.vcs_configuration.remote.each do |key, val|
49
50
  say " Remote: %s -> %s" % [ key, val.url ]
50
51
  end
52
+ say " Track branch: #{mod.vcs_configuration.track_remote}/#{mod.vcs_configuration.track_branch}"
51
53
  when 'git-svn'
54
+ say " Remote: %s -> %s" % [ "git-svn", mod.vcs_configuration.repository.url ]
55
+ mod.vcs_configuration.remote.each do |key, val|
56
+ say " Remote: %s -> %s" % [ key, val.url ]
57
+ end
52
58
  mod.vcs_configuration.externals.each do |key, val|
53
59
  say " External: #{key} -> #{val}"
54
60
  end
55
61
  else
56
62
  logger.warn "Unknown vcs #{mod.vcs_configuration.name}"
57
63
  end
58
- say " Track branch: #{mod.vcs_configuration.track_remote}/#{mod.vcs_configuration.track_branch}"
59
64
  end # if mod.vcs_configuration
60
65
 
61
66
  bs = mod.build_system
62
- say "Build System: #{bs.name}"
63
- say " Out Of Source Build #{bs.out_of_source}"
64
- bs.options.sort.each do |var|
65
- say " %-25s %s" % [ var + ":", bs[var] ]
67
+ if bs
68
+ say "Build System: #{bs.name}"
69
+ say " Out Of Source Build #{bs.out_of_source}"
70
+ bs.options.sort.each do |var|
71
+ say " %-25s %s" % [ var + ":", bs[var] ]
72
+ end
73
+ else
74
+ say "Build System: Not configured"
66
75
  end
67
76
 
68
77
  return 0