autobuild 1.5.24 → 1.5.25
Sign up to get free protection for your applications and to get access to all the features.
- data/Changes.txt +3 -0
- data/lib/autobuild/import/git.rb +24 -15
- data/lib/autobuild/package.rb +12 -0
- data/lib/autobuild/packages/dummy.rb +3 -3
- data/lib/autobuild/version.rb +1 -1
- metadata +4 -4
data/Changes.txt
CHANGED
data/lib/autobuild/import/git.rb
CHANGED
@@ -76,6 +76,15 @@ module Autobuild
|
|
76
76
|
# If set, both commit and tag have to be nil.
|
77
77
|
attr_accessor :branch
|
78
78
|
|
79
|
+
# The branch that should be used on the local clone
|
80
|
+
#
|
81
|
+
# If not set, it defaults to #branch
|
82
|
+
attr_writer :local_branch
|
83
|
+
|
84
|
+
def local_branch
|
85
|
+
@local_branch || branch
|
86
|
+
end
|
87
|
+
|
79
88
|
# The tag we are pointing to. It is a tag name.
|
80
89
|
#
|
81
90
|
# If set, both branch and commit have to be nil.
|
@@ -117,11 +126,11 @@ module Autobuild
|
|
117
126
|
end
|
118
127
|
Subprocess.run(package, :import, Autobuild.tool('git'), 'config',
|
119
128
|
"--replace-all", "remote.autobuild.fetch", "+refs/heads/*:refs/remotes/autobuild/*")
|
120
|
-
if
|
129
|
+
if local_branch
|
121
130
|
Subprocess.run(package, :import, Autobuild.tool('git'), 'config',
|
122
|
-
"--replace-all", "branch.#{
|
131
|
+
"--replace-all", "branch.#{local_branch}.remote", "autobuild")
|
123
132
|
Subprocess.run(package, :import, Autobuild.tool('git'), 'config',
|
124
|
-
"--replace-all", "branch.#{
|
133
|
+
"--replace-all", "branch.#{local_branch}.merge", "refs/heads/#{branch}")
|
125
134
|
end
|
126
135
|
|
127
136
|
# We are checking out a specific commit. We just call git fetch
|
@@ -159,7 +168,7 @@ module Autobuild
|
|
159
168
|
remote_commit = nil
|
160
169
|
if only_local
|
161
170
|
Dir.chdir(package.srcdir) do
|
162
|
-
remote_commit = `git show-ref -s refs/heads/#{
|
171
|
+
remote_commit = `git show-ref -s refs/heads/#{local_branch}`.chomp
|
163
172
|
end
|
164
173
|
else
|
165
174
|
remote_commit = fetch_remote(package)
|
@@ -181,7 +190,7 @@ module Autobuild
|
|
181
190
|
# current directory is the package's directory
|
182
191
|
def on_target_branch?
|
183
192
|
current_branch = `git symbolic-ref HEAD`.chomp
|
184
|
-
current_branch == "refs/heads/#{
|
193
|
+
current_branch == "refs/heads/#{local_branch}"
|
185
194
|
end
|
186
195
|
|
187
196
|
class Status < Importer::Status
|
@@ -230,7 +239,7 @@ module Autobuild
|
|
230
239
|
|
231
240
|
def merge_status(fetch_commit)
|
232
241
|
common_commit = `git merge-base HEAD #{fetch_commit}`.chomp
|
233
|
-
head_commit = `git rev-parse #{
|
242
|
+
head_commit = `git rev-parse #{local_branch}`.chomp
|
234
243
|
|
235
244
|
status = if common_commit != fetch_commit
|
236
245
|
if common_commit == head_commit
|
@@ -266,19 +275,19 @@ module Autobuild
|
|
266
275
|
if !on_target_branch?
|
267
276
|
# Check if the target branch already exists. If it is the
|
268
277
|
# case, check it out. Otherwise, create it.
|
269
|
-
if system("git", "show-ref", "--verify", "--quiet", "refs/heads/#{
|
270
|
-
package.progress "switching branch of %s to %s" % [package.name,
|
271
|
-
Subprocess.run(package, :import, Autobuild.tool('git'), 'checkout',
|
278
|
+
if system("git", "show-ref", "--verify", "--quiet", "refs/heads/#{local_branch}")
|
279
|
+
package.progress "switching branch of %s to %s" % [package.name, local_branch]
|
280
|
+
Subprocess.run(package, :import, Autobuild.tool('git'), 'checkout', local_branch)
|
272
281
|
else
|
273
|
-
package.progress "checking out branch %s for %s" % [
|
274
|
-
Subprocess.run(package, :import, Autobuild.tool('git'), 'checkout', '-b',
|
282
|
+
package.progress "checking out branch %s for %s" % [local_branch, package.name]
|
283
|
+
Subprocess.run(package, :import, Autobuild.tool('git'), 'checkout', '-b', local_branch, "FETCH_HEAD")
|
275
284
|
end
|
276
285
|
end
|
277
286
|
|
278
287
|
status = merge_status(fetch_commit)
|
279
288
|
if status.needs_update?
|
280
289
|
if !merge? && status.status == Status::NEEDS_MERGE
|
281
|
-
raise PackageException, "the local and remote
|
290
|
+
raise PackageException, "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.srcdir} and either reset the local branch or merge the remote changes"
|
282
291
|
end
|
283
292
|
Subprocess.run(package, :import, Autobuild.tool('git'), 'merge', fetch_commit)
|
284
293
|
end
|
@@ -308,12 +317,12 @@ module Autobuild
|
|
308
317
|
end
|
309
318
|
|
310
319
|
current_branch = `git symbolic-ref HEAD`.chomp
|
311
|
-
if current_branch == "refs/heads/#{
|
320
|
+
if current_branch == "refs/heads/#{local_branch}"
|
312
321
|
Subprocess.run(package, :import, Autobuild.tool('git'),
|
313
|
-
|
322
|
+
'reset', '--hard', "autobuild/#{branch}")
|
314
323
|
else
|
315
324
|
Subprocess.run(package, :import, Autobuild.tool('git'),
|
316
|
-
|
325
|
+
'checkout', '-b', local_branch, "autobuild/#{branch}")
|
317
326
|
end
|
318
327
|
end
|
319
328
|
end
|
data/lib/autobuild/package.rb
CHANGED
@@ -376,6 +376,18 @@ module Autobuild
|
|
376
376
|
end
|
377
377
|
end
|
378
378
|
|
379
|
+
# Returns the name of all the packages +self+ depends on
|
380
|
+
def all_dependencies(result = Set.new)
|
381
|
+
dependencies.each do |pkg_name|
|
382
|
+
pkg = Autobuild::Package[pkg_name]
|
383
|
+
if !result.include?(pkg.name)
|
384
|
+
result << pkg.name
|
385
|
+
pkg.all_dependencies(result)
|
386
|
+
end
|
387
|
+
end
|
388
|
+
result
|
389
|
+
end
|
390
|
+
|
379
391
|
# Returns true if this package depends on +package_name+ and false
|
380
392
|
# otherwise.
|
381
393
|
def depends_on?(package_name)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Autobuild
|
2
2
|
def self.dummy(spec)
|
3
|
-
|
3
|
+
DummyPackage.new(spec)
|
4
4
|
end
|
5
5
|
|
6
6
|
class DummyPackage < Package
|
@@ -17,11 +17,11 @@ module Autobuild
|
|
17
17
|
|
18
18
|
def prepare
|
19
19
|
%w{import prepare build doc}.each do |phase|
|
20
|
-
|
20
|
+
task "#{name}-#{phase}"
|
21
21
|
t = Rake::Task["#{name}-#{phase}"]
|
22
22
|
def t.needed?; false end
|
23
23
|
end
|
24
|
-
|
24
|
+
task(installstamp)
|
25
25
|
t = Rake::Task[installstamp]
|
26
26
|
def t.needed?; false end
|
27
27
|
|
data/lib/autobuild/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: autobuild
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 49
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 5
|
9
|
-
-
|
10
|
-
version: 1.5.
|
9
|
+
- 25
|
10
|
+
version: 1.5.25
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Sylvain Joyeux
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-11-
|
18
|
+
date: 2010-11-24 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|