autobuild 1.5.0 → 1.5.1

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.
data/Changes.txt CHANGED
@@ -1,3 +1,13 @@
1
+ == Version 1.5.1
2
+ * autotools: must run libtool before the other tools
3
+ * autotools: properly autodetect need for autoconf (autoconf was always enabled
4
+ before)
5
+ * logs: properly log everything that happens in one session. The previous
6
+ behaviour was to have, in each log file, only the last command that has been
7
+ run.
8
+ * logs: only attach relevant logs to report mails. The previous behaviour was to
9
+ attach all log files that were in <prefix>/log
10
+
1
11
  == Version 1.5.0
2
12
  * now Ruby1.9 compatibility fixes, can be run with ruby1.9.1 on Debian
3
13
  * properly runs if the ruby interpreter is not called 'ruby', as ruby1.9.1
data/lib/autobuild.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Autobuild
2
- VERSION = "1.5.0" unless defined? Autobuild::VERSION
2
+ VERSION = "1.5.1" unless defined? Autobuild::VERSION
3
3
  end
4
4
 
5
5
  require 'autobuild/config'
@@ -138,12 +138,23 @@ module Autobuild
138
138
  #
139
139
  # Let the user disable the use of autoconf explicitely by using 'false'.
140
140
  # 'nil' means autodetection
141
- using[:autoconf] = true if using[:autoconf].nil?
141
+ if using[:autoconf].nil?
142
+ if File.file?(File.join(srcdir, 'configure.in')) || File.file?(File.join(srcdir, 'configure.ac'))
143
+ using[:autoconf] = true
144
+ end
145
+ end
142
146
  using[:aclocal] = using[:autoconf] if using[:aclocal].nil?
143
147
  if using[:automake].nil?
144
148
  using[:automake] = File.exists?(File.join(srcdir, 'Makefile.am'))
145
149
  end
146
150
 
151
+ if using[:libtool].nil?
152
+ using[:libtool] = File.exists?(File.join(srcdir, 'ltmain.sh'))
153
+ end
154
+ if using[:libtool]
155
+ Subprocess.run(self, 'configure', Autobuild.tool('libtoolize'), '--copy')
156
+ end
157
+
147
158
  [ :aclocal, :autoconf, :autoheader, :automake ].each do |tool|
148
159
  if tool_flag = using[tool]
149
160
  tool_program = if tool_flag.respond_to?(:to_str)
@@ -154,13 +165,6 @@ module Autobuild
154
165
  Subprocess.run(self, 'configure', tool_program)
155
166
  end
156
167
  end
157
-
158
- if using[:libtool].nil?
159
- using[:libtool] = File.exists?(File.join(srcdir, 'ltmain.sh'))
160
- end
161
- if using[:libtool]
162
- Subprocess.run(self, 'configure', Autobuild.tool('libtoolize'), '--copy')
163
- end
164
168
  end
165
169
  end
166
170
  end
@@ -74,12 +74,8 @@ module Autobuild
74
74
  end
75
75
 
76
76
  ## Iterate on all log files
77
- def self.each_log
78
- Find.find(Autobuild.logdir) do |path|
79
- if File.file?(path) && path =~ /\.log$/
80
- yield(path)
81
- end
82
- end
77
+ def self.each_log(&block)
78
+ Autobuild.logfiles.each(&block)
83
79
  end
84
80
  end
85
81
 
@@ -160,16 +156,25 @@ module Autobuild
160
156
  end
161
157
 
162
158
  # Send the mails
163
- smtp = Net::SMTP.new(smtp_hostname, smtp_port)
164
- smtp.start {
165
- to_email.each do |email|
166
- mail.header.to = email
167
- smtp.send_mail RMail::Serialize.write('', mail), from_email, email
168
- end
169
- }
170
-
171
- # Notify the sending
172
- puts "Sent notification mail to #{to_email} with source #{from_email}"
159
+ if File.directory?(File.dirname(smtp_hostname))
160
+ File.open(smtp_hostname, 'w') do |io|
161
+ io.puts "From: #{from_email}"
162
+ io.puts "To: #{to_email.join(" ")}"
163
+ io.write RMail::Serialize.write('', mail)
164
+ end
165
+ puts "saved notification email in #{smtp_hostname}"
166
+ else
167
+ smtp = Net::SMTP.new(smtp_hostname, smtp_port)
168
+ smtp.start {
169
+ to_email.each do |email|
170
+ mail.header.to = email
171
+ smtp.send_mail RMail::Serialize.write('', mail), from_email, email
172
+ end
173
+ }
174
+
175
+ # Notify the sending
176
+ puts "sent notification mail to #{to_email} with source #{from_email}"
177
+ end
173
178
  end
174
179
  end
175
180
  end
@@ -1,8 +1,26 @@
1
+ require 'set'
1
2
  require 'autobuild/exceptions'
2
3
  require 'autobuild/reporting'
3
4
  require 'fcntl'
4
5
 
5
6
  module Autobuild
7
+ @logfiles = Set.new
8
+ def self.clear_logfiles
9
+ @logfiles.clear
10
+ end
11
+
12
+ def self.logfiles
13
+ @logfiles
14
+ end
15
+
16
+ def self.register_logfile(path)
17
+ @logfiles << path
18
+ end
19
+
20
+ def self.registered_logfile?(logfile)
21
+ @logfiles.include?(logfile)
22
+ end
23
+
6
24
  @parallel_build_level = nil
7
25
  class << self
8
26
  # Sets the level of parallelism during the build
@@ -81,7 +99,7 @@ module Autobuild::Subprocess
81
99
  else Autobuild.logdir
82
100
  end
83
101
 
84
- logname = "#{logdir}/#{target_name}-#{phase}.log"
102
+ logname = File.join(logdir, "#{target_name}-#{phase}.log")
85
103
  if !File.directory?(File.dirname(logname))
86
104
  FileUtils.mkdir_p File.dirname(logname)
87
105
  end
@@ -94,9 +112,12 @@ module Autobuild::Subprocess
94
112
  command.reject! { |o| o =~ /^\<(.+)/ }
95
113
 
96
114
  open_flag = if Autobuild.keep_oldlogs then 'a'
115
+ elsif Autobuild.registered_logfile?(logname) then 'a'
97
116
  else 'w'
98
117
  end
99
118
 
119
+ Autobuild.register_logfile(logname)
120
+
100
121
  status = File.open(logname, open_flag) do |logfile|
101
122
  if Autobuild.keep_oldlogs
102
123
  logfile.puts
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.5.0
4
+ version: 1.5.1
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: 2010-02-06 00:00:00 +01:00
12
+ date: 2010-02-07 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency