autobuild 1.6.2.b12 → 1.6.2.rc1

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.
@@ -203,7 +203,7 @@ module Autobuild
203
203
  end
204
204
  end
205
205
 
206
- status = merge_status(package, remote_commit)
206
+ status = merge_status(remote_commit)
207
207
  `git diff --quiet`
208
208
  if $?.exitstatus != 0
209
209
  status.uncommitted_code = true
@@ -279,16 +279,7 @@ module Autobuild
279
279
  end
280
280
  end
281
281
 
282
- # Computes the update status to update a branch whose tip is at
283
- # reference_commit (which can be a symbolic reference) using the
284
- # fetch_commit commit
285
- #
286
- # I.e. this compute what happens if one would do
287
- #
288
- # git checkout reference_commit
289
- # git merge fetch_commit
290
- #
291
- def merge_status(package, fetch_commit, reference_commit = "HEAD")
282
+ def merge_status(fetch_commit, reference_commit = "HEAD")
292
283
  common_commit = `git merge-base #{reference_commit} #{fetch_commit}`.chomp
293
284
  if $?.exitstatus != 0
294
285
  raise PackageException.new(package, 'import'), "failed to find the merge-base between #{reference_commit} and #{fetch_commit}. Are you sure these commits exist ?"
@@ -323,12 +314,12 @@ module Autobuild
323
314
  # If we are tracking a commit/tag, just check it out and return
324
315
  if commit || tag
325
316
  target_commit = (commit || tag)
326
- status_to_head = merge_status(package, target_commit, "HEAD")
317
+ status_to_head = merge_status(target_commit, "HEAD")
327
318
  if status_to_head.status == Status::UP_TO_DATE
328
319
  # Check if by any chance we could switch back to a
329
320
  # proper branch instead of having a detached HEAD
330
321
  if detached_head?
331
- status_to_remote = merge_status(package, target_commit, fetch_commit)
322
+ status_to_remote = merge_status(target_commit, fetch_commit)
332
323
  if status_to_remote.status != Status::UP_TO_DATE
333
324
  package.message " the package is on a detached HEAD because of commit pinning"
334
325
  return
@@ -340,11 +331,11 @@ module Autobuild
340
331
  raise PackageException.new(package, 'import'), "checking out the specified commit #{target_commit} would be a non-simple operation (i.e. the current state of the repository is not a linear relationship with the specified commit), do it manually"
341
332
  end
342
333
 
343
- status_to_remote = merge_status(package, target_commit, fetch_commit)
334
+ status_to_remote = merge_status(target_commit, fetch_commit)
344
335
  if status_to_remote.status != Status::UP_TO_DATE
345
336
  # Try very hard to avoid creating a detached HEAD
346
337
  if local_branch
347
- status_to_branch = merge_status(package, target_commit, local_branch)
338
+ status_to_branch = merge_status(target_commit, local_branch)
348
339
  if status_to_branch.status == Status::UP_TO_DATE # Checkout the branch
349
340
  package.message " checking out specific commit %s for %s. It will checkout branch %s." % [target_commit.to_s, package.name, local_branch]
350
341
  Subprocess.run(package, :import, Autobuild.tool('git'), 'checkout', local_branch)
@@ -373,7 +364,7 @@ module Autobuild
373
364
  end
374
365
  end
375
366
 
376
- status = merge_status(package, fetch_commit)
367
+ status = merge_status(fetch_commit)
377
368
  if status.needs_update?
378
369
  if !merge? && status.status == Status::NEEDS_MERGE
379
370
  raise PackageException.new(package, 'import'), "the local branch '#{local_branch}' and the remote branch #{branch} of #{package.name} have diverged, and I therefore refuse to update automatically. Go into #{package.srcdir} and either reset the local branch or merge the remote changes"
@@ -404,7 +395,7 @@ module Autobuild
404
395
 
405
396
  # If we are tracking a commit/tag, just check it out
406
397
  if commit || tag
