autobuild 1.10.0.rc3 → 1.10.0.rc4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/autobuild/environment.rb +8 -0
- data/lib/autobuild/import/git.rb +185 -54
- data/lib/autobuild/subcommand.rb +5 -10
- data/lib/autobuild/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f1f39b2297d4736d60828fa77e676d89de569c07
|
4
|
+
data.tar.gz: 53d2121fc0311cbb65300300e0189bc5c68454bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 92d0e2f85b18705b6110a357c300c0f660432a773ae914149fcc99ea96193754e4dd2f7152954375b1d2e0d92211e8d651aac5ac27ccb9afe7ac5fc538502096
|
7
|
+
data.tar.gz: 0aa3efd0d3e06853355ef9b979419ba0f1b5927dba08ba26f4b6295449d83569f9fe925eb909a20bb7be8751124f9a9e7873bd2236f3d331314b981202cf5286
|
@@ -623,6 +623,14 @@ def add_prefix(newprefix, includes = nil)
|
|
623
623
|
end
|
624
624
|
end
|
625
625
|
|
626
|
+
def find_in_path(file, path_var = 'PATH')
|
627
|
+
path = (value(path_var) || Array.new).
|
628
|
+
find { |dir| File.exist?(File.join(dir, file)) }
|
629
|
+
if path
|
630
|
+
return File.join(path, file)
|
631
|
+
end
|
632
|
+
end
|
633
|
+
|
626
634
|
def isolate
|
627
635
|
self.inherit = false
|
628
636
|
push_path 'PATH', '/usr/local/bin', '/usr/bin', '/bin'
|
data/lib/autobuild/import/git.rb
CHANGED
@@ -73,13 +73,32 @@ def self.at_least_version(*version)
|
|
73
73
|
compare_versions(self.version, version) <= 0
|
74
74
|
end
|
75
75
|
|
76
|
-
# Creates an importer which tracks
|
77
|
-
#
|
76
|
+
# Creates an importer which tracks a repository and branch.
|
77
|
+
#
|
78
|
+
# This importer uses the 'git' tool to perform the import. It defaults
|
79
|
+
# to 'git' and can be configured by doing
|
78
80
|
#
|
79
|
-
# This importer uses the 'git' tool to perform the
|
80
|
-
# import. It defaults to 'git' and can be configured by
|
81
|
-
# doing
|
82
81
|
# Autobuild.programs['git'] = 'my_git_tool'
|
82
|
+
#
|
83
|
+
# @param [String] branch deprecated, use the 'branch' named option
|
84
|
+
# instead
|
85
|
+
#
|
86
|
+
# @option options [String] push_to (repository) the URL to set up as push_to URL in
|
87
|
+
# the remote(s). Note that it is not used internally by this class
|
88
|
+
# @option options [String] branch (master) the branch we should track. It is used
|
89
|
+
# both as {#local_branch} and {#remote_branch}
|
90
|
+
# @option options [String] tag (nil) a tag at which we should pin the
|
91
|
+
# checkout. Cannot be given at the same time than :commit
|
92
|
+
# @option options [String] commit (nil) a commit ID at which we should pin the
|
93
|
+
# checkout. Cannot be given at the same time than :tag
|
94
|
+
# @option options [String] repository_id (git:#{repository}) a string that allows to
|
95
|
+
# uniquely identify a repository. The meaning is caller-specific. For
|
96
|
+
# instance, autoproj uses repository_id to check whether two Git
|
97
|
+
# importers fetches from the same repository.
|
98
|
+
# @option options [Boolean] with_submodules (false) whether the importer should
|
99
|
+
# checkout and update submodules. Note that in an autobuild-based
|
100
|
+
# workflow, it is recommended to not use submodules but checkout all
|
101
|
+
# repositories separately instead.
|
83
102
|
def initialize(repository, branch = nil, options = {})
|
84
103
|
@alternates = Git.default_alternates.dup
|
85
104
|
@git_dir_cache = Array.new
|
@@ -124,36 +143,32 @@ def initialize(repository, branch = nil, options = {})
|
|
124
143
|
|
125
144
|
# The remote repository URL.
|
126
145
|
#
|
127
|
-
#
|
146
|
+
# @see push_to
|
128
147
|
attr_accessor :repository
|
129
148
|
|
130
149
|
# If set, this URL will be listed as a pushurl for the tracked branch.
|
131
150
|
# It makes it possible to have a read-only URL for fetching and specify
|
132
151
|
# a push URL for people that have commit rights
|
133
152
|
#
|
134
|
-
#
|
135
|
-
attr_accessor :push_to
|
136
|
-
|
137
|
-
# The remote branch to which we should push
|
153
|
+
# It is not used by the importer itself
|
138
154
|
#
|
139
|
-
#
|
140
|
-
|
155
|
+
# {#repository} is always used for read-only operations
|
156
|
+
attr_accessor :push_to
|
141
157
|
|
142
158
|
# Set to true if checkout should be done with submodules
|
143
159
|
#
|
144
|
-
# Defaults to
|
160
|
+
# Defaults to false
|
145
161
|
attr_writer :with_submodules
|
146
162
|
|
147
163
|
# The branch this importer is tracking
|
148
|
-
#
|
149
|
-
# If set, both commit and tag have to be nil.
|
150
164
|
attr_accessor :branch
|
151
165
|
|
152
|
-
#
|
153
|
-
#
|
154
|
-
# If not set, it defaults to #branch
|
166
|
+
# Set {#local_branch}
|
155
167
|
attr_writer :local_branch
|
156
168
|
|
169
|
+
# Set {#remote_branch}
|
170
|
+
attr_writer :remote_branch
|
171
|
+
|
157
172
|
# A list of local (same-host) repositories that will be used instead of
|
158
173
|
# the remote one when possible. It has one major issue (see below), so
|
159
174
|
# use at your own risk.
|
@@ -182,26 +197,28 @@ def initialize(repository, branch = nil, options = {})
|
|
182
197
|
|
183
198
|
# The branch that should be used on the local clone
|
184
199
|
#
|
185
|
-
# Defaults to #branch
|
200
|
+
# Defaults to {#branch}
|
186
201
|
def local_branch
|
187
202
|
@local_branch || branch
|
188
203
|
end
|
189
204
|
|
190
205
|
# The remote branch to which we should push
|
191
206
|
#
|
192
|
-
# Defaults to #branch
|
207
|
+
# Defaults to {#branch}
|
193
208
|
def remote_branch
|
194
209
|
@remote_branch || branch
|
195
210
|
end
|
196
211
|
|
197
212
|
# The tag we are pointing to. It is a tag name.
|
198
213
|
#
|
199
|
-
#
|
214
|
+
# Setting it through this method is deprecated, use {#relocate} to set
|
215
|
+
# the tag
|
200
216
|
attr_accessor :tag
|
201
217
|
|
202
218
|
# The commit we are pointing to. It is a commit ID.
|
203
219
|
#
|
204
|
-
#
|
220
|
+
# Setting it through this method is deprecated, use {#relocate} to set
|
221
|
+
# the commit
|
205
222
|
attr_accessor :commit
|
206
223
|
|
207
224
|
# True if it is allowed to merge remote updates automatically. If false
|
@@ -209,19 +226,22 @@ def remote_branch
|
|
209
226
|
# a fast-forward
|
210
227
|
def merge?; !!@merge end
|
211
228
|
|
212
|
-
#Return true if the git checkout should be done with submodules
|
213
|
-
#detaul it false
|
214
|
-
def with_submodules?; !!@with_submodules end
|
215
|
-
|
216
229
|
# Set the merge flag. See #merge?
|
217
230
|
def merge=(flag); @merge = flag end
|
218
231
|
|
219
|
-
#
|
232
|
+
# Whether the git checkout should be done with submodules
|
233
|
+
def with_submodules?; !!@with_submodules end
|
234
|
+
|
235
|
+
# @api private
|
236
|
+
#
|
237
|
+
# Verifies that the package's {Package#importdir} points to a git
|
220
238
|
# repository
|
221
239
|
def validate_importdir(package)
|
222
240
|
return git_dir(package, true)
|
223
241
|
end
|
224
242
|
|
243
|
+
# @api private
|
244
|
+
#
|
225
245
|
# Resolves the git directory associated with path, and tells whether it
|
226
246
|
# is a bare repository or not
|
227
247
|
#
|
@@ -243,6 +263,15 @@ def self.resolve_git_dir(path)
|
|
243
263
|
end
|
244
264
|
end
|
245
265
|
|
266
|
+
# @api private
|
267
|
+
#
|
268
|
+
# Returns either the package's working copy or git directory
|
269
|
+
#
|
270
|
+
# @param [Package] package the package to resolve
|
271
|
+
# @param [Boolean] require_working_copy whether a working copy is
|
272
|
+
# required
|
273
|
+
# @raise if the package's {Package#importdir} is not a git repository,
|
274
|
+
# or if it is a bare repository and require_working_copy is true
|
246
275
|
def git_dir(package, require_working_copy)
|
247
276
|
if @git_dir_cache[0] == package.importdir
|
248
277
|
dir, style = *@git_dir_cache[1, 2]
|
@@ -255,12 +284,17 @@ def git_dir(package, require_working_copy)
|
|
255
284
|
dir
|
256
285
|
end
|
257
286
|
|
287
|
+
# @api private
|
288
|
+
#
|
289
|
+
# (see Git#git_dir)
|
258
290
|
def self.git_dir(package, require_working_copy)
|
259
291
|
dir, style = Git.resolve_git_dir(package.importdir)
|
260
292
|
validate_git_dir(package, require_working_copy, dir, style)
|
261
293
|
dir
|
262
294
|
end
|
263
295
|
|
296
|
+
# @api private
|
297
|
+
#
|
264
298
|
# Validates the return value of {resolve_git_dir}
|
265
299
|
#
|
266
300
|
# @param [Package] package the package we are working on
|
@@ -287,7 +321,11 @@ def self.validate_git_dir(package, require_working_copy, dir, style)
|
|
287
321
|
end
|
288
322
|
|
289
323
|
# Computes the merge status for this package between two existing tags
|
290
|
-
#
|
324
|
+
#
|
325
|
+
# @param [Package] package
|
326
|
+
# @param [String] from_tag the source tag
|
327
|
+
# @param [String] to_tag the target tag
|
328
|
+
# @raise [ArgumentError] if one of the tags is unknown
|
291
329
|
def delta_between_tags(package, from_tag, to_tag)
|
292
330
|
pkg_tags = tags(package)
|
293
331
|
if not pkg_tags.has_key?(from_tag)
|
@@ -303,8 +341,17 @@ def delta_between_tags(package, from_tag, to_tag)
|
|
303
341
|
merge_status(package, to_commit, from_commit)
|
304
342
|
end
|
305
343
|
|
306
|
-
#
|
307
|
-
|
344
|
+
# The tags of this packages
|
345
|
+
#
|
346
|
+
# @param [Package] package
|
347
|
+
# @option options [Boolean] only_local (false) whether the tags should
|
348
|
+
# be fetch from the remote first, or if one should only list tags that
|
349
|
+
# are already known locally
|
350
|
+
# @return [Hash<String,String>] a mapping from a tag name to its commit
|
351
|
+
# ID
|
352
|
+
def tags(package, options = Hash.new)
|
353
|
+
only_local = options.fetch(only_local: false)
|
354
|
+
|
308
355
|
run_git_bare(package, 'fetch', '--tags')
|
309
356
|
tag_list = run_git_bare(package, 'show-ref', '--tags').map(&:strip)
|
310
357
|
tags = Hash.new
|
@@ -315,10 +362,21 @@ def tags(package)
|
|
315
362
|
tags
|
316
363
|
end
|
317
364
|
|
365
|
+
# @api private
|
366
|
+
#
|
367
|
+
# Run a git command that require a working copy
|
368
|
+
#
|
369
|
+
# @param [Package] package
|
370
|
+
# @param [Array] args the git arguments, excluding the git command
|
371
|
+
# itself. The last argument can be a hash, in which case it is passed
|
372
|
+
# as an option hash to {Package#run}
|
318
373
|
def run_git(package, *args)
|
319
374
|
self.class.run_git(package, *args)
|
320
375
|
end
|
321
376
|
|
377
|
+
# @api private
|
378
|
+
#
|
379
|
+
# (see Git#run_git)
|
322
380
|
def self.run_git(package, *args)
|
323
381
|
options = Hash.new
|
324
382
|
if args.last.kind_of?(Hash)
|
@@ -330,14 +388,25 @@ def self.run_git(package, *args)
|
|
330
388
|
Hash[working_directory: working_directory].merge(options))
|
331
389
|
end
|
332
390
|
|
391
|
+
# @api private
|
392
|
+
#
|
393
|
+
# Run a git command that only need a git directory
|
394
|
+
#
|
395
|
+
# @param (see Git#run_git)
|
333
396
|
def run_git_bare(package, *args)
|
334
397
|
self.class.run_git_bare(package, *args)
|
335
398
|
end
|
336
399
|
|
400
|
+
# @api private
|
401
|
+
#
|
402
|
+
# (see Git#run_git_bare)
|
337
403
|
def self.run_git_bare(package, *args)
|
338
404
|
package.run(:import, Autobuild.tool(:git), '--git-dir', git_dir(package, false), *args)
|
339
405
|
end
|
340
406
|
|
407
|
+
# @api private
|
408
|
+
#
|
409
|
+
# Set a remote up in the repositorie's configuration
|
341
410
|
def setup_remote(package, remote_name, repository, push_to = repository)
|
342
411
|
run_git_bare(package, 'config', '--replace-all', "remote.#{remote_name}.url", repository)
|
343
412
|
run_git_bare(package, 'config', '--replace-all', "remote.#{remote_name}.pushurl", push_to || repository)
|
@@ -362,6 +431,8 @@ def each_configured_remote
|
|
362
431
|
end
|
363
432
|
end
|
364
433
|
|
434
|
+
# @api private
|
435
|
+
#
|
365
436
|
# Updates the git repository's configuration for the target remote
|
366
437
|
def update_remotes_configuration(package)
|
367
438
|
each_configured_remote do |*args|
|
@@ -397,13 +468,16 @@ def each_remote_ref(package)
|
|
397
468
|
end
|
398
469
|
end
|
399
470
|
|
471
|
+
# @api private
|
472
|
+
#
|
400
473
|
# Fetches updates from the remote repository. Returns the remote commit
|
401
474
|
# ID on success, nil on failure. Expects the current directory to be the
|
402
475
|
# package's source directory.
|
403
476
|
def fetch_remote(package, options = Hash.new)
|
404
477
|
validate_importdir(package)
|
405
|
-
|
406
|
-
refspec
|
478
|
+
if !options[:refspec]
|
479
|
+
raise ArgumentError, "required argument 'refspec' not given"
|
480
|
+
end
|
407
481
|
|
408
482
|
git_dir = git_dir(package, false)
|
409
483
|
|
@@ -418,7 +492,7 @@ def fetch_remote(package, options = Hash.new)
|
|
418
492
|
# configuration parameters only if the repository and branch are
|
419
493
|
# OK (i.e. we keep old working configuration instead)
|
420
494
|
refspec = Array(options[:refspec])
|
421
|
-
run_git_bare(package, 'fetch',
|
495
|
+
run_git_bare(package, 'fetch', repository, *refspec, retry: true)
|
422
496
|
|
423
497
|
update_remotes_configuration(package)
|
424
498
|
|
@@ -433,13 +507,20 @@ def fetch_remote(package, options = Hash.new)
|
|
433
507
|
end
|
434
508
|
|
435
509
|
# Update the remote tag if needs be
|
436
|
-
if
|
510
|
+
if (options[:refspec] == tag) && commit_id
|
437
511
|
run_git_bare(package, 'update-ref', "-m", "updated by autobuild", "refs/remotes/#{remote_name}/#{remote_branch}", commit_id)
|
438
512
|
end
|
439
513
|
|
440
514
|
commit_id
|
441
515
|
end
|
442
516
|
|
517
|
+
# @api private
|
518
|
+
#
|
519
|
+
# Tests whether the package's working copy has uncommitted changes
|
520
|
+
#
|
521
|
+
# @param [Package] package
|
522
|
+
# @param [Boolean] with_untracked_files whether untracked files are
|
523
|
+
# considered uncommitted changes
|
443
524
|
def self.has_uncommitted_changes?(package, with_untracked_files = false)
|
444
525
|
status = run_git(package, 'status', '--porcelain').map(&:strip)
|
445
526
|
if with_untracked_files
|
@@ -449,34 +530,56 @@ def self.has_uncommitted_changes?(package, with_untracked_files = false)
|
|
449
530
|
end
|
450
531
|
end
|
451
532
|
|
533
|
+
# @api private
|
534
|
+
#
|
452
535
|
# Returns the commit ID of what we should consider being the remote
|
453
536
|
# commit
|
454
537
|
#
|
455
538
|
# @param [Package] package
|
456
|
-
# @
|
539
|
+
# @options options [Boolean] only_local if true, no remote access should be
|
457
540
|
# performed, in which case the current known state of the remote will be
|
458
541
|
# used. If false, we access the remote repository to fetch the actual
|
459
542
|
# commit ID
|
543
|
+
# @options options [Array] refspec list of refs to fetch. Only the first
|
544
|
+
# one is returned by this method
|
460
545
|
# @return [String] the commit ID as a string
|
461
|
-
def current_remote_commit(package,
|
546
|
+
def current_remote_commit(package, options = Hash.new)
|
547
|
+
if !options.kind_of?(Hash)
|
548
|
+
options = Hash[only_local: options]
|
549
|
+
end
|
550
|
+
only_local = options.delete(:only_local)
|
551
|
+
|
552
|
+
|
462
553
|
if only_local
|
554
|
+
refspec = options[:refspec] ||
|
555
|
+
("refs/tags/#{tag}" if tag) ||
|
556
|
+
"refs/remotes/#{remote_name}/#{remote_branch}"
|
557
|
+
refspec = Array(refspec).first
|
463
558
|
begin
|
464
|
-
run_git_bare(package, 'show-ref', '-s',
|
559
|
+
run_git_bare(package, 'show-ref', '-s', refspec).first.strip
|
465
560
|
rescue SubcommandFailed
|
466
|
-
raise PackageException.new(package, "import"), "cannot resolve
|
561
|
+
raise PackageException.new(package, "import"), "cannot resolve #{refspec}"
|
467
562
|
end
|
468
|
-
else
|
469
|
-
|
563
|
+
else
|
564
|
+
refspec = options[:refspec] ||
|
565
|
+
("refs/tags/#{tag}" if tag) ||
|
566
|
+
"refs/heads/#{remote_branch}"
|
567
|
+
begin fetch_remote(package, refspec: refspec)
|
470
568
|
rescue Exception => e
|
471
569
|
return fallback(e, package, :status, package, only_local)
|
472
570
|
end
|
473
571
|
end
|
474
572
|
end
|
475
573
|
|
574
|
+
# Returns a {Status} object that represents the status of this package
|
575
|
+
# w.r.t. the expected remote repository and branch
|
576
|
+
def status(package, options = Hash.new)
|
577
|
+
if !options.kind_of?(Hash)
|
578
|
+
only_local = options
|
579
|
+
else
|
580
|
+
only_local = options.fetch(:only_local, false)
|
581
|
+
end
|
476
582
|
|
477
|
-
# Returns a Importer::Status object that represents the status of this
|
478
|
-
# package w.r.t. the root repository
|
479
|
-
def status(package, only_local = false)
|
480
583
|
validate_importdir(package)
|
481
584
|
remote_commit = current_remote_commit(package, only_local)
|
482
585
|
status = merge_status(package, remote_commit)
|
@@ -546,6 +649,10 @@ def on_target_branch?(package)
|
|
546
649
|
on_local_branch?(package)
|
547
650
|
end
|
548
651
|
|
652
|
+
# A {Importer::Status} object extended to store more git-specific
|
653
|
+
# information
|
654
|
+
#
|
655
|
+
# This is the value returned by {Git#status}
|
549
656
|
class Status < Importer::Status
|
550
657
|
attr_reader :fetch_commit
|
551
658
|
attr_reader :head_commit
|
@@ -578,6 +685,15 @@ def log(package, from, to)
|
|
578
685
|
end
|
579
686
|
end
|
580
687
|
|
688
|
+
# @api private
|
689
|
+
#
|
690
|
+
# Resolves a revision into a commit ID
|
691
|
+
#
|
692
|
+
# @param [Package] package
|
693
|
+
# @param [String] name the revspec that is to be resolved
|
694
|
+
# @param [String] objecT_type the type of git object we want to resolve to
|
695
|
+
# @return [String] the commit ID
|
696
|
+
# @raise [PackageException] if name cannot be found
|
581
697
|
def rev_parse(package, name, object_type = "commit")
|
582
698
|
if object_type
|
583
699
|
name = "#{name}^{#{object_type}}"
|
@@ -587,6 +703,12 @@ def rev_parse(package, name, object_type = "commit")
|
|
587
703
|
raise PackageException.new(package, 'import'), "failed to resolve #{name}. Are you sure this commit, branch or tag exists ?"
|
588
704
|
end
|
589
705
|
|
706
|
+
# Returns the file's conents at a certain commit
|
707
|
+
#
|
708
|
+
# @param [Package] package
|
709
|
+
# @param [String] commit
|
710
|
+
# @param [String] path
|
711
|
+
# @return [String]
|
590
712
|
def show(package, commit, path)
|
591
713
|
run_git_bare(package, 'show', "#{commit}:#{path}").join("\n")
|
592
714
|
rescue Autobuild::SubcommandFailed
|
@@ -712,6 +834,8 @@ def merge_status(package, fetch_commit, reference_commit = "HEAD")
|
|
712
834
|
Status.new(package, status, fetch_commit, head_commit, common_commit)
|
713
835
|
end
|
714
836
|
|
837
|
+
# @api private
|
838
|
+
#
|
715
839
|
# Updates the git alternates file in the already checked out package to
|
716
840
|
# match {#alternates}
|
717
841
|
#
|
@@ -746,6 +870,8 @@ def update_alternates(package)
|
|
746
870
|
end
|
747
871
|
end
|
748
872
|
|
873
|
+
# @api private
|
874
|
+
#
|
749
875
|
# Safely resets the current branch to a given commit
|
750
876
|
#
|
751
877
|
# This method safely resets the current branch to a given commit,
|
@@ -803,6 +929,8 @@ def reset_head_to_commit(package, target_commit, fetch_commit, options = Hash.ne
|
|
803
929
|
# @option (see Package#update)
|
804
930
|
def update(package, options = Hash.new)
|
805
931
|
validate_importdir(package)
|
932
|
+
only_local = options.fetch(:only_local, false)
|
933
|
+
reset = options.fetch(:reset, false)
|
806
934
|
|
807
935
|
# This is really really a hack to workaround how broken the
|
808
936
|
# importdir thing is
|
@@ -817,16 +945,17 @@ def update(package, options = Hash.new)
|
|
817
945
|
|
818
946
|
if pinned_state
|
819
947
|
if !has_commit?(package, pinned_state)
|
820
|
-
fetch_commit = current_remote_commit(
|
948
|
+
fetch_commit = current_remote_commit(
|
949
|
+
package,
|
950
|
+
only_local: only_local,
|
951
|
+
refspec: [remote_branch, tag])
|
821
952
|
end
|
822
|
-
pinned_state = rev_parse(package, pinned_state)
|
953
|
+
target_commit = pinned_state = rev_parse(package, pinned_state)
|
954
|
+
else
|
955
|
+
target_commit = fetch_commit =
|
956
|
+
current_remote_commit(package, only_local: only_local)
|
823
957
|
end
|
824
958
|
|
825
|
-
target_commit =
|
826
|
-
if pinned_state then pinned_state
|
827
|
-
else fetch_commit ||= current_remote_commit(package, options[:only_local])
|
828
|
-
end
|
829
|
-
|
830
959
|
# If we are tracking a commit/tag, just check it out and return
|
831
960
|
if !has_local_branch?(package)
|
832
961
|
package.message "%%s: checking out branch %s" % [local_branch]
|
@@ -842,7 +971,7 @@ def update(package, options = Hash.new)
|
|
842
971
|
# Check whether we are already at the requested state
|
843
972
|
if pinned_state
|
844
973
|
current_head = rev_parse(package, 'HEAD')
|
845
|
-
if
|
974
|
+
if reset
|
846
975
|
if current_head == pinned_state
|
847
976
|
return
|
848
977
|
end
|
@@ -853,14 +982,16 @@ def update(package, options = Hash.new)
|
|
853
982
|
end
|
854
983
|
end
|
855
984
|
|
856
|
-
fetch_commit ||= current_remote_commit(
|
857
|
-
|
858
|
-
|
985
|
+
fetch_commit ||= current_remote_commit(
|
986
|
+
package, only_local: only_local, refspec: [remote_branch, tag])
|
987
|
+
if reset
|
988
|
+
reset_head_to_commit(package, target_commit, fetch_commit, force: (reset == :force))
|
859
989
|
else
|
860
990
|
merge_if_simple(package, target_commit)
|
861
991
|
end
|
862
992
|
end
|
863
993
|
|
994
|
+
# @api private
|
864
995
|
def merge_if_simple(package, target_commit)
|
865
996
|
status = merge_status(package, target_commit)
|
866
997
|
if status.needs_update?
|
data/lib/autobuild/subcommand.rb
CHANGED
@@ -234,7 +234,7 @@ def self.run(target, phase, *command)
|
|
234
234
|
options[:working_directory] ||= target.working_directory
|
235
235
|
end
|
236
236
|
|
237
|
-
|
237
|
+
logname = File.join(logdir, "#{target_name.gsub(/[:]/,'_')}-#{phase.to_s.gsub(/[:]/,'_')}.log")
|
238
238
|
if !File.directory?(File.dirname(logname))
|
239
239
|
FileUtils.mkdir_p File.dirname(logname)
|
240
240
|
end
|
@@ -270,7 +270,9 @@ def self.run(target, phase, *command)
|
|
270
270
|
logfile.puts " #{command.join(" ")}"
|
271
271
|
logfile.puts "with environment:"
|
272
272
|
env.keys.sort.each do |key|
|
273
|
-
|
273
|
+
if value = env[key]
|
274
|
+
logfile.puts " '#{key}'='#{value}'"
|
275
|
+
end
|
274
276
|
end
|
275
277
|
logfile.puts
|
276
278
|
logfile.puts "#{Time.now}: running"
|
@@ -302,13 +304,6 @@ def self.run(target, phase, *command)
|
|
302
304
|
|
303
305
|
pid = fork do
|
304
306
|
begin
|
305
|
-
env.each do |k, v|
|
306
|
-
if v
|
307
|
-
ENV[k] = v
|
308
|
-
else
|
309
|
-
ENV.delete(k)
|
310
|
-
end
|
311
|
-
end
|
312
307
|
if options[:working_directory] && (options[:working_directory] != Dir.pwd)
|
313
308
|
Dir.chdir(options[:working_directory])
|
314
309
|
end
|
@@ -336,7 +331,7 @@ def self.run(target, phase, *command)
|
|
336
331
|
if RUBY_VERSION >= "1.9"
|
337
332
|
command << Hash[:close_others => false]
|
338
333
|
end
|
339
|
-
exec(*command)
|
334
|
+
exec(env, *command)
|
340
335
|
rescue Errno::ENOENT
|
341
336
|
cwrite.write([CONTROL_COMMAND_NOT_FOUND].pack('I'))
|
342
337
|
exit(100)
|
data/lib/autobuild/version.rb
CHANGED
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.10.0.
|
4
|
+
version: 1.10.0.rc4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sylvain Joyeux
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-10-
|
11
|
+
date: 2015-10-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|