build-tool 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. data.tar.gz.sig +3 -0
  2. data/History.txt +7 -0
  3. data/Manifest.txt +51 -0
  4. data/PostInstall.txt +3 -0
  5. data/README.rdoc +55 -0
  6. data/Rakefile +30 -0
  7. data/TODO +2 -0
  8. data/bin/kde-build.rb +21 -0
  9. data/config/website.yml +2 -0
  10. data/config/website.yml.sample +2 -0
  11. data/lib/kde-build.rb +18 -0
  12. data/lib/kde-build/application.rb +258 -0
  13. data/lib/kde-build/build_system.rb +26 -0
  14. data/lib/kde-build/build_system/autoconf.rb +109 -0
  15. data/lib/kde-build/build_system/base.rb +132 -0
  16. data/lib/kde-build/build_system/cmake.rb +82 -0
  17. data/lib/kde-build/build_system/qtcopy.rb +125 -0
  18. data/lib/kde-build/command.rb +30 -0
  19. data/lib/kde-build/command/build.rb +119 -0
  20. data/lib/kde-build/command/fetch.rb +28 -0
  21. data/lib/kde-build/command/help.rb +71 -0
  22. data/lib/kde-build/command/info.rb +42 -0
  23. data/lib/kde-build/command/version.rb +43 -0
  24. data/lib/kde-build/configuration.rb +186 -0
  25. data/lib/kde-build/exception.rb +6 -0
  26. data/lib/kde-build/metaaid.rb +18 -0
  27. data/lib/kde-build/module.rb +203 -0
  28. data/lib/kde-build/module_configuration.rb +107 -0
  29. data/lib/kde-build/moduleregistry.rb +85 -0
  30. data/lib/kde-build/subprocess.rb +82 -0
  31. data/lib/kde-build/tools/ctags.rb +34 -0
  32. data/lib/kde-build/tools/logging.rb +49 -0
  33. data/lib/kde-build/tools/make.rb +58 -0
  34. data/lib/kde-build/tools/ssh.rb +47 -0
  35. data/lib/kde-build/vcs.rb +26 -0
  36. data/lib/kde-build/vcs/base.rb +81 -0
  37. data/lib/kde-build/vcs/git-svn.rb +133 -0
  38. data/lib/kde-build/vcs/git.rb +96 -0
  39. data/lib/kde-build/vcs/svn.rb +105 -0
  40. data/script/console +10 -0
  41. data/script/destroy +14 -0
  42. data/script/generate +14 -0
  43. data/script/txt2html +71 -0
  44. data/test.yaml.tmpl +552 -0
  45. data/test/test_helper.rb +12 -0
  46. data/test/test_kde-build.rb +11 -0
  47. data/test/test_vcs_svn.rb +44 -0
  48. data/website/index.html +84 -0
  49. data/website/index.txt +59 -0
  50. data/website/javascripts/rounded_corners_lite.inc.js +285 -0
  51. data/website/stylesheets/screen.css +159 -0
  52. data/website/template.html.erb +50 -0
  53. metadata +171 -0
  54. metadata.gz.sig +0 -0