407
- status = merge_status(package, commit || tag)
398
+ status = merge_status(commit || tag)
408
399
  if status.status != Status::UP_TO_DATE
409
400
  package.message " checking out specific commit for %s. This will create a detached HEAD." % [package.name]
410
401
  Subprocess.run(package, :import, Autobuild.tool('git'), 'checkout', commit || tag)
@@ -101,7 +101,7 @@ module Autobuild
101
101
  # false.
102
102
  def updated?; !!@updated end
103
103
 
104
- def initialize(spec = Hash.new)
104
+ def initialize(spec)
105
105
  @dependencies = Array.new
106
106
  @provides = Array.new
107
107
  @parallel_build_level = nil
@@ -374,31 +374,27 @@ module Autobuild
374
374
  # In general, specific package types define a meaningful #with_doc
375
375
  # method which calls this method internally.
376
376
  def doc_task
377
- @doc_task = task "#{name}-doc" do
378
- # This flag allows to disable documentation generation
379
- # once doc_task has been called
380
- if generates_doc?
381
- @installed_doc = false
382
- catch(:doc_disabled) do
383
- begin
384
- yield if block_given?
385
-
386
- unless @installed_doc
387
- install_doc
388
- end
377
+ task "#{name}-doc" do
378
+ @installed_doc = false
379
+ catch(:doc_disabled) do
380
+ begin
381
+ yield if block_given?
382
+
383
+ unless @installed_doc
384
+ install_doc
385
+ end
389
386
 
390
- rescue Interrupt
387
+ rescue Interrupt
388
+ raise
389
+ rescue ::Exception => e
390
+ if Autobuild.doc_errors
391
391
  raise
392
- rescue ::Exception => e
393
- if Autobuild.doc_errors
394
- raise
392
+ else
393
+ warn "%s: failed to generate documentation"
394
+ if e.kind_of?(SubcommandFailed)
395
+ warn "%s: see #{e.logfile} for more details"
395
396
  else
396
- warn "%s: failed to generate documentation"
397
- if e.kind_of?(SubcommandFailed)
398
- warn "%s: see #{e.logfile} for more details"
399
- else
400
- warn "%s: #{e.message}"
401
- end
397
+ warn "%s: #{e.message}"
402
398
  end
403
399
  end
404
400
  end
@@ -408,30 +404,6 @@ module Autobuild
408
404
  task :doc => "#{name}-doc"
409
405
  end
410
406
 
411
- # True if some documentation will be generated and false otherwise.
412
- #
413
- # This will return true only if a documentation task has been defined by
414
- # calling #doc_task _and_ #disable_doc has not been called (or if
415
- # #enable_doc has been called after the last call to #disable_doc).
416
- def generates_doc?
417
- if @doc_disabled
418
- return false
419
- else
420
- return !!@doc_task
421
- end
422
- end
423
-
424
- # Re-enables documentation generation after #disable_doc has been called
425
- def enable_doc
426
- @doc_disabled = false
427
- end
428
-
429
- # Disables any documentation generation, regardless of whether doc_task
430
- # has been called or not.
431
- def disable_doc
432
- @doc_disabled = true
433
- end
434
-
435
407
  def install_doc
436
408
  if !File.directory?(self.doc_dir)
437
409
  raise "#{self.doc_dir} was expected to be a directory, but it is not. Check the package's documentation generation, the generated documentation should be in #{self.doc_dir}"
@@ -129,6 +129,7 @@ module Autobuild::Subprocess
129
129
 
130
130
  CONTROL_COMMAND_NOT_FOUND = 1
131
131
  CONTROL_UNEXPECTED = 2
132
+ CONTROL_INTERRUPT = 3
132
133
  def self.run(target, phase, *command)
133
134
  STDOUT.sync = true
134
135
 
@@ -208,11 +209,12 @@ module Autobuild::Subprocess
208
209
  cwrite.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC)
209
210
 
210
211
  pid = fork do
211
- if options[:working_directory] && (options[:working_directory] != Dir.pwd)
212
- Dir.chdir(options[:working_directory])
213
- end
214
- logfile.puts "in directory #{Dir.pwd}"
215
212
  begin
