autobuild 1.4.4 → 1.4.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,13 @@
1
+ == Version 1.4.5
2
+ * add support for zip in TarImporter, which is renamed ArchiveImporter to
3
+ reflect that. Backward compatibility is retained.
4
+ * support sourceforge-like setups in ArchiveImporter: use wget for download and
5
+ add a :filename option to specify what is the name of the downloaded file.
6
+ * improve configurability of the progress display for tools built on top of
7
+ autobuild
8
+ * always call with_doc in orogen packages, as orogen itself adds a documentation
9
+ target
10
+
1
11
  == Version 1.4.4
2
12
  * minor bug fixes
3
13
 
@@ -1,5 +1,5 @@
1
1
  module Autobuild
2
- VERSION = "1.4.4" unless defined? Autobuild::VERSION
2
+ VERSION = "1.4.5" unless defined? Autobuild::VERSION
3
3
  end
4
4
 
5
5
  require 'autobuild/config'
@@ -11,6 +11,7 @@ require 'autobuild/import/darcs'
11
11
  require 'autobuild/importer'
12
12
  require 'autobuild/import/git'
13
13
  require 'autobuild/import/svn'
14
+ require 'autobuild/import/archive'
14
15
  require 'autobuild/import/tar'
15
16
  require 'autobuild/packages/autotools'
16
17
  require 'autobuild/packages/cmake'
@@ -84,6 +84,7 @@ module Autobuild
84
84
 
85
85
  Autobuild.source_tree srcdir do |pkg|
86
86
  pkg.exclude << Regexp.new("^#{Regexp.quote(builddir)}")
87
+ pkg.exclude << Regexp.new("^#{doc_dir}") if doc_dir
87
88
  end
88
89
 
89
90
  file buildstamp => [ srcdir, configurestamp ] do
@@ -74,7 +74,7 @@ module Autobuild
74
74
  # repository
75
75
  def validate_srcdir(package)
76
76
  if !File.directory?(File.join(package.srcdir, '.git'))
77
- raise ConfigException, "#{Dir.pwd} is not a git repository"
77
+ raise ConfigException, "while importing #{package.name}, #{Dir.pwd} is not a git repository"
78
78
  end
79
79
  end
80
80
 
@@ -202,7 +202,7 @@ module Autobuild
202
202
  status = merge_status(fetch_commit)
203
203
  if status.needs_update?
204
204
  if !merge? && status.status == Status::NEEDS_MERGE
205
- raise PackageException, "importing the current version would require a merge"
205
+ raise PackageException, "importing the current version of #{package.name} would require a merge"
206
206
  end
207
207
  Subprocess.run(package, :import, Autobuild.tool('git'), 'merge', fetch_commit)
208
208
  end
