autobuild 1.7.12.rc6 → 1.8.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2adc58accd29a554c2853a23fe117ea15e021263
4
- data.tar.gz: f5c20d74ad6ab876b0f20e0edd3f4a6137cac1c3
3
+ metadata.gz: 02fbd561a58e387234abbd68df3dcc0cfdad031d
4
+ data.tar.gz: 4a64a4a2c63cd4d91782577167c92e31f863e14c
5
5
  SHA512:
6
- metadata.gz: cb1d9df085fee0ee0e9b1fcf89497d57c09b2be06ef3559725f54135b367f9b468a2332078fb0246969218b2e533af7ef824cb9fd9354009055eeb22f212369e
7
- data.tar.gz: c01f8ded6b0a6ab6a5bb15e7c96c5515ddf6802ec9c1b1c9f99a8a16310ed06203d160a1e6d5ae24cd4adbc743e377dc4f57150e61ccbff19d3ad75902dca511
6
+ metadata.gz: 843b80f0b1e84fbf70f687ba6ec597bafa249b14b0dba06c4886d8e6b5874f315a3ba4055df40360f6279f6f3c5eaedf8cd662c0778f9e211c25b98acccbb181
7
+ data.tar.gz: c018435f7acc876f5c9d0e4e0aa9acbb97c0842d7646eaabf62e64520765bff3e623ccca22a3dbedfb3fb1bc9bf3d9fc25a8c2e0e5c7df9d777816187482e941
@@ -196,7 +196,7 @@ module Autobuild
196
196
  dir = path
197
197
  end
198
198
 
199
- result = `#{Autobuild.tool(:git)} --git-dir="#{dir}" rev-parse --is-bare-repository`
199
+ result = `#{Autobuild.tool(:git)} --git-dir="#{dir}" rev-parse --is-bare-repository 2>&1`
200
200
  if $?.success?
201
201
  if result.strip == "true"
202
202
  return dir, :bare
@@ -326,6 +326,17 @@ module Autobuild
326
326
  commit_id
327
327
  end
328
328
 
329
+ def self.has_uncommitted_changes?(package, with_untracked_files = false)
330
+ Dir.chdir(package.importdir) do
331
+ status = `git status --porcelain`.split("\n").map(&:strip)
332
+ if with_untracked_files
333
+ !status.empty?
334
+ else
335
+ status.any? { |l| l[0, 2] !~ /^\?\?|^ / }
336
+ end
337
+ end
338
+ end
339
+
329
340
  # Returns a Importer::Status object that represents the status of this
330
341
  # package w.r.t. the root repository
331
342
  def status(package, only_local = false)
@@ -347,10 +358,7 @@ module Autobuild
347
358
  end
348
359
 
349
360
  status = merge_status(package, remote_commit)
350
- `git diff --quiet`
351
- if $?.exitstatus != 0
352
- status.uncommitted_code = true
353
- end
361
+ status.uncommitted_code = self.class.has_uncommitted_changes?(package)
354
362
  status
355
363
  end
356
364
 
@@ -648,7 +656,7 @@ module Autobuild
648
656
  # based on the information contained in the git configuration
649
657
  #
650
658
  # @raise [ArgumentError] if the path does not point to a git repository
651
- def self.vcs_definition_for(path)
659
+ def self.vcs_definition_for(path, remote_name = 'autobuild')
652
660
  if !can_handle?(path)
653
661
  raise ArgumentError, "#{path} is either not a git repository, or a bare git repository"
654
662
  end
@@ -284,14 +284,14 @@ class Importer
284
284
  def apply(package, path, patch_level = 0); call_patch(package, false, path, patch_level) end
285
285
  def unapply(package, path, patch_level = 0); call_patch(package, true, path, patch_level) end
286
286
 
287
- def parse_patch_list(patches_file)
287
+ def parse_patch_list(package, patches_file)
288
288
  File.readlines(patches_file).map do |line|
289
289
  line = line.rstrip
290
290
  if line =~ /^(.*)\s+(\d+)$/