213
+ if options[:working_directory] && (options[:working_directory] != Dir.pwd)
214
+ Dir.chdir(options[:working_directory])
215
+ end
216
+ logfile.puts "in directory #{Dir.pwd}"
217
+
216
218
  cwrite.sync = true
217
219
  if Autobuild.nice
218
220
  Process.setpriority(Process::PRIO_PROCESS, 0, Autobuild.nice)
@@ -235,10 +237,13 @@ module Autobuild::Subprocess
235
237
  exec(*command)
236
238
  rescue Errno::ENOENT
237
239
  cwrite.write([CONTROL_COMMAND_NOT_FOUND].pack('I'))
238
- raise
240
+ exit(100)
241
+ rescue Interrupt
242
+ cwrite.write([CONTROL_INTERRUPT].pack('I'))
243
+ exit(100)
239
244
  rescue ::Exception
240
245
  cwrite.write([CONTROL_UNEXPECTED].pack('I'))
241
- raise
246
+ exit(100)
242
247
  end
243
248
  end
244
249
 
@@ -265,6 +270,8 @@ module Autobuild::Subprocess
265
270
  value = value.unpack('I').first
266
271
  if value == CONTROL_COMMAND_NOT_FOUND
267
272
  raise Failed.new, "command '#{command.first}' not found"
273
+ elsif value == CONTROL_INTERRUPT
274
+ raise Interrupt, "command '#{command.first}': interrupted by user"
268
275
  else
269
276
  raise Failed.new, "something unexpected happened"
270
277
  end
@@ -1,5 +1,5 @@
1
1
  module Autobuild
2
- VERSION = "1.6.2.b12" unless defined? Autobuild::VERSION
2
+ VERSION = "1.6.2.rc1" unless defined? Autobuild::VERSION
3
3
  end
4
4
 
5
5
 
@@ -3,12 +3,10 @@ $LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__))
3
3
  require 'test/unit'
4
4
  require 'tools'
5
5
 
6
- require 'autobuild/config'
7
- require 'autobuild/subcommand'
6
+ require 'autobuild'
8
7
  require 'tmpdir'
9
8
  require 'fileutils'
10
-
11
- include Autobuild
9
+ require 'flexmock/test_unit'
12
10
 
13
11
  class TC_Subcommand < Test::Unit::TestCase
14
12
  EXAMPLE_1 = <<EOF
@@ -31,29 +29,25 @@ EOF
31
29
  @source2 = File.join(tmpdir, 'source2')
32
30
  File.open(source1, 'w+') { |f| f.write(EXAMPLE_1) }
33
31
  File.open(source2, 'w+') { |f| f.write(EXAMPLE_2) }
32
+
33
+ super
34
34
  end
35
35
 
36
36
  def teardown
37
+ super
37
38
  TestTools.clean
38
39
  end
39
40
 
40
- def test_logfiles
41
- assert_raise(SubcommandFailed) { || Subprocess.run('test', 'copy', 'cat', 'bla') }
42
-
43
- Subprocess.run('test', 'simple', 'cat', nil, '', source1)
44
- result_content = File.readlines(File.join(tmpdir, 'test-simple.log'))[1..-1].join
45
- assert_equal(EXAMPLE_1, result_content)
46
-
47
- Subprocess.run('test', 'use-lt', 'cat', "<#{source1}")
48
- result_content = File.readlines(File.join(tmpdir, 'test-use-lt.log'))[1..-1].join
49
- assert_equal(EXAMPLE_1, result_content)
50
-
51
- Subprocess.run('test', 'use-both', 'cat', source1, '-', "<#{source2}")
52
- result = File.open( File.join(tmpdir, 'test-use-both.log') ) do |f|
53
- f.readlines
54
- end
55
- result = result[1..-1].join
56
- assert_equal(EXAMPLE_1 + EXAMPLE_2, result)
41
+ def test_behaviour_on_unexpected_error
42
+ flexmock(Autobuild::Subprocess).should_receive(:exec).and_raise(::Exception)
43
+ assert_raises(Autobuild::SubcommandFailed) { Autobuild::Subprocess.run('test', 'test', 'does_not_exist') }
44
+ end
45
+ def test_behaviour_on_inexistent_command
46
+ assert_raises(Autobuild::SubcommandFailed) { Autobuild::Subprocess.run('test', 'test', 'does_not_exist') }
47
+ end
48
+ def test_behaviour_on_interrupt
49
+ flexmock(Autobuild::Subprocess).should_receive(:exec).and_raise(Interrupt)
50
+ assert_raises(Interrupt) { Autobuild::Subprocess.run('test', 'test', 'does_not_exist') }
57
51
  end