@@ -1,145 +1 @@
1
- require 'autobuild/importer'
2
- require 'open-uri'
3
-
4
- module Autobuild
5
- class TarImporter < Importer
6
- # The tarball is not compressed
7
- Plain = 0
8
- # The tarball is compressed with gzip
9
- Gzip = 1
10
- # The tarball is compressed using bzip
11
- Bzip = 2
12
-
13
- TAR_OPTION = {
14
- Plain => '',
15
- Gzip => 'z',
16
- Bzip => 'j'
17
- }
18
-
19
- # Known URI schemes for +url+
20
- VALID_URI_SCHEMES = [ 'file', 'http', 'https', 'ftp' ]
21
-
22
- # Returns the unpack mode from the file name
23
- def self.url_to_mode(url)
24
- ext = File.extname(url)
25
- unless ext == '.tar'
26
- raise "Invalid file type in #{url}" unless File.basename(url, ext) != '.tar'
27
- end
28
- mode = case ext
29
- when '.tar'; Plain
30
- when '.gz'; Gzip
31
- when '.tgz'; Gzip
32
- when '.bz2'; Bzip
33
- end
34
-
35
- mode
36
- end
37
-
38
- # Updates the downloaded file in cache only if it is needed
39
- def update_cache
40
- do_update = true
41
-
42
- if File.file?(cachefile)
43
- cached_size = File.lstat(cachefile).size
44
- cached_mtime = File.lstat(cachefile).mtime
45
-
46
- size, mtime = nil
47
- open @url, :content_length_proc => lambda { |size| } do |file|
48
- mtime = file.last_modified
49
- end
50
-
51
- if mtime && size
52
- do_update = (size != cached_size || mtime > cached_mtime)
53
- elsif mtime
54
- $stderr.puts "WARNING: size is not available for #{@url}, relying on modification time"
55
- do_update = (mtime > cached_mtime)
56
- elsif size
57
- $stderr.puts "WARNING: modification time is not available for #{@url}, relying on size"
58
- do_update = (size != cached_size)
59
- else
60
- $stderr.puts "WARNING: neither size nor modification time available for #{@url}, will always update"
61
- end
62
- end
63
-
64
- if do_update
65
- puts "downloading #{url}"
66
- FileUtils.mkdir_p(cachedir)
67
- File.open(cachefile, 'w') do |cache|
68
- open @url do |file|
69
- while block = file.read(4096)
70
- cache.write block
71
- end
72
- end
73
- end
74
- true
75
- end
76
- end
77
-
78
- # Sets the source URL and update +cachefile+ and +mode+ attributes accordingly.
79
- def url=(url)
80
- @url = URI.parse(url)
81
- raise ConfigException, "invalid URL #{@url}" unless VALID_URI_SCHEMES.include?(@url.scheme)
82
-
83
- @mode = TarImporter.url_to_mode(url)
84
- if @url.scheme == 'file'
85
- @cachefile = @url.path
86
- else
87
- @cachefile = File.join(cachedir, File.basename(@url.path))
88
- end
89
- end
90
-
91
- # The source URL
92
- attr_reader :url
93
- # The local file (either a downloaded file if +url+ is not local, or +url+ itself)
94
- attr_reader :cachefile
95
- # The unpack mode. One of Bzip, Gzip or Plain
96
- attr_reader :mode
97
- # The directory in which remote files are cached
98
- def cachedir; @options[:cachedir] end
99
- # The directory contained in the tar file
100
- def tardir; @options[:tardir] end
101
-
102
- # Creates a new importer which downloads +url+ in +cachedir+ and unpacks it. The following options
103
- # are allowed:
104
- # [:cachedir] the cache directory. Defaults to "#{Autobuild.prefix}/cache"
105
- # [:tardir] the directory contained in the tar file. If set, the importer will rename that directory
106
- # to make it match Package#srcdir
107
- def initialize(url, options)
108
- @options = options.dup
109
- @options[:cachedir] ||= "#{Autobuild.prefix}/cache"
110
- self.url = url
111
- end
112
-
113
- def update(package) # :nodoc:
114
- checkout(package) if update_cache
115
- rescue OpenURI::HTTPError
116
- raise Autobuild::Exception.new(package.name, :import)
117
- end
118
-
119
- def checkout(package) # :nodoc:
120
- update_cache
121
-
122
- base_dir = File.dirname(package.srcdir)
123
- FileUtils.mkdir_p base_dir
124
- cmd = [ 'tar', "x#{TAR_OPTION[mode]}f", cachefile, '-C', base_dir ]
125
-
126
- Subprocess.run(package, :import, *cmd)
127
- if tardir
128
- File.mv File.join(base_dir, tardir), package.srcdir
129
- end
130
-
131
- rescue OpenURI::HTTPError
132
- raise Autobuild::Exception.new(package.name, :import)
133
- rescue SubcommandFailed
134
- FileUtils.rm_f cachefile
135
- raise
136
- end
137
- end
138
-
139
- # Creates an importer which downloads a tarball from +source+ and unpacks
140
- # it. The allowed values in +options+ are described in TarImporter.new.
141
- def self.tar(source, options = {})
142
- TarImporter.new(source, options)
143
- end
144
- end
145
-
1
+ require 'autobuild/import/archive'
@@ -52,7 +52,7 @@ class Autobuild::Importer
52
52
  srcdir = package.srcdir
53
53
  if File.directory?(srcdir)
54
54
  if Autobuild.do_update
55
- Autobuild.progress "updating #{package.name}"
55
+ package.progress "updating %s"
56
56
  update(package)
57
57
  patch(package)
58
58
  else
@@ -66,7 +66,7 @@ class Autobuild::Importer
66
66
  raise ConfigException, "#{srcdir} exists but is not a directory"
67
67
  else
68
68
  begin
