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
@@ -1,107 +0,0 @@
1
- require 'kde-build/configuration'
2
- require 'kde-build/build_system'
3
- require 'kde-build/module'
4
- require 'kde-build/moduleregistry.rb'
5
- require 'kde-build/vcs'
6
-
7
- require 'yaml'
8
-
9
- module BuildTool
10
-
11
- class ModuleConfiguration
12
-
13
- include MJ::Configuration::Configurable
14
-
15
- option( "repository", "Remote repository url" ).
16
- required
17
-
18
- option( "ssh-key", "ssh-key for the repository" )
19
- option( "ssh-file", "ssh-file for the repository" )
20
-
21
- option( "name", "Name of the module" ).
22
- required
23
-
24
- option( "vcs", "VCS used for the module. # TODO" ).
25
- on_write {
26
- |val|
27
- if val.instance_of?( String )
28
- val = VCS::get( val ).config.new
29
- elsif val.instance_of?( Array )
30
- a = val.inject([]) {
31
- |arr, v|
32
- v.each_pair {
33
- |val, key|
34
- arr << val << key
35
- }
36
- arr
37
- }
38
- a = Hash[*a]
39
- val = VCS::get(a['name']).config.new
40
- val.parse(a)
41
- else
42
- raise Exception, "Don't know how to handle #{val.inspect}"
43
- end
44
- val
45
- }
46
-
47
- option( "build-system", "Build System" ).
48
- on_write {
49
- |val|
50
- if val.instance_of?( String )
51
- val = BuildSystem::get( val ).config.new
52
- elsif val.instance_of?( Array )
53
- a = val.inject([]) {
54
- |arr, v|
55
- v.each_pair {
56
- |val, key|
57
- arr << val << key
58
- }
59
- arr
60
- }
61
- a = Hash[*a]
62
- val = BuildSystem::get(a['name']).config.new
63
- val.parse(a)
64
- else
65
- raise Exception, "FIXME"
66
- end
67
- val
68
- }
69
-
70
- option( "env", "Environment Settings" ).
71
- on_write { |val|
72
- h = Hash.new
73
- MJ::Configuration::flatten_values val do
74
- |k, v|
75
- h[k] = v
76
- end
77
- h
78
- }
79
-
80
- option( "local-path", "Local path to build. Relative to <stage>/src" )
81
-
82
- option( "remote-path", "Path to fetch from. Relative to <repository>" ).
83
- required
84
-
85
- option( "prefix", "Installation Directory" ).
86
- required
87
-
88
- def to_s
89
- self.name
90
- end
91
- end
92
-
93
-
94
- YAML.add_domain_type(
95
- "michael-jansen.biz,2009", "ModuleConfiguration" ) {
96
- |type, val|
97
- mc = ModuleConfiguration.new
98
- MJ::Configuration::flatten_values val do
99
- |k, v|
100
- mc.set( k, v )
101
- end
102
- mc.validate
103
- ModuleRegistry.instance.register_module( Module.new( mc ) )
104
- mc
105
- }
106
-
107
- end
@@ -1,85 +0,0 @@
1
- # encoding: utf-8
2
- #
3
- require 'singleton'
4
-
5
- module BuildTool
6
-
7
- class ConfigurationError < Exception
8
- end
9
-
10
- class ModuleRegistry
11
-
12
- include Singleton
13
-
14
- include MJ::Configuration::Configurable
15
-
16
- include Singleton
17
-
18
- @@packages = {}
19
- def set( name, string )
20
- @@packages[name] = string.to_s.split( / */ )
21
- end
22
-
23
- def self.resolve_package( string, &block )
24
- name = string[1..-1]
25
- if @@packages.has_key? name
26
- return self.get_modules( @@packages[name], &block )
27
- else
28
- $log.error( "Unknown package #{string}" )
29
- end
30
- end
31
-
32
- @@modules = []
33
-
34
- def register_module( mod )
35
- if self.class.module_by_name mod.name
36
- raise ConfigurationError, "Two configurations for #{mod.name} found"
37
- end
38
- @@modules.push( [mod.name ,mod] )
39
- end
40
-
41
- def self.module_by_name( name )
42
- @@modules.each do |v|
43
- if v[0] == name
44
- return v[1]
45
- end
46
- end
47
- nil
48
- end
49
-
50
-
51
- def self.get_modules( args, &block )
52
- if args.instance_of?( String )
53
- if args[0,1] == ':'
54
- self.resolve_package( args, &block )
55
- # Check if we have a exact match
56
- elsif mod = module_by_name(args)
57
- yield mod
58
- elsif args[-1,1] == '/'
59
- found = false
60
- @@modules.select{ |a| a[0].index(args) == 0}.each do |a|
61
- found = true
62
- yield a[1]
63
- end
64
- $log.error( "Unknown module #{args}" ) if !found
65
- else
66
- $log.error( "Unknown module #{args}" )
67
- end
68
- elsif args.instance_of?( Array )
69
- args.map { |arg| get_modules( arg, &block ) }
70
- end
71
- end
72
-
73
- end
74
-
75
- YAML.add_domain_type(
76
- "michael-jansen.biz,2009", "Packages" ) {
77
- |type, val|
78
- mr = ModuleRegistry.instance
79
- MJ::Configuration::flatten_values val do
80
- |k, v|
81
- mr.set( k, v )
82
- end
83
- }
84
-
85
- end
@@ -1,59 +0,0 @@
1
- require 'kde-build/configuration'
2
- require 'kde-build/subprocess'
3
-
4
- require 'singleton'
5
- require 'yaml'
6
-
7
- module BuildTool
8
-
9
- class CTagsConfiguration
10
-
11
- include MJ::Configuration::Configurable
12
-
13
- include Singleton
14
-
15
- option( "executable", "Full path for to the executable" )
16
- option( "options", "" )
17
- option( "output", "" )
18
-
19
- def initialize
20
- @executable = "ctags"
21
- end
22
-
23
- end
24
-
25
-
26
- class CTags
27
-
28
- include MJ::Tools::SubProcess
29
-
30
- def self.run( dir, file )
31
- file = file.tr( "/", "-" )
32
- conf = CTagsConfiguration::instance
33
- if !conf.output
34
- $log.error("No ctags configuration section found!")
35
- return
36
- else
37
- FileUtils.mkdir_p( Pathname.new( conf.output ).expand_path )
38
- end
39
- ctags "#{conf.options ? conf.options : ""} -f #{Pathname.new( conf.output ).join( file )} -R #{dir}"
40
- end
41
-
42
- def self.ctags( cmd )
43
- conf = CTagsConfiguration::instance
44
- execute( "#{conf.executable ? conf.executable : "ctags"} #{cmd}" )
45
- end
46
-
47
- end
48
-
49
- YAML.add_domain_type(
50
- "michael-jansen.biz,2009", "CTagsConfiguration" ) {
51
- |type, val|
52
- cc = CTagsConfiguration.instance
53
- MJ::Configuration::flatten_values val do
54
- |k, v|
55
- cc.set( k, v )
56
- end
57
- }
58
-
59
- end
@@ -1,49 +0,0 @@
1
- require 'log4r'
2
-
3
- class Object
4
-
5
- def while_logging_to( dir, fname, &block )
6
- if logdir = BuildTool::Application::instance.log_directory
7
- dirname = "#{logdir}/#{dir}"
8
- FileUtils.mkdir_p( dirname )
9
- with_warnings_suppressed do
10
- $log.add( FileOutputter.new( fname, :filename => "#{dirname}/#{fname}", :level => DEBUG ) )
11
- Outputter[fname].formatter = BuildTool::CmdFormatter.new
12
- end
13
- end
14
-
15
- begin
16
- yield
17
- rescue Exception => e
18
- $log.info("More information in #{dirname}/#{fname}")
19
- raise e
20
- ensure
21
- if logdir
22
- with_warnings_suppressed do
23
- $log.remove( fname )
24
- end
25
- end
26
- end
27
- end
28
-
29
- end
30
-
31
- module BuildTool
32
-
33
- class PlainFormatter < Log4r::Formatter
34
- def format(event)
35
- sprintf("%s\n", event.data)
36
- end
37
- end
38
-
39
- class CmdFormatter < Log4r::Formatter
40
- def format(event)
41
- if event.level != CMDOUT
42
- sprintf("%*s %s> %s\n", MaxLevelLength, LNAMES[event.level],
43
- event.name, event.data)
44
- else
45
- sprintf("%s\n", event.data)
46
- end
47
- end
48
- end
49
- end
@@ -1,58 +0,0 @@
1
- require 'kde-build/configuration.rb'
2
-
3
- require 'yaml'
4
- require 'singleton'
5
-
6
- module BuildTool
7
-
8
- class MakeConfiguration
9
-
10
- include Singleton
11
-
12
- include MJ::Configuration::Configurable
13
-
14
- option( "executable", "Full path for to the executable" ).
15
- required
16
- option( "options", "TODO" )
17
- option( "cxxflags", "TODO" )
18
-
19
- def initialize
20
- self.executable = "make"
21
- end
22
-
23
- end
24
-
25
-
26
- class Make
27
-
28
- include MJ::Tools::SubProcess
29
-
30
- def make( command, wd = build_directory )
31
- self.class.execute "#{executable} #{cxxflags} #{options} #{command}", wd
32
- end
33
-
34
- def options
35
- MakeConfiguration.instance.options
36
- end
37
-
38
- def cxxflags
39
- MakeConfiguration.instance.cxxflags
40
- end
41
-
42
- def executable
43
- MakeConfiguration.instance.executable
44
- end
45
- end
46
-
47
-
48
- YAML.add_domain_type(
49
- "michael-jansen.biz,2009", "MakeConfiguration" ) {
50
- |type, val|
51
- mc = MakeConfiguration.instance
52
- MJ::Configuration::flatten_values val do
53
- |k, v|
54
- mc.set( k, v )
55
- end
56
- }
57
-
58
- end
@@ -1,47 +0,0 @@
1
- require 'kde-build/subprocess'
2
-
3
- module MJ; module Tools
4
-
5
- class SSH
6
-
7
- include MJ::Tools::SubProcess
8
-
9
- def add_key( key_file )
10
- ssh_add( "#{key_file}" )
11
- end
12
-
13
- def has_key?( key )
14
- found = false
15
- ssh_add '-l' do
16
- |line|
17
- if line.index(key) == 0
18
- return found = true
19
- end
20
- end
21
- return found
22
- end
23
-
24
- def remove_key( key_file )
25
- ssh_add( "-d #{key_file}" )
26
- end
27
-
28
- def remove_all_keys
29
- ssh_add( "-D" )
30
- end
31
-
32
- def list_keys
33
- ssh_add( "-l" )
34
- end
35
-
36
- def ssh_add( command, &block )
37
- if block_given?
38
- self.class.execute "ssh-add #{command}", &block
39
- else
40
- self.class.execute "ssh-add #{command}"
41
- end
42
- end
43
-
44
- end
45
-
46
- end; end
47
-
@@ -1,28 +0,0 @@
1
- require 'kde-build/vcs/git'
2
- require 'kde-build/vcs/git-svn'
3
- require 'kde-build/vcs/svn'
4
-
5
- module BuildTool; module VCS
6
-
7
- @mapping = {
8
- 'git-svn' => GitSVN,
9
- 'git' => Git,
10
- 'svn' => SVN
11
- }
12
-
13
- module_function
14
-
15
- def available
16
- @mapping.keys
17
- end
18
-
19
- class UnknownVcsError < Exception; end
20
-
21
- def get( name )
22
- if !available.include? name
23
- raise VcsError, "VCS '#{name}' is not supported"
24
- end
25
- @mapping[name]
26
- end
27
-
28
- end; end
@@ -1,85 +0,0 @@
1
- require 'kde-build/configuration'
2
- require 'kde-build/subprocess'
3
-
4
- require 'fileutils'
5
-
6
- module BuildTool; module VCS
7
-
8
- class BuildToolError < Exception; end
9
-
10
-
11
- class BaseConfiguration
12
-
13
- include MJ::Configuration::Configurable
14
-
15
- option( 'name', "Name" )
16
-
17
- end
18
-
19
-
20
- # Base class for all version control system implementations.
21
- #
22
- # This class is abstract. Most method just raise NotImplementedError
23
- # exceptions.
24
- class Base
25
-
26
- include MJ::Tools::SubProcess
27
-
28
- attr_accessor :repository, :path
29
- attr_accessor :configuration
30
-
31
-
32
- # Creates a new vcs module. Stores +repository+ and +path+
33
- def initialize( repository, path = nil)
34
- @repository = repository
35
- @path = path
36
- end
37
-
38
- def info
39
- puts "Version Control: #{name}"
40
- end
41
-
42
- # Check if the local checkout exists.
43
- #
44
- # This method only checks it the local checkout path exists and is
45
- # a directory
46
- def checkedout?
47
- return ( File.exist?( self.path ) and File.directory?( path ) )
48
- end
49
-
50
- # Fetch the changes from the remote repository without changing
51
- # code locally
52
- #
53
- # raises NotImplementedError
54
- def fetch
55
- raise NotImplementedError, "Base::fetch in #{self.class}"
56
- end
57
-
58
- # Initialize the local checkout
59
- #
60
- # raises NotImplementedError
61
- def init
62
- raise NotImplementedError, "Base::init in #{self.class}"
63
- end
64
-
65
- # Return the name for this version control system
66
- #
67
- # raises NotImplementedError
68
- def name
69
- raise NotImplementedError, "Base::name in #{self.class}"
70
- end
71
-
72
- # Rebase the local branch with the remote changes
73
- #
74
- # raises NotImplementedError
75
- def rebase
76
- raise NotImplementedError, "Base::rebase in #{self.class}"
77
- end
78
-
79
- def self.config
80
- raise NotImplementedError, "Base::config in #{self}"
81
- end
82
-
83
- end
84
-
85
- end; end