autobuild 1.6.0.rc3 → 1.6.0.rc4

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.
@@ -44,8 +44,8 @@ module Autobuild
44
44
  @builddir = 'build'
45
45
 
46
46
  def builddir=(new)
47
- raise ConfigException, "absolute builddirs are not supported" if (Pathname.new(new).absolute?)
48
- raise ConfigException, "builddir must be non-empty" if new.empty?
47
+ raise ConfigException.new(self), "absolute builddirs are not supported" if (Pathname.new(new).absolute?)
48
+ raise ConfigException.new(self), "builddir must be non-empty" if new.empty?
49
49
  @builddir = new
50
50
  end
51
51
  # Returns the absolute builddir
@@ -109,7 +109,7 @@ module Autobuild
109
109
  # Configure the builddir directory before starting make
110
110
  def configure
111
111
  if File.exists?(builddir) && !File.directory?(builddir)
112
- raise ConfigException, "#{builddir} already exists but is not a directory"
112
+ raise ConfigException.new(self, 'configure'), "#{builddir} already exists but is not a directory"
113
113
  end
114
114
  FileUtils.mkdir_p builddir if !File.directory?(builddir)
115
115
 
@@ -15,10 +15,22 @@ module Autobuild
15
15
 
16
16
  alias :exception_message :to_s
17
17
  def to_s
18
+ dir =
19
+ if target.respond_to?(:srcdir)
20
+ "(#{target.srcdir})"
21
+ else
22
+ puts target.inspect
23
+ end
24
+ target_name =
25
+ if target.respond_to?(:name)
26
+ target.name
27
+ else target.to_str
28
+ end
29
+
18
30
  if target && phase
19
- "#{target}: failed in #{phase} phase\n #{super}"
31
+ "#{target_name}#{dir}: failed in #{phase} phase\n #{super}"
20
32
  elsif target
21
- "#{target}: #{super}"
33
+ "#{target_name}#{dir}: #{super}"
22
34
  else
23
35
  super
24
36
  end
@@ -41,7 +41,7 @@ module Autobuild
41
41
  def update(package) # :nodoc:
42
42
  Dir.chdir(package.srcdir) do
43
43
  if !File.exists?("#{package.srcdir}/CVS/Root")
44
- raise ConfigException, "#{package.srcdir} is not a CVS working copy"
44
+ raise ConfigException.new(package, 'import'), "#{package.srcdir} is not a CVS working copy"
45
45
  end
46
46
 
47
47
  root = File.open("#{package.srcdir}/CVS/Root") { |io| io.read }.chomp
@@ -55,7 +55,7 @@ module Autobuild
55
55
  expected_root = expected_root.gsub /:/, ''
56
56
 
57
57
  if root != expected_root || mod != @module
58
- raise ConfigException, "checkout in #{package.srcdir} is from #{root}:#{mod}, was expecting #{expected_root}:#{@module}"
58
+ raise ConfigException.new(package, 'import'), "checkout in #{package.srcdir} is from #{root}:#{mod}, was expecting #{expected_root}:#{@module}"
59
59
  end
60
60
  Subprocess.run(package, :import, @program, 'up', *@options_up)
61
61
  end
@@ -24,7 +24,7 @@ module Autobuild
24
24
 
25
25
  def update(package) # :nodoc:
26
26
  if !File.directory?( File.join(package.srcdir, '_darcs') )
27
- raise ConfigException, "#{package.srcdir} is not a Darcs repository"
27
+ raise ConfigException.new(package, 'import'), "#{package.srcdir} is not a Darcs repository"
28
28
  end
29
29
 
30
30
  Subprocess.run(package, :import, @program,
@@ -119,7 +119,7 @@ module Autobuild
119
119
  # repository
120
120
  def validate_srcdir(package)
121
121
  if !File.directory?(File.join(package.srcdir, '.git'))
122
- raise ConfigException, "while importing #{package.name}, #{package.srcdir} is not a git repository"
122
+ raise ConfigException.new(package, 'import'), "while importing #{package.name}, #{package.srcdir} is not a git repository"
123
123
  end
124
124
  end
125
125
 
@@ -288,11 +288,11 @@ module Autobuild
288
288
  def merge_status(fetch_commit, reference_commit = "HEAD")
289
289
  common_commit = `git merge-base #{reference_commit} #{fetch_commit}`.chomp
290
290
  if $?.exitstatus != 0
291
- raise PackageException, "failed to find the merge-base between #{reference_commit} and #{fetch_commit}. Are you sure these commits exist ?"
291
+ raise PackageException.new(package, 'import'), "failed to find the merge-base between #{reference_commit} and #{fetch_commit}. Are you sure these commits exist ?"
292
292
  end
293
293
  head_commit = `git rev-parse #{reference_commit}`.chomp
294
294
  if $?.exitstatus != 0
295
- raise PackageException, "failed to resolve #{reference_commit}. Are you sure this commit, branch or tag exists ?"
295
+ raise PackageException.new(package, 'import'), "failed to resolve #{reference_commit}. Are you sure this commit, branch or tag exists ?"
296
296
  end
297
297
 
298
298
  status = if common_commit != fetch_commit
@@ -334,7 +334,7 @@ module Autobuild
334
334
  return
335
335
  end
336
336
  elsif status_to_head.status != Status::SIMPLE_UPDATE
337
- raise PackageException, "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"
337
+ 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"
338
338
  end
339
339
 
340
340
  status_to_remote = merge_status(target_commit, fetch_commit)
@@ -373,7 +373,7 @@ module Autobuild
373
373
  status = merge_status(fetch_commit)
374
374
  if status.needs_update?
375
375
  if !merge? && status.status == Status::NEEDS_MERGE
376
- raise PackageException, "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"
376
+ 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"
377
377
  end
378
378
  Subprocess.run(package, :import, Autobuild.tool('git'), 'merge', fetch_commit)
379
379
  end
@@ -42,15 +42,15 @@ module Autobuild
42
42
  ENV['LC_ALL'] = old_lang
43
43
  unless url = svninfo.grep(/^URL: /).first
44
44
  if svninfo.grep(/is not a working copy/).empty?
45
- raise ConfigException, "#{package.srcdir} is not a Subversion working copy"
45
+ raise ConfigException.new(package, 'import'), "#{package.srcdir} is not a Subversion working copy"
46
46
  else
47
- raise ConfigException, "Bug: cannot get SVN information for #{package.srcdir}"
47
+ raise ConfigException.new(package, 'import'), "Bug: cannot get SVN information for #{package.srcdir}"
48
48
  end
49
49
  end
50
50
  url.chomp =~ /URL: (.+)/
51
51
  source = $1
52
52
  if source != @source
53
- raise ConfigException, "current checkout found at #{package.srcdir} is from #{source}, was expecting #{@source}"
53
+ raise ConfigException.new(package, 'import'), "current checkout found at #{package.srcdir} is from #{source}, was expecting #{@source}"
54
54
  end
55
55
  Subprocess.run(package, :import, @program, 'up', "--non-interactive", *@options_up)
56
56
  }