69
- Autobuild.progress "checking out #{package.name}"
69
+ package.progress "checking out %s"
70
70
  checkout(package)
71
71
  patch(package)
72
72
  rescue Autobuild::Exception
@@ -105,7 +105,7 @@ class Autobuild::Importer
105
105
  end
106
106
 
107
107
  if !patches.empty?
108
- Autobuild.progress "patching #{package.name}"
108
+ package.progress "patching %s"
109
109
  end
110
110
 
111
111
  # Do not be smart, remove all already applied patches
@@ -120,7 +120,7 @@ module Autobuild
120
120
  Rake::Task["#{name}-import"].invoke
121
121
  Rake::Task["#{name}-prepare"].invoke
122
122
  Rake::Task["#{name}-build"].invoke
123
- if has_doc? && !Autobuild.no_doc
123
+ if has_doc? && Autobuild.do_doc
124
124
  Rake::Task["#{name}-doc"].invoke
125
125
  end
126
126
  end
@@ -168,6 +168,22 @@ module Autobuild
168
168
  Autobuild.update_environment prefix
169
169
  end
170
170
 
171
+ # Display a progress message. %s in the string is replaced by the
172
+ # package name
173
+ def progress(msg)
174
+ Autobuild.progress(msg % [name])
175
+ end
176
+
177
+ # Display a progress message, and later on update it with a progress
178
+ # value. %s in the string is replaced by the package name
179
+ def progress_with_value(msg)
180
+ Autobuild.progress_with_value(msg % [name])
181
+ end
182
+
183
+ def progress_value(value)
184
+ Autobuild.progress_value(value)
185
+ end
186
+
171
187
  # Directory in which the documentation target will have generated the
172
188
  # documentation (if any). The interpretation of relative directories
173
189
  # is package-specific. The default implementation interpret them
@@ -62,7 +62,7 @@ module Autobuild
62
62
  def with_doc(target = 'doc')
63
63
  doc_task do
64
64
  Dir.chdir(builddir) do
65
- Autobuild.progress "generating documentation for #{name}"
65
+ progress "generating documentation for %s"
66
66
  Subprocess.run(self, 'doc', Autobuild.tool(:make), "-j#{parallel_build_level}", target)
67
67
  yield if block_given?
68
68
  end
@@ -182,7 +182,7 @@ module Autobuild
182
182
  using[:autogen] = %w{autogen autogen.sh}.find { |f| File.exists?(f) }
183
183
  end
184
184
 
185
- Autobuild.progress "generating build system for #{name}"
185
+ progress "generating build system for %s"
186
186
  if using[:autogen]
187
187
  Subprocess.run(self, 'configure', File.expand_path(using[:autogen]))
188
188
  else
@@ -224,7 +224,7 @@ module Autobuild
224
224
  command = [ "#{srcdir}/configure", "--no-create", "--prefix=#{prefix}" ]
225
225
  command += Array[*configureflags]
226
226
 
227
- Autobuild.progress "configuring build system for #{name}"
227
+ progress "configuring build system for %s"
228
228
  Subprocess.run(self, 'configure', *command)
229
229
  }
230
230
  end
@@ -232,7 +232,7 @@ module Autobuild
232
232
  # Do the build in builddir
233
233
  def build
234
234
  Dir.chdir(builddir) do
235
- Autobuild.progress "building #{name}"
235
+ progress "building %s"
236
236
  Subprocess.run(self, 'build', './config.status')
237
237
  Subprocess.run(self, 'build', Autobuild.tool(:make), "-j#{parallel_build_level}")
238
238
  end
@@ -242,7 +242,7 @@ module Autobuild
242
242
  # Install the result in prefix
243
243
  def install
244
244
  Dir.chdir(builddir) do
245
- Autobuild.progress "installing #{name}"
245
+ progress "installing %s"
246
246
  Subprocess.run(self, 'install', Autobuild.tool(:make), "-j#{parallel_build_level}", 'install')
247
247
  end
248
248
  Autobuild.touch_stamp(installstamp)
@@ -63,7 +63,7 @@ module Autobuild
63
63
  def with_doc(target = 'doc')
64
64
  doc_task do
65
65
  Dir.chdir(builddir) do
66
- Autobuild.progress "generating documentation for #{name}"
66
+ progress "generating documentation for %s"
67
67
  Subprocess.run(self, 'doc', Autobuild.tool(:make), "-j#{parallel_build_level}", target)