data.tar.gz.sig ADDED
@@ -0,0 +1,3 @@
1
+ �����6Zs��Hb�����|�Ş!�
2
+ ���K������.�C|4`.����=�$s�H�w�
3
+ F�|���\���a6���0@\�2}�+��G��BᅄM�Tu* �g5�$����;-]|��%����vY�M���O�'��2��iy�� �#�+�9�ӗ-��� �}�&�#}<`ն���ʗC~�n`̔(7�D±��`Sx, ��V�e��ޥ���6"s� ���x2�|�? QF�.ĉ}N#E]�Q��
data/History.txt ADDED
@@ -0,0 +1,7 @@
1
+ == 0.0.1 2009-06-04
2
+
3
+ * 1 major enhancement:
4
+ * Initial release (test)
5
+ * The only currently supported command is build. It's possible to compile a
6
+ complete kde session using it with nearly no manual intervention. If your
7
+ system has the deveopment requirements met for kde.
data/Manifest.txt ADDED
@@ -0,0 +1,51 @@
1
+ History.txt
2
+ Manifest.txt
3
+ PostInstall.txt
4
+ README.rdoc
5
+ Rakefile
6
+ TODO
7
+ bin/kde-build.rb
8
+ config/website.yml
9
+ config/website.yml.sample
10
+ lib/kde-build.rb
11
+ lib/kde-build/application.rb
12
+ lib/kde-build/build_system.rb
13
+ lib/kde-build/build_system/autoconf.rb
14
+ lib/kde-build/build_system/base.rb
15
+ lib/kde-build/build_system/cmake.rb
16
+ lib/kde-build/build_system/qtcopy.rb
17
+ lib/kde-build/command.rb
18
+ lib/kde-build/command/build.rb
19
+ lib/kde-build/command/fetch.rb
20
+ lib/kde-build/command/help.rb
21
+ lib/kde-build/command/info.rb
22
+ lib/kde-build/command/version.rb
23
+ lib/kde-build/configuration.rb
24
+ lib/kde-build/exception.rb
25
+ lib/kde-build/metaaid.rb
26
+ lib/kde-build/module.rb
27
+ lib/kde-build/module_configuration.rb
28
+ lib/kde-build/moduleregistry.rb
29
+ lib/kde-build/subprocess.rb
30
+ lib/kde-build/tools/ctags.rb
31
+ lib/kde-build/tools/logging.rb
32
+ lib/kde-build/tools/make.rb
33
+ lib/kde-build/tools/ssh.rb
34
+ lib/kde-build/vcs.rb
35
+ lib/kde-build/vcs/base.rb
36
+ lib/kde-build/vcs/git-svn.rb
37
+ lib/kde-build/vcs/git.rb
38
+ lib/kde-build/vcs/svn.rb
39
+ script/console
40
+ script/destroy
41
+ script/generate
42
+ script/txt2html
43
+ test.yaml.tmpl
44
+ test/test_helper.rb
45
+ test/test_kde-build.rb
46
+ test/test_vcs_svn.rb
47
+ website/index.html
48
+ website/index.txt
49
+ website/javascripts/rounded_corners_lite.inc.js
50
+ website/stylesheets/screen.css
51
+ website/template.html.erb
data/PostInstall.txt ADDED
@@ -0,0 +1,3 @@
1
+
2
+ For more information on build-tool, see http://build-tool.rubyforge.org
3
+
data/README.rdoc ADDED
@@ -0,0 +1,55 @@
1
+ = kde-build
2
+
3
+ * http://build-tool.rubyforge.org/git?p=build-tool.git;a=tree
4
+
5
+ == DESCRIPTION:
6
+
7
+ A ruby based alternative to kdesvn-build.
8
+
9
+ == FEATURES/PROBLEMS:
10
+
11
+ * *WARNING* Very young and immature program
12
+
13
+ == SYNOPSIS:
14
+
15
+ kde-build build :qt kdesupport/ :default
16
+
17
+ This will build
18
+ 1. The package _qt_ as configured in the config file.
19
+ 2. All modules named _kdesupport_/... in the order specified in the config file.
20
+ 3. The package _default_ as configured in the config file.
21
+
22
+ If you haven't changed the default configuration you should end up with a
23
+ usable kde session.
24
+
25
+ == REQUIREMENTS:
26
+
27
+ Packages
28
+ - ruby
29
+ - rubygems
30
+
31
+ Gems
32
+ - cmdparse
33
+ - log4r
34
+
35
+ == INSTALL:
36
+
37
+ Currently not supported
38
+
39
+ == LICENSE:
40
+
41
+ Copyright (C) 2009 Michael Jansen <kde@michael-jansen.biz>
42
+
43
+ This library is free software; you can redistribute it and/or
44
+ modify it under the terms of the GNU General Public
45
+ License version 2 or later as published by the Free Software Foundation.
46
+
47
+ This library is distributed in the hope that it will be useful,
48
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
49
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
50
+ Library General Public License for more details.
51
+
52
+ You should have received a copy of the GNU Library General Public License
53
+ along with this library; see the file COPYING.LIB. If not, write to
54
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
55
+ Boston, MA 02110-1301, USA.
data/Rakefile ADDED
@@ -0,0 +1,30 @@
1
+ require 'rubygems' unless ENV['NO_RUBYGEMS']
2
+ %w[rake rake/clean fileutils newgem rubigen].each { |f| require f }
3
+ require File.dirname(__FILE__) + '/lib/kde-build'
4
+
5
+ # Generate all the Rake tasks
6
+ # Run 'rake -T' to see list of generated tasks (from gem root directory)
7
+ $hoe = Hoe.new('build-tool', KdeBuild::VERSION) do |p|
8
+ p.developer( 'Michael Jansen', 'kde@michael-jansen.biz' )
9
+ p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
10
+ p.post_install_message = 'PostInstall.txt'
11
+ p.rubyforge_name = p.name
12
+ p.extra_deps = [
13
+ ['cmdparse','>= 2.0.2'],
14
+ ['log4r','>= 1.0.5'],
15
+ ]
16
+ p.extra_dev_deps = [
17
+ ['newgem', ">= #{::Newgem::VERSION}"]
18
+ ]
19
+
20
+ p.clean_globs |= %w[**/.DS_Store tmp *.log]
21
+ path = (p.rubyforge_name == p.name) ? p.rubyforge_name : "\#{p.rubyforge_name}/\#{p.name}"
22
+ p.remote_rdoc_dir = File.join(path.gsub(/^#{p.rubyforge_name}\/?/,''), 'rdoc')
23
+ p.rsync_args = '-av --delete --ignore-errors'
24
+ end
25
+
26
+ require 'newgem/tasks' # load /tasks/*.rake
27
+ Dir['tasks/**/*.rake'].each { |t| load t }
28
+
29
+ # TODO - want other tests/tasks run by default? Add them to the list
30
+ # task :default => [:spec, :features]
data/TODO ADDED
@@ -0,0 +1,2 @@
1
+ TODOS:
2
+ - Use a default target
data/bin/kde-build.rb ADDED
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env ruby
2
+ # -*- coding:utf-8 -*-
3
+
4
+ require 'rubygems'
5
+
6
+ require File.dirname(__FILE__) + '/../lib/kde-build'
7
+
8
+ require 'kde-build/application'
9
+
10
+ app = BuildTool::Application.instance
11
+
12
+ # Set the root directory. Its where we find the config template
13
+ app.root_directory= Pathname.new( File.dirname(__FILE__) ).join( '..' ).cleanpath
14
+
15
+ # Read the configuration file. The configuration file to load depends on the
16
+ # scriptname used to invoke us. This makes it possible to have more than one
17
+ # configuration using symlinks
18
+ if app.read_configuration( "#{Pathname.new($0).basename}.yaml" )
19
+ app.main(ARGV)
20
+ end
21
+
@@ -0,0 +1,2 @@
1
+ host: mjansen@rubyforge.org
2
+ remote_dir: /var/www/gforge-projects/build-tool
@@ -0,0 +1,2 @@
1
+ host: mjansen@rubyforge.org
2
+ remote_dir: /var/www/gforge-projects/build-tool
data/lib/kde-build.rb ADDED
@@ -0,0 +1,18 @@
1
+ $:.unshift(File.dirname(__FILE__)) unless
2
+ $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
3
+
4
+ module KdeBuild
5
+ VERSION = '0.0.1'
6
+ end
7
+
8
+ module Kernel
9
+ # Suppresses warnings within a given block.
10
+ def with_warnings_suppressed
11
+ saved_verbosity = $-v
12
+ $-v = nil
13
+ yield
14
+ ensure
15
+ $-v = saved_verbosity
16
+ end
17
+ end
18
+
@@ -0,0 +1,258 @@
1
+ # encoding: utf-8
2
+ #
3
+ require 'kde-build/vcs/git-svn'
4
+ require 'kde-build/command/build'
5
+ require 'kde-build/command/help'
6
+ require 'kde-build/command/info'
7
+ require 'kde-build/command/version'
8
+
9
+ require 'kde-build/configuration'
10
+
11
+ require 'kde-build/tools/ctags.rb'
12
+ require 'kde-build/tools/logging.rb'
13
+
14
+ require 'kde-build/moduleregistry'
15
+ require 'kde-build/module_configuration'
16
+
17
+ require 'cmdparse'
18
+ require 'erb'
19
+ require 'singleton'
20
+ require 'yaml'
21
+ require 'fileutils'
22
+
23
+ # log4r produces nasty warnings
24
+ # (eval):1: warning: redefine off?
25
+ # (eval):2: warning: redefine debug
26
+ # (eval):2: warning: redefine info
27
+ with_warnings_suppressed do
28
+ require 'log4r'
29
+ include Log4r
30
+ Log4r.define_levels('DEBUG','CMDOUT', 'CMD', 'INFO', 'WARN', 'ERROR', 'FATAL')
31
+ $log = Logger.new('default')
32
+ $log.outputters = StdoutOutputter.new( "log_stdout", :level => INFO )
33
+ Outputter["log_stdout"].formatter = BuildTool::PlainFormatter.new
34
+ end
35
+
36
+ module BuildTool
37
+
38
+
39
+ class Application
40
+
41
+ include Singleton
42
+
43
+ include MJ::Configuration::Configurable
44
+
45
+ # This is where the script is installed.
46
+ attr_accessor :root_directory
47
+
48
+ option( "workdir", "Working directory" ).
49
+ required.on_write{
50
+ |val|
51
+ File.expand_path( val )
52
+ }
53
+
54
+ def initialize
55
+ $noop = false
56
+ $verbose = false
57
+ with_warnings_suppressed do
58
+ @outputter = Outputter["log_stdout"]
59
+ end
60
+
61
+ @command = CmdParse::CommandParser.new(
62
+ false, # handle exceptions
63
+ true # Allow partial command matching
64
+ )
65
+ @command.program_name = "kde4svn-build"
66
+ @command.program_version = [ 0, 1, 1 ]
67
+ @command.options = CmdParse::OptionParserWrapper.new do |opt|
68
+ opt.separator "Global Options"
69
+ opt.on( "--verbose", "Verbose output" ) { |t|
70
+ $verbose = true
71
+ with_warnings_suppressed do
72
+ @outputter.level = DEBUG
73
+ end
74
+ }
75
+ opt.on( "--dry-run", "Verbose output" ) { |t|
76
+ $noop = true
77
+ }
78
+ end
79
+
80
+ YAML.add_domain_type(
81
+ "michael-jansen.biz,2009", "ApplicationConfiguration" ) {
82
+ |type, val|
83
+ mc = Application::instance
84
+ MJ::Configuration::flatten_values val do
85
+ |k, v|
86
+ mc.set( k, v )
87
+ end
88
+ mc
89
+ }
90
+
91
+ @command.add_command( BuildCommand.new, true )
92
+ @command.add_command( InfoCommand.new, true )
93
+
94
+ @command.add_command( HelpCommand.new )
95
+ @command.add_command( VersionCommand.new )
96
+
97
+ end
98
+
99
+ # Read the configuration file. If we can't find a configuration file
100
+ # provide a template file
101
+ def read_configuration( name )
102
+
103
+ configdir = Pathname.new("~").expand_path.join('.build_tool')
104
+ # Make sure out configuration directory exists
105
+ if !configdir.exist?
106
+ # Create it
107
+ FileUtils.mkdir_p( configdir )
108
+ else
109
+ # It's there. Make sure it's a directory
110
+ if !configdir.directory?
111
+ puts "Failed to create configuration directory #{configdir}. There is a file with this name!"
112
+ return false
113
+ end
114
+ end
115
+
116
+ # Check if the configuration file exists
117
+ configfile = configdir.join( name )
118
+ if !configfile.exist?
119
+ # Copy our template file (if we find it)
120
+ templatefile = root_directory.join( 'test.yaml.tmpl' )
121
+ if !templatefile.exist?
122
+ $log.error( "Could not find our template file at #{templatefile}!" )
123
+ return false
124
+ end
125
+ FileUtils.copy( templatefile, configfile )
126
+ $log.info( "I copied a template configuration file to '#{configfile}'. Please review it and adapt it to your needs." )
127
+ return false
128
+ end
129
+
130
+ # The config file exists. Go on and read it
131
+ config_string = File.read(configfile)
132
+ config = ERB.new( config_string )
133
+ @configuration = YAML.load( config.result )
134
+ return true
135
+
136
+ end
137
+
138
+ def cli
139
+ require 'readline'
140
+ require 'shellwords'
141
+
142
+ Readline.completion_proc = method(:completion)
143
+ Readline.completer_word_break_characters = "\x00"
144
+
145
+ begin
146
+
147
+ while line = Readline.readline('> ', true)
148
+
149
+ return nil if line.nil?
150
+
151
+ # Remove duplicate or empty lines from history
152
+ if line =~ /^\s*$/ or Readline::HISTORY.to_a[-2] == line
153
+ Readline::HISTORY.pop
154
+ end
155
+
156
+ # Split the line like bash would do it
157
+ execute Shellwords.shellwords( line )
158
+
159
+ end
160
+
161
+ rescue Interrupt => e
162
+ exit
163
+
164
+ end
165
+ end
166
+
167
+
168
+ def completion( string )
169
+ args = Shellwords.shellwords(string)
170
+
171
+ # Check if we are able to resolve to a command
172
+ cmd = @command.main_command.commands[args[0]]
173
+
174
+ if cmd
175
+ # We are still on the first shellword
176
+ if args.length == 1 and args[0] != cmd.name
177
+ return [ cmd.name ]
178
+ else
179
+ return cmd.complete args[1..-1]
180
+ end
181
+ else
182
+ # No command. Try to give some possible expansions
183
+ args[0] = "" if args[0] === nil
184
+ cmds = []
185
+ @command.main_command.commands.each do |name, cmd|
186
+ if name.start_with? args[0]
187
+ cmds.push cmd.name
188
+ end
189
+ end
190
+ cmds
191
+ end
192
+ end
193
+
194
+
195
+ def execute(args)
196
+ begin
197
+
198
+ @command.parse( args )
199
+
200
+ rescue CmdParse::InvalidCommandError => e
201
+ puts e.message
202
+ @command.main_command.commands.sort.each do |name, cmd|
203
+ print name.ljust( 15 ) + cmd.short_desc.to_s
204
+ print " (=default command)" if name == cmd.default_command
205
+ print "\n"
206
+ end
207
+
208
+ rescue CmdParse::InvalidOptionError => e
209
+ puts e.message
210
+ cmd = @command.main_command.commands[args[0]]
211
+ cmd.show_help
212
+
213
+ rescue Exception => e
214
+ puts e.message
215
+ puts e.backtrace if $verbose
216
+ end
217
+ end
218
+
219
+ def log_directory
220
+ @log_directory
221
+ end
222
+
223
+ def initialize_logging
224
+ # Ensure the base log directory exists
225
+ if !File.exist? "#{workdir}/log"
226
+ FileUtils.mkdir_p "#{workdir}/log"
227
+ end
228
+
229
+ i = -1
230
+
231
+ begin
232
+ @log_directory = "#{workdir}/log/#{Date.today.to_s}-%02d" % i+=1
233
+ end until !File.exist?( @log_directory )
234
+
235
+ FileUtils.mkdir_p( @log_directory )
236
+
237
+ with_warnings_suppressed do
238
+ $log.add( FileOutputter.new(
239
+ "status",
240
+ :filename => "#{@log_directory}/build-status",
241
+ :level => INFO ) )
242
+ end
243
+ end
244
+
245
+
246
+ def main(args)
247
+ if args.length > 0
248
+ initialize_logging
249
+ execute(args)
250
+ else
251
+ cli
252
+ end
253
+ end
254
+
255
+
256
+ end
257
+
258
+ end