autobuild 1.7.3.rc2 → 1.7.3.rc3

Sign up to get free protection for your applications and to get access to all the features.
@@ -44,6 +44,18 @@ module Autobuild
44
44
  end
45
45
  end
46
46
 
47
+ # Tells the importer that the checkout should be automatically deleted
48
+ # on update, without asking the user
49
+ # @return [Boolean] true if the archive importer should automatically
50
+ # delete the current checkout when the archive changed, false
51
+ # otherwise. The default is to set it to true if the
52
+ # AUTOBUILD_ARCHIVE_AUTOUPDATE environment variable is set to 1, and
53
+ # to false in all other cases
54
+ def self.auto_update?
55
+ @auto_update
56
+ end
57
+ @auto_update = (ENV['AUTOBUILD_ARCHIVE_AUTOUPDATE'] == '1')
58
+
47
59
  def update_cached_file?; @options[:update_cached_file] end
48
60
 
49
61
 
@@ -233,20 +245,26 @@ module Autobuild
233
245
  # Check whether the archive file changed, and if that is the case
234
246
  # then ask the user about deleting the folder
235
247
  if File.file?(checkout_digest_stamp(package)) && archive_changed?(package)
236
- package.progress_done
237
- package.message "The archive #{@url.to_s} is different from the one currently checked out at #{package.srcdir}", :bold
238
- package.message " I will have to delete the current folder to go on with the update"
239
- response = HighLine.new.ask " Continue (yes or no) ? If no, this update will be ignored, which can lead to build problems.", String do |q|
240
- q.overwrite = true
241
- q.in = ['yes', 'no']
242
- q.default = 'yes'
243
- q.case = :downcase
248
+ if ArchiveImporter.auto_update?
249
+ response = 'yes'
250
+ else
251
+ package.progress_done
252
+ package.message "The archive #{@url.to_s} is different from the one currently checked out at #{package.srcdir}", :bold
253
+ package.message "I will have to delete the current folder to go on with the update"
254
+ response = HighLine.new.ask " Continue (yes or no) ? If no, this update will be ignored, which can lead to build problems.", String do |q|
255
+ q.overwrite = true
256
+ q.in = ['yes', 'no']
257
+ q.default = 'yes'
258
+ q.case = :downcase
259
+ end
244
260
  end
261
+
245
262
  if response == "no"
246
- package.message " Not updating #{package.srcdir}"
263
+ package.message "not updating #{package.srcdir}"
264
+ package.progress_done
247
265
  return
248
266
  else
249
- package.message " Deleting #{package.srcdir}"
267
+ package.message "deleting #{package.srcdir} to update to new archive"
250
268
  FileUtils.rm_rf package.srcdir
251
269
  package.progress "checking out %s"
252
270
  end
@@ -223,16 +223,22 @@ module Autobuild
223
223
  return ($?.exitstatus != 0)
224
224
  end
225
225
 
226
- # Checks if the current branch is the target branch. Expects that the
227
- # current directory is the package's directory
228
- def on_target_branch?
226
+ def current_branch
229
227
  current_branch = `git symbolic-ref HEAD -q`.chomp
230
228
  if $?.exitstatus != 0
231
- # HEAD cannot be resolved as a symbol. Assume that we are on a
229
+ # HEAD cannot be resolved as a symbol. We are probably on a
232
230
  # detached HEAD
233
- return false
231
+ return
232
+ end
233
+ return current_branch
234
+ end
235
+
236
+ # Checks if the current branch is the target branch. Expects that the
237
+ # current directory is the package's directory
238
+ def on_target_branch?
239
+ if current_branch = self.current_branch
240
+ current_branch == "refs/heads/#{local_branch}"
234
241
  end
235
- current_branch == "refs/heads/#{local_branch}"
236
242
  end
237
243
 
238
244
  class Status < Importer::Status
@@ -338,7 +338,7 @@ module Autobuild
338
338
  end
339
339
 
340
340
  def progress_done(done_message = nil)
341
- if done_message
341
+ if done_message && Autobuild.has_progress_for?(self)
342
342
  progress(process_formatting_string(done_message))
343
343
  end
344
344
  Autobuild.progress_done(self)
@@ -156,14 +156,7 @@ module Autobuild
156
156
 
157
157
  # Add the --prefix option to the configureflags array
158
158
  testflags = ["--prefix=#{prefix}"] + Array[*configureflags]
159
- old_opt = options.find do |o|
160
- if testflags.include?(o)
161
- false
162
- else
163
- name, value = o.split("=")
164
- ENV[name] != value
165
- end
166
- end
159
+ old_opt = options.find { |o| !testflags.include?(o) }
167
160
  new_opt = testflags.find { |o| !options.include?(o) }
168
161
  if old_opt || new_opt
169
162
  if Autobuild.verbose
@@ -87,6 +87,11 @@ module Autobuild
87
87
  Autobuild.message(" WARN: #{message}", :magenta, *style)
88
88
  end
89
89
 
90
+ # @return [Boolean] true if there is some progress messages for the given
91
+ # key
92
+ def self.has_progress_for?(key)
93
+ progress_messages.any? { |msg_key, _| msg_key == key }
94
+ end
90
95
 
91
96
  def self.progress_start(key, *args)
92
97
  if args.last.kind_of?(Hash)
@@ -108,7 +113,7 @@ module Autobuild
108
113
  if block_given?
109
114
  begin
110
115
  yield
111
- if options[:done_message]
116
+ if options[:done_message] && has_progress_for?(key)
112
117
  progress(key, *options[:done_message])
113
118
  end
114
119
  progress_done(key, true)
@@ -1,5 +1,5 @@
1
1
  module Autobuild
2
- VERSION = "1.7.3.rc2" unless defined? Autobuild::VERSION
2
+ VERSION = "1.7.3.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.7.3.rc2
4
+ version: 1.7.3.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: 2013-04-18 00:00:00.000000000 Z
12
+ date: 2013-04-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
16
- requirement: &16804000 !ruby/object:Gem::Requirement
16
+ requirement: &13610200 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 0.9.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *16804000
24
+ version_requirements: *13610200
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: utilrb
27
- requirement: &16803220 !ruby/object:Gem::Requirement
27
+ requirement: &13609360 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 1.6.0
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *16803220
35
+ version_requirements: *13609360
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: highline
38
- requirement: &16802320 !ruby/object:Gem::Requirement
38
+ requirement: &13608820 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,29 +43,29 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *16802320
46
+ version_requirements: *13608820
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rdoc
49
- requirement: &16801420 !ruby/object:Gem::Requirement
49
+ requirement: &13607660 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
53
53
  - !ruby/object:Gem::Version
54
- version: '3.10'
54
+ version: '4.0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *16801420
57
+ version_requirements: *13607660
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: hoe
60
- requirement: &16800600 !ruby/object:Gem::Requirement
60
+ requirement: &13606280 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
64
64
  - !ruby/object:Gem::Version
65
- version: '3.5'
65
+ version: '3.6'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *16800600
68
+ version_requirements: *13606280
69
69
  description: Collection of classes to handle build systems (CMake, autotools, ...)
70
70
  and import mechanisms (tarballs, CVS, SVN, git, ...). It also offers a Rake integration
71
71
  to import and build such software packages. It is the backbone of the autoproj (http://rock-robotics.org/autoproj)