58
52
  end
59
53
 
metadata CHANGED
@@ -1,97 +1,73 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: autobuild
3
- version: !ruby/object:Gem::Version
4
- hash: 4225852661
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.6.2.rc1
5
5
  prerelease: 6
6
- segments:
7
- - 1
8
- - 6
9
- - 2
10
- - b
11
- - 12
12
- version: 1.6.2.b12
13
6
  platform: ruby
14
- authors:
7
+ authors:
15
8
  - Sylvain Joyeux
16
9
  autorequire:
17
10
  bindir: bin
18
11
  cert_chain: []
19
-
20
- date: 2012-10-15 00:00:00 Z
21
- dependencies:
22
- - !ruby/object:Gem::Dependency
12
+ date: 2012-10-17 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
23
15
  name: rake
24
- prerelease: false
25
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &17308940 !ruby/object:Gem::Requirement
26
17
  none: false
27
- requirements:
28
- - - ">="
29
- - !ruby/object:Gem::Version
30
- hash: 3
31
- segments:
32
- - 0
33
- - 7
34
- - 0
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
35
21
  version: 0.7.0
36
22
  type: :runtime
37
- version_requirements: *id001
38
- - !ruby/object:Gem::Dependency
39
- name: utilrb
40
23
  prerelease: false
41
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: *17308940
25
+ - !ruby/object:Gem::Dependency
26
+ name: utilrb
27
+ requirement: &17308360 !ruby/object:Gem::Requirement
42
28
  none: false
43
- requirements:
44
- - - ">="
45
- - !ruby/object:Gem::Version
46
- hash: 29
47
- segments:
48
- - 1
49
- - 3
50
- - 3
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
51
32
  version: 1.3.3
52
33
  type: :runtime
53
- version_requirements: *id002
54
- - !ruby/object:Gem::Dependency
55
- name: rdoc
56
34
  prerelease: false
57
- requirement: &id003 !ruby/object:Gem::Requirement
35
+ version_requirements: *17308360
36
+ - !ruby/object:Gem::Dependency
37
+ name: rdoc
38
+ requirement: &17306940 !ruby/object:Gem::Requirement
58
39
  none: false
59
- requirements:
40
+ requirements:
60
41
  - - ~>
61
- - !ruby/object:Gem::Version
62
- hash: 19
63
- segments:
64
- - 3
65
- - 10
66
- version: "3.10"
42
+ - !ruby/object:Gem::Version
43
+ version: '3.10'
67
44
  type: :development
68
- version_requirements: *id003
69
- - !ruby/object:Gem::Dependency
70
- name: hoe
71
45
  prerelease: false
72
- requirement: &id004 !ruby/object:Gem::Requirement
46
+ version_requirements: *17306940
47
+ - !ruby/object:Gem::Dependency
48
+ name: hoe
49
+ requirement: &17321240 !ruby/object:Gem::Requirement
73
50
  none: false
74
- requirements:
51
+ requirements:
75
52
  - - ~>
76
- - !ruby/object:Gem::Version
77
- hash: 5
78
- segments:
79
- - 3
80
- - 1
81
- version: "3.1"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.1'
82
55
  type: :development
