autobuild 1.7.9 → 1.7.10
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/autobuild/environment.rb +12 -10
- data/lib/autobuild/import/archive.rb +1 -0
- data/lib/autobuild/importer.rb +58 -30
- data/lib/autobuild/timestamps.rb +1 -0
- data/lib/autobuild/version.rb +1 -1
- metadata +5 -5
@@ -206,12 +206,21 @@ module Autobuild
|
|
206
206
|
env_update_var(name)
|
207
207
|
end
|
208
208
|
|
209
|
-
def self.env_value(name)
|
209
|
+
def self.env_value(name, expand_inherited = true)
|
210
210
|
if !environment[name] && !inherited_environment[name] && !SYSTEM_ENV[name]
|
211
211
|
nil
|
212
212
|
else
|
213
|
+
inherited =
|
214
|
+
if expand_inherited
|
215
|
+
inherited_environment[name] || []
|
216
|
+
elsif env_inherit?(name)
|
217
|
+
["$#{name}"]
|
218
|
+
else []
|
219
|
+
end
|
220
|
+
|
221
|
+
|
213
222
|
value = []
|
214
|
-
[environment[name],
|
223
|
+
[environment[name], inherited, SYSTEM_ENV[name]].each do |paths|
|
215
224
|
(paths || []).each do |p|
|
216
225
|
if !value.include?(p)
|
217
226
|
value << p
|
@@ -292,20 +301,13 @@ module Autobuild
|
|
292
301
|
variables = []
|
293
302
|
Autobuild.environment.each do |name, _|
|
294
303
|
variables << name
|
295
|
-
value = env_value(name)
|
304
|
+
value = env_value(name, false)
|
296
305
|
|
297
306
|
if value
|
298
307
|
shell_line = SHELL_SET_COMMAND % [name, value.join(ENV_LIST_SEPARATOR)]
|
299
308
|
else
|
300
309
|
shell_line = SHELL_UNSET_COMMAND % [name]
|
301
310
|
end
|
302
|
-
if env_inherit?(name)
|
303
|
-
if value.empty?
|
304
|
-
next
|
305
|
-
else
|
306
|
-
shell_line << "#{ENV_LIST_SEPARATOR}$#{name}"
|
307
|
-
end
|
308
|
-
end
|
309
311
|
io.puts shell_line
|
310
312
|
end
|
311
313
|
variables.each do |var|
|
data/lib/autobuild/importer.rb
CHANGED
@@ -103,7 +103,7 @@ class Importer
|
|
103
103
|
if patches.size == 2 && patches[0].respond_to?(:to_str) && patches[1].respond_to?(:to_int)
|
104
104
|
patches = [patches]
|
105
105
|
else
|
106
|
-
patches.map do |obj|
|
106
|
+
patches = patches.map do |obj|
|
107
107
|
if obj.respond_to?(:to_str)
|
108
108
|
[obj, 0]
|
109
109
|
elsif obj.respond_to?(:to_ary)
|
@@ -114,14 +114,16 @@ class Importer
|
|
114
114
|
end
|
115
115
|
end
|
116
116
|
end
|
117
|
+
patches.map do |path, level|
|
118
|
+
[path, level, File.read(path)]
|
119
|
+
end
|
117
120
|
end
|
118
121
|
|
119
122
|
def perform_update(package)
|
120
|
-
cur_patches
|
123
|
+
cur_patches = currently_applied_patches(package)
|
121
124
|
needed_patches = self.patches
|
122
|
-
|
123
|
-
|
124
|
-
patch(package, kept_patches)
|
125
|
+
if cur_patches.map(&:last) != needed_patches.map(&:last)
|
126
|
+
patch(package, [])
|
125
127
|
end
|
126
128
|
|
127
129
|
retry_count = 0
|
@@ -239,11 +241,15 @@ class Importer
|
|
239
241
|
end
|
240
242
|
|
241
243
|
private
|
244
|
+
|
245
|
+
def patchdir(package)
|
246
|
+
File.join(package.importdir, ".autobuild-patches")
|
247
|
+
end
|
242
248
|
|
243
249
|
# We assume that package.importdir already exists (checkout is supposed to
|
244
250
|
# have been called)
|
245
251
|
def patchlist(package)
|
246
|
-
File.join(package
|
252
|
+
File.join(patchdir(package), "list")
|
247
253
|
end
|
248
254
|
|
249
255
|
def call_patch(package, reverse, file, patch_level)
|
@@ -256,33 +262,42 @@ class Importer
|
|
256
262
|
def apply(package, path, patch_level = 0); call_patch(package, false, path, patch_level) end
|
257
263
|
def unapply(package, path, patch_level = 0); call_patch(package, true, path, patch_level) end
|
258
264
|
|
265
|
+
def parse_patch_list(patches_file)
|
266
|
+
File.readlines(patches_file).map do |line|
|
267
|
+
line = line.rstrip
|
268
|
+
if line =~ /^(.*)\s+(\d+)$/
|
269
|
+
path = $1
|
270
|
+
level = Integer($2)
|
271
|
+
else
|
272
|
+
path = line
|
273
|
+
level = 0
|
274
|
+
end
|
275
|
+
[path, level, File.read(path)]
|
276
|
+
end
|
277
|
+
end
|
278
|
+
|
259
279
|
def currently_applied_patches(package)
|
260
280
|
patches_file = patchlist(package)
|
261
|
-
if
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
path = line
|
272
|
-
level = 0
|
273
|
-
end
|
274
|
-
current_patches << [path, level]
|
275
|
-
end
|
276
|
-
end
|
277
|
-
current_patches
|
281
|
+
if File.exists?(patches_file)
|
282
|
+
return parse_patch_list(patches_file)
|
283
|
+
end
|
284
|
+
|
285
|
+
patches_file = File.join(package.importdir, "patches-autobuild-stamp")
|
286
|
+
if File.exists?(patches_file)
|
287
|
+
cur_patches = parse_patch_list(patches_file)
|
288
|
+
save_patch_state(package, cur_patches)
|
289
|
+
FileUtils.rm_f patches_file
|
290
|
+
return currently_applied_patches(package)
|
278
291
|
end
|
292
|
+
|
293
|
+
return Array.new
|
279
294
|
end
|
280
295
|
|
281
296
|
def patch(package, patches = self.patches)
|
282
297
|
# Get the list of already applied patches
|
283
298
|
cur_patches = currently_applied_patches(package)
|
284
299
|
|
285
|
-
if cur_patches == patches
|
300
|
+
if cur_patches.map(&:last) == patches.map(&:last)
|
286
301
|
return false
|
287
302
|
end
|
288
303
|
|
@@ -300,23 +315,36 @@ class Importer
|
|
300
315
|
end
|
301
316
|
|
302
317
|
while p = cur_patches.last
|
303
|
-
p, level = *p
|
318
|
+
p, level, _ = *p
|
304
319
|
unapply(package, p, level)
|
305
320
|
cur_patches.pop
|
306
321
|
end
|
307
322
|
|
308
|
-
patches.to_a.each do |p, level|
|
323
|
+
patches.to_a.each do |p, level, content|
|
309
324
|
apply(package, p, level)
|
310
|
-
cur_patches << [p, level]
|
325
|
+
cur_patches << [p, level, content]
|
311
326
|
end
|
312
327
|
ensure
|
313
|
-
|
314
|
-
f.write(cur_patches.map { |p, l| "#{p} #{l}" }.join("\n"))
|
315
|
-
end
|
328
|
+
save_patch_state(package, cur_patches)
|
316
329
|
end
|
317
330
|
|
318
331
|
return true
|
319
332
|
end
|
333
|
+
|
334
|
+
def save_patch_state(package, cur_patches)
|
335
|
+
patch_dir = patchdir(package)
|
336
|
+
FileUtils.mkdir_p patch_dir
|
337
|
+
cur_patches = cur_patches.each_with_index.map do |(path, level, content), idx|
|
338
|
+
path = File.join(patch_dir, idx.to_s)
|
339
|
+
File.open(path, 'w') do |patch_io|
|
340
|
+
patch_io.write content
|
341
|
+
end
|
342
|
+
[path, level]
|
343
|
+
end
|
344
|
+
File.open(patchlist(package), 'w') do |f|
|
345
|
+
f.write(cur_patches.map { |p, l| "#{p} #{l}" }.join("\n"))
|
346
|
+
end
|
347
|
+
end
|
320
348
|
|
321
349
|
def supports_relocation?; false end
|
322
350
|
end
|
data/lib/autobuild/timestamps.rb
CHANGED
@@ -31,6 +31,7 @@ module Autobuild
|
|
31
31
|
# Exclude autobuild timestamps
|
32
32
|
exclude.each { |rx| raise unless Regexp === rx }
|
33
33
|
exclude << (/#{Regexp.quote(STAMPFILE)}$/)
|
34
|
+
exclude << (/\.autobuild-patches$/)
|
34
35
|
|
35
36
|
Autobuild.message "getting tree timestamp for #{path}" if Autobuild.debug
|
36
37
|
latest = Time.at(0)
|
data/lib/autobuild/version.rb
CHANGED
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.7.
|
4
|
+
version: 1.7.10
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-12-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -178,8 +178,8 @@ signing_key:
|
|
178
178
|
specification_version: 3
|
179
179
|
summary: Library to handle build systems and import mechanisms
|
180
180
|
test_files:
|
181
|
-
- test/
|
182
|
-
- test/test_subcommand.rb
|
181
|
+
- test/test_import_cvs.rb
|
183
182
|
- test/test_reporting.rb
|
183
|
+
- test/test_subcommand.rb
|
184
184
|
- test/test_import_svn.rb
|
185
|
-
- test/
|
185
|
+
- test/test_import_tar.rb
|