autobuild 1.8.0 → 1.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/autobuild/importer.rb +12 -18
- data/lib/autobuild/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 22c8d45a3b5f47a9c2e2544358bc594b3eb5dfe2
|
4
|
+
data.tar.gz: 5f1ccfc0fe622f6c17ab2eabc0c3d90c258af70d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 549a6b22ef745f3e0927250b7eb983afa681c08198ccf3f7814bc1299be9f5d29060237e43f35bf30f5986b86472fece8df17e0bb9aa2ede01b4837ec6d5a7e9
|
7
|
+
data.tar.gz: 2e49c8313b488d6b3f7c8930fccbc2d64df77ba03ed529a1e27ec0e447438fa931103a47d45ff61680bdff62edc78ebce1cdbc5d18db3d8920165846dfb896f5
|
data/lib/autobuild/importer.rb
CHANGED
@@ -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(
|
287
|
+
def parse_patch_list(patches_file)
|
288
288
|
File.readlines(patches_file).map do |line|
|
289
289
|
line = line.rstrip
|
290
290
|
if line =~ /^(.*)\s+(\d+)$/
|
291
|
-
path =
|
291
|
+
path = $1
|
292
292
|
level = Integer($2)
|
293
293
|
else
|
294
|
-
path =
|
294
|
+
path = line
|
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(
|
304
|
+
return parse_patch_list(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(
|
309
|
+
cur_patches = parse_patch_list(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,9 +319,7 @@ class Importer
|
|
319
319
|
# Get the list of already applied patches
|
320
320
|
cur_patches = currently_applied_patches(package)
|
321
321
|
|
322
|
-
|
323
|
-
patches_state = patches.map { |_, level, content| [level, content] }
|
324
|
-
if cur_patches_state == patches_state
|
322
|
+
if cur_patches.map(&:last) == patches.map(&:last)
|
325
323
|
return false
|
326
324
|
end
|
327
325
|
|
@@ -359,18 +357,14 @@ class Importer
|
|
359
357
|
patch_dir = patchdir(package)
|
360
358
|
FileUtils.mkdir_p patch_dir
|
361
359
|
cur_patches = cur_patches.each_with_index.map do |(path, level, content), idx|
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
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]
|
367
365
|
end
|
368
366
|
File.open(patchlist(package), 'w') do |f|
|
369
|
-
|
370
|
-
path = Pathname.new(path).relative_path_from(package.srcdir).to_s
|
371
|
-
"#{path} #{level}"
|
372
|
-
end
|
373
|
-
f.write(patch_state.join("\n"))
|
367
|
+
f.write(cur_patches.map { |p, l| "#{p} #{l}" }.join("\n"))
|
374
368
|
end
|
375
369
|
end
|
376
370
|
|
data/lib/autobuild/version.rb
CHANGED