68
68
  yield if block_given?
69
69
  end
@@ -149,7 +149,7 @@ module Autobuild
149
149
  end
150
150
  command << srcdir
151
151
 
152
- Autobuild.progress "generating and configuring build system for #{name}"
152
+ progress "generating and configuring build system for %s"
153
153
  if full_reconfigures?
154
154
  FileUtils.rm_f configurestamp
155
155
  end
@@ -161,13 +161,13 @@ module Autobuild
161
161
  # Do the build in builddir
162
162
  def build
163
163
  Dir.chdir(builddir) do
164
- Autobuild.progress_with_value "building #{name}"
164
+ progress_with_value "building %s"
165
165
  if always_reconfigure || !File.file?('Makefile')
166
166
  Subprocess.run(self, 'build', Autobuild.tool(:cmake), '.')
167
167
  end
168
168
  Subprocess.run(self, 'build', Autobuild.tool(:make), "-j#{parallel_build_level}") do |line|
169
169
  if line =~ /\[\s+(\d+)%\]/
170
- Autobuild.progress_value Integer($1)
170
+ progress_value Integer($1)
171
171
  end
172
172
  end
173
173
  end
@@ -177,7 +177,7 @@ module Autobuild
177
177
  # Install the result in prefix
178
178
  def install
179
179
  Dir.chdir(builddir) do
180
- Autobuild.progress "installing #{name}"
180
+ progress "installing %s"
181
181
  Subprocess.run(self, 'build', Autobuild.tool(:make), "-j#{parallel_build_level}", 'install')
182
182
  Autobuild.update_environment prefix
183
183
  end
@@ -135,7 +135,7 @@ module Autobuild
135
135
  file genomstamp => genom_dependencies
136
136
  file genomstamp => srcdir do
137
137
  Dir.chdir(srcdir) do
138
- Autobuild.progress "generating GenoM files for #{name}"
138
+ progress "generating GenoM files for %s"
139
139
  Subprocess.run(self, 'genom', *cmdline)
140
140
  end
141
141
  end
@@ -145,7 +145,7 @@ module Autobuild
145
145
  # configure does not depend on the .gen file
146
146
  # since the generation takes care of rebuilding configure
147
147
  # if .gen has changed
148
- Autobuild.progress "generating build system for #{name}"
148
+ progress "generating build system for %s"
149
149
  Dir.chdir(srcdir) { Subprocess.run(self, 'genom', File.expand_path('autogen')) }
150
150
  end
151
151
 
@@ -21,7 +21,11 @@ module Autobuild
21
21
  def prepare
22
22
  super
23
23
 
24
+ exclude = self.exclude.dup
24
25
  exclude << Regexp.new("^#{Regexp.quote(installstamp)}")
26
+ if doc_dir
27
+ exclude << Regexp.new("^#{doc_dir}")
28
+ end
25
29
 
26
30
  Autobuild.source_tree(srcdir) do |pkg|
27
31
  pkg.exclude.concat exclude
@@ -246,6 +246,8 @@ module Autobuild
246
246
  file genstamp => File.join(srcdir, orogen_file) do
247
247
  regen
248
248
  end
249
+
250
+ with_doc
249
251
  end
250
252
  def genstamp; File.join(srcdir, '.orogen', 'orogen-stamp') end
251
253
 
@@ -254,7 +256,7 @@ module Autobuild
254
256
  cmdline << '--corba' if corba
255
257
  cmdline << orogen_file
256
258
 
257
- Autobuild.progress "generating oroGen project #{name}"
259
+ progress "generating oroGen project %s"
258
260
  Dir.chdir(srcdir) do
259
261
  Subprocess.run self, 'orogen', *cmdline
260
262
  Autobuild.touch_stamp genstamp
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.4.4
4
+ version: 1.4.5
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-12-07 00:00:00 +01:00
12
+ date: 2009-12-23 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -60,7 +60,7 @@ dependencies:
60
60
  requirements:
61
61
  - - ">="
62
62
  - !ruby/object:Gem::Version
63
- version: 2.3.3
63
+ version: 2.4.0
64
64
  version:
65
65
  description: |-
66
66
  This work is licensed under the GPLv2 license. See License.txt for details