@@ -162,7 +162,7 @@ class Importer
162
162
  end
163
163
 
164
164
  elsif File.exists?(srcdir)
165
- raise ConfigException, "#{srcdir} exists but is not a directory"
165
+ raise ConfigException.new(package, 'import'), "#{srcdir} exists but is not a directory"
166
166
  else
167
167
  perform_checkout(package)
168
168
  end
@@ -454,11 +454,11 @@ module Autobuild
454
454
  # and installed.
455
455
  def depends_on(*packages)
456
456
  packages.each do |p|
457
- raise ConfigException, "#{p.inspect} should be a string" if !p.respond_to? :to_str
457
+ raise ArgumentError, "#{p.inspect} should be a string" if !p.respond_to? :to_str
458
458
  p = p.to_str
459
459
  next if p == name
460
460
  unless pkg = Package[p]
461
- raise ConfigException.new(name), "package #{p} not defined"
461
+ raise ConfigException.new(self), "package #{p}, listed as a dependency of #{self.name}, is not defined"
462
462
  end
463
463
 
464
464
  next if @dependencies.include?(pkg.name)
@@ -478,7 +478,7 @@ module Autobuild
478
478
  # listed in +packages+ are aliases for this package.
479
479
  def provides(*packages)
480
480
  packages.each do |p|
481
- raise ConfigException, "#{p.inspect} should be a string" if !p.respond_to? :to_str
481
+ raise ArgumentError, "#{p.inspect} should be a string" if !p.respond_to? :to_str
482
482
  p = p.to_str
483
483
  next if p == name
484
484
  next if @provides.include?(name)
@@ -210,7 +210,7 @@ module Autobuild
210
210
  elsif confext = %w{.ac .in}.find { |ext| File.exists?("#{conffile}#{ext}") }
211
211
  file conffile => "#{conffile}#{confext}"
212
212
  else
213
- raise PackageException.new(name), "neither configure.ac nor configure.in present in #{srcdir}"
213
+ raise PackageException.new(self, 'prepare'), "neither configure.ac nor configure.in present in #{srcdir}"
214
214
  end
215
215
 
216
216
  file conffile do
@@ -299,7 +299,7 @@ module Autobuild
299
299
  super do
300
300
  in_dir(builddir) do
301
301
  if !File.file?(File.join(srcdir, 'CMakeLists.txt'))
302
- raise ConfigException, "#{srcdir} contains no CMakeLists.txt file"
302
+ raise ConfigException.new(self, 'configure'), "#{srcdir} contains no CMakeLists.txt file"
303
303
  end
304
304
 
305
305
  command = [ "cmake", "-DCMAKE_INSTALL_PREFIX=#{prefix}", "-DCMAKE_MODULE_PATH=#{CMake.module_path.join(";")}" ]
@@ -234,9 +234,7 @@ module Autobuild
234
234
  end
235
235
 
236
236
  if needs_regen
237
- isolate_errors do
238
- regen
239
- end
237
+ isolate_errors { regen }
240
238
  end
241
239
  end
242
240
 
@@ -306,7 +306,7 @@ module Autobuild::Subprocess
306
306
  end
307
307
 
308
308
  rescue Failed => e
309
- error = Autobuild::SubcommandFailed.new(target_name, command.join(" "), logname, e.status)
309
+ error = Autobuild::SubcommandFailed.new(target, command.join(" "), logname, e.status)
310
310
  error.phase = phase
311
311
  raise error, e.message
312
312
  end
@@ -1,5 +1,5 @@
1
1
  module Autobuild
2
- VERSION = "1.6.0.rc3" unless defined? Autobuild::VERSION
2
+ VERSION = "1.6.0.rc4" unless defined? Autobuild::VERSION
3
3
  end
4
4
 
5
5
 
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: autobuild
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15424083
4
+ hash: 15424093
5
5
  prerelease: 6
6
6
  segments:
7
7
  - 1
8
8
  - 6
9
9
  - 0
10
10
  - rc
11
- - 3
12
- version: 1.6.0.rc3
11
+ - 4
12
+ version: 1.6.0.rc4
13
13
  platform: ruby
14
14
  authors:
15
15
  - Sylvain Joyeux
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2012-03-31 00:00:00 Z
20
+ date: 2012-04-11 00:00:00 Z
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
23
23
  name: rake