autobuild 1.6.2.rc2 → 1.6.2.rc3

Sign up to get free protection for your applications and to get access to all the features.
@@ -203,7 +203,7 @@ module Autobuild
203
203
  end
204
204
  end
205
205
 
206
- status = merge_status(remote_commit)
206
+ status = merge_status(package, remote_commit)
207
207
  `git diff --quiet`
208
208
  if $?.exitstatus != 0
209
209
  status.uncommitted_code = true
@@ -279,7 +279,16 @@ module Autobuild
279
279
  end
280
280
  end
281
281
 
282
- def merge_status(fetch_commit, reference_commit = "HEAD")
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")
283
292
  common_commit = `git merge-base #{reference_commit} #{fetch_commit}`.chomp
284
293
  if $?.exitstatus != 0
285
294
  raise PackageException.new(package, 'import'), "failed to find the merge-base between #{reference_commit} and #{fetch_commit}. Are you sure these commits exist ?"
@@ -314,12 +323,12 @@ module Autobuild
314
323
  # If we are tracking a commit/tag, just check it out and return
315
324
  if commit || tag
316
325
  target_commit = (commit || tag)
317
- status_to_head = merge_status(target_commit, "HEAD")
326
+ status_to_head = merge_status(package, target_commit, "HEAD")
318
327
  if status_to_head.status == Status::UP_TO_DATE
319
328
  # Check if by any chance we could switch back to a
320
329
  # proper branch instead of having a detached HEAD
321
330
  if detached_head?
322
- status_to_remote = merge_status(target_commit, fetch_commit)
331
+ status_to_remote = merge_status(package, target_commit, fetch_commit)
323
332
  if status_to_remote.status != Status::UP_TO_DATE
324
333
  package.message " the package is on a detached HEAD because of commit pinning"
325
334
  return
@@ -331,11 +340,11 @@ module Autobuild
331
340
  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"
332
341
  end
333
342
 
334
- status_to_remote = merge_status(target_commit, fetch_commit)
343
+ status_to_remote = merge_status(package, target_commit, fetch_commit)
335
344
  if status_to_remote.status != Status::UP_TO_DATE
336
345
  # Try very hard to avoid creating a detached HEAD
337
346
  if local_branch
338
- status_to_branch = merge_status(target_commit, local_branch)
347
+ status_to_branch = merge_status(package, target_commit, local_branch)
339
348
  if status_to_branch.status == Status::UP_TO_DATE # Checkout the branch
340
349
  package.message " checking out specific commit %s for %s. It will checkout branch %s." % [target_commit.to_s, package.name, local_branch]
341
350
  Subprocess.run(package, :import, Autobuild.tool('git'), 'checkout', local_branch)
@@ -364,7 +373,7 @@ module Autobuild
364
373
  end
365
374
  end
366
375
 
367
- status = merge_status(fetch_commit)
376
+ status = merge_status(package, fetch_commit)
368
377
  if status.needs_update?
369
378
  if !merge? && status.status == Status::NEEDS_MERGE
370
379
  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"
@@ -395,7 +404,7 @@ module Autobuild
395
404
 
396
405
  # If we are tracking a commit/tag, just check it out
397
406
  if commit || tag
398
- status = merge_status(commit || tag)
407
+ status = merge_status(package, commit || tag)
399
408
  if status.status != Status::UP_TO_DATE
400
409
  package.message " checking out specific commit for %s. This will create a detached HEAD." % [package.name]
401
410
  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)
104
+ def initialize(spec = Hash.new)
105
105
  @dependencies = Array.new
106
106
  @provides = Array.new
107
107
  @parallel_build_level = nil
@@ -374,27 +374,31 @@ 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
- 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
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
386
389
 
387
- rescue Interrupt
388
- raise
389
- rescue ::Exception => e
390
- if Autobuild.doc_errors
390
+ rescue Interrupt
391
391
  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"
392
+ rescue ::Exception => e
393
+ if Autobuild.doc_errors
394
+ raise
396
395
  else
397
- warn "%s: #{e.message}"
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
398
402
  end
399
403
  end
400
404
  end
@@ -404,6 +408,30 @@ module Autobuild
404
408
  task :doc => "#{name}-doc"
405
409
  end
406
410
 
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
+
407
435
  def install_doc
408
436
  if !File.directory?(self.doc_dir)
409
437
  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}"
@@ -1,5 +1,5 @@
1
1
  module Autobuild
2
- VERSION = "1.6.2.rc2" unless defined? Autobuild::VERSION
2
+ VERSION = "1.6.2.rc3" unless defined? Autobuild::VERSION
3
3
  end
4
4
 
5
5
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: autobuild
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.2.rc2
4
+ version: 1.6.2.rc3
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-17 00:00:00.000000000 Z
12
+ date: 2012-10-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
16
- requirement: &18924760 !ruby/object:Gem::Requirement
16
+ requirement: &20141480 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 0.7.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *18924760
24
+ version_requirements: *20141480
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: utilrb
27
- requirement: &18535380 !ruby/object:Gem::Requirement
27
+ requirement: &20138420 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 1.3.3
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *18535380
35
+ version_requirements: *20138420
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rdoc
38
- requirement: &18534640 !ruby/object:Gem::Requirement
38
+ requirement: &20134680 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '3.10'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *18534640
46
+ version_requirements: *20134680
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: hoe
49
- requirement: &18533880 !ruby/object:Gem::Requirement
49
+ requirement: &19452900 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: '3.1'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *18533880
57
+ version_requirements: *19452900
58
58
  description: Collection of classes to handle build systems (CMake, autotools, ...)
59
59
  and import mechanisms (tarballs, CVS, SVN, git, ...). It also offers a Rake integration
60
60
  to import and build such software packages. It is the backbone of the autoproj (http://rock-robotics.org/autoproj)