autobuild 1.9.0.b2 → 1.9.0.b3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/autobuild/import/archive.rb +10 -0
- data/lib/autobuild/import/git.rb +40 -22
- data/lib/autobuild/importer.rb +2 -0
- data/lib/autobuild/version.rb +1 -1
- data/test/import/test_git.rb +11 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 97d91fdc5b06cf57bc85a29436b8ae83de8bf188
|
4
|
+
data.tar.gz: 366b4196e75cb245ba30e241d3b3b2d57b18919e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 87f2e924550b4c3568e195e065b8e152091d452c177f5409f27ae637019e6e0643a15fde769f124954f23547981c7ef864fb9944659bd849cc20e35ab3f56d79
|
7
|
+
data.tar.gz: cb5e7f5c663ab02bad5c3d1ade8e1090ab2db8e87056af6d33fdd10fc75fa7f37b6e738c05abe81f0582cd4cc5480a47d204398855335ef1c6733dbb92ab7056
|
@@ -262,6 +262,16 @@ module Autobuild
|
|
262
262
|
# It defaults to the global ArchiveImporter.timeout
|
263
263
|
attr_accessor :timeout
|
264
264
|
|
265
|
+
# Tests whether the archive's content is stored within a subdirectory or
|
266
|
+
# not
|
267
|
+
#
|
268
|
+
# If it has a subdirectory, its name is assumed to be the package's
|
269
|
+
# basename, or the value returned by {archive_dir} if the archive_dir
|
270
|
+
# option was given to {initialize}
|
271
|
+
def has_subdirectory?
|
272
|
+
!@options[:no_subdirectory]
|
273
|
+
end
|
274
|
+
|
265
275
|
# Creates a new importer which downloads +url+ in +cachedir+ and unpacks it. The following options
|
266
276
|
# are allowed:
|
267
277
|
# [:cachedir] the cache directory. Defaults to "#{Autobuild.prefix}/cache"
|
data/lib/autobuild/import/git.rb
CHANGED
@@ -671,25 +671,21 @@ module Autobuild
|
|
671
671
|
update_alternates(package)
|
672
672
|
end
|
673
673
|
|
674
|
-
|
675
|
-
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
|
682
|
-
end
|
683
|
-
elsif commit_present_in?(package, pinned_state, current_head)
|
684
|
-
return
|
674
|
+
pinned_state =
|
675
|
+
if commit then commit
|
676
|
+
elsif tag then "refs/tags/#{tag}"
|
677
|
+
end
|
678
|
+
|
679
|
+
if pinned_state
|
680
|
+
if !has_commit?(package, pinned_state)
|
681
|
+
fetch_commit = current_remote_commit(package, options[:only_local])
|
685
682
|
end
|
683
|
+
pinned_state = rev_parse(package, pinned_state)
|
686
684
|
end
|
687
|
-
fetch_commit = current_remote_commit(package, options[:only_local])
|
688
685
|
|
689
686
|
target_commit =
|
690
|
-
if
|
691
|
-
|
692
|
-
else fetch_commit
|
687
|
+
if pinned_state then pinned_state
|
688
|
+
else fetch_commit ||= current_remote_commit(package, options[:only_local])
|
693
689
|
end
|
694
690
|
|
695
691
|
# If we are tracking a commit/tag, just check it out and return
|
@@ -699,21 +695,43 @@ module Autobuild
|
|
699
695
|
return
|
700
696
|
end
|
701
697
|
|
702
|
-
if !
|
698
|
+
if !on_local_branch?(package)
|
703
699
|
package.message "%%s: switching to branch %s" % [local_branch]
|
704
700
|
run_git(package, 'checkout', local_branch)
|
705
701
|
end
|
706
702
|
|
703
|
+
# Check whether we are already at the requested state
|
704
|
+
if pinned_state
|
705
|
+
current_head = rev_parse(package, 'HEAD')
|
706
|
+
if options[:reset]
|
707
|
+
if current_head == pinned_state
|
708
|
+
return
|
709
|
+
elsif merge_if_simple(package, pinned_state)
|
710
|
+
return
|
711
|
+
end
|
712
|
+
elsif commit_present_in?(package, pinned_state, current_head)
|
713
|
+
return
|
714
|
+
elsif merge_if_simple(package, pinned_state)
|
715
|
+
return
|
716
|
+
end
|
717
|
+
end
|
718
|
+
|
719
|
+
fetch_commit ||= current_remote_commit(package, options[:only_local])
|
707
720
|
if options[:reset]
|
708
721
|
commit_pinning(package, target_commit, fetch_commit)
|
709
722
|
else
|
710
|
-
|
711
|
-
|
712
|
-
|
713
|
-
|
714
|
-
|
715
|
-
|
723
|
+
merge_if_simple(package, target_commit)
|
724
|
+
end
|
725
|
+
end
|
726
|
+
|
727
|
+
def merge_if_simple(package, target_commit)
|
728
|
+
status = merge_status(package, target_commit)
|
729
|
+
if status.needs_update?
|
730
|
+
if !merge? && status.status == Status::NEEDS_MERGE
|
731
|
+
raise PackageException.new(package, 'import'), "the local branch '#{local_branch}' and the remote branch #{branch} of #{package.name} have diverged, and I therefore refuse to update automatically. Go into #{package.importdir} and either reset the local branch or merge the remote changes"
|
716
732
|
end
|
733
|
+
run_git(package, 'merge', target_commit)
|
734
|
+
true
|
717
735
|
end
|
718
736
|
end
|
719
737
|
|
data/lib/autobuild/importer.rb
CHANGED
@@ -242,6 +242,8 @@ class Importer
|
|
242
242
|
#
|
243
243
|
# @raises ConfigException if package.importdir exists and is not a directory
|
244
244
|
#
|
245
|
+
# @option options [Boolean] :checkout_only (false) if true, the importer
|
246
|
+
# will not update an already checked-out package.
|
245
247
|
# @option options [Boolean] :only_local (false) if true, will only perform
|
246
248
|
# actions that do not require network access. Importers that do not
|
247
249
|
# support this mode will simply do nothing
|
data/lib/autobuild/version.rb
CHANGED
data/test/import/test_git.rb
CHANGED
@@ -317,6 +317,17 @@ describe Autobuild::Git do
|
|
317
317
|
importer.import(pkg)
|
318
318
|
end
|
319
319
|
end
|
320
|
+
it "switches to the local branch regardless of the presence of the tag or commit" do
|
321
|
+
importer.import(pkg)
|
322
|
+
head = importer.rev_parse(pkg, 'HEAD')
|
323
|
+
importer.run_git(pkg, 'reset', '--hard', 'master~1')
|
324
|
+
importer.run_git(pkg, 'branch', 'local')
|
325
|
+
importer.local_branch = 'local'
|
326
|
+
importer.relocate(importer.repository, tag: 'third_commit')
|
327
|
+
importer.update(pkg)
|
328
|
+
assert_equal 'refs/heads/local', importer.current_branch(pkg)
|
329
|
+
assert_equal head, importer.rev_parse(pkg, 'refs/remotes/autobuild/master')
|
330
|
+
end
|
320
331
|
end
|
321
332
|
describe "with a specific commit given" do
|
322
333
|
def assert_on_commit(id)
|
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.9.0.
|
4
|
+
version: 1.9.0.b3
|
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-03-
|
11
|
+
date: 2015-03-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -178,4 +178,5 @@ rubygems_version: 2.2.2
|
|
178
178
|
signing_key:
|
179
179
|
specification_version: 4
|
180
180
|
summary: Library to handle build systems and import mechanisms
|
181
|
-
test_files:
|
181
|
+
test_files:
|
182
|
+
- test/suite.rb
|