autobuild 1.12.3 → 1.13.0.pre1

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.
@@ -1,13 +1,13 @@
1
1
  module Autobuild
2
2
  class CVSImporter < Importer
3
- # Creates a new importer which gets the module +name+ from the
4
- # repository in +root+. The following values are allowed in +options+:
5
- # [:cvsup] options to give to 'cvs up'. Default: -dP.
6
- # [:cvsco] options to give to 'cvs co'. Default: -P.
7
- #
8
- # This importer uses the 'cvs' tool to perform the import. It defaults
9
- # to 'cvs' and can be configured by doing
10
- # Autobuild.programs['cvs'] = 'my_cvs_tool'
3
+ # Creates a new importer which gets the module +name+ from the
4
+ # repository in +root+. The following values are allowed in +options+:
5
+ # [:cvsup] options to give to 'cvs up'. Default: -dP.
6
+ # [:cvsco] options to give to 'cvs co'. Default: -P.
7
+ #
8
+ # This importer uses the 'cvs' tool to perform the import. It defaults
9
+ # to 'cvs' and can be configured by doing
10
+ # Autobuild.programs['cvs'] = 'my_cvs_tool'
11
11
  def initialize(root_name, options = {})
12
12
  cvsopts, common = Kernel.filter_options options, :module => nil, :cvsup => '-dP', :cvsco => '-P'
13
13
  @root = root_name
@@ -23,12 +23,12 @@ def initialize(root_name, options = {})
23
23
  super(common.merge(repository_id: "cvs:#{@root}:#{@module}"))
24
24
  end
25
25
 
26
- # Array of options to give to 'cvs checkout'
27
- attr_reader :options_co
28
- # Array of options to give to 'cvs update'
29
- attr_reader :options_up
26
+ # Array of options to give to 'cvs checkout'
27
+ attr_reader :options_co
28
+ # Array of options to give to 'cvs update'
29
+ attr_reader :options_up
30
30
 
31
- # Returns the module to get
31
+ # Returns the module to get
32
32
  def modulename; @module end
33
33
 
34
34
  private
@@ -4,20 +4,20 @@
4
4
 
5
5
  module Autobuild
6
6
  class DarcsImporter < Importer
7
- # Creates a new importer which gets the source from the Darcs repository
8
- # +source+ # The following values are allowed in +options+:
9
- # [:get] options to give to 'darcs get'.
10
- # [:pull] options to give to 'darcs pull'.
11
- #
12
- # This importer uses the 'darcs' tool to perform the import. It defaults
13
- # to 'darcs' and can be configured by doing
14
- # Autobuild.programs['darcs'] = 'my_darcs_tool'
7
+ # Creates a new importer which gets the source from the Darcs repository
8
+ # +source+ # The following values are allowed in +options+:
9
+ # [:get] options to give to 'darcs get'.
10
+ # [:pull] options to give to 'darcs pull'.
11
+ #
12
+ # This importer uses the 'darcs' tool to perform the import. It defaults
13
+ # to 'darcs' and can be configured by doing
14
+ # Autobuild.programs['darcs'] = 'my_darcs_tool'
15
15
  def initialize(source, options = {})
16
16
  @source = source
17
17
  @program = Autobuild.tool('darcs')
18
18
  super(options.merge(repository_id: source))
19
- @pull = [*options[:pull]]
20
- @get = [*options[:get]]
19
+ @pull = [*options[:pull]]
20
+ @get = [*options[:get]]
21
21
  end
22
22
 
23
23
  private
@@ -27,24 +27,24 @@ def update(package, options = Hash.new) # :nodoc:
27
27
  package.warn "%s: the darcs importer does not support local updates, skipping"
28
28
  return false
29
29
  end
30
- if !File.directory?( File.join(package.srcdir, '_darcs') )
31
- raise ConfigException.new(package, 'import'),
30
+ if !File.directory?( File.join(package.srcdir, '_darcs') )
31
+ raise ConfigException.new(package, 'import'),
32
32
  "#{package.srcdir} is not a Darcs repository"
