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.
Files changed (149) hide show
  1. data.tar.gz.sig +0 -0
  2. data/History.txt +28 -1
  3. data/Manifest.txt +91 -52
  4. data/README.txt +63 -0
  5. data/Rakefile +20 -23
  6. data/bin/build-tool +53 -0
  7. data/lib/build-tool.rb +7 -0
  8. data/lib/build-tool/GUI.rb +360 -0
  9. data/lib/build-tool/application.rb +84 -0
  10. data/lib/build-tool/build-system/autoconf.rb +60 -0
  11. data/lib/build-tool/build-system/base.rb +142 -0
  12. data/lib/build-tool/build-system/cmake.rb +119 -0
  13. data/lib/build-tool/build-system/custom.rb +115 -0
  14. data/lib/build-tool/build-system/qt.rb +113 -0
  15. data/lib/build-tool/cfg/lexer.rb +558 -0
  16. data/lib/build-tool/cfg/lexer.rex +248 -0
  17. data/lib/build-tool/cfg/lexer_base.rb +82 -0
  18. data/lib/build-tool/cfg/node.rb +94 -0
  19. data/lib/build-tool/cfg/parser.rb +871 -0
  20. data/lib/build-tool/cfg/parser.y +279 -0
  21. data/lib/build-tool/cfg/visitor.rb +471 -0
  22. data/lib/build-tool/commands.rb +639 -0
  23. data/lib/build-tool/commands/build.rb +120 -0
  24. data/lib/build-tool/commands/configure.rb +73 -0
  25. data/lib/build-tool/commands/ctags.rb +46 -0
  26. data/lib/build-tool/commands/environments.rb +29 -0
  27. data/lib/build-tool/commands/environments/list.rb +37 -0
  28. data/lib/build-tool/commands/environments/set.rb +33 -0
  29. data/lib/build-tool/commands/fetch.rb +50 -0
  30. data/lib/build-tool/commands/files.rb +73 -0
  31. data/lib/build-tool/commands/help.rb +22 -0
  32. data/lib/build-tool/commands/info.rb +48 -0
  33. data/lib/build-tool/commands/install.rb +56 -0
  34. data/lib/build-tool/commands/modules.rb +29 -0
  35. data/lib/build-tool/commands/modules/info.rb +75 -0
  36. data/lib/build-tool/commands/modules/list.rb +49 -0
  37. data/lib/build-tool/commands/modules/shell.rb +40 -0
  38. data/lib/build-tool/commands/rebase.rb +46 -0
  39. data/lib/build-tool/commands/recipes.rb +32 -0
  40. data/lib/build-tool/commands/recipes/info.rb +46 -0
  41. data/lib/build-tool/commands/recipes/install.rb +184 -0
  42. data/lib/build-tool/commands/recipes/list.rb +33 -0
  43. data/lib/build-tool/configuration.rb +115 -0
  44. data/lib/build-tool/environment.rb +119 -0
  45. data/lib/build-tool/errors.rb +9 -0
  46. data/lib/build-tool/module.rb +366 -0
  47. data/lib/build-tool/pluginbase.rb +43 -0
  48. data/lib/build-tool/recipe.rb +180 -0
  49. data/lib/build-tool/repository.rb +59 -0
  50. data/lib/build-tool/server.rb +43 -0
  51. data/lib/build-tool/singleton.rb +50 -0
  52. data/lib/build-tool/sshkey.rb +22 -0
  53. data/lib/build-tool/vcs/base.rb +105 -0
  54. data/lib/build-tool/vcs/git-svn.rb +154 -0
  55. data/lib/build-tool/vcs/git.rb +187 -0
  56. data/lib/build-tool/vcs/svn.rb +136 -0
  57. data/lib/mj/logging.rb +31 -0
  58. data/lib/mj/tools/ssh.rb +64 -0
  59. data/lib/{kde-build → mj/tools}/subprocess.rb +21 -16
  60. data/lib/mj/visitor.rb +21 -0
  61. data/recipes/kde/files/finish_installation.sh +16 -0
  62. data/recipes/kde/files/kde4.desktop +22 -0
  63. data/recipes/kde/files/xsession +89 -0
  64. data/recipes/kde/info.yaml +10 -0
  65. data/recipes/kde/recipe +585 -0
  66. data/recipes/kde/recipe-local +90 -0
  67. data/recipes/kde/settings.yaml +52 -0
  68. data/recipes/kde43/info.yaml +10 -0
  69. data/recipes/kde43/recipe +256 -0
  70. data/recipes/kde43/recipe-local +90 -0
  71. data/recipes/kde43/settings.yaml +32 -0
  72. data/recipes/kdeqt4.6/custom/qt/qtscriptgenerator/compile.sh +77 -0
  73. data/recipes/kdeqt4.6/custom/qt/qtscriptgenerator/configure.sh +70 -0
  74. data/recipes/kdeqt4.6/custom/qt/qtscriptgenerator/install.sh +39 -0
  75. data/recipes/kdeqt4.6/info.yaml +7 -0
  76. data/recipes/kdeqt4.6/recipe +155 -0
  77. data/recipes/kdeqt4.6/recipe-local +30 -0
  78. data/recipes/kdeqt4.6/settings.yaml +27 -0
  79. data/tags +745 -0
  80. data/tasks/genfiles.rake +28 -0
  81. data/tasks/rdoc.rake +34 -0
  82. data/tasks/rspec.rake +21 -0
  83. data/test.rb +28 -0
  84. data/test/commands/test_build.rb +29 -0
  85. data/test/test_build_system.rb +98 -0
  86. data/test/test_cli.rb +61 -0
  87. data/test/test_command.rb +175 -0
  88. data/test/test_configuration_parser.rb +542 -0
  89. data/test/test_environment.rb +82 -0
  90. data/test/test_helper.rb +39 -7
  91. data/test/test_module.rb +158 -0
  92. data/test/test_repository.rb +75 -0
  93. data/test/test_singleton.rb +51 -0
  94. data/test/test_ssh_key.rb +14 -0
  95. data/test/test_svn_parser.rb +28 -0
  96. data/test/test_vcs.rb +33 -0
  97. metadata +139 -90
  98. metadata.gz.sig +0 -0
  99. data/PostInstall.txt +0 -3
  100. data/TODO +0 -2
  101. data/bin/kde-build.rb +0 -21
  102. data/config/website.yml +0 -2
  103. data/config/website.yml.sample +0 -2
  104. data/lib/kde-build.rb +0 -18
  105. data/lib/kde-build/application.rb +0 -270
  106. data/lib/kde-build/build_system.rb +0 -28
  107. data/lib/kde-build/build_system/autoconf.rb +0 -108
  108. data/lib/kde-build/build_system/base.rb +0 -139
  109. data/lib/kde-build/build_system/cmake.rb +0 -94
  110. data/lib/kde-build/build_system/qtcopy.rb +0 -127
  111. data/lib/kde-build/command.rb +0 -42
  112. data/lib/kde-build/command/build.rb +0 -106
  113. data/lib/kde-build/command/compile.rb +0 -39
  114. data/lib/kde-build/command/configure.rb +0 -48
  115. data/lib/kde-build/command/ctags.rb +0 -41
  116. data/lib/kde-build/command/fetch.rb +0 -33
  117. data/lib/kde-build/command/help.rb +0 -71
  118. data/lib/kde-build/command/info.rb +0 -45
  119. data/lib/kde-build/command/install.rb +0 -39
  120. data/lib/kde-build/command/module_based.rb +0 -44
  121. data/lib/kde-build/command/rebase.rb +0 -50
  122. data/lib/kde-build/command/version.rb +0 -43
  123. data/lib/kde-build/configuration.rb +0 -209
  124. data/lib/kde-build/exception.rb +0 -6
  125. data/lib/kde-build/metaaid.rb +0 -18
  126. data/lib/kde-build/module.rb +0 -227
  127. data/lib/kde-build/module_configuration.rb +0 -107
  128. data/lib/kde-build/moduleregistry.rb +0 -85
  129. data/lib/kde-build/tools/ctags.rb +0 -59
  130. data/lib/kde-build/tools/logging.rb +0 -49
  131. data/lib/kde-build/tools/make.rb +0 -58
  132. data/lib/kde-build/tools/ssh.rb +0 -47
  133. data/lib/kde-build/vcs.rb +0 -28
  134. data/lib/kde-build/vcs/base.rb +0 -85
  135. data/lib/kde-build/vcs/git-svn.rb +0 -139
  136. data/lib/kde-build/vcs/git.rb +0 -121
  137. data/lib/kde-build/vcs/svn.rb +0 -102
  138. data/script/console +0 -10
  139. data/script/destroy +0 -14
  140. data/script/generate +0 -14
  141. data/script/txt2html +0 -71
  142. data/test.yaml.tmpl +0 -632
  143. data/test/test_kde-build.rb +0 -11
  144. data/test/test_vcs_svn.rb +0 -44
  145. data/website/index.html +0 -84
  146. data/website/index.txt +0 -59
  147. data/website/javascripts/rounded_corners_lite.inc.js +0 -285
  148. data/website/stylesheets/screen.css +0 -159
  149. data/website/template.html.erb +0 -50
