build-tool 0.6.0.rc2 → 0.6.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.
@@ -33,6 +33,7 @@
33
33
  will be done automatically on first run.
34
34
  - 'configuration list' Will show the configuration values.
35
35
  - 'configuration edit' will edit them.
36
+ - Support for the bazar vcs.
36
37
 
37
38
 
38
39
  - Enhancements
@@ -6,16 +6,16 @@
6
6
 
7
7
  This project is inspired by kdesrc-build[http://kdesrc-build.kde.org/].
8
8
 
9
- It help in building and maintaining a development environment. It downloads
9
+ It helps in building and maintaining a development environment. It downloads
10
10
  and configures sources and updates them later.
11
11
 
12
12
  == FEATURES/PROBLEMS:
13
13
 
14
14
  The tool uses recipes to build software from scratch. It does
15
- - Check out the sources from the repository (git, git-svn, svn).
15
+ - Check out the sources from the repository (git, git-svn, svn, mercurial, bazar, archive).
16
16
  - Update the sources.
17
17
  - Set the build environment.
18
- - Configure (qt, cmake, custom)
18
+ - Configure (qt, cmake, autoconf, custom)
19
19
  - Build
20
20
  - Install
21
21
 
@@ -37,10 +37,10 @@ Currently the following recipes are provided:
37
37
  > build-tool recipe install kde
38
38
  ...
39
39
  # Adapt the configuration
40
- > vim ~/.build-tool/kde.yaml
40
+ > kde-build configuration edit
41
41
 
42
42
  # Build kdesupport/ modules and the base kde workspace
43
- kde-build build kdesupport/ KDE/
43
+ > kde-build build -u kdesupport/ KDE/
44
44
 
45
45
  == Documentation
46
46
 
@@ -54,5 +54,5 @@ http://michael-jansen.biz/build-tool
54
54
 
55
55
  (The GPL LICENSE)
56
56
 
57
- Copyright (c) 2009-2011 Michael Jansen
57
+ Copyright (c) 2009-2012 Michael Jansen
58
58
 
data/build-tool.gemspec CHANGED
@@ -25,7 +25,7 @@ Gem::Specification.new do |s|
25
25
 
26
26
  # Documentation
27
27
  s.rubyforge_project = 'build-tool'
28
- s.extra_rdoc_files = [ 'README.txt' ]
28
+ s.extra_rdoc_files = [ 'README.rdoc' ]
29
29
 
30
30
  # Dependencies
31
31
  s.add_dependency( 'logging', '>= 1.6.0' ) # Logging Support
@@ -144,7 +144,8 @@ def open_database( name )
144
144
  logger.debug "Opening the database #{path}."
145
145
  ActiveRecord::Base.establish_connection(
146
146
  :adapter => 'sqlite3',
147
- :database => path.to_s )
147
+ :database => path.to_s,
148
+ :timeout => 5000 )
148
149
  ActiveRecord::Migrator.migrate(
149
150
  [ application_root.join( 'db/migrations' ) ] )
150
151
  end
@@ -92,6 +92,23 @@ rule
92
92
  :ARCHIVE {STRINGERROR} { [:GARBAGE, text]; }
93
93
  :ARCHIVE . { [:GARBAGE, text]; }
94
94
 
95
+ #
96
+ ### BAZAR
97
+ #
98
+ :BAZAR {INHERITANCE} { [:INHERITANCE, text] }
99
+ :BAZAR url\b { [:URL, text]; }
100
+ :BAZAR push\b { [:PUSH, text]; }
101
+ :BAZAR ssh-key\b { @states.push @state; @state = :SSH_KEY; [:SSH_KEY, text]; }
102
+ :BAZAR end\b { @state = @states.pop; [ :END, text ]; }
103
+ # COMMON
104
+ :BAZAR {STRING} { [:STRING, @ss[1]]; }
105
+ :BAZAR {TOKEN} { [:TOKEN, text]; }
106
+ :BAZAR {COMMENT} { [:COMMENT, text]; }
107
+ :BAZAR {BLANK} { [:IGNORE, text]; }
108
+ :BAZAR {LF} { [:IGNORE, text]; }
109
+ :BAZAR {STRINGERROR} { [:GARBAGE, text]; }
110
+ :BAZAR . { [:GARBAGE, text]; }
111
+
95
112
  #
96
113
  ### BUILD SYSTEM
97
114
  #
@@ -358,6 +375,7 @@ rule
358
375
  #
359
376
  ### VCS
360
377
  #
378
+ :VCS bazar\b { @state = :BAZAR; [:BAZAR, text]; }
361
379
  :VCS git-svn\b { @state = :GIT_SVN; [:GIT_SVN, text]; }
362
380
  :VCS git\b { @state = :GIT; [:GIT, text]; }
363
381
  :VCS svn\b { @state = :SVN; [:SVN, text]; }
@@ -72,6 +72,9 @@ def initialize(values = nil, *args )
72
72
  MercurialTrack
73
73
  MercurialUrl
74
74
 
75
+ BazarDeclaration
76
+ BazarUrl
77
+
75
78
  ModuleBuildPrefix