33
- end
33
+ end
34
34
 
35
- package.run(:import, @program,
36
- 'pull', '--all', "--repodir=#{package.srcdir}", '--set-scripts-executable', @source, *@pull, retry: true)
35
+ package.run(:import, @program,
36
+ 'pull', '--all', "--repodir=#{package.srcdir}", '--set-scripts-executable', @source, *@pull, retry: true)
37
37
  true # no easy to know if package was updated, keep previous behavior
38
38
  end
39
39
 
40
40
  def checkout(package, options = Hash.new) # :nodoc:
41
- basedir = File.dirname(package.srcdir)
42
- unless File.directory?(basedir)
43
- FileUtils.mkdir_p(basedir)
44
- end
41
+ basedir = File.dirname(package.srcdir)
42
+ unless File.directory?(basedir)
43
+ FileUtils.mkdir_p(basedir)
44
+ end
45
45
 
46
- package.run(:import, @program,
47
- 'get', '--set-scripts-executable', @source, package.srcdir, *@get, retry: true)
46
+ package.run(:import, @program,
47
+ 'get', '--set-scripts-executable', @source, package.srcdir, *@get, retry: true)
48
48
  end
49
49
  end
50
50
 
@@ -84,7 +84,7 @@ def self.at_least_version(*version)
84
84
  # This importer uses the 'git' tool to perform the import. It defaults
85
85
  # to 'git' and can be configured by doing
86
86
  #
87
- # Autobuild.programs['git'] = 'my_git_tool'
87
+ # Autobuild.programs['git'] = 'my_git_tool'
88
88
  #
89
89
  # @param [String] branch deprecated, use the 'branch' named option
90
90
  # instead
@@ -529,20 +529,18 @@ def fetch_remote(package, options = Hash.new)
529
529
 
530
530
  # Now get the actual commit ID from the FETCH_HEAD file, and
531
531
  # return it
532
- commit_id = if File.readable?( File.join(git_dir, 'FETCH_HEAD') )
533
- fetch_commit = File.readlines( File.join(git_dir, 'FETCH_HEAD') ).
534
- delete_if { |l| l =~ /not-for-merge/ }
535
- if !fetch_commit.empty?
536
- fetch_commit.first.split(/\s+/).first
532
+ if File.readable?( File.join(git_dir, 'FETCH_HEAD') )
533
+ fetched_commits = File.readlines( File.join(git_dir, 'FETCH_HEAD') ).
534
+ find_all { |l| l !~ /not-for-merge/ }.
535
+ map { |line| line.split(/\s+/).first }
536
+ refspec.zip(fetched_commits).each do |refspec, commit_id|
537
+ if refspec =~ /^refs\/heads\/(.*)$/
538
+ run_git_bare(package, 'update-ref', "-m", "updated by autobuild", "refs/remotes/#{remote_name}/#{$1}", commit_id)
539
+ end
537
540
  end
538
- end
539
541
 
540
- # Update the remote tag if needs be
541
- if (options[:refspec] == tag) && commit_id
542
- run_git_bare(package, 'update-ref', "-m", "updated by autobuild", "refs/remotes/#{remote_name}/#{remote_branch}", commit_id)
542
+ fetched_commits.first
543
543
  end
544
-
545
- commit_id
546
544
  end
547
545
 
548
546
  # @api private
@@ -997,46 +995,46 @@ def update(package, options = Hash.new)
997
995
  pinned_state, target_commit, fetch_commit =
998
996
  determine_target_state(package, only_local: only_local)
999
997
 