291
- path = $1
291
+ path = File.expand_path($1, package.srcdir)
292
292
  level = Integer($2)
293
293
  else
294
- path = line
294
+ path = File.expand_path(line, package.srcdir)
295
295
  level = 0
296
296
  end
297
297
  [path, level, File.read(path)]
@@ -301,12 +301,12 @@ class Importer
301
301
  def currently_applied_patches(package)
302
302
  patches_file = patchlist(package)
303
303
  if File.exists?(patches_file)
304
- return parse_patch_list(patches_file)
304
+ return parse_patch_list(package, patches_file)
305
305
  end
306
306
 
307
307
  patches_file = File.join(package.importdir, "patches-autobuild-stamp")
308
308
  if File.exists?(patches_file)
309
- cur_patches = parse_patch_list(patches_file)
309
+ cur_patches = parse_patch_list(package, patches_file)
310
310
  save_patch_state(package, cur_patches)
311
311
  FileUtils.rm_f patches_file
312
312
  return currently_applied_patches(package)
@@ -319,7 +319,9 @@ class Importer
319
319
  # Get the list of already applied patches
320
320
  cur_patches = currently_applied_patches(package)
321
321
 
322
- if cur_patches.map(&:last) == patches.map(&:last)
322
+ cur_patches_state = cur_patches.map { |_, level, content| [level, content] }
323
+ patches_state = patches.map { |_, level, content| [level, content] }
324
+ if cur_patches_state == patches_state
323
325
  return false
324
326
  end
325
327
 
@@ -357,14 +359,18 @@ class Importer
357
359
  patch_dir = patchdir(package)
358
360
  FileUtils.mkdir_p patch_dir
359
361
  cur_patches = cur_patches.each_with_index.map do |(path, level, content), idx|
360
- path = File.join(patch_dir, idx.to_s)
361
- File.open(path, 'w') do |patch_io|
362
- patch_io.write content
363
- end
364
- [path, level]
362
+ path = File.join(patch_dir, idx.to_s)
363
+ File.open(path, 'w') do |patch_io|
364
+ patch_io.write content
365
+ end
366
+ [path, level]
365
367
  end
366
368
  File.open(patchlist(package), 'w') do |f|
367
- f.write(cur_patches.map { |p, l| "#{p} #{l}" }.join("\n"))
369
+ patch_state = cur_patches.map do |path, level|
370
+ path = Pathname.new(path).relative_path_from(package.srcdir).to_s
371
+ "#{path} #{level}"
372
+ end
373
+ f.write(patch_state.join("\n"))
368
374
  end
369
375
  end
370
376
 
@@ -1,5 +1,5 @@
1
1
  module Autobuild
2
- VERSION = "1.7.12.rc6" unless defined? Autobuild::VERSION
2
+ VERSION = "1.8.0" unless defined? Autobuild::VERSION
3
3
  end
4
4
 
5
5
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: autobuild
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.12.rc6
4
+ version: 1.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sylvain Joyeux
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-29 00:00:00.000000000 Z
11
+ date: 2014-11-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -161,9 +161,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
161
161
  version: 1.9.2
162
162
  required_rubygems_version: !ruby/object:Gem::Requirement
163
163
  requirements:
164
- - - ">"
164
+ - - ">="
165
165
  - !ruby/object:Gem::Version
166
- version: 1.3.1
166
+ version: '0'
167
167
  requirements: []
168
168
  rubyforge_project:
169
169
  rubygems_version: 2.2.2
@@ -171,9 +171,9 @@ signing_key:
171
171
  specification_version: 4
172
172
  summary: Library to handle build systems and import mechanisms
173
173
  test_files:
174
- - test/test_import_tar.rb
175
174
  - test/test_config.rb
176
- - test/test_subcommand.rb
177
- - test/test_reporting.rb
178
- - test/test_import_svn.rb
179
175
  - test/test_import_cvs.rb
176
+ - test/test_import_svn.rb
177
+ - test/test_import_tar.rb
178
+ - test/test_reporting.rb
179
+ - test/test_subcommand.rb