autobuild 1.5.53.rc1 → 1.5.53

Sign up to get free protection for your applications and to get access to all the features.
data/Changes.txt CHANGED
@@ -2,6 +2,11 @@
2
2
  * remove RMail and Daemons from the dependency list of the gem. autobuild can
3
3
  work fine without them, and they are seldom used anyway.
4
4
  The RMail dependency is notified to the user if he uses --mail-to.
5
+ * git: improve the behaviour on commit pinning. The importer avoids creating
6
+ detached HEAD as much as it can now.
7
+ * archive: fix some issues regarding patching and checkout. The list of patches
8
+ was not reset when the package was re-checkout, which was leading to errors
9
+ later.
5
10
 
6
11
  == Version 1.5.52
7
12
  * fix local in the git importer
@@ -117,7 +117,7 @@ module Autobuild
117
117
  def initialize(url, options)
118
118
  @options = options.dup
119
119
  if !@options.has_key?(:update_cached_file)
120
- @options[:update_cached_file] = true
120
+ @options[:update_cached_file] = false
121
121
  end
122
122
  @options[:cachedir] ||= "#{Autobuild.prefix}/cache"
123
123
 
@@ -136,7 +136,9 @@ module Autobuild
136
136
  end
137
137
 
138
138
  def update(package) # :nodoc:
139
- checkout(package) if update_cache(package)
139
+ if update_cache(package)
140
+ checkout(package)
141
+ end
140
142
  rescue OpenURI::HTTPError
141
143
  raise Autobuild::Exception.new(package.name, :import)
142
144
  end
@@ -169,6 +171,11 @@ module Autobuild
169
171
  Subprocess.run(package, :import, Autobuild.tool('tar'), *cmd)
170
172
  end
171
173
 
174
+ # This method can be used to re-checkout an existing package /
175
+ # directory. If we successfully did that, make sure we delete the
176
+ # patch list so that it gets re-patched
177
+ FileUtils.rm_f(patchlist(package))
178
+
172
179
  rescue OpenURI::HTTPError
173
180
  raise Autobuild::Exception.new(package.name, :import)
174
181
  rescue SubcommandFailed
@@ -37,9 +37,6 @@ module Autobuild
37
37
  tag = gitopts[:tag]
38
38
  commit = gitopts[:commit]
39
39
 
40
- if (branch && commit) || (branch && tag) || (tag && commit)
41
- raise ConfigException, "you can specify only a branch, tag or commit but not two or three at the same time"
42
- end
43
40
  @branch = branch || 'master'
44
41
  @tag = tag
45
42
  @commit = commit
@@ -142,8 +139,10 @@ module Autobuild
142
139
  # Doing it now is better as it makes sure that we replace the
143
140
  # configuration parameters only if the repository and branch are
144
141
  # OK (i.e. we keep old working configuration instead)
145
- if !commit
142
+ if branch || tag
146
143
  Subprocess.run(package, :import, Autobuild.tool('git'), 'fetch', repository, branch || tag)
144
+ elsif commit
145
+ Subprocess.run(package, :import, Autobuild.tool('git'), 'fetch', repository)
147
146
  end
148
147
 
149
148
  Subprocess.run(package, :import, Autobuild.tool('git'), 'config',
@@ -170,10 +169,6 @@ module Autobuild
170
169
  "--replace-all", "branch.#{local_branch}.merge", "refs/heads/#{local_branch}")
171
170
  end
172
171
 
173
- if commit
174
- Subprocess.run(package, :import, Autobuild.tool('git'), 'fetch', 'autobuild')
175
- end
176
-
177
172
  # Now get the actual commit ID from the FETCH_HEAD file, and
178
173
  # return it
179
174
  commit_id = if File.readable?( File.join('.git', 'FETCH_HEAD') )
@@ -229,10 +224,20 @@ module Autobuild
229
224
  $?.exitstatus == 0
230
225
  end
231
226
 
227
+ def detached_head?
228
+ `git symbolic-ref HEAD -q`
229
+ return ($?.exitstatus != 0)
230
+ end
231
+
232
232
  # Checks if the current branch is the target branch. Expects that the
233
233
  # current directory is the package's directory
234
234
  def on_target_branch?