1000
- # If we are tracking a commit/tag, just check it out and return
1001
- if !has_local_branch?(package)
1002
- package.message "%%s: checking out branch %s" % [local_branch]
1003
- run_git(package, 'checkout', '-b', local_branch, target_commit)
1004
- return false
1005
- end
1006
-
1007
- if !on_local_branch?(package)
1008
- package.message "%%s: switching to branch %s" % [local_branch]
1009
- run_git(package, 'checkout', local_branch)
1010
- end
998
+ did_change_branch = ensure_on_local_branch(package, target_commit)
1011
999
 
1012
1000
  # Check whether we are already at the requested state
1013
- if pinned_state
1014
- current_head = rev_parse(package, 'HEAD')
1015
- if reset
1016
- if current_head == pinned_state
1017
- return false
1018
- end
1019
- elsif commit_present_in?(package, pinned_state, current_head)
1020
- return false
1021
- elsif merge_if_simple(package, pinned_state)
1022
- return true
1001
+ pin_is_uptodate, pin_did_merge =
1002
+ if pinned_state
1003
+ handle_pinned_state(package, pinned_state, reset: reset)
1023
1004
  end
1024
- end
1025
1005
 
1026
- did_update = false
1027
- fetch_commit ||= current_remote_commit(
1028
- package, only_local: only_local, refspec: [remote_branch, tag])
1029
- if reset
1030
- did_update = reset_head_to_commit(package, target_commit, fetch_commit, force: (reset == :force))
1031
- else
1032
- did_update = merge_if_simple(package, target_commit)
1006
+ unless pin_is_uptodate
1007
+ fetch_commit ||= current_remote_commit(
1008
+ package, only_local: only_local, refspec: [remote_branch, tag])
1009
+ did_update =
1010
+ if reset
1011
+ reset_head_to_commit(package, target_commit, fetch_commit,
1012
+ force: (reset == :force))
1013
+ else
1014
+ merge_if_simple(package, target_commit)
1015
+ end
1033
1016
  end
1034
1017
 
1035
- if with_submodules?
1018
+ if !only_local && with_submodules?
1036
1019
  run_git(package, "submodule", "update", '--init')
1037
1020
  did_update = true
1038
1021
  end
1039
- did_update
1022
+
1023
+ did_update || pin_did_merge || did_change_branch
1024
+ end
1025
+
1026
+ private def ensure_on_local_branch(package, target_commit)
1027
+ if !has_local_branch?(package)
1028
+ package.message "%%s: checking out branch %s" % [local_branch]
1029
+ run_git(package, 'checkout', '-b', local_branch, target_commit)
1030
+ true
1031
+ elsif !on_local_branch?(package)
1032
+ package.message "%%s: switching to branch %s" % [local_branch]
1033
+ run_git(package, 'checkout', local_branch)
1034
+ true
1035
+ else
1036
+ false
1037
+ end
1040
1038
  end
1041
1039
 
1042
1040
  # @api private
@@ -1052,6 +1050,17 @@ def merge_if_simple(package, target_commit)
1052
1050
  false
1053
1051
  end
1054
1052
 
1053
+ private def handle_pinned_state(package, pinned_state, reset: false)
1054
+ current_head = rev_parse(package, 'HEAD')
1055
+ if reset
1056
+ [current_head == pinned_state, false]
1057
+ elsif commit_present_in?(package, pinned_state, current_head)
1058
+ [true, false]
1059
+ elsif merge_if_simple(package, pinned_state)
1060
+ [true, true]
1061
+ end
1062
+ end
1063
+
1055
1064
  def each_alternate_path(package)
1056
1065
  return enum_for(__method__, package) if !block_given?
1057
1066
 
@@ -1088,6 +1097,9 @@ def checkout(package, options = Hash.new)
1088
1097
 
1089
1098
  update_remotes_configuration(package)
1090
1099
  update(package, only_local: true, reset: true)
1100
+ if with_submodules?
1101
+ run_git(package, "submodule", "update", '--init')
1102
+ end
1091
1103
  end
1092
1104
 
1093
1105
  # Changes the repository this importer is pointing to
@@ -11,7 +11,7 @@ class Hg < Importer
11
11
  # This importer uses the 'hg' tool to perform the