83
- version_requirements: *id004
84
- description: Collection of classes to handle build systems (CMake, autotools, ...) and import mechanisms (tarballs, CVS, SVN, git, ...). It also offers a Rake integration to import and build such software packages. It is the backbone of the autoproj (http://rock-robotics.org/autoproj) integrated software project management tool.
56
+ prerelease: false
57
+ version_requirements: *17321240
58
+ description: Collection of classes to handle build systems (CMake, autotools, ...)
59
+ and import mechanisms (tarballs, CVS, SVN, git, ...). It also offers a Rake integration
60
+ to import and build such software packages. It is the backbone of the autoproj (http://rock-robotics.org/autoproj)
61
+ integrated software project management tool.
85
62
  email: rock-dev@dfki.de
86
- executables:
63
+ executables:
87
64
  - autobuild
88
65
  extensions: []
89
-
90
- extra_rdoc_files:
66
+ extra_rdoc_files:
91
67
  - Changes.txt
92
68
  - Manifest.txt
93
69
  - README.txt
94
- files:
70
+ files:
95
71
  - Changes.txt
96
72
  - Manifest.txt
97
73
  - README.txt
@@ -134,47 +110,35 @@ files:
134
110
  - test/test_import_tar.rb
135
111
  - test/test_subcommand.rb
136
112
  - test/tools.rb
137
- - test/test_package.rb
138
113
  - .gemtest
139
114
  homepage: http://rock-robotics.org/stable/documentation/autoproj
140
115
  licenses: []
141
-
142
116
  post_install_message:
143
- rdoc_options:
117
+ rdoc_options:
144
118
  - --main
145
119
  - README.txt
146
- require_paths:
120
+ require_paths:
147
121
  - lib
148
- required_ruby_version: !ruby/object:Gem::Requirement
122
+ required_ruby_version: !ruby/object:Gem::Requirement
149
123
  none: false
150
- requirements:
151
- - - ">="
152
- - !ruby/object:Gem::Version
153
- hash: 3
154
- segments:
155
- - 0
156
- version: "0"
157
- required_rubygems_version: !ruby/object:Gem::Requirement
124
+ requirements:
125
+ - - ! '>='
126
+ - !ruby/object:Gem::Version
127
+ version: '0'
128
+ required_rubygems_version: !ruby/object:Gem::Requirement
158
129
  none: false
159
- requirements:
160
- - - ">"
161
- - !ruby/object:Gem::Version
162
- hash: 25
163
- segments:
164
- - 1
165
- - 3
166
- - 1
130
+ requirements:
131
+ - - ! '>'
132
+ - !ruby/object:Gem::Version
167
133
  version: 1.3.1
168
134
  requirements: []
169
-
170
135
  rubyforge_project: autobuild
171
- rubygems_version: 1.8.24
136
+ rubygems_version: 1.8.11
172
137
  signing_key:
173
138
  specification_version: 3
174
139
  summary: Library to handle build systems and import mechanisms
175
- test_files:
140
+ test_files:
141
+ - test/test_import_cvs.rb
142
+ - test/test_subcommand.rb
176
143
  - test/test_import_svn.rb
177
144
  - test/test_import_tar.rb
178
- - test/test_subcommand.rb
179
- - test/test_package.rb
180
- - test/test_import_cvs.rb
@@ -1,21 +0,0 @@
1
- $LOAD_PATH.unshift File.expand_path('..', File.dirname(__FILE__))
2
- $LOAD_PATH << File.expand_path('../lib', File.dirname(__FILE__))
3
- require 'test/unit'
4
- require 'test/tools'
5
- require 'autobuild'
6
-
7
- class TC_Package < Test::Unit::TestCase
8
- include Autobuild
9
-
10
- def test_generates_doc_p
11
- pkg = Autobuild::Package.new
12
- assert !pkg.generates_doc?
13
- pkg.doc_task
14
- assert pkg.generates_doc?
15
- pkg.disable_doc
16
- assert !pkg.generates_doc?
17
- pkg.enable_doc
18
- assert pkg.generates_doc?
19
- end
20
- end
21
-