@@ -0,0 +1,120 @@
1
+ require 'build-tool/application'
2
+ require 'build-tool/commands'
3
+
4
+ module BuildTool; module Commands;
5
+
6
+ #
7
+ # BuildCommand
8
+ #
9
+ class Build < ModuleBasedCommand
10
+
11
+ name "build"
12
+ description "Build a module."
13
+
14
+ def initialize_options
15
+
16
+ @clean = false
17
+ @configure = false
18
+ @from_scratch = false
19
+ @build = true
20
+ @install = true
21
+ @reconfigure = false
22
+ @update = false
23
+
24
+ options.on( "--[no-]clean", "Make clean before building." ) { |t|
25
+ @clean = t
26
+ }
27
+
28
+ options.on( "--[no-]install", "Do not install" ) { |t|
29
+ @install = t
30
+ }
31
+
32
+ options.on( "--[no-]update", "Do not update from the repository" ) { |t|
33
+ @update = t
34
+ }
35
+
36
+ options.on( "-c", "--configure", "Run the configuration step again" ) { |t|
37
+ @configure = true
38
+ }
39
+
40
+ options.on( "--reconfigure", "Remove old configuration then run configuration again" ) { |t|
41
+ @reconfigure = true
42
+ }
43
+
44
+ options.on( nil, "--from-scratch", "Rebuild from scratch" ) { |t|
45
+ @from_scratch = true
46
+ }
47
+
48
+
49
+ super
50
+ end
51
+
52
+ def applicable?
53
+ BuildTool::Application.instance.name != "build-tool"
54
+ end
55
+
56
+ def do_execute( args )
57
+ rc = super(args)
58
+ MJ::Tools::SSH::cleanup()
59
+ return rc
60
+ end
61
+
62
+ def is_module_ready?( mod )
63
+ isready = true
64
+ @update && isready &= mod.prepare_for_vcs_access
65
+ if !@update and (@build or @install or @configure)
66
+ if !mod.checkedout?
67
+ logger.warn "#{mod.name}: is not checked out. Skipping (add -u for checkout)"
68
+ end
69
+ end
70
+ @install && isready &= mod.prepare_for_installation
71
+ return isready
72
+ end # is_module_ready
73
+
74
+ def do_execute_module( mod )
75
+ if @from_scratch or @clean
76
+ mod.clean( @log_directory, @from_scratch )
77
+ end
78
+
79
+ if @update
80
+ if mod.checkedout?
81
+ mod.fetch( @log_directory )
82
+ mod.rebase( @log_directory )
83
+ else
84
+ mod.clone( @log_directory )
85
+ end
86
+ end
87
+
88
+ if $noop or mod.checkedout?
89
+ if @configure or @reconfigure or !mod.configured?
90
+ if @reconfigure
91
+ mod.reconfigure( @log_directory )
92
+ else
93
+ # See outer if. @configure or !mod.configured?
94
+ mod.configure( @log_directory )
95
+ end
96
+ end
97
+
98
+ if @build
99
+ mod.make( @log_directory )
100
+ end
101
+
102
+ if @install
103
+ mod.install( @log_directory )
104
+ end
105
+
106
+ else
107
+
108
+ logger.warn "Module is not checked out! Use -u to check it out."
109
+ logger.warn "skipped!"
110
+
111
+ end
112
+
113
+ end # do_execute_module
114
+
115
+ end # class Build
116
+
117
+
118
+ end; end # module BuildTool::Commands
119
+
120
+
@@ -0,0 +1,73 @@
1
+ require 'build-tool/application'
2
+ require 'build-tool/commands'
3
+
4
+ module BuildTool; module Commands;
5
+
6
+ class CtagsError < BuildTool::Error; end
7
+ #
8
+ # BuildCommand
9
+ #
10
+ class Configure < ModuleBasedCommand
11
+
12
+ include MJ::Tools::SubProcess
13
+
14
+ name "configure"
15
+ description "configure the module"
16
+
17
+ def initialize_options
18
+
19
+ @rmcache = false
20
+ @from_scratch = false
21
+ @clean = false
22
+
23
+ options.on( "--[no-]clean", "Make clean before building." ) { |t|
24
+ @clean = t
25
+ }
26
+
27
+ options.on( nil, "--from-scratch", "Rebuild from scratch" ) { |t|
28
+ @from_scratch = true
29
+ }
30
+
31
+ options.on( "--rmcache", "Remove cache file." ) { |t|
32
+ @rmcache = true
33
+ }
34
+
35
+ super
36
+ end
37
+
38
+ def applicable?
39
+ BuildTool::Application.instance.name != "build-tool"
40
+ end
41
+
42
+ def is_module_ready?( mod )
43
+ isready = true
44
+ if !mod.checkedout?
45
+ logger.warn "#{mod.name}: module not checked out -> skipping."
46
+ end
47
+ return isready
48
+ end
49
+
50
+
51
+ def do_execute_module( mod )
52
+ if mod.checkedout?
53
+ if @from_scratch or @clean
54
+ mod.clean( @log_directory, @from_scratch )
55
+ end
56
+
57
+ if @rmcache and !@from_scratch
58
+ mod.reconfigure( @log_directory )
59
+ else
60
+ mod.configure( @log_directory )
61
+ end
62
+ else
63
+ logger.info "Not checked out. Skipping"
64
+ end
65
+ end
66
+
67
+ end # class Build
68
+
69
+ end; end # module BuildTool::Commands
70
+
71
+
72
+
73
+
@@ -0,0 +1,46 @@
1
+ require 'build-tool/application'
2
+ require 'build-tool/commands'
3
+
4
+ module BuildTool; module Commands;
5
+
6
+ class CtagsError < BuildTool::Error; end
7
+ #
8
+ # BuildCommand
9
+ #
10
+ class Ctags < ModuleBasedCommand
11
+
12
+ include MJ::Tools::SubProcess
13
+
14
+ name "ctags"
15
+ description "run ctags on the module."
16
+
17
+ def applicable?
18
+ BuildTool::Application.instance.name != "build-tool"
19
+ end
20
+
21
+ def do_execute_module( mod )
22
+ if mod.checkedout?
23
+ FileUtils.mkdir_p mod.build_prefix_required.join("tags").to_s
24
+ ctags(mod.source_directory,
25
+ mod.build_prefix_required.join(
26
+ "tags",
27
+ mod.name.gsub( '/', '-' ) + ".tags" ))
28
+
29
+ else
30
+ logger.warn "Module is not checked out! Use -u to check it out."
31
+ logger.warn "skipped!"
32
+ end
33
+ end
34
+
35
+ def ctags( source, tagsfile )
36
+ rc = self.class.execute "ctags -R -f #{tagsfile} #{source}"
37
+ if rc != 0
38
+ raise CtagsError, "ctags failed with error #{rc}!"
39
+ end
40
+ rc
41
+ end
42
+ end # class Build
43
+
44
+ end; end # module BuildTool::Commands
45
+
46
+
@@ -0,0 +1,29 @@
1
+ require 'build-tool/commands'
2
+
3
+ module BuildTool; module Commands; module Environments
4
+
5
+ class CLI < Commands::SubCommands
6
+
7
+ name "environments"
8
+ description "Environment related commands."
9
+
10
+ def initialize_options
11
+ super
12
+ end
13
+
14
+ def applicable?
15
+ BuildTool::Application.instance.name != "build-tool"
16
+ end
17
+
18
+ def do_execute
19
+ raise NotImplementedError
20
+ end
21
+
22
+ end # class CLI
23
+
24
+ def self.create( *args )
25
+ cmd = CLI.new( *args )
26
+ end
27
+
28
+ end; end; end # module BuildTool::Commands::Environments
29
+
@@ -0,0 +1,37 @@
1
+ require 'build-tool/commands'
2
+
3
+ module BuildTool; module Commands; module Environments
4
+
5
+ #
6
+ # BuildCommand
7
+ #
8
+ class List < Standard
9
+
10
+ name "list"
11
+ description "List all available environments in alphabetical order."
12
+ cmdalias "lsenv"
13
+
14
+ def do_execute( args )
15
+ if args.length != 0
16
+ return usage( "To many arguments." )
17
+ end
18
+
19
+ say "%-15s (%s)" % [ "Environment", "Inherits" ]
20
+ say "------------------------------------------------------------"
21
+ configuration.environments.keys.sort.each do |name|
22
+ env = configuration.environment(name)
23
+ if env.parent
24
+ say "%-15s %s" % [ name, env.parent.name ]
25
+ else
26
+ say name
27
+ end
28
+ end
29
+
30
+ return 0
31
+ end
32
+
33
+ end # class
34
+
35
+ end; end; end # module BuildTool::Commands::Modules
36
+
37
+
@@ -0,0 +1,33 @@
1
+ require 'build-tool/commands'
2
+
3
+ module BuildTool; module Commands; module Environments
4
+
5
+ #
6
+ # BuildCommand
7
+ #
8
+ class Set < Standard
9
+
10
+ name "set"
11
+ description "Open a shell with the environment set."
12
+
13
+ def do_execute( args )
14
+ case args.length
15
+ when 0
16
+ return usage( "Not enough arguments." )
17
+ when 1
18
+ # OK
19
+ else
20
+ return usage( "To many arguments." )
21
+ end
22
+
23
+ # Get the environment.
24
+ env = configuration.environment(args[0])
25
+ return env.shell
26
+ end
27
+
28
+ end # class
29
+
30
+ end; end; end # module BuildTool::Commands::Modules
31
+
32
+
33
+
@@ -0,0 +1,50 @@
1
+ require 'build-tool/application'
2
+ require 'build-tool/commands'
3
+
4
+ module BuildTool; module Commands;
5
+
6
+ class CtagsError < BuildTool::Error; end
7
+ #
8
+ # BuildCommand
9
+ #
10
+ class Fetch < ModuleBasedCommand
11
+
12
+ include MJ::Tools::SubProcess
13
+
14
+ name "fetch"
15
+ description "fetch remote changes (if applicable)"
16
+
17
+ def applicable?
18
+ BuildTool::Application.instance.name != "build-tool"
19
+ end
20
+
21
+ def is_module_ready?( mod )
22
+ isready = true
23
+ isready &= mod.prepare_for_vcs_access
24
+ if !mod.vcs.fetching_supported?
25
+ logger.warn "#{mod.name}: fetching not support by #{mod.vcs.name} -> implicit rebase."
26
+ end
27
+ return isready
28
+ end
29
+
30
+ def do_execute_module( mod )
31
+
32
+ if mod.checkedout?
33
+ mod.fetch( @log_directory )
34
+ else
35
+ mod.clone( @log_directory )
36
+ end
37
+
38
+ end
39
+
40
+ def do_execute( args )
41
+ rc = super(args)
42
+ MJ::Tools::SSH::cleanup()
43
+ return rc
44
+ end
45
+
46
+ end # class Build
47
+
48
+ end; end # module BuildTool::Commands
49
+
50
+
@@ -0,0 +1,73 @@
1
+ require 'build-tool/application'
2
+ require 'build-tool/commands'
3
+
4
+ module BuildTool; module Commands;
5
+
6
+ #
7
+ # BuildCommand
8
+ #
9
+ class Files < Standard
10
+
11
+ name "files"
12
+ description "Get the content of some helper files."
13
+
14
+ def applicable?
15
+ BuildTool::Application.instance.name != "build-tool"
16
+ end
17
+
18
+ def do_execute( args )
19
+ case args.length
20
+
21
+ when 0
22
+ return print_file_list
23
+
24
+ when 1
25
+ return print_file( args[0] )
26
+
27
+ else
28
+ return usage("Too many arguments.")
29
+
30
+ end
31
+ end
32
+
33
+ def print_file_list
34
+ recipe = Application::instance.recipe
35
+ files_dir = recipe.files_path
36
+ if !files_dir.exist?
37
+ say "No files supplied with this recipe"
38
+ return 0
39
+ end
40
+ Dir.new(files_dir).each do |entry|
41
+ next if entry == "."
42
+ next if entry == ".."
43
+ say entry
44
+ end
45
+ return 0
46
+ end
47
+
48
+ def print_file( filename )
49
+ recipe = Application::instance.recipe
50
+ files_dir = recipe.files_path
51
+ if !files_dir.exist?
52
+ say "No files supplied with this recipe"
53
+ return 0
54
+ end
55
+ file = files_dir.join( filename )
56
+ if !files_dir.exist?
57
+ say "That file does not exist"
58
+ return -1
59
+ end
60
+
61
+ erb = ERB.new( file.read, nil, "%<>" )
62
+ b = binding
63
+ settings = recipe.settings
64
+ puts erb.result(b)
65
+ return 0
66
+ end
67
+
68
+ end # class Build
69
+
70
+ end; end # module BuildTool::Commands
71
+
72
+
73
+