12
12
  # import. It defaults to 'hg' and can be configured by
13
13
  # doing
14
- # Autobuild.programs['hg'] = 'my_git_tool'
14
+ # Autobuild.programs['hg'] = 'my_git_tool'
15
15
  #
16
16
  # @param [String] repository the repository URL
17
17
  # @option options [String] :branch (default) the branch to track
@@ -4,14 +4,14 @@
4
4
 
5
5
  module Autobuild
6
6
  class SVN < Importer
7
- # Creates an importer which gets the source for the Subversion URL +source+.
8
- # The following options are allowed:
9
- # [:svnup] options to give to 'svn up'
10
- # [:svnco] options to give to 'svn co'
11
- #
12
- # This importer uses the 'svn' tool to perform the import. It defaults
13
- # to 'svn' and can be configured by doing
14
- # Autobuild.programs['svn'] = 'my_svn_tool'
7
+ # Creates an importer which gets the source for the Subversion URL +source+.
8
+ # The following options are allowed:
9
+ # [:svnup] options to give to 'svn up'
10
+ # [:svnco] options to give to 'svn co'
11
+ #
12
+ # This importer uses the 'svn' tool to perform the import. It defaults
13
+ # to 'svn' and can be configured by doing
14
+ # Autobuild.programs['svn'] = 'my_svn_tool'
15
15
  def initialize(svnroot, options = {})
16
16
  svnroot = [*svnroot].join("/")
17
17
  svnopts, common = Kernel.filter_options options,
@@ -328,6 +328,7 @@ def perform_update(package,only_local=false)
328
328
  Autobuild.color('updated', :yellow)
329
329
  end
330
330
 
331
+ did_update
331
332
  rescue Interrupt
332
333
  message = Autobuild.color('interrupted', :red)
333
334
  if last_error
@@ -368,6 +369,7 @@ def perform_update(package,only_local=false)
368
369
 
369
370
  patch(package)
370
371
  package.updated = true
372
+ did_update
371
373
  rescue Autobuild::Exception => e
372
374
  fallback(e, package, :import, package)
373
375
  end
@@ -454,7 +456,6 @@ def import(package, options = Hash.new)
454
456
  if Autobuild.verbose
455
457
  package.message "%s: not updating"
456
458
  end
457
- return
458
459
  end
459
460
  end
460
461
 
@@ -463,6 +464,7 @@ def import(package, options = Hash.new)
463
464
  else
464
465
  package.isolate_errors(mark_as_failed: true, ignore_errors: ignore_errors) do
465
466
  perform_checkout(package, allow_interactive: options[:allow_interactive])
467
+ true
466
468
  end
467
469
  end
468
470
  end
@@ -564,7 +566,7 @@ def patch(package, patches = self.patches)
564
566
  patches.to_a.each do |new_patch, new_patch_level, content|
565
567
  apply(package, new_patch, new_patch_level)
566
568
  cur_patches << [new_patch, new_patch_level, content]
567
- end
569
+ end
568
570
  ensure
569
571
  save_patch_state(package, cur_patches)
570
572
  end
@@ -20,12 +20,12 @@ def default_mail
20
20
  "#{pwent.name}@#{Socket.gethostname}"
21
21
  end
22
22
 
23
- attr_reader :from_email, :to_email, :smtp_hostname, :smtp_port, :subject, :only_errors
23
+ attr_reader :from_email, :to_email, :smtp_hostname, :smtp_port, :subject, :only_errors
24
24
  def initialize(config)
25
25
  @from_email = (config[:from] || default_mail)
26
26
  @to_email = (config[:to] || default_mail)
27
- @subject = (config[:subject] || "Build %result% on #{Socket.gethostname} at %time%")
28
- @only_errors = config[:only_errors]
27
+ @subject = (config[:subject] || "Build %result% on #{Socket.gethostname} at %time%")
28
+ @only_errors = config[:only_errors]
29
29
  @smtp_hostname = (config[:smtp] || "localhost" )
