autobuild 1.2.15 → 1.3.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.
@@ -15,6 +15,10 @@ require 'autobuild/config'
15
15
  require 'autobuild/exceptions'
16
16
 
17
17
  module Autobuild
18
+ def self.progress(msg)
19
+ puts " #{msg}"
20
+ end
21
+
18
22
  ## The reporting module provides the framework
19
23
  # to run commands in autobuild and report errors
20
24
  # to the user
@@ -4,7 +4,7 @@ require 'autobuild/reporting'
4
4
  module Autobuild::Subprocess
5
5
  class Failed < Exception
6
6
  attr_reader :status
7
- def initialize(status = 0)
7
+ def initialize(status = nil)
8
8
  @status = status
9
9
  end
10
10
  end
@@ -22,7 +22,9 @@ module Autobuild::Subprocess
22
22
  FileUtils.mkdir_p File.dirname(logname)
23
23
  end
24
24
 
25
- puts "#{target}: running #{command.join(" ")}\n (output goes to #{logname})"
25
+ if Autobuild.verbose
26
+ puts "#{target}: running #{command.join(" ")}\n (output goes to #{logname})"
27
+ end
26
28
 
27
29
  input_streams = command.collect { |o| $1 if o =~ /^\<(.+)/ }.compact
28
30
  command.reject! { |o| o =~ /^\<(.+)/ }
@@ -43,7 +45,7 @@ module Autobuild::Subprocess
43
45
  pread, pwrite = IO.pipe # to feed subprocess stdin
44
46
  cread, cwrite = IO.pipe # to control that exec goes well
45
47
 
46
- pid = fork {
48
+ pid = fork do
47
49
  cwrite.sync = true
48
50
  begin
49
51
  Process.setpriority(Process::PRIO_PROCESS, 0, Autobuild.nice)
@@ -68,7 +70,7 @@ module Autobuild::Subprocess
68
70
  cwrite.write([CONTROL_UNEXPECTED].pack('I'))
69
71
  raise
70
72
  end
71
- }
73
+ end
72
74
 
73
75
  # Feed the input
74
76
  pread.close
@@ -90,7 +92,7 @@ module Autobuild::Subprocess
90
92
  # An error occured
91
93
  value = value.unpack('I').first
92
94
  if value == CONTROL_COMMAND_NOT_FOUND
93
- raise Failed.new, "file not found"
95
+ raise Failed.new, "command '#{command.first}' not found"
94
96
  else
95
97
  raise Failed.new, "something unexpected happened"
96
98
  end
@@ -101,7 +103,7 @@ module Autobuild::Subprocess
101
103
  end
102
104
 
103
105
  if status.exitstatus > 0
104
- raise Failed.new(status.exitstatus), "command returned with status #{status.exitstatus}"
106
+ raise Failed.new(status.exitstatus), "'#{command.join(' ')}' returned status #{status.exitstatus}"
105
107
  end
106
108
 
107
109
  rescue Failed => e
@@ -6,7 +6,7 @@ require 'fileutils'
6
6
  STAMPFILE = "autobuild-stamp"
7
7
 
8
8
  module Autobuild
9
- def tree_timestamp(path, *exclude)
9
+ def self.tree_timestamp(path, *exclude)
10
10
  # Exclude autobuild timestamps
11
11
  exclude.each { |rx| raise unless Regexp === rx }
12
12
  exclude << (/#{Regexp.quote(STAMPFILE)}$/)
@@ -44,23 +44,27 @@ module Autobuild
44
44
  end
45
45
 
46
46
  def timestamp
47
- tree_timestamp(name, %r#(?:^|/)(?:CVS|_darcs|\.svn)$#, *@exclude)
47
+ Autobuild.tree_timestamp(name, %r#(?:^|/)(?:CVS|_darcs|\.svn)$#, *@exclude)
48
48
  end
49
49
  end
50
- def source_tree(path, &block)
50
+ def self.source_tree(path, &block)
51
51
  task = SourceTreeTask.define_task(path)
52
52
  block.call(task) unless !block
53
53
  task
54
54
  end
55
55
 
56
- def get_stamp(stampfile)
56
+ def self.get_stamp(stampfile)
57
57
  return Time.at(0) if !File.exists?(stampfile)
58
58
  return File.mtime(stampfile)
59
59
  end
60
60
 
61
- def touch_stamp(stampfile)
61
+ def self.touch_stamp(stampfile)
62
62
  puts "Touching #{stampfile}" if Autobuild.debug
63
63
  FileUtils.touch(stampfile)
64
+
65
+ # File modification times on most Unix filesystems have a granularity of
66
+ # one second, so we (unfortunately) have to sleep 1s to make sure that
67
+ # time comparisons will work as expected.
64
68
  sleep(1)
65
69
  end
66
70
  end
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.2.15
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sylvain Joyeux
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-09-11 00:00:00 +02:00
12
+ date: 2009-10-14 00:00:00 +02:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -30,7 +30,7 @@ dependencies:
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: "0"
33
+ version: "1.0"
34
34
  version:
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: daemons
@@ -40,7 +40,7 @@ dependencies:
40
40
  requirements:
41
41
  - - ">="
42
42
  - !ruby/object:Gem::Version
43
- version: "0"
43
+ version: "0.0"
44
44
  version:
45
45
  - !ruby/object:Gem::Dependency
46
46
  name: hoe
@@ -70,7 +70,8 @@ description: |-
70
70
  It takes the dependencies between packages into account in its build process,
71
71
  updates the needed environment variables (+PKG_CONFIG_PATH+, +PATH+,
72
72
  +LD_LIBRARY_PATH+, ...)
73
- email: sylvain.joyeux@m4x.org
73
+ email:
74
+ - sylvain.joyeux@m4x.org
74
75
  executables:
75
76
  - autobuild
76
77
  extensions: []
@@ -148,6 +149,6 @@ specification_version: 3
148
149
  summary: Rake-based utility to build and install multiple packages with dependencies
149
150
  test_files:
150
151
  - test/test_import_tar.rb
151
- - test/test_subcommand.rb
152
- - test/test_import_svn.rb
153
152
  - test/test_import_cvs.rb
153
+ - test/test_import_svn.rb
154
+ - test/test_subcommand.rb