76
79
  ModuleDeclaration
77
80
  ModuleInstallPrefix
@@ -3,6 +3,7 @@ class BuildTool::Cfg::Parser < BuildTool::Cfg::Lexer
3
3
  token APPEND
4
4
  token APPLY
5
5
  token ARCHIVE
6
+ token BAZAR
6
7
  token BUILD_PREFIX
7
8
  token BUILD_SYSTEM
8
9
  token DESCRIPTION
@@ -119,6 +120,7 @@ rule
119
120
 
120
121
  vcs_declaration
121
122
  : git_declaration { result = val[0]; }
123
+ | bazar_declaration { result = val[0]; }
122
124
  | svn_declaration { result = val[0]; }
123
125
  | git_svn_declaration { result = val[0]; }
124
126
  | archive_declaration { result = val[0]; }
@@ -205,6 +207,23 @@ rule
205
207
  | SHORT DESCRIPTION STRING { result = ShortDescriptionNode.new( val[2] ); }
206
208
  ;
207
209
 
210
+ #
211
+ ### BAZAR CONFIGURATION
212
+ #
213
+ bazar_declaration
214
+ : VCS BAZAR bazar_statements END { result = BazarDeclarationNode.new( val[2] ); }
215
+ | VCS BAZAR inheritance bazar_statements END { result = BazarDeclarationNode.new( val[3] ); result.options[:inheritance] = true; }
216
+ ;
217
+
218
+ bazar_statements
219
+ : /* empty */
220
+ | bazar_statement bazar_statements { result = val.flatten; }
221
+ ;
222
+
223
+ bazar_statement
224
+ : URL STRING { result = BazarUrlNode.new( val[1..-1] ); }
225
+ ;
226
+
208
227
  #
209
228
  ### GIT OPTION DECLARATION
210
229
  #
@@ -486,6 +486,26 @@ def visit_IncludeNode( node )
486
486
  end
487
487
  end
488
488
 
489
+ class BazarDeclarationNodeVisitor < ListVisitor
490
+
491
+ def initialize( configuration, vcs )
492
+ super( configuration )
493
+ @vcs = vcs
494
+ end
495
+
496
+ def visit_BazarDeclarationNode( node )
497
+ visit_nodes( node.values )
498
+ @vcs
499
+ end
500
+
501
+ def visit_BazarUrlNode( node )
502
+ @vcs.url = node.values[0]
503
+ end
504
+
505
+ end
506
+
507
+
508
+
489
509
  class MercurialDeclarationNodeVisitor < ListVisitor
490
510
 
491
511
  def initialize( configuration, vcs )
@@ -585,6 +605,24 @@ def visit_GitDeclarationNode( node )
585
605
  node.accept( visitor )
586
606
  end
587
607
 
608
+ def visit_BazarDeclarationNode( node )
609
+ vcs = BuildTool::VCS::BazarConfiguration.new
610
+ if node.options[:inheritance]
611
+ if not @module.vcs_configuration
612
+ raise ConfigurationError,
613
+ "#{@module.name} has no previous bazar configuration!"
614
+ end
615
+ if @module.vcs_configuration.name != "bazar"
616
+ raise ConfigurationError,
617
+ "#{@module.name} has a #{@module.vcs_configuration.name} configuration!"
618
+ end
619
+ vcs.parent = @module.vcs_configuration
620
+ end
621
+ @module.vcs_configuration = vcs
622
+ visitor = BazarDeclarationNodeVisitor.new( configuration, vcs )
623
+ node.accept( visitor )
624
+ end
625
+
588
626
  def visit_GitSvnDeclarationNode( node )
589
627
  vcs = BuildTool::VCS::GitSvnConfiguration.new
590
628
  if node.options[:inheritance]
@@ -117,8 +117,9 @@ def execute()
117
117
 
118
118
  class Fetch < Base
119
119
 
120
- def initialize( command, mod )
120
+ def initialize( command, mod, verbose )
121
121
  super( command, 20, :fetch, mod )
122
+ @verbose = verbose
122
123
  if !mod.vcs_required.fetching_supported?
123
124
  logger.info "Fetching/Rebase not supported by vcs #{mod.vcs.name}. Doing it in one step."
124
125
  end
@@ -126,7 +127,7 @@ def initialize( command, mod )
126
127
 
127
128
  def execute()
128
129
  logger.info "Fetching remote changes."
129
- @module.fetch
130
+ @module.fetch( @verbose )
130
131
  end
131
132
 
132
133
  end
@@ -669,8 +669,8 @@ def configure( mod )
669
669
  # Call the #fetch method of the module.
670
670
  #
671
671
  # @param [Object] mod The module to use
672
- def fetch( mod )
673
- ModuleActions::Fetch.new( self, mod ).do
672
+ def fetch( mod, verbose = false )
673
+ ModuleActions::Fetch.new( self, mod, verbose ).do
674
674
  end
675
675
 
676
676
  # Call the #install method of the module.
@@ -56,9 +56,9 @@ def initialize_options
56
56
  @from_scratch = true