30
30
  @smtp_port = Integer(config[:port] || Socket.getservbyname('smtp'))
31
31
  end
@@ -37,9 +37,9 @@ def error(error)
37
37
  end
38
38
 
39
39
  def success
40
- unless only_errors
41
- send_mail("success", Autobuild.post_success_message || "")
42
- end
40
+ unless only_errors
41
+ send_mail("success", Autobuild.post_success_message || "")
42
+ end
43
43
  end
44
44
 
45
45
  def send_mail(result, body = "")
@@ -47,9 +47,9 @@ def send_mail(result, body = "")
47
47
  mail.header.date = Time.now
48
48
  mail.header.from = from_email
49
49
  mail.header.subject = subject.
50
- gsub('%result%', result).
51
- gsub('%time%', Time.now.to_s).
52
- gsub('%hostname%', Socket.gethostname)
50
+ gsub('%result%', result).
51
+ gsub('%time%', Time.now.to_s).
52
+ gsub('%hostname%', Socket.gethostname)
53
53
 
54
54
  part = RMail::Message.new
55
55
  part.header.set('Content-Type', 'text/plain')
@@ -22,21 +22,21 @@ class << self
22
22
  # Finally, the build stage actually calls the package's build targets (of
23
23
  # the form "package_name-build", which will trigger the build if needed.
24
24
  class Package
25
- @@packages = {}
26
- @@provides = {}
27
-
28
- # the package name
29
- attr_reader :name
30
- # set the source directory. If a relative path is given,
31
- # it is relative to Autobuild.srcdir. Defaults to #name
32
- attr_writer :srcdir
25
+ @@packages = {}
26
+ @@provides = {}
27
+
28
+ # the package name
29
+ attr_reader :name
30
+ # set the source directory. If a relative path is given,
31
+ # it is relative to Autobuild.srcdir. Defaults to #name
32
+ attr_writer :srcdir
33
33
  # set the importdir, this can be different than the sourcedir
34
34
  # if the source-root is in an subfolder of the package itself
35
35
  # then the importdir will be the root
36
36
  attr_writer :importdir
37
- # set the installation directory. If a relative path is given,
38
- # it is relative to Autobuild.prefix. Defaults to ''
39
- attr_writer :prefix
37
+ # set the installation directory. If a relative path is given,
38
+ # it is relative to Autobuild.prefix. Defaults to ''
39
+ attr_writer :prefix
40
40
  # Sets the log directory. If no value is set, the package will use
41
41
  # Autobuild.logdir
42
42
  attr_writer :logdir
@@ -45,17 +45,17 @@ class Package
45
45
  attr_reader :utilities
46
46
  # Whether {#apply_post_install} has been called
47
47
  def applied_post_install?; !!@applied_post_install end
48
-
49
- # Sets importer object for this package. Defined for backwards compatibility.
50
- # Use the #importer attribute instead
51
- def import=(value)
52
- @importer = value
53
- end
54
- # Sets an importer object for this package
55
- attr_accessor :importer
56
-
57
- # The list of packages this one depends upon
58
- attr_reader :dependencies
48
+
49
+ # Sets importer object for this package. Defined for backwards compatibility.
50
+ # Use the #importer attribute instead
51
+ def import=(value)
52
+ @importer = value
53
+ end
54
+ # Sets an importer object for this package
55
+ attr_accessor :importer
56
+
57
+ # The list of packages this one depends upon
58
+ attr_reader :dependencies
59
59
 
60
60
  # Some statistics about the commands that have been run
61
61
  attr_reader :statistics
@@ -73,12 +73,12 @@ def add_stat(phase, duration)
73
73
  @statistics[phase] += duration
74
74
  end
75
75
 
