autobuild 1.4.2 → 1.4.3

Sign up to get free protection for your applications and to get access to all the features.
data/Changes.txt CHANGED
@@ -1,3 +1,9 @@
1
+ == Version 1.4.3
2
+ * minor changes in how the shell environment is managed
3
+ * update LD_LIBRARY_PATH when applicable
4
+ * fix parsing of genom 'require' statements (fix from Matthieu Gallien)
5
+ * fix issues with tracking tags and commits (fix from Matthieu Gallien)
6
+
1
7
  == Version 1.4.2
2
8
  * call subversion with the --non-interactive option, otherwise the build will
3
9
  block indefinitely. Note that git "questions" are properly passed to the user.
data/lib/autobuild.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Autobuild
2
- VERSION = "1.4.2" unless defined? Autobuild::VERSION
2
+ VERSION = "1.4.3" unless defined? Autobuild::VERSION
3
3
  end
4
4
 
5
5
  require 'autobuild/config'
@@ -1,22 +1,35 @@
1
1
  module Autobuild
2
+ @inherited_environment = Hash.new
2
3
  @environment = Hash.new
3
4
  class << self
5
+ attr_reader :inherited_environment
4
6
  attr_reader :environment
5
7
  end
6
8
 
9
+ def self.env_clear(name)
10
+ environment[name] = nil
11
+ inherited_environment[name] = nil
12
+ end
13
+
7
14
  # Set a new environment variable
8
15
  def self.env_set(name, *values)
9
- environment[name] = nil
16
+ env_clear(name)
10
17
  env_add(name, *values)
11
18
  end
12
19
  # Adds a new value to an environment variable
13
20
  def self.env_add(name, *values)
14
21
  set = if environment.has_key?(name)
15
22
  environment[name]
16
- elsif ENV[name]
17
- ENV[name].split(':')
18
23
  end
19
24
 
25
+ if !inherited_environment.has_key?(name)
26
+ if parent_env = ENV[name]
27
+ inherited_environment[name] = parent_env.split(':')
28
+ else
29
+ inherited_environment[name] = Array.new
30
+ end
31
+ end
32
+
20
33
  if !set
21
34
  set = Array.new
22
35
  elsif !set.respond_to?(:to_ary)
@@ -25,7 +38,9 @@ module Autobuild
25
38
 
26
39
  values.concat(set)
27
40
  @environment[name] = values
28
- ENV[name] = values.join(":")
41
+
42
+ inherited = inherited_environment[name] || Array.new
43
+ ENV[name] = (values + inherited).join(":")
29
44
  end
30
45
 
31
46
  def self.env_add_path(name, path, *paths)
@@ -57,6 +72,9 @@ module Autobuild
57
72
  def self.update_environment(newprefix)
58
73
  env_add_path('PATH', "#{newprefix}/bin")
59
74
  env_add_path('PKG_CONFIG_PATH', "#{newprefix}/lib/pkgconfig")
75
+ if File.directory?("#{newprefix}/lib") && !Dir.glob("#{newprefix}/lib/*.so").empty?
76
+ env_add_path('LD_LIBRARY_PATH', "#{newprefix}/lib")
77
+ end
60
78
 
61
79
  # Validate the new rubylib path
62
80
  new_rubylib = "#{newprefix}/lib"
@@ -32,15 +32,16 @@ module Autobuild
32
32
  if gitopts[:branch] && branch
33
33
  raise ConfigException, "git branch specified with both the option hash and the explicit parameter"
34
34
  end
35
- branch = gitopts[:branch] || branch || 'master'
35
+ branch = gitopts[:branch] || branch
36
36
  tag = gitopts[:tag]
37
37
  commit = gitopts[:commit]
38
38
 
39
- if (branch && commit) || (branch && commit) || (tag && commit)
39
+ if (branch && commit) || (branch && tag) || (tag && commit)
40
40
  raise ConfigException, "you can specify only a branch, tag or commit but not two or three at the same time"
41
41
  end
42
- @branch = branch
43
- @commit = tag || commit
42
+ @branch = branch || 'master'
43
+ @tag = tag
44
+ @commit = commit
44
45
  super(common)
45
46
  end
46
47
 
@@ -48,12 +49,17 @@ module Autobuild
48
49
 
49
50
  # The branch this importer is tracking
50
51
  #