57
57
  }
58
58
 
59
- @verbose_rebase = true
60
- options.on( nil, "--[no]-verbose-rebase", "Show the changes applied by rebase." ) { |t|
61
- @verbose_rebase = false
59
+ @verbose_rebase = false
60
+ options.on( nil, "--[no-]verbose-rebase", "Show the changes applied by rebase." ) { |t|
61
+ @verbose_rebase = t
62
62
  }
63
63
 
64
64
  super
@@ -100,7 +100,7 @@ def do_execute_module( mod )
100
100
  # fetch/rebase
101
101
  if @update
102
102
  if mod.checkedout?
103
- fetch( mod )
103
+ fetch( mod, @verbose_rebase )
104
104
  rebase( mod, @verbose_rebase )
105
105
  else
106
106
  clone( mod )
@@ -60,6 +60,8 @@ def do_execute_module( mod )
60
60
  case mod.vcs_configuration.name
61
61
  when 'svn'
62
62
  info( " Repository: %s/%s" % [ mod.vcs_configuration.repository.url, mod.vcs_configuration.remote_path ] )
63
+ when 'bazar'
64
+ info( " Branch: %s" % [ mod.vcs_configuration.url ] )
63
65
  when 'archive'
64
66
  info( " URL: %s" % [ mod.vcs.archive_url ] )
65
67
  when 'git'
@@ -7,6 +7,7 @@
7
7
  require 'build-tool/vcs/svn'
8
8
  require 'build-tool/vcs/archive'
9
9
  require 'build-tool/vcs/mercurial'
10
+ require 'build-tool/vcs/bazar'
10
11
 
11
12
  require 'build-tool/model/module'
12
13
  require 'build-tool/model/feature'
@@ -146,6 +147,8 @@ def vcs( name )
146
147
  return BuildTool::VCS::ArchiveConfiguration.new
147
148
  when "mercurial"
148
149
  return BuildTool::VCS::MercurialConfiguration.new
150
+ when "bazar"
151
+ return BuildTool::VCS::BazarConfiguration.new
149
152
  else
150
153
  raise StandardError, "Unknown Version Control System #{name}"
151
154
  end
@@ -302,15 +305,9 @@ def complete_modules( name, include_templates = false, all = false, resume_from
302
305
  next if !( mod.active? || all )
303
306
  take_module = true
304
307
  elsif mod.name == name or mod.name.end_with?( "/#{name}" )
305
- # if a module is specified by name we add it regardless of its enabled /
306
- # disabled state. But only if the associated features is enabled.
307
- if ( mod.active? ) or ( !mod.active? && ( mod.feature.nil? || mod.feature.active? ) )
308
- found = true
309
- should_be_unique = true
310
- take_module = true
311
- else
312
- raise BuildTool::ConfigurationError, "Can't select module %s from inactive feature %s" % [ mod.name, mod.feature.name ]
313
- end
308
+ found = true
309
+ should_be_unique = true
310
+ take_module = true
314
311
  elsif name == '*'
315
312
  found = true
316
313
  # Now check if it is active.
@@ -336,8 +333,19 @@ def complete_modules( name, include_templates = false, all = false, resume_from
336
333
  end
337
334
 
338
335
  # Raise an error if the result should be unique but is not.
339
- if should_be_unique and res.size > 1
340
- raise BuildTool::ConfigurationError, "#{name} is ambiguous (#{res.map { |m| m.name }.join( ', ' ) })."
336
+ if should_be_unique
337
+
338
+ if res.size > 1
339
+ raise BuildTool::ConfigurationError, "#{name} is ambiguous (#{res.map { |m| m.name }.join( ', ' ) })."
340
+ end
341
+
342
+ mod = res[0]
343
+
344
+ # If the module is inactive make sure the feature is active
345
+ if not ( mod.active? || mod.feature.nil? || mod.feature.active? )
346
+ raise BuildTool::ConfigurationError, "Can't select module %s from inactive feature %s" % [ mod.name, mod.feature.name ]
347
+ end
348
+
341
349
  end
342
350
 
343
351
  # Give a warning if all modules where
@@ -355,8 +355,8 @@ def clone
355
355
 
356
356
  # Fetch changes from the remote repository. Do not change the local
357
357
  # checkout.
358
- def fetch
359
- vcs_required.fetch
358
+ def fetch( verbose = false )
359
+ vcs_required.fetch( verbose = verbose )
360
360
  end
361
361
 
362
362
  # Update the local changes with remote changes. Do not fetch changes
@@ -110,7 +110,7 @@ def clone
110
110
  0
111
111
  end
112
112
 
113
- def fetch()
113
+ def fetch( verbose = false )
114
114
  # Check if the archive is already downloaded
115
115
  if File.exist? archive_local_path
116
116
  logger.trace "Archive already fetched. Skipping."
@@ -0,0 +1,150 @@
1
+ # -*- coding: UTF-8 -*-
2
+
3
+ require 'mj/mixins/inherited_attributes'
4
+ require 'build-tool/vcs/base'
5
+ require 'build-tool/errors'
6
+
7
+ module BuildTool; module VCS
8
+
9
+ class BazarError < BuildTool::Error; end
10
+
11
+ class BazarConfiguration < BaseConfiguration
12
+
13
+ include MJ::Mixins::InheritedAttributes
14
+
15
+ def name
16
+ "bazar"
17
+ end
18
+
19
+ def initialize
20
+ super
21
+ @url = nil
22
+ end
23
+
24
+ def vcs( mod )
25
+ raise StandardError if @module and ! mod.equal?( @module )
26
+ @module = mod
27
+ Bazar.new( self )
28
+ end
29
+
30
+ inherited_attr_accessor :url
31
+
32
+ def copy_configuration( other )
33
+ super
34
+ end
35
+ end
36
+
37
+ #
38
+ # Implementation for the bzr version control system.
39
+ #
40
+ class Bazar < Base
41
+
42
+ def initialize( config )
43
+ super( config )
44
+ @vcs = nil
45
+ end
46
+
47
+ #
48
+ ### ATTRIBUTES
49
+ #
50
+ def name
51
+ "bazar"
52
+ end
53
+
54
+ def fetching_supported?
55
+ false
56
+ end
57
+
58
+ #
59
+ ### METHODS
60
+ #
61
+
62
+ def checkedout?
63
+ return false if !local_path_exist?
64
+ if !Pathname.new( local_path ).join( ".bzr" ).exist?
65
+ raise Base::VcsError, "Checkout path #{local_path} is not a bazar repo!"
66
+ end
67
+ return true
68
+ end
69
+
70
+ # Initialize the local repository
71
+ def clone
72
+ # Check if path exists
73
+ if local_path_exist?
74
+ raise BazarError, "Failed to create repository at '#{local_path}': Path exists"
75
+ end
76
+ FileUtils.mkdir_p Pathname.new( local_path ).dirname if ! $noop
77
+
78
+ # Initialize the repository
79
+ if bzr( "branch #{config.url} #{local_path}", Pathname.new( local_path ).dirname) != 0
80
+ raise BazarError, "Error while initializing the repo `bzr branch #{config.url} #{local_path}'`: #{$?}"
81
+ end
82
+ end
83
+
84
+ # Is the git executable available?
85
+ def self.bzr_available?()
86
+ return @bzr_available unless @bzr_available.nil?
87
+ %x( bzr --version 2>&1 )
88
+ @bzr_available = $?.success?
89
+ return @bzr_available
90
+ end
91
+
92
+ def ready_for_fetch
93
+ if not self.class.bzr_available?
94
+ logger.error( "#{config.module.name}: Calling `bzr` failed!" )
95
+ return false
96
+ end
97
+
98
+ if checkedout?
99
+ # Check if the index is dirty.
100
+ if bzr( "diff" ) != 0
101
+ logger.info( "#{config.module.name}: Local changes will prevent the update." )
102
+ bzr( "status --short --versioned" ) do |line|
103
+ logger.info line.chomp
104
+ end
105
+ return false
106
+ end
107
+ end
108
+
109
+ return true
110
+ end
111
+
112
+ # Fetch from +repository+
113
+ #
114
+ # Initializes the local clone if it does not exist.
115
+ def fetch( verbose = false )
116
+
117
+ if !checkedout? and !$noop
118
+ clone
119
+ end
120
+
121
+ if verbose
122
+ cmd = "update -v"
123
+ else
124
+ cmd = "update"
125
+ end
126
+
127
+ rc = bzr( cmd ) do |line|
128
+ logger.info( line )
129
+ end
130
+
131
+ if rc != 0
132
+ raise BazarError, "Error while update: #{rc}"
133
+ end
134
+ end
135
+
136
+ # Execute +command+ in directory +wd+ and yield every line of output.
137
+ def bzr( command, wd = local_path, &block )
138
+ rc = self.class.execute "bzr #{command}", wd, &block
139
+ end
140
+
141
+ def rebase( verbose = false )
142
+ # Rebasing is not supported
143
+ 0
144
+ end
145
+
146
+ end # class Bazar
147
+
148
+ end; end # module BuildTool::VCS
149
+
150
+
@@ -121,7 +121,7 @@ def clone
121
121
  raise GitSvnError, "Error while initializing the repo `git svn init '#{config.repository}/#{remote_path}'`: #{$?}"
122
122
  end
123
123
 
124
- fetch( "HEAD" )
124
+ fetch( revision: "HEAD" )
125
125
  end
126
126
 
127
127
  def configure
@@ -131,21 +131,26 @@ def configure
131
131
  # Fetch from +repository+
132
132
  #
133
133
  # Initializes the local clone if it does not exist.
134
- def fetch( revision = nil )
134
+ def fetch( verbose = false, options = {} )
135
+ revision = options[:revision] || nil
136
+
135
137
  if !checkedout? and !$noop # Beware of looping
136
138
  clone
137
139
  else
138
140
  # clone() calls those methods.
139
141
  git.check_config
140
142
  end
143
+
141
144
  if revision
142
145
  cmd = "fetch -r#{revision}"
143
146
  else
144
147
  cmd = "fetch"
145
148
  end
149
+
146
150
  if ( rc = git_svn( cmd ) ) != 0
147
151
  raise GitSvnError, "Error while fetching: #{rc}"
148
152
  end
153
+
149
154
  update_externals
150
155
  end
151
156
 
@@ -175,7 +180,7 @@ def rebase( verbose = false )
175
180
  remote_branch = "#{config.track_branch}"
176
181
 
177
182
  if verbose
178
- git.git('log --first-parent HEAD..%s' % remote_branch ) do |line|
183
+ git.git('log --first-parent --pretty=oneline HEAD..%s' % remote_branch ) do |line|
179
184
  logger.info( line )
180
185
  end
181
186
  end
@@ -300,7 +300,7 @@ def gc
300
300
  # Fetch from +repository+
301
301
  #
302
302
  # Initializes the local clone if it does not exist.
303
- def fetch()
303
+ def fetch( verbose = false )
304
304
  if !checkedout? and !$noop
305
305
  clone
306
306
  else
@@ -439,7 +439,7 @@ def rebase( verbose = false )
439
439
  remote_branch = "#{config.track_remote}/#{config.track_branch}"
440
440
 
441
441
  if verbose
442
- git('log --first-parent HEAD..%s' % remote_branch ) do |line|
442
+ git('log --first-parent --pretty=oneline HEAD..%s' % remote_branch ) do |line|
443
443
  logger.info( line )
444
444
  end
445
445
  end
@@ -95,7 +95,7 @@ def clone
95
95
  # Fetch from +repository+
96
96
  #
97
97
  # Initializes the local clone if it does not exist.
98
- def fetch()
98
+ def fetch( verbose = false )
99
99
  if !checkedout? and !$noop
100
100
  clone
101
101
  end
@@ -66,7 +66,7 @@ class << self
66
66
  svn_available = nil
67
67
 
68
68
  # Is the git executable available?
69
- def svn_available
69
+ def svn_available?
70
70
  return @svn_available unless @svn_available.nil?
71
71
  %x( svn --version 2>&1 )
72
72
  @svn_available = $?.success?
@@ -120,21 +120,31 @@ def clone
120
120
  else
121
121
  svn "checkout --depth=infinity #{repository.url}/#{remote_path} #{local_path}", local_path.dirname
122
122
  end
123
+ return true
123
124
  end
124
125
 
125
126
  def ready_for_fetch
126
- if not Svn.svn_available
127
+ if not Svn.svn_available?
127
128
  logger.info( "#{config.module.name}: Calling `svn` failed!" )
129
+ return false
128
130
  end
129
- return Svn.svn_available
131
+ return true
130
132
  end
131
133
 
132
- def fetch()
134
+ def fetch( verbose = false )
135
+
133
136
  if !checkedout?
134
- clone
135
- else
136
- svn "update"
137
+ return clone
137
138
  end
139
+
140
+ if verbose
141
+ svn "log -r HEAD:BASE -q" do |line|
142
+ logger.info( line )
143
+ end
144
+ end
145
+
146
+ svn "update"
147
+
138
148
  return true
139
149
  end
140
150
 
@@ -181,11 +191,6 @@ def self.svn( command, wd, &block )
181
191
  end
182
192
 
183
193
  def rebase( verbose = false )
184
-
185
- if verbose
186
- logger.info( 'Verbose rebase not yet implemented for subversion.' )
187
- end
188
-
189
194
  # Rebasing is not supported
190
195
  0
191
196
  end
@@ -26,5 +26,5 @@ def recipe_version()
26
26
 
27
27
  end
28
28
 
29
- VERSION = Version.new( 0, 6, 0, 2 )
29
+ VERSION = Version.new( 0, 6, 0 )
30
30
  end
@@ -20,6 +20,17 @@ module "toplevel2_disabled"
20
20
  end
21
21
  disable module "toplevel2_disabled"
22
22
 
23
+ feature "feature2"
24
+
25
+ module "feature2/module1"
26
+ end
27
+
28
+ module "feature2/module2"
29
+ end
30
+ disable module "feature2/module2"
31
+ end
32
+ disable feature "feature2"
33
+
23
34
  feature "feature1"
24
35
 
25
36
  module "feature1/module1"
@@ -34,16 +45,6 @@ module "feature1/module3"
34
45
  disable module "feature1/module2"
35
46
  end
36
47
 
37
- feature "feature2"
38
-
39
- module "feature2/module1"
40
- end
41
-
42
- module "feature2/module2"
43
- end
44
- disable module "feature2/module2"
45
- end
46
- disable feature "feature2"
47
48
  EOF
48
49
  end
49
50
 
@@ -79,21 +80,24 @@ module "feature2/module2"
79
80
  end
80
81
 
81
82
  test 'selecting a active module from a inactive feature works not.' do
82
- assert_raises( BuildTool::ConfigurationError ) do
83
+ exc = assert_raises( BuildTool::ConfigurationError ) do
83
84
  @configuration.complete_modules( 'feature2/module1' )
84
85
  end
86
+ assert_match( /inactive feature/, exc.message )
85
87
  end
86
88
 
87
89
  test 'selecting a inactive module from a inactive feature works not.' do
88
- assert_raises( BuildTool::ConfigurationError ) do
90
+ exc = assert_raises( BuildTool::ConfigurationError ) do
89
91
  @configuration.complete_modules( 'feature2/module2' )
90
92
  end
93
+ assert_match( /inactive feature/, exc.message )
91
94
  end
92
95
 
93
96
  test 'selecting a nonexistant module works not.' do
94
- assert_raises( BuildTool::ConfigurationError ) do
97
+ exc = assert_raises( BuildTool::ConfigurationError ) do
95
98
  @configuration.complete_modules( 'nothere' )
96
99
  end
100
+ assert_match( /Unknown module/, exc.message )
97
101
  end
98
102
 
99
103
  test 'selecting a group works.' do
@@ -119,11 +123,26 @@ module "feature2/module2"
119
123
  [ 'feature1/module2', 'feature1/module3' ],
120
124
  @configuration.complete_modules( 'feature1/', false, true, @configuration.complete_module( 'feature1/module2' ) ).map { |m| m.name } )
121
125
  end
126
+
122
127
  test 'selecting a group works with all = true on disabled feature' do
123
128
  assert_equal(
124
129
  [ 'feature2/module1', 'feature2/module2' ],
125
130
  @configuration.complete_modules( 'feature2/', false, true ).map { |m| m.name } )
126
131
  end
132
+
133
+ test 'selecting a notexistand package works not.' do
134
+ exc = assert_raises( BuildTool::ConfigurationError ) do
135
+ @configuration.complete_modules( 'unknownpackage/' )
136
+ end
137
+ assert_match( /Unknown module/, exc.message )
138
+ end
139
+
140
+ test 'selecting a ambiguous module throws ambiguous message' do
141
+ exc = assert_raises( BuildTool::ConfigurationError ) do
142
+ @configuration.complete_modules( 'module1' )
143
+ end
144
+ assert_match( /ambiguous/, exc.message )
145
+ end
127
146
  end
128
147
 
129
148
 
@@ -0,0 +1,73 @@
1
+ require 'test_helper'
2
+
3
+ require 'build-tool/cfg/parser'
4
+
5
+ class TestParserBazar < ActiveSupport::TestCase
6
+
7
+ def setup
8
+ @configuration = BuildTool::Configuration.new()
9
+ @configuration.truncate()
10
+ @parser = BuildTool::Cfg::Parser.new( @configuration )
11
+ end
12
+
13
+ test "Parses a valid bazar repository declation." do
14
+ assert_nothing_raised() { @parser.parse_string <<-EOF }
15
+ module "oxygen-icons"
16
+ vcs bazar
17
+ url "https://bazar.url/test"
18
+ end # vcs
19
+ end # module
20
+ EOF
21
+ # Now check the parsed configuration
22
+ assert_not_nil( @configuration.module('oxygen-icons') )
23
+ assert_attributes(
24
+ @configuration.module('oxygen-icons'),
25
+ {
26
+ :vcs =>
27
+ {
28
+ :name => 'bazar',
29
+ :config =>
30
+ {
31
+ :url => 'https://bazar.url/test',
32
+ }
33
+ }
34
+
35
+ }
36
+ )
37
+ end
38
+
39
+ test "Bazar Repository inheritance works." do
40
+ assert_nothing_raised() { @parser.parse_string <<-EOF }
41
+ module "oxygen-icons"
42
+ vcs bazar
43
+ url "https://bazar.url/test"
44
+ end # vcs
45
+ end # module
46
+ module "oxygen-icons"
47
+ vcs bazar <
48
+ end
49
+ end # module
50
+ EOF
51
+ # Now check the parsed configuration
52
+ assert_not_nil( @configuration.module('oxygen-icons') )
53
+ assert_attributes(
54
+ @configuration.module('oxygen-icons'),
55
+ {
56
+ :vcs =>
57
+ {
58
+ :name => 'bazar',
59
+ :config =>
60
+ {
61
+ :url => 'https://bazar.url/test',
62
+ }
63
+ }
64
+
65
+ }
66
+ )
67
+ end
68
+
69
+ end
70
+
71
+
72
+
73
+
@@ -38,7 +38,7 @@ module "oxygen-icons"
38
38
  )
39
39
  end
40
40
 
41
- test "Git-SVN Repository inheritance works." do
41
+ test "Mercurial Repository inheritance works." do
42
42
  assert_nothing_raised() { @parser.parse_string <<-EOF }
43
43
  module "oxygen-icons"
44
44
  vcs mercurial
data/test/test_helper.rb CHANGED
@@ -15,7 +15,7 @@
15
15
  # Set up the database.
16
16
  def setup_database
17
17
  if not ActiveRecord::Base.connected?
18
- ActiveRecord::Base.establish_connection( :adapter => 'sqlite3', :database => ':memory:' )
18
+ ActiveRecord::Base.establish_connection( :adapter => 'sqlite3', :database => ':memory:', :timeout => 5000 )
19
19
  ActiveRecord::Migrator.migrate( [ 'db/migrations' ] )
20
20
  end
21
21
  end
@@ -12,12 +12,16 @@ class ConfigurationTest < ActiveSupport::TestCase
12
12
 
13
13
  test 'log_directory is not allowed to be relative' do
14
14
  c = BuildTool::Configuration.new
15
- assert_raises( BuildTool::ConfigurationError, /Log directory .* is relative/ ) do
15
+
16
+ exc = assert_raises( BuildTool::ConfigurationError ) do
16
17
  c.log_directory = 'my/relative/dir'
17
18
  end
18
- assert_raises( BuildTool::ConfigurationError, /Log directory .* is relative/ ) do
19
+ assert_match( /Log directory .* is relative/, exc.message )
20
+
21
+ exc = assert_raises( BuildTool::ConfigurationError ) do
19
22
  c.log_directory = '$SOME_SHELL_VAR/relative/dir'
20
23
  end
24
+ assert_match( /Log directory .* is relative/, exc.message )
21
25
  end
22
26
 
23
27
  test 'log_directory handles ~ and $HOME' do
@@ -14,7 +14,7 @@ class MercurialConfigurationTest < ActiveSupport::TestCase
14
14
 
15
15
  test 'accessor url() works.' do
16
16
  cfg = create_configuration
17
- assert_equal( 'some_branch', cfg.track )
17
+ assert_equal( 'some_url', cfg.url )
18
18
  end
19
19
 
20
20
  test 'accessor url() works with inheritance.' do
@@ -31,12 +31,12 @@ class MercurialConfigurationTest < ActiveSupport::TestCase
31
31
  assert_equal( 'some_url', cfg.url )
32
32
  end
33
33
 
34
- test 'accessor branch() works.' do
34
+ test 'accessor track() works.' do
35
35
  cfg = create_configuration
36
36
  assert_equal( 'some_branch', cfg.track )
37
37
  end
38
38
 
39
- test 'accessor branch() works with inheritance.' do
39
+ test 'accessor track() works with inheritance.' do
40
40
  parent = create_configuration
41
41
  cfg = BuildTool::VCS::MercurialConfiguration.new
42
42
  cfg.parent = parent
@@ -0,0 +1,44 @@
1
+ require 'test_helper'
2
+
3
+ require 'build-tool/vcs/bazar'
4
+
5
+ class BazarConfigurationTest < ActiveSupport::TestCase
6
+
7
+ test 'Constructor' do
8
+ cfg = BuildTool::VCS::BazarConfiguration.new
9
+ cfg.vcs( ModuleMock.new( 'bazar/test' ) )
10
+ assert_equal( cfg.name, 'bazar' )
11
+ assert_nil( cfg.url )
12
+ end
13
+
14
+ test 'accessor url() works.' do
15
+ cfg = create_configuration
16
+ assert_equal( 'some_url', cfg.url() )
17
+ end
18
+
19
+ test 'accessor url() works with inheritance.' do
20
+ parent = create_configuration
21
+ cfg = BuildTool::VCS::BazarConfiguration.new
22
+ cfg.parent = parent
23
+ # We get the value from the parent
24
+ assert_equal( 'some_url', cfg.url )
25
+ # Unless we have it overriden
26
+ cfg.url = 'different_url'
27
+ assert_equal( 'different_url', cfg.url )
28
+ # But we can reset it
29
+ cfg.url = nil
30
+ assert_equal( 'some_url', cfg.url )
31
+ end
32
+
33
+ #######
34
+ private
35
+ #######
36
+
37
+ def create_configuration
38
+ cfg = BuildTool::VCS::BazarConfiguration.new
39
+ cfg.url = 'some_url'
40
+ cfg
41
+ end
42
+
43
+ end
44
+
metadata CHANGED
@@ -1,19 +1,19 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: build-tool
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0.rc2
5
- prerelease: 6
4
+ version: 0.6.0
5
+ prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - Michael Jansen
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-25 00:00:00.000000000 Z
12
+ date: 2012-03-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: logging
16
- requirement: &5454660 !ruby/object:Gem::Requirement
16
+ requirement: &5456920 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 1.6.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *5454660
24
+ version_requirements: *5456920
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: activerecord
27
- requirement: &5454160 !ruby/object:Gem::Requirement
27
+ requirement: &5454940 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 3.2.1
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *5454160
35
+ version_requirements: *5454940
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: sqlite3
38
- requirement: &5453620 !ruby/object:Gem::Requirement
38
+ requirement: &5454460 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 1.3.5
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *5453620
46
+ version_requirements: *5454460
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: ansi
49
- requirement: &5453100 !ruby/object:Gem::Requirement
49
+ requirement: &5453900 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 1.4.2
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *5453100
57
+ version_requirements: *5453900
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: grit
60
- requirement: &5452240 !ruby/object:Gem::Requirement
60
+ requirement: &5453440 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: 2.4.1
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *5452240
68
+ version_requirements: *5453440
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: racc
71
- requirement: &5482440 !ruby/object:Gem::Requirement
71
+ requirement: &5452620 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: 1.4.7
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *5482440
79
+ version_requirements: *5452620
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: rexical
82
- requirement: &5481740 !ruby/object:Gem::Requirement
82
+ requirement: &5452040 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: 1.0.5
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *5481740
90
+ version_requirements: *5452040
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: rake
93
- requirement: &5481200 !ruby/object:Gem::Requirement
93
+ requirement: &5482000 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ! '>='
@@ -98,10 +98,10 @@ dependencies:
98
98
  version: 0.9.2
99
99
  type: :development
100
100
  prerelease: false
101
- version_requirements: *5481200
101
+ version_requirements: *5482000
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: yard
104
- requirement: &5480720 !ruby/object:Gem::Requirement
104
+ requirement: &5481460 !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
107
  - - ! '>='
@@ -109,10 +109,10 @@ dependencies:
109
109
  version: 0.7.5
110
110
  type: :development
111
111
  prerelease: false
112
- version_requirements: *5480720
112
+ version_requirements: *5481460
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: turn
115
- requirement: &5480260 !ruby/object:Gem::Requirement
115
+ requirement: &5480980 !ruby/object:Gem::Requirement
116
116
  none: false
117
117
  requirements:
118
118
  - - ! '>='
@@ -120,7 +120,7 @@ dependencies:
120
120
  version: '0.9'
121
121
  type: :development
122
122
  prerelease: false
123
- version_requirements: *5480260
123
+ version_requirements: *5480980
124
124
  description: ! "\n The tool helps \n\n ...\n "
125
125
  email:
126
126
  - info@michael-jansen.biz
@@ -128,7 +128,7 @@ executables:
128
128
  - build-tool
129
129
  extensions: []
130
130
  extra_rdoc_files:
131
- - README.txt
131
+ - README.rdoc
132
132
  files:
133
133
  - .gitattributes
134
134
  - .gitignore
@@ -136,9 +136,9 @@ files:
136
136
  - .yardopts
137
137
  - Gemfile
138
138
  - Gemfile.lock
139
- - History.txt
139
+ - History.rdoc
140
140
  - KNOWN_PROBLEMS
141
- - README.txt
141
+ - README.rdoc
142
142
  - Rakefile
143
143
  - bin/build-tool
144
144
  - build-tool.gemspec
@@ -216,6 +216,7 @@ files:
216
216
  - lib/build-tool/state_helper.rb
217
217
  - lib/build-tool/vcs/archive.rb
218
218
  - lib/build-tool/vcs/base.rb
219
+ - lib/build-tool/vcs/bazar.rb
219
220
  - lib/build-tool/vcs/git-svn.rb
220
221
  - lib/build-tool/vcs/git.rb
221
222
  - lib/build-tool/vcs/mercurial.rb
@@ -236,6 +237,7 @@ files:
236
237
  - tasks/test.rake
237
238
  - test/integration/configuration_test.rb
238
239
  - test/integration/history_test.rb
240
+ - test/integration/parser_bazar_test.rb
239
241
  - test/integration/parser_configuration.rb
240
242
  - test/integration/parser_environment_parser.rb
241
243
  - test/integration/parser_feature_test.rb
@@ -250,6 +252,7 @@ files:
250
252
  - test/unit/git_configuration_test.rb
251
253
  - test/unit/git_svn_configuration_test.rb
252
254
  - test/unit/mercurial_configuration_test.rb
255
+ - test/unit/model/bazar_configuration_test.rb
253
256
  - test/unit/model/command_log_test.rb
254
257
  - test/unit/model/feature_test.rb
255
258
  - test/unit/model/module_log_test.rb
@@ -278,9 +281,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
278
281
  required_rubygems_version: !ruby/object:Gem::Requirement
279
282
  none: false
280
283
  requirements:
281
- - - ! '>'
284
+ - - ! '>='
282
285
  - !ruby/object:Gem::Version
283
- version: 1.3.1
286
+ version: '0'
284
287
  requirements: []
285
288
  rubyforge_project: build-tool
286
289
  rubygems_version: 1.8.15
@@ -290,6 +293,7 @@ summary: A tool helping to download, configure and compile from sources.
290
293
  test_files:
291
294
  - test/integration/configuration_test.rb
292
295
  - test/integration/history_test.rb
296
+ - test/integration/parser_bazar_test.rb
293
297
  - test/integration/parser_configuration.rb
294
298
  - test/integration/parser_environment_parser.rb
295
299
  - test/integration/parser_feature_test.rb
@@ -304,6 +308,7 @@ test_files:
304
308
  - test/unit/git_configuration_test.rb
305
309
  - test/unit/git_svn_configuration_test.rb
306
310
  - test/unit/mercurial_configuration_test.rb
311
+ - test/unit/model/bazar_configuration_test.rb
307
312
  - test/unit/model/command_log_test.rb
308
313
  - test/unit/model/feature_test.rb
309
314
  - test/unit/model/module_log_test.rb