76
- # Absolute path to the source directory. See #srcdir=
77
- def srcdir; File.expand_path(@srcdir || name, Autobuild.srcdir) end
78
- # Absolute path to the import directory. See #importdir=
79
- def importdir; File.expand_path(@importdir || srcdir, Autobuild.srcdir) end
80
- # Absolute path to the installation directory. See #prefix=
81
- def prefix; File.expand_path(@prefix || '', Autobuild.prefix) end
76
+ # Absolute path to the source directory. See #srcdir=
77
+ def srcdir; File.expand_path(@srcdir || name, Autobuild.srcdir) end
78
+ # Absolute path to the import directory. See #importdir=
79
+ def importdir; File.expand_path(@importdir || srcdir, Autobuild.srcdir) end
80
+ # Absolute path to the installation directory. See #prefix=
81
+ def prefix; File.expand_path(@prefix || '', Autobuild.prefix) end
82
82
  # Absolute path to the log directory for this package. See #logdir=
83
83
  def logdir
84
84
  if @logdir
@@ -88,11 +88,11 @@ def logdir
88
88
  end
89
89
  end
90
90
 
91
- # The file which marks when the last sucessful install
92
- # has finished. The path is absolute
93
- #
94
- # A package is sucessfully built when it is installed
95
- def installstamp
91
+ # The file which marks when the last sucessful install
92
+ # has finished. The path is absolute
93
+ #
94
+ # A package is sucessfully built when it is installed
95
+ def installstamp
96
96
  File.join(logdir, "#{name}-#{STAMPFILE}")
97
97
  end
98
98
 
@@ -117,13 +117,13 @@ def update?
117
117
  # false.
118
118
  def updated?; !!@updated end
119
119
 
120
- def initialize(spec = Hash.new)
120
+ def initialize(spec = Hash.new)
121
121
  @srcdir = @importdir = @logdir = @prefix = nil
122
122
  @updated = false
123
123
  @update = nil
124
124
  @failed = nil
125
- @dependencies = Array.new
126
- @provides = Array.new
125
+ @dependencies = Array.new
126
+ @provides = Array.new
127
127
  @parallel_build_level = nil
128
128
  @statistics = Hash.new
129
129
  @failures = Array.new
@@ -133,52 +133,52 @@ def initialize(spec = Hash.new)
133
133
  @utilities = Hash.new
134
134
  @env = Array.new
135
135
 
136
- if Hash === spec
137
- name, depends = spec.to_a.first
138
- else
139
- name, depends = spec, nil
140
- end
136
+ if Hash === spec
137
+ name, depends = spec.to_a.first
138
+ else
139
+ name, depends = spec, nil
140
+ end
141
141
 
142
- name = name.to_s
143
- @name = name
144
- raise ConfigException, "package #{name} is already defined" if Autobuild::Package[name]
145
- @@packages[name] = self
142
+ name = name.to_s
143
+ @name = name
144
+ raise ConfigException, "package #{name} is already defined" if Autobuild::Package[name]
145
+ @@packages[name] = self
146
146
 
147
- # Call the config block (if any)
148
- yield(self) if block_given?
147
+ # Call the config block (if any)
148
+ yield(self) if block_given?
149
149
 
150
150
  self.doc_utility.source_dir ||= 'doc'
151
151
  self.doc_utility.target_dir ||= name
152
152
 
153
- # Define the default tasks
154
- task "#{name}-import" do
153
+ # Define the default tasks
154
+ task "#{name}-import" do
155
155
  isolate_errors { import }
156
156
  end
157
- task :import => "#{name}-import"
157
+ task :import => "#{name}-import"
158
158
 
159
- # Define the prepare task
160
- task "#{name}-prepare" => "#{name}-import" do
159
+ # Define the prepare task
160
+ task "#{name}-prepare" => "#{name}-import" do
161
161
  isolate_errors { prepare }
162
162
  end
163
- task :prepare => "#{name}-prepare"
163
+ task :prepare => "#{name}-prepare"
164
164
 
165
- task "#{name}-build"
166
- task :build => "#{name}-build"
165
+ task "#{name}-build"
166
+ task :build => "#{name}-build"
167
167
 
168
- task(name) do
169
- Rake::Task["#{name}-import"].invoke
170
- Rake::Task["#{name}-prepare"].invoke
171
- Rake::Task["#{name}-build"].invoke
168
+ task(name) do
169
+ Rake::Task["#{name}-import"].invoke
170
+ Rake::Task["#{name}-prepare"].invoke
171
+ Rake::Task["#{name}-build"].invoke
172
172
  if has_doc? && Autobuild.do_doc
173
173
  Rake::Task["#{name}-doc"].invoke
174
174
  end
175
- end
176
- task :default => name
177
-
175
+ end
176
+ task :default => name
177
+
178
178
  # The dependencies will be declared in the import phase, so save
179
179
  # them there for now
180
180
  @spec_dependencies = depends
181
- end
181
+ end
182
182
 
183
183
  # Whether the package's source directory is present on disk
184
184
  def checked_out?
@@ -415,25 +415,26 @@ def isolate_errors(options = Hash.new)
415
415
  # be done there as well.
416
416
  #
417
417
  # (see Importer#import)
418
- def import(options = Hash.new)
418
+ def import(options = Hash.new)
419
419
  if !options.respond_to?(:to_hash)
420
420
  options = Hash[only_local: options]
421
421
  end
422
422
 
423
423
  if @importer
424
- @importer.import(self, options)
424
+ result = @importer.import(self, options)
425
425
  elsif update?
426
426
  message "%s: no importer defined, doing nothing"
427
427
  end
428
428
 
429
429
  # Add the dependencies declared in spec
430
430
  depends_on(*@spec_dependencies) if @spec_dependencies
431
+ result
431
432
  end
432
433
 
433
434
  # Create all the dependencies required to reconfigure and/or rebuild the
434
435
  # package when required. The package's build target is called
435
436
  # "package_name-build".
436
- def prepare
437
+ def prepare
437
438
  super if defined? super
438
439
 
439
440
  stamps = dependencies.map { |p| Package[p].installstamp }
@@ -579,15 +580,15 @@ def install_doc; doc_utility.install end
579
580
  def doc_disabled; doc_utility.disabled end
580
581
  def has_doc?; doc_utility.has_task? end
581
582
 
582
- def post_install(*args, &block)
583
- if args.empty?
584
- @post_install_blocks << block
585
- elsif !block
586
- @post_install_blocks << args
587
- else
588
- raise ArgumentError, "cannot set both arguments and block"
589
- end
590
- end
583
+ def post_install(*args, &block)
584
+ if args.empty?
585
+ @post_install_blocks << block
586
+ elsif !block
587
+ @post_install_blocks << args
588
+ else
589
+ raise ArgumentError, "cannot set both arguments and block"
590
+ end
591
+ end
591
592
 
592
593
  # Returns the name of all the packages +self+ depends on
593
594
  def all_dependencies(result = Set.new)
@@ -607,18 +608,18 @@ def depends_on?(package_name)
607
608
  @dependencies.include?(package_name)
608
609
  end
609
610
 
610
- # This package depends on +packages+. It means that its build will
611
+ # This package depends on +packages+. It means that its build will
611
612
  # always be triggered after the packages listed in +packages+ are built
612
613
  # and installed.
613
- def depends_on(*packages)
614
- packages.each do |p|
614
+ def depends_on(*packages)
615
+ packages.each do |p|
615
616
  p = p.name if p.respond_to?(:name)
616
617
  raise ArgumentError, "#{p.inspect} should be a string" if !p.respond_to? :to_str
617
- p = p.to_str
618
- next if p == name
619
- unless pkg = Package[p]
620
- raise ConfigException.new(self), "package #{p}, listed as a dependency of #{self.name}, is not defined"
621
- end
618
+ p = p.to_str
619
+ next if p == name
620
+ unless pkg = Package[p]
621
+ raise ConfigException.new(self), "package #{p}, listed as a dependency of #{self.name}, is not defined"
622
+ end
622
623
 
623
624
  next if @dependencies.include?(pkg.name)
624
625
 
@@ -626,52 +627,52 @@ def depends_on(*packages)
626
627
  Autobuild.message "#{name} depends on #{pkg.name}"
627
628
  end
628
629
 
629
- task "#{name}-import" => "#{pkg.name}-import"
630
- task "#{name}-prepare" => "#{pkg.name}-prepare"
631
- task "#{name}-build" => "#{pkg.name}-build"
632
- @dependencies << pkg.name
633
- end
634
- end
630
+ task "#{name}-import" => "#{pkg.name}-import"
631
+ task "#{name}-prepare" => "#{pkg.name}-prepare"
632
+ task "#{name}-build" => "#{pkg.name}-build"
633
+ @dependencies << pkg.name
634
+ end
635
+ end
635
636
 
636
- # Declare that this package provides +packages+. In effect, the names
637
+ # Declare that this package provides +packages+. In effect, the names
637
638
  # listed in +packages+ are aliases for this package.
638
- def provides(*packages)
639
- packages.each do |p|
639
+ def provides(*packages)
640
+ packages.each do |p|
640
641
  raise ArgumentError, "#{p.inspect} should be a string" if !p.respond_to? :to_str
641
- p = p.to_str
642
- next if p == name
642
+ p = p.to_str
643
+ next if p == name
643
644
  next if @provides.include?(name)
644
645
 
645
- @@provides[p] = self
646
+ @@provides[p] = self
646
647
 
647
648
  if Autobuild.verbose
648
649
  Autobuild.message "#{name} provides #{p}"
649
650
  end
650
651
 
651
- task p => name
652
- task "#{p}-import" => "#{name}-import"
653
- task "#{p}-prepare" => "#{name}-prepare"
654
- task "#{p}-build" => "#{name}-build"
655
- @provides << p
656
- end
657
- end
658
-
659
- # Iterates on all available packages
660
- # if with_provides is true, includes the list
661
- # of package aliases
662
- def self.each(with_provides = false, &p)
652
+ task p => name
653
+ task "#{p}-import" => "#{name}-import"
654
+ task "#{p}-prepare" => "#{name}-prepare"
655
+ task "#{p}-build" => "#{name}-build"
656
+ @provides << p
657
+ end
658
+ end
659
+
660
+ # Iterates on all available packages
661
+ # if with_provides is true, includes the list
662
+ # of package aliases
663
+ def self.each(with_provides = false, &p)
663
664
  if !p
664
665
  return enum_for(:each, with_provides)
665
666
  end
666
667
 
667
- @@packages.each(&p)
668
- @@provides.each(&p) if with_provides
669
- end
668
+ @@packages.each(&p)
669
+ @@provides.each(&p) if with_provides
670
+ end
670
671
 
671
- # Gets a package from its name
672
- def self.[](name)
673
- @@packages[name.to_s] || @@provides[name.to_s]
674
- end
672
+ # Gets a package from its name
673
+ def self.[](name)
674
+ @@packages[name.to_s] || @@provides[name.to_s]
675
+ end
675
676
 
676
677
  # Removes all package definitions
677
678
  def self.clear
@@ -761,11 +762,11 @@ def method_missing(m, *args, &block)
761
762
  end
762
763
 
763
764
  def self.package_set(spec)
764
- spec.each do |name, packages|
765
- Autobuild::TARGETS.each do |target|
766
- task "#{name}-#{target}" => packages.map { |dep| "#{dep}-#{target}" }
767
- end
768
- end
765
+ spec.each do |name, packages|
766
+ Autobuild::TARGETS.each do |target|
767
+ task "#{name}-#{target}" => packages.map { |dep| "#{dep}-#{target}" }
768
+ end
769
+ end
769
770
  end
770
771
  end
771
772