autobuild 1.10.0.b4 → 1.10.0.rc1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitattributes +1 -0
- data/.gitignore +5 -0
- data/.travis.yml +5 -0
- data/Changes.txt +8 -0
- data/Gemfile +3 -0
- data/README.md +54 -0
- data/Rakefile +7 -22
- data/autobuild.gemspec +30 -0
- data/lib/autobuild/environment.rb +27 -4
- data/lib/autobuild/import/archive.rb +5 -9
- data/lib/autobuild/import/git.rb +6 -8
- data/lib/autobuild/importer.rb +67 -0
- data/lib/autobuild/reporting.rb +7 -5
- data/lib/autobuild/test.rb +2 -14
- data/lib/autobuild/version.rb +1 -1
- data/manifest.xml +21 -0
- metadata +67 -48
- data/.gemtest +0 -0
- data/README.txt +0 -181
- data/TODO +0 -9
- data/test/data/cvsroot.tar +0 -0
- data/test/data/gitrepo-with-extra-commit-and-tag.tar +0 -0
- data/test/data/gitrepo.tar +0 -0
- data/test/data/svnroot.tar +0 -0
- data/test/data/tarimport.tar.gz +0 -0
- data/test/import/test_cvs.rb +0 -51
- data/test/import/test_git.rb +0 -446
- data/test/import/test_svn.rb +0 -144
- data/test/import/test_tar.rb +0 -95
- data/test/suite.rb +0 -7
- data/test/test_config.rb +0 -79
- data/test/test_environment.rb +0 -88
- data/test/test_reporting.rb +0 -43
- data/test/test_subcommand.rb +0 -38
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8e471e6766c9f499c7afbc82edda72bf1abfc8fa
|
4
|
+
data.tar.gz: 25268f055e8dd9d2018b9630b2b48fe3183b8972
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ad1ec6b44e38d3761dab2a223b4d0ec9a8ed1f64d26441d3049a96e5c5ed0e92be1047d002e76605770d3452e9f3b7eef150ab05cf0789c9a61806fc807e9ce3
|
7
|
+
data.tar.gz: 2aeb1d2b702ceb8d1e3d1ed71342ef937411c12a78c3b0a1b10fda27e0a9c598c1bfa25fe69eabc6e143609c14a095b44f6734b74a65ccd11163c832ed088161
|
data/.gitattributes
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
*.rb diff=ruby
|
data/.travis.yml
ADDED
data/Changes.txt
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
== Version 1.10.0
|
2
|
+
|
3
|
+
Apart from a bunch of extensions to the Git importer API, and a host of
|
4
|
+
bugfixes, the main change is a modularized environment handling. Environment can
|
5
|
+
now be declared on a per-package basis, and commands executed through
|
6
|
+
Package#run will get the environment as stored in their package and its
|
7
|
+
dependencies, instead of always using a global environment.
|
8
|
+
|
1
9
|
== Version 1.7.1
|
2
10
|
* fix problems with encoding of subcommand output
|
3
11
|
|
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
[](https://travis-ci.org/rock-core/autobuild)
|
2
|
+
[](http://badge.fury.io/rb/autobuild)
|
3
|
+
[](http://rubydoc.info/gems/autobuild/frames)
|
4
|
+
|
5
|
+
## What's autobuild ?
|
6
|
+
|
7
|
+
Autobuild is a collection of classes to interface with build systems (e.g.
|
8
|
+
autotools, CMake) and import mechanisms (git, svn, ...). It is used to build the
|
9
|
+
[autoproj](http://rock-robotics.org/documentation/autoproj) higher-level tool
|
10
|
+
that provides mechanisms to manage a whole workspace.
|
11
|
+
|
12
|
+
## Installation
|
13
|
+
|
14
|
+
Add this line to your application's Gemfile:
|
15
|
+
|
16
|
+
```ruby
|
17
|
+
gem 'autobuild'
|
18
|
+
```
|
19
|
+
|
20
|
+
And then execute:
|
21
|
+
|
22
|
+
$ bundle
|
23
|
+
|
24
|
+
Or install it yourself as:
|
25
|
+
|
26
|
+
$ gem install autobuild
|
27
|
+
|
28
|
+
## Development
|
29
|
+
|
30
|
+
After checking out the repo, run `bundle install` to install dependencies. Then,
|
31
|
+
run `bundle exec rake test` to run the tests.
|
32
|
+
|
33
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To
|
34
|
+
release a new version, update the version number in `version.rb`, and then run
|
35
|
+
`bundle exec rake release`, which will create a git tag for the version, push
|
36
|
+
git commits and tags, and push the `.gem` file to
|
37
|
+
[rubygems.org](https://rubygems.org).
|
38
|
+
|
39
|
+
## Contributing
|
40
|
+
|
41
|
+
Bug reports and pull requests are welcome on GitHub at
|
42
|
+
https://github.com/rock-core/autobuild
|
43
|
+
|
44
|
+
## License
|
45
|
+
|
46
|
+
The gem is available as open source under the terms of the GPL license v2 or
|
47
|
+
later.
|
48
|
+
|
49
|
+
Copyright and license
|
50
|
+
=====================
|
51
|
+
Author:: Sylvain Joyeux <sylvain.joyeux@m4x.org>
|
52
|
+
Copyright:: Copyright (c) 2005-2015 Sylvain Joyeux
|
53
|
+
License:: GPL
|
54
|
+
|
data/Rakefile
CHANGED
@@ -1,28 +1,13 @@
|
|
1
1
|
require 'utilrb/rake_common'
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
developer "Sylvain Joyeux", "sylvain.joyeux@m4x.org"
|
3
|
+
require "bundler/gem_tasks"
|
4
|
+
require "rake/testtask"
|
6
5
|
|
7
|
-
|
8
|
-
|
9
|
-
self.description = "Collection of classes to handle build systems (CMake, autotools, ...) and import mechanisms (tarballs, CVS, SVN, git, ...). It also offers a Rake integration to import and build such software packages. It is the backbone of the autoproj (http://rock-robotics.org/autoproj) integrated software project management tool."
|
10
|
-
self.email = %q{rock-dev@dfki.de}
|
6
|
+
task 'default'
|
7
|
+
task 'gem' => 'build'
|
11
8
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
self.extra_deps <<
|
17
|
-
['rake', '>= 0.9.0'] <<
|
18
|
-
['utilrb', '>= 1.6.0'] <<
|
19
|
-
['pastel', '>= 0.4.0'] <<
|
20
|
-
['tty', '>= 0.2.0']
|
21
|
-
|
22
|
-
self.test_globs = ['test/suite.rb']
|
23
|
-
end
|
24
|
-
Rake.clear_tasks(/publish_docs/, /default/)
|
9
|
+
Rake::TestTask.new(:test) do |t|
|
10
|
+
t.libs << "lib" << Dir.pwd
|
11
|
+
t.test_files = ['test/suite.rb']
|
25
12
|
end
|
26
13
|
|
27
|
-
task "default"
|
28
|
-
|
data/autobuild.gemspec
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'autobuild/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = "autobuild"
|
8
|
+
s.version = Autobuild::VERSION
|
9
|
+
s.authors = ["Sylvain Joyeux"]
|
10
|
+
s.email = "sylvain.joyeux@m4x.org"
|
11
|
+
s.summary = "Library to handle build systems and import mechanisms"
|
12
|
+
s.description = "Collection of classes to handle build systems (CMake, autotools, ...) and import mechanisms (tarballs, CVS, SVN, git, ...). It also offers a Rake integration to import and build such software packages. It is the backbone of the autoproj (http://rock-robotics.org/autoproj) integrated software project management tool."
|
13
|
+
s.homepage = "http://rock-robotics.org"
|
14
|
+
s.licenses = ["BSD"]
|
15
|
+
|
16
|
+
s.required_ruby_version = ">= 1.9.3"
|
17
|
+
s.require_paths = ["lib"]
|
18
|
+
s.extensions = []
|
19
|
+
s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
20
|
+
|
21
|
+
s.add_runtime_dependency "rake", ">= 0.9.0"
|
22
|
+
s.add_runtime_dependency "utilrb", ">= 2.0"
|
23
|
+
s.add_runtime_dependency "tty", '>= 0.2.1'
|
24
|
+
s.add_runtime_dependency 'pastel', '>= 0.5.0'
|
25
|
+
s.add_development_dependency "flexmock", ">= 2.0.0"
|
26
|
+
s.add_development_dependency "minitest", ">= 5.0", "~> 5.0"
|
27
|
+
s.add_development_dependency "fakefs"
|
28
|
+
s.add_development_dependency "simplecov"
|
29
|
+
end
|
30
|
+
|
@@ -171,6 +171,14 @@ def set(name, *values)
|
|
171
171
|
add(name, *values)
|
172
172
|
end
|
173
173
|
|
174
|
+
# Unset the given environment variable
|
175
|
+
#
|
176
|
+
# It is different from {#delete} in that it will lead to the environment
|
177
|
+
# variable being actively unset, while 'delete' will leave it to its
|
178
|
+
# original value
|
179
|
+
def unset(name)
|
180
|
+
environment[name] = nil
|
181
|
+
end
|
174
182
|
|
175
183
|
# Returns true if the given environment variable must not be reset by the
|
176
184
|
# env.sh script, but that new values should simply be prepended to it.
|
@@ -303,7 +311,9 @@ def value(name, options = Hash.new)
|
|
303
311
|
inheritance_mode: :expand
|
304
312
|
inheritance_mode = options[:inheritance_mode]
|
305
313
|
|
306
|
-
if !
|
314
|
+
if !include?(name)
|
315
|
+
nil
|
316
|
+
elsif !environment[name]
|
307
317
|
nil
|
308
318
|
else
|
309
319
|
inherited =
|
@@ -327,9 +337,18 @@ def value(name, options = Hash.new)
|
|
327
337
|
end
|
328
338
|
end
|
329
339
|
|
340
|
+
# Whether this object manages the given environment variable
|
341
|
+
def include?(name)
|
342
|
+
environment.has_key?(name)
|
343
|
+
end
|
344
|
+
|
330
345
|
def update_var(name)
|
331
|
-
if
|
332
|
-
|
346
|
+
if include?(name)
|
347
|
+
if value = value(name)
|
348
|
+
resolved_env[name] = value.join(File::PATH_SEPARATOR)
|
349
|
+
else
|
350
|
+
resolved_env[name] = nil
|
351
|
+
end
|
333
352
|
else
|
334
353
|
resolved_env.delete(name)
|
335
354
|
end
|
@@ -413,6 +432,7 @@ def export_env_sh(io)
|
|
413
432
|
io.puts SHELL_SOURCE_SCRIPT % path
|
414
433
|
end
|
415
434
|
|
435
|
+
unset_variables = Set.new
|
416
436
|
variables = []
|
417
437
|
environment.each do |name, _|
|
418
438
|
variables << name
|
@@ -420,6 +440,7 @@ def export_env_sh(io)
|
|
420
440
|
value_without_inheritance = value(name, inheritance_mode: :ignore)
|
421
441
|
|
422
442
|
if !value_with_inheritance
|
443
|
+
unset_variables << name
|
423
444
|
shell_line = SHELL_UNSET_COMMAND % [name]
|
424
445
|
elsif value_with_inheritance == value_without_inheritance # no inheritance
|
425
446
|
shell_line = SHELL_SET_COMMAND % [name, value_with_inheritance.join(File::PATH_SEPARATOR)]
|
@@ -429,7 +450,9 @@ def export_env_sh(io)
|
|
429
450
|
io.puts shell_line
|
430
451
|
end
|
431
452
|
variables.each do |var|
|
432
|
-
|
453
|
+
if !unset_variables.include?(var)
|
454
|
+
io.puts SHELL_EXPORT_COMMAND % [var]
|
455
|
+
end
|
433
456
|
end
|
434
457
|
@source_after.each do |path|
|
435
458
|
io.puts SHELL_SOURCE_SCRIPT % [path]
|
@@ -35,18 +35,14 @@ class ArchiveImporter < Importer
|
|
35
35
|
class << self
|
36
36
|
# The directory in which downloaded files are saved
|
37
37
|
#
|
38
|
-
# It defaults,
|
39
|
-
#
|
40
|
-
# AUTOBUILD_ARCHIVES_CACHE_DIR (if set) environment variable and to
|
41
|
-
# #{prefix}/cache
|
38
|
+
# It defaults, if set, to the value returned by
|
39
|
+
# {Importer.cache_dirs} and falls back #{prefix}/cache
|
42
40
|
def cachedir
|
43
41
|
if @cachedir then @cachedir
|
44
|
-
elsif
|
45
|
-
@cachedir =
|
46
|
-
elsif dir = ENV['AUTOBUILD_CACHE_DIR']
|
47
|
-
@cachedir = File.join(File.expand_path(dir), 'archives')
|
42
|
+
elsif cache_dirs = Importer.cache_dirs('archives')
|
43
|
+
@cachedir = cache_dirs.first
|
48
44
|
else
|
49
|
-
|
45
|
+
"#{Autobuild.prefix}/cache"
|
50
46
|
end
|
51
47
|
end
|
52
48
|
|
data/lib/autobuild/import/git.rb
CHANGED
@@ -26,10 +26,8 @@ class << self
|
|
26
26
|
# @see default_alternates=, Git#alternates
|
27
27
|
def default_alternates
|
28
28
|
if @default_alternates then @default_alternates
|
29
|
-
elsif
|
30
|
-
@default_alternates =
|
31
|
-
elsif cache_dir = ENV['AUTOBUILD_CACHE_DIR']
|
32
|
-
@default_alternates = cache_dir.split(':').map { |path| File.join(File.expand_path(path), 'git', '%s') }
|
29
|
+
elsif cache_dirs = Importer.cache_dirs('git')
|
30
|
+
@default_alternates = cache_dirs.map { |path| File.join(File.expand_path(path), '%s') }
|
33
31
|
else Array.new
|
34
32
|
end
|
35
33
|
end
|
@@ -584,7 +582,7 @@ def rev_parse(package, name, object_type = "commit")
|
|
584
582
|
if object_type
|
585
583
|
name = "#{name}^{#{object_type}}"
|
586
584
|
end
|
587
|
-
run_git_bare(package, 'rev-parse', name).first
|
585
|
+
run_git_bare(package, 'rev-parse', '-q', '--verify', name).first
|
588
586
|
rescue Autobuild::SubcommandFailed
|
589
587
|
raise PackageException.new(package, 'import'), "failed to resolve #{name}. Are you sure this commit, branch or tag exists ?"
|
590
588
|
end
|
@@ -731,7 +729,7 @@ def update_alternates(package)
|
|
731
729
|
File.join(path, 'objects')
|
732
730
|
end
|
733
731
|
|
734
|
-
if current_alternates.sort
|
732
|
+
if !(current_alternates.sort - alternates.sort).empty?
|
735
733
|
# Warn that something is fishy, but assume that the user knows
|
736
734
|
# what he is doing
|
737
735
|
package.warn "%s: the list of git alternates listed in the repository differs from the one set up in autobuild."
|
@@ -911,9 +909,9 @@ def relocate(repository, options = Hash.new)
|
|
911
909
|
options = Hash[options.map { |k, v| [k.to_sym, v] }]
|
912
910
|
|
913
911
|
@push_to = options[:push_to] || @push_to
|
912
|
+
local_branch = options[:local_branch] || options[:branch] || self.local_branch || 'master'
|
913
|
+
remote_branch = options[:remote_branch] || options[:branch] || self.remote_branch || 'master'
|
914
914
|
@branch = @local_branch = @remote_branch = nil
|
915
|
-
local_branch = options[:local_branch] || options[:branch] || local_branch || 'master'
|
916
|
-
remote_branch = options[:remote_branch] || options[:branch] || remote_branch || 'master'
|
917
915
|
if local_branch == remote_branch
|
918
916
|
@branch = local_branch
|
919
917
|
else
|
data/lib/autobuild/importer.rb
CHANGED
@@ -70,6 +70,73 @@ def initialize(status = -1)
|
|
70
70
|
end
|
71
71
|
end
|
72
72
|
|
73
|
+
# The cache directories for the given importer type.
|
74
|
+
#
|
75
|
+
# This is used by some importers to save disk space and/or avoid downloading
|
76
|
+
# the same things over and over again
|
77
|
+
#
|
78
|
+
# The default global cache directory is initialized from the
|
79
|
+
# AUTOBUILD_CACHE_DIR environment variable. Per-importer cache directories
|
80
|
+
# can be overriden by setting AUTOBUILD_{TYPE}_CACHE_DIR (e.g.
|
81
|
+
# AUTOBUILD_GIT_CACHE_DIR)
|
82
|
+
#
|
83
|
+
# The following importers use caches:
|
84
|
+
# - the archive importer saves downloaded files in the cache. They are
|
85
|
+
# saved under an archives/ subdirectory of the default cache if set, or to
|
86
|
+
# the value of AUTOBUILD_ARCHIVES_CACHE_DIR
|
87
|
+
# - the git importer uses the cache directories as alternates for the git
|
88
|
+
# checkouts
|
89
|
+
#
|
90
|
+
# @param [String] type the importer type. If set, it Given a root cache
|
91
|
+
# directory X, and importer specific cache is setup as a subdirectory of X
|
92
|
+
# with e.g. X/git or X/archives. The subdirectory name is defined by this
|
93
|
+
# argument
|
94
|
+
# @return [nil,Array<String>]
|
95
|
+
#
|
96
|
+
# @see .set_cache_dirs .default_cache_dirs .default_cache_dirs=
|
97
|
+
def self.cache_dirs(type)
|
98
|
+
if @cache_dirs[type] || (env = ENV["AUTOBUILD_#{type.upcase}_CACHE_DIR"])
|
99
|
+
@cache_dirs[type] ||= env.split(":")
|
100
|
+
elsif dirs = default_cache_dirs
|
101
|
+
dirs.map { |d| File.join(d, type) }
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
# Returns the default cache directory if there is one
|
106
|
+
#
|
107
|
+
# @return [Array<String>,nil]
|
108
|
+
# @see .cache_dirs
|
109
|
+
def self.default_cache_dirs
|
110
|
+
if @default_cache_dirs ||= ENV['AUTOBUILD_CACHE_DIR']
|
111
|
+
[@default_cache_dirs]
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
# Sets the cache directory for a given importer type
|
116
|
+
#
|
117
|
+
# @param [String] type the importer type
|
118
|
+
# @param [String] dir the cache directory
|
119
|
+
# @see .cache_dirs
|
120
|
+
def self.set_cache_dirs(type, *dirs)
|
121
|
+
@cache_dirs[type] = dirs
|
122
|
+
end
|
123
|
+
|
124
|
+
# Sets the default cache directory
|
125
|
+
#
|
126
|
+
# @param [Array<String>,String] the directories
|
127
|
+
# @see .cache_dirs
|
128
|
+
def self.default_cache_dirs=(dirs)
|
129
|
+
@default_cache_dirs = Array(dirs)
|
130
|
+
end
|
131
|
+
|
132
|
+
# Unset all cache directories
|
133
|
+
def self.unset_cache_dirs
|
134
|
+
@cache_dirs = Hash.new
|
135
|
+
@default_cache_dirs = nil
|
136
|
+
end
|
137
|
+
|
138
|
+
unset_cache_dirs
|
139
|
+
|
73
140
|
# @return [Hash] the original option hash as given to #initialize
|
74
141
|
attr_reader :options
|
75
142
|
|
data/lib/autobuild/reporting.rb
CHANGED
@@ -288,9 +288,7 @@ def self.report
|
|
288
288
|
# it
|
289
289
|
errors = []
|
290
290
|
Autobuild::Package.each do |name, pkg|
|
291
|
-
|
292
|
-
errors.concat(pkg.failures)
|
293
|
-
end
|
291
|
+
errors.concat(pkg.failures)
|
294
292
|
end
|
295
293
|
|
296
294
|
if !errors.empty?
|
@@ -311,12 +309,12 @@ def self.report
|
|
311
309
|
|
312
310
|
## Reports a successful build to the user
|
313
311
|
def self.success
|
314
|
-
|
312
|
+
each_reporter { |rep| rep.success }
|
315
313
|
end
|
316
314
|
|
317
315
|
## Reports that the build failed to the user
|
318
316
|
def self.error(error)
|
319
|
-
|
317
|
+
each_reporter { |rep| rep.error(error) }
|
320
318
|
end
|
321
319
|
|
322
320
|
## Add a new reporter
|
@@ -324,6 +322,10 @@ def self.<<(reporter)
|
|
324
322
|
@@reporters << reporter
|
325
323
|
end
|
326
324
|
|
325
|
+
def self.remove(reporter)
|
326
|
+
@@reporters.delete(reporter)
|
327
|
+
end
|
328
|
+
|
327
329
|
def self.clear_reporters
|
328
330
|
@@reporters.clear
|
329
331
|
end
|
data/lib/autobuild/test.rb
CHANGED
@@ -18,8 +18,7 @@
|
|
18
18
|
require 'tmpdir'
|
19
19
|
require 'erb'
|
20
20
|
require 'fileutils'
|
21
|
-
|
22
|
-
require 'flexmock/test_unit'
|
21
|
+
require 'flexmock/minitest'
|
23
22
|
require 'minitest/spec'
|
24
23
|
|
25
24
|
if ENV['TEST_ENABLE_PRY'] != '0'
|
@@ -41,11 +40,6 @@ module Autobuild
|
|
41
40
|
# end
|
42
41
|
#
|
43
42
|
module SelfTest
|
44
|
-
if defined? FlexMock
|
45
|
-
include FlexMock::ArgumentTypes
|
46
|
-
include FlexMock::MockContainer
|
47
|
-
end
|
48
|
-
|
49
43
|
def setup
|
50
44
|
@tempdir = File.join(Dir.tmpdir, "/autobuild-test-#{Process.uid}")
|
51
45
|
FileUtils.mkdir_p(@tempdir, :mode => 0700)
|
@@ -57,9 +51,6 @@ def setup
|
|
57
51
|
|
58
52
|
def teardown
|
59
53
|
Autobuild.silent = false
|
60
|
-
if defined? FlexMock
|
61
|
-
flexmock_teardown
|
62
|
-
end
|
63
54
|
super
|
64
55
|
|
65
56
|
Autobuild::Package.clear
|
@@ -98,7 +89,4 @@ def untar(file)
|
|
98
89
|
end
|
99
90
|
end
|
100
91
|
|
101
|
-
|
102
|
-
include Autobuild::SelfTest
|
103
|
-
end
|
104
|
-
|
92
|
+
Minitest::Test.include Autobuild::SelfTest
|