51
- # If set, tag has to be nil.
52
+ # If set, both commit and tag have to be nil.
52
53
  attr_accessor :branch
53
- # The commit we are pointing to. It can be either a commit ID or a tag
54
- # name.
54
+
55
+ # The tag we are pointing to. It is a tag name.
56
+ #
57
+ # If set, both branch and commit have to be nil.
58
+ attr_reader :tag
59
+
60
+ # The commit we are pointing to. It is a commit ID.
55
61
  #
56
- # If set, branch has to be nil.
62
+ # If set, both branch and tag have to be nil.
57
63
  attr_reader :commit
58
64
 
59
65
  # True if it is allowed to merge remote updates automatically. If false
@@ -78,7 +84,11 @@ module Autobuild
78
84
  def fetch_remote(package)
79
85
  validate_srcdir(package)
80
86
  Dir.chdir(package.srcdir) do
81
- Subprocess.run(package.name, :import, Autobuild.tool('git'), 'fetch', repository, branch)
87
+ if commit # we are checking out a specific commit. We just call git fetch
88
+ Subprocess.run(package.name, :import, Autobuild.tool('git'), 'fetch', repository)
89
+ else
90
+ Subprocess.run(package.name, :import, Autobuild.tool('git'), 'fetch', repository, branch || tag)
91
+ end
82
92
  if File.readable?( File.join('.git', 'FETCH_HEAD') )
83
93
  fetch_commit = File.readlines( File.join('.git', 'FETCH_HEAD') ).
84
94
  delete_if { |l| l =~ /not-for-merge/ }
@@ -174,8 +184,8 @@ module Autobuild
174
184
  end
175
185
 
176
186
  # If we are tracking a commit/tag, just check it out and return
177
- if commit
178
- Subprocess.run(package.name, :import, Autobuild.tool('git'), 'checkout', commit)
187
+ if commit || tag
188
+ Subprocess.run(package.name, :import, Autobuild.tool('git'), 'checkout', commit || tag)
179
189
  return
180
190
  end
181
191
 
@@ -211,9 +221,9 @@ module Autobuild
211
221
 
212
222
  Dir.chdir(package.srcdir) do
213
223
  # If we are tracking a commit/tag, just check it out
214
- if commit
224
+ if commit || tag
215
225
  Subprocess.run(package.name, :import, Autobuild.tool('git'),
216
- 'checkout', commit)
226
+ 'checkout', commit || tag)
217
227
  return
218
228
  end
219
229
 
@@ -255,6 +255,7 @@ module Autobuild
255
255
  # and installed.
256
256
  def depends_on(*packages)
257
257
  packages.each do |p|
258
+ raise ConfigException, "#{p.inspect} should be a string" if !p.respond_to? :to_str
258
259
  p = p.to_str
259
260
  next if p == name
260
261
  unless Package[p]
@@ -271,6 +272,7 @@ module Autobuild
271
272
  # listed in +packages+ are aliases for this package.
272
273
  def provides(*packages)
273
274
  packages.each do |p|
275
+ raise ConfigException, "#{p.inspect} should be a string" if !p.respond_to? :to_str
274
276
  p = p.to_str
275
277
  next if p == name
276
278
  @@provides[p] = self
@@ -46,9 +46,10 @@ module Autobuild
46
46
  currentBuffer = nil
47
47
  Open3.popen3("#{cpp} #{cpp_options.join(" ")} #{srcdir}/#{name}.gen") do |cin, out, err|
48
48
  out.each_line do |line|
49
- if line =~ /^\s*(codels_)?requires\s*:.*,$/
50
- currentBuffer = line
51
- elsif currentBuffer
49
+ if line =~ /^\s*(codels_)?requires\s*:.*$/
50
+ currentBuffer = ""
51
+ end
52
+ if currentBuffer
52
53
  currentBuffer += line
53
54
  if currentBuffer =~ /^\s*(codels_)?requires\s*:\s*(\"?\s*[\w\-=><0-9.\s]+\s*\"?(?:\s*,\s*\"?\s*[\w\-=><0-9.\s]+\s*\"?)*);/
54
55
  # Remove the codels_requires lines if -a is given to genom
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.4.2
4
+ version: 1.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sylvain Joyeux
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-11-24 00:00:00 +01:00
12
+ date: 2009-11-26 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency