autobuild 0.1 → 0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README CHANGED
@@ -100,12 +100,14 @@ Autobuild uses three sections:
100
100
  *programs*:: the programs used by importers and builders. See each tool
101
101
  documentation for the list of used options
102
102
  *packages*:: the list of packages to build. See <b>Package configuration</b> below
103
-
103
+ *defines*:: this is used for variable interpolation. Any key/value pair defined in
104
+ this section can be used later in other parts of the config files using
105
+ the $key or ${key} notation
104
106
 
105
107
  == Autobuild configuration (<tt>autobuild-config</tt>)
106
108
  === Misc options
107
- *noupdate*:: if true, do not update the packages that are already imported (default: false). You
108
- can also add the <tt>--noupdate</tt> on the command line
109
+ *update*:: if false, do not update the packages that are already imported (default: true). You
110
+ can also use the <tt>--no-update</tt> on the command line
109
111
 
110
112
  === Directories (<tt>autobuild-config/srcdir</tt>, <tt>autobuild-config/prefix</tt> and <tt>autobuild-config/logdir</tt>)
111
113
  *srcdir*:: the path where programs are to be imported. See <b>Packages configuration</b> for
@@ -193,7 +195,7 @@ source and the builder to build and install it.
193
195
 
194
196
  <b>importer/source</b>::
195
197
  where the importer should get the sources. The format of this options depends on
196
- the importer used.
198
+ the importer used. See Available importers.
197
199
 
198
200
  *prefix*:: where the program is to be installed. If this is a relative path, it is relative to the global
199
201
  <tt>/autobuild-config/prefix</tt> option. Otherwise, the absolute path is used. If no prefix
@@ -234,7 +236,7 @@ to set up the importer and +srcdir+. +prefix+ is ignored.
234
236
  type: import
235
237
  import: cvs
236
238
  source: [ *my_repository, "bar" ]
237
- srcdir: &bar_srcdir bar
239
+ srcdir: bar
238
240
 
239
241
  === Autotools (<tt>type: autotools</tt>)
240
242
  Use this to build GNU autotools-based packages. This handles autoconf-only packages as
@@ -249,9 +251,10 @@ instance, to be sure that automake 1.9 is used, you set
249
251
  automake: automake-1.9
250
252
 
251
253
  Autobuild tries to detect what tools it should run
252
- * +aclocal+ and +autoheader+ are always used
253
- * +autoconf+ is used if there is <tt>configure.ac</tt> or <tt>configure.in</tt> in the import dir
254
- * +automake+ is used if there is a <tt>Makefile.am</tt> file in the import dir
254
+ * +autoheader+ is never used by default
255
+ * +autoconf+ is used if there is <tt>configure.ac</tt> or <tt>configure.in</tt> in the imported dir
256
+ * +aclocal+ is used if +autoconf+ is enabled (either explicitely or by autodetection)
257
+ * +automake+ is used if there is a <tt>Makefile.am</tt> file in the imported dir
255
258
  * you can force to enable or disable any of these four tools in each package config by setting the tool
256
259
  flag to true or false. For instance, if you don't want package +foo+ to use automake, you say
257
260
 
@@ -269,14 +272,13 @@ The only program used during the build phase is +make+. The make command can too
269
272
  ==== Other options
270
273
  *builddir*:: the directory where the build takes place. For now, it has to be a relative path,
271
274
  which is added to the import dir. The default value is "build"
272
- *configureflags*:: array of options to add to the +configure+ command line. To ease the reuse of
273
- Yaml references (the <tt>*label</tt> form), you can use an array of arrays, in which
274
- case the second array levels are joined using ''. For example if our +foo+ package
275
- needs the source of the +bar+ package we added as an import package earlier,
276
-
277
- configureflags: [ [ --with-bar-source=, *srcdir, '/', *bar_srcdir ] ]
275
+ *configureflags*:: array of options to add to the +configure+ command line
276
+ configureflags: [ --with-bar-source=$srcdir/$bar_srcdir ]
278
277
  depends: bar
279
278
 
279
+ = Running autobuild in daemon mode
280
+ The <tt>--daemon</tt> command line options makes autobuild go into daemon mode.
281
+
280
282
  = Copyright and license
281
283
  Author:: Sylvain Joyeux <sylvain.joyeux@m4x.org>
282
284
  Copyright:: Copyright (c) 2005 Sylvain Joyeux
@@ -8,41 +8,40 @@ require 'optparse'
8
8
 
9
9
  require 'autobuild/config'
10
10
  require 'autobuild/logging'
11
+ require 'daemons'
12
+
13
+ DEFAULT_HTTP_PORT = 2000
11
14
 
12
15
  def parse_options(args)
13
16
  options = OpenStruct.new
14
- options.noupdate = false
17
+ options.update = false
15
18
  options.srcdir = nil
16
19
  options.prefix = nil
17
20
  options.builddir = "build"
18
21
  options.logdir = nil
22
+ options.daemonize = false
23
+ options.use_http = false
19
24
  $VERBOSE = false
20
25
 
21
26
  parser = OptionParser.new do |opts|
22
27
  opts.banner = "Usage: autobuild [options] config.yml"
23
28
  opts.separator ""
24
29
 
25
- opts.on("--srcdir PATH", "Find or imports sources in PATH") do |p|
26
- options.srcdir = p
27
- end
28
-
29
- opts.on("--prefix PATH", "Packages are installed in PATH") do |p|
30
- options.prefix = p
31
- options.logdir = "#{p}/autobuild"
30
+ opts.on("--srcdir PATH", "Find or imports sources in PATH") do |options.srcdir| end
31
+ opts.on("--prefix PATH", "Packages are installed in PATH") do |options.prefix|
32
+ options.logdir = "#{options.prefix}/autobuild"
32
33
  end
33
34
 
34
- opts.on("--logdir", "Where logs are saved (default: <prefix>/autobuild)") do |p|
35
- options.logdir = p
36
- end
37
-
38
- opts.on("--noupdate", "Do not update already checked-out sources") do
39
- options.noupdate = true
40
- end
41
-
42
- opts.on("--verbose", "Display output of commands on stdout") do
43
- $VERBOSE = true
44
- end
35
+ opts.on("--logdir", "Where logs are saved (default: <prefix>/autobuild)") do |options.logdir| end
36
+ opts.on("--[no-]update", "Update already checked-out sources") do |options.update| end
37
+ opts.on("--verbose", "Display output of commands on stdout") do |$VERBOSE| end
45
38
 
39
+ opts.on("--[no-]daemon", "Go into daemon mode") do |options.daemonize| end
40
+ #opts.on("--http [PORT]", Integer,
41
+ # "Display a HTTP information page on PORT (PORT default: #{DEFAULT_HTTP_PORT})") do |port|
42
+ # options.http = (port || DEFAULT_HTTP_PORT)
43
+ #end
44
+ opts.on("--[no-]debug", "Verbose information (for debugging purposes)") do |options.debug| end
46
45
  opts.on_tail("-h", "--help", "Show this message") do
47
46
  puts opts
48
47
  exit
@@ -60,18 +59,20 @@ end
60
59
 
61
60
  # Load the command line options
62
61
  options, conffile, targets = parse_options(ARGV)
62
+ if options.daemonize
63
+ puts "Going into daemon mode ..."
64
+ Daemons.daemonize
65
+ end
66
+
63
67
  Config.load(conffile, options)
64
68
 
65
- $DEBUG = true
66
- if $DEBUG
67
- $trace = true
68
- end
69
+ $trace = $DEBUG = options.debug
69
70
 
70
71
  begin
71
72
  if targets.empty?
72
- Task[:default].invoke
73
+ Rake::Task[:default].invoke
73
74
  else
74
- targets.each { |t| Task[t.to_sym].invoke }
75
+ targets.each { |t| Rake::Task[t.to_sym].invoke }
75
76
  end
76
77
  success
77
78
  rescue BuildException => error
@@ -5,9 +5,101 @@ require 'autobuild/logging'
5
5
  require 'autobuild/package'
6
6
  require 'autobuild/importer'
7
7
 
8
+ class Regexp
9
+ def each_match(string)
10
+ string = string.to_str
11
+ while data = match(string)
12
+ yield(data)
13
+ string = data.post_match
14
+ end
15
+ end
16
+ end
17
+
18
+ class UndefinedVariable < Exception
19
+ attr_reader :name
20
+ def initialize(name); @name = name end
21
+ end
22
+
23
+ class Interpolator
24
+ VarDefKey = 'defines'
25
+ InterpolationMatch = Regexp.new('\$\{([^}]+)\}|\$(\w+)')
26
+
27
+ def self.interpolate(config, parent = nil)
28
+ Interpolator.new(config, parent).interpolate
29
+ end
30
+
31
+ def initialize(node, parent = nil, variables = {})
32
+ @node = node
33
+ @variables = {}
34
+ @defines = {}
35
+ @parent = parent
36
+ end
37
+
38
+ def interpolate
39
+ case @node
40
+ when Hash
41
+ @defines = (@node[VarDefKey] || {})
42
+
43
+ interpolated = Hash.new
44
+ @node.each do |k, v|
45
+ next if k == VarDefKey
46
+ interpolated[k] = Interpolator.interpolate(v, self)
47
+ end
48
+
49
+ interpolated
50
+
51
+ when Array
52
+ @node.collect { |v| Interpolator.interpolate(v, self) }
53
+
54
+ else
55
+ if @node.respond_to?(:to_str)
56
+ do_string(@node.to_str) { |varname| value_of(varname) }
57
+ else
58
+ @node
59
+ end
60
+ end
61
+ end
62
+
63
+ def value_of(name)
64
+ if @defines.has_key?(name)
65
+ value = @defines.delete(name)
66
+ @variables[name] = do_string(value) { |varname|
67
+ begin
68
+ value_of(varname)
69
+ rescue UndefinedVariable => e
70
+ if e.varname == name
71
+ raise "Cyclic reference found in definition of #{name}"
72
+ else
73
+ raise
74
+ end
75
+ end
76
+ }
77
+ elsif @variables.has_key?(name)
78
+ @variables[name]
79
+ elsif @parent
80
+ @parent.value_of(name)
81
+ else
82
+ raise UndefinedVariable.new(name), "Interpolated variable #{name} is not defined"
83
+ end
84
+ end
85
+
86
+ def do_string(value)
87
+ return value if value.empty?
88
+
89
+ interpolated = ''
90
+ data = nil
91
+ InterpolationMatch.each_match(value) do |data|
92
+ varname = data[1] || data[2]
93
+ interpolated << data.pre_match << yield(varname)
94
+ end
95
+ return data ? (interpolated << data.post_match) : value
96
+ end
97
+ end
98
+
8
99
  module Config
9
100
  def self.load(conffile, user_options)
10
101
  data = YAML.load( File.open(conffile) )
102
+ data = Interpolator.interpolate(data)
11
103
 
12
104
  get_autobuild_config(data, user_options)
13
105
  get_package_config(data)
@@ -37,15 +129,17 @@ module Config
37
129
  FileUtils.mkdir_p $LOGDIR if !File.directory?($LOGDIR)
38
130
  if setup["clean-log"]
39
131
  puts "Cleaning log dir #{$LOGDIR}"
40
- FileUtils.rm_rf Dir.glob("#{$LOGDIR}/*")
132
+ FileUtils.rm_rf Dir.glob("#{$LOGDIR}/*.log")
41
133
  end
42
134
 
43
135
  $MAIL = setup["mail"]
44
- $NOUPDATE = (options.noupdate or setup["noupdate"] or false)
136
+ $UPDATE = options.update
137
+ $UPDATE = setup["update"] if $UPDATE.nil?
138
+ $UPDATE = true if $UPDATE.nil?
45
139
 
46
140
  envvars = setup["environment"]
47
141
  envvars.each { |k, v|
48
- ENV[k] = ( v.to_a.collect { |path| path.to_a.join("") }.join(":") )
142
+ ENV[k] = v.to_a.join(":")
49
143
  }
50
144
  end
51
145
 
@@ -100,7 +194,7 @@ module Config
100
194
  }
101
195
  # Remove p -> p dependency which may come from common_config
102
196
  if config.has_key?(:depends)
103
- config[:depends] = config[:depends].to_a.find_all { |el| el != p }
197
+ config[:depends] = config[:depends].to_a.reject { |el| el == p }
104
198
  end
105
199
 
106
200
  add_package(p, config)
@@ -9,6 +9,7 @@ class CVSImporter < Importer
9
9
  @program = ($PROGRAMS[:cvs] || 'cvs')
10
10
  @up = (options[:cvsup] || '-dP')
11
11
  @co = (options[:cvsco] || '-P')
12
+ super(options)
12
13
  end
13
14
 
14
15
  private
@@ -16,7 +17,7 @@ class CVSImporter < Importer
16
17
  def update(package)
17
18
  Dir.chdir(package.srcdir) {
18
19
  begin
19
- subcommand(package.target, 'cvs', "#{@program} up #{@up}")
20
+ subcommand(package.target, 'cvs', @program, 'up' , @up)
20
21
  rescue SubcommandFailed => e
21
22
  raise ImportException.new(e), "failed to update #{modulename}"
22
23
  end
@@ -31,7 +32,7 @@ class CVSImporter < Importer
31
32
  FileUtils.mkdir_p(head) if !File.directory?(head)
32
33
  Dir.chdir(head) {
33
34
  begin
34
- subcommand(package.target, 'cvs', "#{@program} -d #{cvsroot} co #{@co} -d #{tail} #{modulename}")
35
+ subcommand(package.target, 'cvs', @program, '-d', cvsroot, 'co', @co, '-d', tail, modulename)
35
36
  rescue SubcommandFailed => e
36
37
  raise ImportException.new(e), "failed to check out #{modulename}"
37
38
  end
@@ -6,8 +6,10 @@ class SVNImporter < Importer
6
6
  @source = source.to_a.join("/")
7
7
 
8
8
  @program = ($PROGRAMS[:svn] || 'svn')
9
- @up = options[:svnup]
10
- @co = options[:svnco]
9
+ @up = options[:svnup] || ""
10
+ @co = options[:svnco] || ""
11
+
12
+ super(options)
11
13
  end
12
14
 
13
15
  private
@@ -15,18 +17,18 @@ class SVNImporter < Importer
15
17
  def update(package)
16
18
  Dir.chdir(package.srcdir) {
17
19
  begin
18
- subcommand(package.target, 'svn', "#{program} up #{@up}")
20
+ subcommand(package.target, 'svn', @program, 'up', @up)
19
21
  rescue SubcommandFailed => e
20
- raise ImportException.new(e), "failed to update #{modulename}"
22
+ raise ImportException.new(e), "failed to update #{package.target}"
21
23
  end
22
24
  }
23
25
  end
24
26
 
25
27
  def checkout(package)
26
28
  begin
27
- subcommand(package.target, 'svn', "#{program} co #{@co} #{@source} #{package.srcdir}")
29
+ subcommand(package.target, 'svn', @program, 'co', @co, @source, package.srcdir)
28
30
  rescue SubcommandFailed => e
29
- raise ImportException.new(e), "failed to check out #{modulename}"
31
+ raise ImportException.new(e), "failed to check out #{package.target}"
30
32
  end
31
33
  end
32
34
  end
@@ -1,24 +1,37 @@
1
1
  class Importer
2
+ def initialize(options)
3
+ @options = options
4
+ end
5
+
2
6
  def import(package)
3
7
  srcdir = package.srcdir
4
8
  if File.directory?(srcdir)
5
- if $NOUPDATE
6
- puts "Not updating #{package.target} since noupdate is set"
9
+ if $UPDATE
10
+ update(package)
11
+ else
12
+ puts "Not updating #{package.target}"
7
13
  return
8
14
  end
9
15
 
10
- update(package)
11
-
12
16
  elsif File.exists?(srcdir)
13
17
  raise ImportException, "#{srcdir} exists but is not a directory"
14
18
  else
15
19
  begin
16
20
  checkout(package)
21
+ patch(package)
17
22
  rescue ImportException => error
18
23
  FileUtils.rm_rf package.srcdir
19
24
  raise error
20
25
  end
21
26
  end
22
27
  end
28
+
29
+ # def patch(package)
30
+ # patch = $PROGRAMS['patch'] || 'patch'
31
+ # # Apply patches, if any
32
+ # @options[:patch].to_a.each do |path|
33
+ # subcommand(package.target, 'patch', patch
34
+ # end
35
+ # end
23
36
  end
24
37
 
@@ -42,7 +42,6 @@ class Package
42
42
 
43
43
  def depends_on(p)
44
44
  p = Package.name2target(p)
45
- raise :bla if !(Symbol === p)
46
45
  task target => p
47
46
  puts "#{target} depends on #{p}"
48
47
 
@@ -3,19 +3,44 @@ require 'autobuild/environment'
3
3
  require 'autobuild/package'
4
4
  require 'autobuild/subcommand'
5
5
 
6
+ ##
7
+ # ==== Handles autotools-based packages
8
+ #
9
+ # == Used programs
10
+ # - aclocal, autoheader, autoconf, automake
11
+ #
12
+ # == Available options
13
+ # - aclocal (default: true if autoconf is enabled, false otherwise) run aclocal
14
+ # - autoconf (default: autodetect) run autoconf. Will be enabled if there is
15
+ # +configure.in+ or +configure.ac+ in the source directory
16
+ # - autoheader (default: false) run autoheader
17
+ # - automake (default: autodetect) run automake. Will run automake if there is a
18
+ # +Makefile.am+ in the source directory
19
+ #
6
20
  class Autotools < Package
7
21
  factory :autotools, self
8
22
 
9
23
  attr_reader :builddir
10
24
 
11
- def buildstamp;
25
+ DefaultOptions = {
26
+ :autoheader => false,
27
+ :aclocal => nil,
28
+ :autoconf => nil,
29
+ :automake => nil,
30
+ :builddir => 'build'
31
+ }
32
+
33
+ def buildstamp
12
34
  "#{builddir}/#{target}-#{STAMPFILE}"
13
35
  end
14
36
 
15
37
  def initialize(target, options)
38
+ options = DefaultOptions.merge(options) { |key, old, new|
39
+ (new.nil? || (new.respond_to?(:empty) && new.empty?)) ? old : new
40
+ }
16
41
  super(target, options)
17
42
 
18
- @builddir = (options[:builddir] || "build")
43
+ @builddir = options[:builddir]
19
44
  raise ConfigException, "Autotools packages need a non-empty builddir" if (@builddir.nil? || @builddir.empty?)
20
45
  raise ConfigException, "No support for absolute builddirs" if (Pathname.new(@builddir).absolute?)
21
46
  @builddir = File.expand_path(builddir, srcdir)
@@ -27,11 +52,16 @@ class Autotools < Package
27
52
  end
28
53
 
29
54
  source_tree srcdir, builddir
30
- file srcdir => dependencies if !dependencies.empty?
31
55
  file buildstamp => [ srcdir, "#{builddir}/config.status" ] do
32
56
  build
33
57
  end
34
- file installstamp => [ buildstamp ] do
58
+
59
+ if !dependencies.empty?
60
+ file buildstamp => dependencies
61
+ file srcdir => dependencies
62
+ end
63
+
64
+ file installstamp => buildstamp do
35
65
  install
36
66
  update_environment(prefix)
37
67
  end
@@ -47,16 +77,27 @@ class Autotools < Package
47
77
  end
48
78
  file conffile do
49
79
  Dir.chdir(srcdir) {
50
- $PROGRAMS["aclocal"] ||= "aclocal"
51
- $PROGRAMS["autoconf"] ||= "autoconf"
52
- $PROGRAMS["autoheader"] ||= "autoheader"
53
- $PROGRAMS["automake"] ||= "automake"
80
+ $PROGRAMS['aclocal'] ||= 'aclocal'
81
+ $PROGRAMS['autoconf'] ||= 'autoconf'
82
+ $PROGRAMS['autoheader'] ||= 'autoheader'
83
+ $PROGRAMS['automake'] ||= 'automake'
54
84
 
55
85
  begin
56
- subcommand(target, "configure", $PROGRAMS["aclocal"]) if @options[:aclocal]
57
- subcommand(target, "configure", $PROGRAMS["autoconf"]) if @options[:autoconf]
58
- subcommand(target, "configure", $PROGRAMS["autoheader"]) if @options[:autoheader]
59
- subcommand(target, "configure", $PROGRAMS["automake"]) if @options[:automake]
86
+ # Autodetect autoconf/aclocal/automake
87
+ if @options[:autoconf].nil?
88
+ @options[:autoconf] =
89
+ File.exists?(File.join(srcdir, 'configure.in')) ||
90
+ File.exists?(File.join(srcdir, 'configure.ac'))
91
+ end
92
+ @options[:aclocal] ||= @options[:autoconf]
93
+ if @options[:automake].nil?
94
+ @options[:automake] = File.exists?(File.join(srcdir, 'Makefile.am'))
95
+ end
96
+
97
+ subcommand(target, 'configure', $PROGRAMS['aclocal']) if @options[:aclocal]
98
+ subcommand(target, 'configure', $PROGRAMS['autoconf']) if @options[:autoconf]
99
+ subcommand(target, 'configure', $PROGRAMS['autoheader']) if @options[:autoheader]
100
+ subcommand(target, 'configure', $PROGRAMS['automake']) if @options[:automake]
60
101
  rescue SubcommandFailed => e
61
102
  raise BuildException.new(e), "failed to build the configure environment of #{target}"
62
103
  end
@@ -71,15 +112,11 @@ class Autotools < Package
71
112
 
72
113
  FileUtils.mkdir_p builddir if !File.directory?(builddir)
73
114
  Dir.chdir(builddir) {
74
- command = "#{srcdir}/configure --no-create --prefix=#{prefix}"
75
-
76
- configureflags = @options[:configureflags].to_a.collect { |item|
77
- item.to_a.join("")
78
- }.join(" ")
79
- command += " #{configureflags}" if !configureflags.empty?
115
+ command = [ "#{srcdir}/configure", "--no-create", "--prefix=#{prefix}" ]
116
+ command |= @options[:configureflags].to_a
80
117
 
81
118
  begin
82
- subcommand(target, "configure", command)
119
+ subcommand(target, 'configure', *command)
83
120
  rescue SubcommandFailed => e
84
121
  raise BuildException.new(e), "failed to configure #{target}"
85
122
  end
@@ -89,9 +126,9 @@ class Autotools < Package
89
126
  def build
90
127
  Dir.chdir(builddir) {
91
128
  begin
92
- subcommand(target, "build", "./config.status")
93
- $PROGRAMS["make"] ||= "make"
94
- subcommand(target, "build", $PROGRAMS["make"])
129
+ subcommand(target, 'build', './config.status')
130
+ $PROGRAMS['make'] ||= 'make'
131
+ subcommand(target, 'build', $PROGRAMS['make'])
95
132
  rescue SubcommandFailed => e
96
133
  raise BuildException.new(e), "failed to build #{target}"
97
134
  end
@@ -101,9 +138,9 @@ class Autotools < Package
101
138
 
102
139
  def install
103
140
  Dir.chdir(builddir) {
104
- make = ($PROGRAMS["make"] or "make")
141
+ make = ($PROGRAMS['make'] or 'make')
105
142
  begin
106
- subcommand(target, "install", "#{make} install")
143
+ subcommand(target, 'install', make, 'install')
107
144
  rescue SubcommandFailed => e
108
145
  raise BuildException.new(e), "failed to install #{builddir}"
109
146
  end
@@ -9,16 +9,21 @@ class GenomModule < Autotools
9
9
 
10
10
  def genomstamp; "#{srcdir}/.genom/genom-stamp" end
11
11
 
12
+ def cpp_options
13
+ @options[:genomflags].to_a.find_all { |opt| opt =~ /^-D/ }
14
+ end
15
+
12
16
  def get_requires
13
- File.open("#{srcdir}/#{target}.gen") do |f|
14
- f.each_line { |line|
15
- if line =~ /^require\s*:\s*([\w\-]+(?:\s*,\s*[\w\-]+)*);/
17
+ cpp = ($PROGRAMS['cpp'] || 'cpp')
18
+ Open3.popen3("#{cpp} #{cpp_options.join(" ")} #{srcdir}/#{target}.gen") do |in, out, err|
19
+ out.each_line { |line|
20
+ if line =~ /^\s*requires\s*:\s*([\w\-]+(?:\s*,\s*[\w\-]+)*);/
16
21
  $1.split(/, /).each { |name|
17
22
  depends_on name
18
23
  file genomstamp => Package.name2target(name)
19
24
  }
20
- elsif line =~ /^require/
21
- puts "failed to math #{line}"
25
+ elsif line =~ /^\s*requires/
26
+ puts "failed to match #{line}"
22
27
  end
23
28
  }
24
29
  end
@@ -38,12 +43,13 @@ class GenomModule < Autotools
38
43
 
39
44
 
40
45
  def regen_targets
46
+ cmdline = [ 'genom', target ] | @options[:genomflags].to_a
47
+
41
48
  file buildstamp => genomstamp
42
49
  file genomstamp => [ :genom, "#{srcdir}/#{target}.gen" ] do
43
50
  Dir.chdir(srcdir) {
44
- cmdline = "genom " + @options[:genomflags].to_a.join(" ") + " #{target}"
45
51
  begin
46
- subcommand(target, 'genom', cmdline)
52
+ subcommand(target, 'genom', *cmdline)
47
53
  rescue SubcommandFailed => e
48
54
  raise BuildException.new(e), "failed to generate module #{target}"
49
55
  end
@@ -57,7 +63,7 @@ class GenomModule < Autotools
57
63
  # since the generation takes care of rebuilding configure
58
64
  # if .gen has changed
59
65
  begin
60
- subcommand(target, 'genom', cmdline)
66
+ subcommand(target, 'genom', *cmdline)
61
67
  rescue SubcommandFailed => e
62
68
  raise BuildException.new(e), "failed to generate module #{target}"
63
69
  end
@@ -1,8 +1,12 @@
1
1
  require 'autobuild/logging'
2
2
 
3
- def subcommand(target, type, command)
3
+ def subcommand(target, type, *command)
4
+ # Filter nil and empty? in command
5
+ command = command.reject { |o| o.nil? || (o.respond_to?(:empty?) && o.empty?) }
6
+ command.collect! { |o| o.to_s }
7
+
4
8
  logname = "#{$LOGDIR}/#{target}-#{type}.log"
5
- puts "#{target}: running #{command}\n (output goes to #{logname})"
9
+ puts "#{target}: running #{command.join(" ")}\n (output goes to #{logname})"
6
10
 
7
11
  status = File.open(logname, "a") { |logfile|
8
12
  pid = fork {
@@ -14,7 +18,7 @@ def subcommand(target, type, command)
14
18
  $stdout.reopen(logfile.dup)
15
19
  end
16
20
 
17
- if !exec(*command.split(" "))
21
+ if !exec(*command)
18
22
  raise "Error running command"
19
23
  end
20
24
  }
@@ -23,7 +27,7 @@ def subcommand(target, type, command)
23
27
  }
24
28
 
25
29
  if status.exitstatus > 0
26
- raise SubcommandFailed.new(target, command, logname, status.exitstatus)
30
+ raise SubcommandFailed.new(target, command.join(" "), logname, status.exitstatus)
27
31
  return false
28
32
  else
29
33
  return true
@@ -1,5 +1,6 @@
1
1
  require 'find'
2
2
  require 'rake/tasklib'
3
+ require 'fileutils'
3
4
 
4
5
  STAMPFILE = "autobuild-stamp"
5
6
 
@@ -26,7 +27,7 @@ def tree_timestamp(path, *exclude)
26
27
  return latest
27
28
  end
28
29
 
29
- class SourceTreeTask < Task
30
+ class SourceTreeTask < Rake::Task
30
31
  attr_accessor :exclude
31
32
  def timestamp
32
33
  tree_timestamp(name, "*CVS", *@exclude)
@@ -43,6 +44,7 @@ def get_stamp(stampfile)
43
44
  end
44
45
 
45
46
  def touch_stamp(stampfile)
46
- File.open(stampfile, "w") { |*| }
47
+ puts "Touching #{stampfile}" if $trace
48
+ FileUtils.touch(stampfile)
47
49
  end
48
50
 
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.11
3
3
  specification_version: 1
4
4
  name: autobuild
5
5
  version: !ruby/object:Gem::Version
6
- version: "0.1"
7
- date: 2005-08-31 00:00:00 +02:00
6
+ version: "0.2"
7
+ date: 2005-09-12 00:00:00 +02:00
8
8
  summary: Rake-based utility to build and install multiple packages with dependencies
9
9
  require_paths:
10
10
  - lib
@@ -34,12 +34,12 @@ authors:
34
34
  - Sylvain Joyeux
35
35
  files:
36
36
  - lib/autobuild/config.rb
37
+ - lib/autobuild/environment.rb
37
38
  - lib/autobuild/importer.rb
38
- - lib/autobuild/package.rb
39
- - lib/autobuild/timestamps.rb
40
39
  - lib/autobuild/logging.rb
40
+ - lib/autobuild/package.rb
41
41
  - lib/autobuild/subcommand.rb
42
- - lib/autobuild/environment.rb
42
+ - lib/autobuild/timestamps.rb
43
43
  - lib/autobuild/import/cvs.rb
44
44
  - lib/autobuild/import/svn.rb
45
45
  - lib/autobuild/packages/autotools.rb
@@ -73,6 +73,16 @@ dependencies:
73
73
  - !ruby/object:Gem::Dependency
74
74
  name: rmail
75
75
  version_requirement:
76
+ version_requirements: !ruby/object:Gem::Version::Requirement
77
+ requirements:
78
+ -
79
+ - ">"
80
+ - !ruby/object:Gem::Version
81
+ version: 0.0.0
82
+ version:
83
+ - !ruby/object:Gem::Dependency
84
+ name: daemons
85
+ version_requirement:
76
86
  version_requirements: !ruby/object:Gem::Version::Requirement
77
87
  requirements:
78
88
  -