235
- current_branch = `git symbolic-ref HEAD`.chomp
235
+ current_branch = `git symbolic-ref HEAD -q`.chomp
236
+ if $?.exitstatus != 0
237
+ # HEAD cannot be resolved as a symbol. Assume that we are on a
238
+ # detached HEAD
239
+ return false
240
+ end
236
241
  current_branch == "refs/heads/#{local_branch}"
237
242
  end
238
243
 
@@ -280,9 +285,15 @@ module Autobuild
280
285
  end
281
286
  end
282
287
 
283
- def merge_status(fetch_commit)
284
- common_commit = `git merge-base HEAD #{fetch_commit}`.chomp
285
- head_commit = `git rev-parse HEAD`.chomp
288
+ def merge_status(fetch_commit, reference_commit = "HEAD")
289
+ common_commit = `git merge-base #{reference_commit} #{fetch_commit}`.chomp
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 ?"
292
+ end
293
+ head_commit = `git rev-parse #{reference_commit}`.chomp
294
+ if $?.exitstatus != 0
295
+ raise PackageException, "failed to resolve #{reference_commit}. Are you sure this commit, branch or tag exists ?"
296
+ end
286
297
 
287
298
  status = if common_commit != fetch_commit
288
299
  if common_commit == head_commit
@@ -305,13 +316,45 @@ module Autobuild
305
316
  validate_srcdir(package)
306
317
  Dir.chdir(package.srcdir) do
307
318
  fetch_commit = fetch_remote(package)
308
- if !fetch_commit
309
- return
310
- end
311
319
 
312
320
  # If we are tracking a commit/tag, just check it out and return
313
321
  if commit || tag
314
- Subprocess.run(package, :import, Autobuild.tool('git'), 'checkout', commit || tag)
322
+ target_commit = (commit || tag)
323
+ status_to_head = merge_status(target_commit, "HEAD")
324
+ if status_to_head.status == Status::UP_TO_DATE
325
+ # Check if by any chance we could switch back to a
326
+ # proper branch instead of having a detached HEAD
327
+ if detached_head?
328
+ status_to_remote = merge_status(target_commit, fetch_commit)
329
+ if status_to_remote.status != Status::UP_TO_DATE
330
+ package.progress " the package is on a detached HEAD because of commit pinning"
331
+ return
332
+ end
333
+ else
334
+ return
335
+ end
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"
338
+ end
339
+
340
+ status_to_remote = merge_status(target_commit, fetch_commit)
341
+ if status_to_remote.status != Status::UP_TO_DATE
342
+ # Try very hard to avoid creating a detached HEAD
343
+ if local_branch
344
+ status_to_branch = merge_status(target_commit, local_branch)
345
+ if status_to_branch.status == Status::UP_TO_DATE # Checkout the branch
346
+ package.progress " checking out specific commit %s for %s. It will checkout branch %s." % [target_commit.to_s, package.name, local_branch]
347
+ Subprocess.run(package, :import, Autobuild.tool('git'), 'checkout', local_branch)
348
+ return
349
+ end
350
+ end
351
+ package.progress " checking out specific commit %s for %s. This will create a detached HEAD." % [target_commit.to_s, package.name]
352
+ Subprocess.run(package, :import, Autobuild.tool('git'), 'checkout', target_commit)
353
+ return
354
+ end
355
+ end
356
+
357
+ if !fetch_commit
315
358
  return
316
359
  end
317
360
 
@@ -358,18 +401,20 @@ module Autobuild
358
401
 
359
402
  # If we are tracking a commit/tag, just check it out
360
403
  if commit || tag
361
- Subprocess.run(package, :import, Autobuild.tool('git'),
362
- 'checkout', commit || tag)
363
- return
364
- end
365
-
366
- current_branch = `git symbolic-ref HEAD`.chomp
367
- if current_branch == "refs/heads/#{local_branch}"
368
- Subprocess.run(package, :import, Autobuild.tool('git'),
369
- 'reset', '--hard', "autobuild/#{branch}")
404
+ status = merge_status(commit || tag)
405
+ if status.status != Status::UP_TO_DATE
406
+ package.progress " checking out specific commit for %s. This will create a detached HEAD." % [package.name]
407
+ Subprocess.run(package, :import, Autobuild.tool('git'), 'checkout', commit || tag)
408
+ end
370
409
  else
371
- Subprocess.run(package, :import, Autobuild.tool('git'),
372
- 'checkout', '-b', local_branch, "autobuild/#{branch}")
410
+ current_branch = `git symbolic-ref HEAD`.chomp
411
+ if current_branch == "refs/heads/#{local_branch}"
412
+ Subprocess.run(package, :import, Autobuild.tool('git'),
413
+ 'reset', '--hard', "autobuild/#{branch}")
414
+ else
415
+ Subprocess.run(package, :import, Autobuild.tool('git'),
416
+ 'checkout', '-b', local_branch, "autobuild/#{branch}")
417
+ end
373
418
  end
374
419
  end
375
420
  end
@@ -5,6 +5,7 @@ module Autobuild
5
5
  CMake.new(options, &block)
6
6
  end
7
7
 
8
+ # Handler class to build CMake-based packages
8
9
  class CMake < Configurable
9
10
  class << self
10
11
  def builddir; @builddir || Configurable.builddir end
@@ -19,6 +20,13 @@ module Autobuild
19
20
  @full_reconfigures
20
21
  end
21
22
 
23
+ # Global default for the CMake generator to use. If nil (the
24
+ # default), the -G option will not be given at all. Will work only
25
+ # if the generator creates makefiles
26
+ #
27
+ # It can be overriden on a per-package basis with CMake.generator=
28
+ attr_accessor :generator
29
+
22
30
  attr_reader :module_path
23
31
  end
24
32
  @module_path = []
@@ -32,6 +40,17 @@ module Autobuild
32
40
  #
33
41
  # See #full_reconfigures? for more details
34
42
  attr_writer :full_reconfigures
43
+ # Sets a generator explicitely for this component. See #generator and
44
+ # CMake.generator
45
+ attr_writer :generator
46
+ # The CMake generator to use. You must choose one that generates
47
+ # Makefiles. If not set for this package explicitely, it is using the
48
+ # global value CMake.generator.
49
+ def generator
50
+ if @generator then @generator
51
+ else CMake.generator
52
+ end
53
+ end
35
54
 
36
55
  # If true, we always remove the CMake cache before reconfiguring. This
37
56
  # is to workaround the aggressive caching behaviour of CMake, and is set
@@ -286,6 +305,9 @@ module Autobuild
286
305
  defines.each do |name, value|
287
306
  command << "-D#{name}=#{value}"
288
307
  end
308
+ if generator
309
+ command << "-G#{generator}"
310
+ end
289
311
  command << srcdir
290
312
 
291
313
  progress "configuring CMake build system for %s"
@@ -1,5 +1,5 @@
1
1
  module Autobuild
2
- VERSION = "1.5.53.rc1" unless defined? Autobuild::VERSION
2
+ VERSION = "1.5.53" unless defined? Autobuild::VERSION
3
3
  end
4
4
 
5
5
 
metadata CHANGED
@@ -1,15 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: autobuild
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15424463
5
- prerelease: 7
4
+ hash: 105
5
+ prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 5
9
9
  - 53
10
- - rc
11
- - 1
12
- version: 1.5.53.rc1
10
+ version: 1.5.53
13
11
  platform: ruby
14
12
  authors:
15
13
  - Sylvain Joyeux
@@ -17,7 +15,7 @@ autorequire:
17
15
  bindir: bin
18
16
  cert_chain: []
19
17
 
20
- date: 2011-12-02 00:00:00 Z
18
+ date: 2012-01-10 00:00:00 Z
21
19
  dependencies:
22
20
  - !ruby/object:Gem::Dependency
23
21
  name: rake
@@ -157,18 +155,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
157
155
  required_rubygems_version: !ruby/object:Gem::Requirement
158
156
  none: false
159
157
  requirements:
160
- - - ">"
158
+ - - ">="
161
159
  - !ruby/object:Gem::Version
162
- hash: 25
160
+ hash: 3
163
161
  segments:
164
- - 1
165
- - 3
166
- - 1
167
- version: 1.3.1
162
+ - 0
163
+ version: "0"
168
164
  requirements: []
169
165
 
170
166
  rubyforge_project: autobuild
171
- rubygems_version: 1.8.10
167
+ rubygems_version: 1.8.12
172
168
  signing_key:
173
169
  specification_version: 3
174
170
  summary: Rake-based utility to build and install multiple packages with dependencies