module Autobuild
Main Autobuild
module. This module includes the build configuration options (see Autobuild::DEFAULT_OPTIONS
) for the default values)
- nice
-
the nice value at which we should spawn subprocesses
- srcdir
-
the base source directory. If a package defines a relative srcdir, then
it is defined relatively to Autobuild.srcdir. Defaults to the current directory.
- prefix
-
the base install directory. If a package defines a relative prefix, then
it is defined relatively to Autobuild.prefix.
- verbose
-
if true, displays all subprocesses output
- debug
-
more verbose than ‘verbose’: displays Rake’s debugging output
- do_update
-
if we should update the packages
- do_build
-
if we should build the packages
- do_forced_build
-
if we should forcefully trigger all the packages build phases
- do_rebuild
-
if we should cleanly rebuild every packages
- do_doc
-
if we should produce the documentation
- doc_errors
-
if errors during the documentation generation are treated as errors
- daemonize
-
if the build should go into daemon mode (only if the daemons gem
is available)
- clean_log
-
remove all logs before starting the build
- packages
-
a list of packages to build specifically
- default_packages
-
the list of packages to build if Autobuild.packages is empty.
It this array is empty too, build all defined packages.
- keep_oldlogs
-
if true, new runs will be appended to existing logfiles.
Otherwise, the existing logfile contents is erased.
This class is the base class for objects that are used to get the source from various RCS into the package source directory. A list of patches to apply after the import can be given in the :patches
option.
Main Autobuild
module
Constants
- DEFAULT_OPTIONS
- Exception
-
Base class for all
Autobuild
exceptions - GNUMAKE_JOBSERVER_AUTH_VERSION
- HAS_RMAIL
- HUMAN_READABLE_SIZES
- LIBRARY_PATH
- LIBRARY_SUFFIX
- LIB_DIR
- ORIGINAL_ENV
- SHELL_CONDITIONAL_SET_COMMAND
- SHELL_EXPORT_COMMAND
- SHELL_SET_COMMAND
- SHELL_SOURCE_SCRIPT
- SHELL_UNSET_COMMAND
- SHELL_VAR_EXPANSION
- STAMPFILE
- TARGETS
- TarImporter
-
For backwards compatibility
- VERSION
Attributes
The set of global ignores for SourceTreeTask
Regular expressions added to this set will be used to determine if a source tree has or has not changed
The directory in which logs are saved. Defaults to PREFIX/log.
Mailing configuration. It is a hash with the following keys (as symbols)
- :to
-
the mail destination. Defaults to HOSTNAME at
USER
, where HOSTNAME atUSER
is
the username of autobuild's caller, and HOSTNAME the hostname of the current machine.
- :from
-
the mail origin. Defaults to the same value than
:to
- :smtp
-
the hostname of the SMTP server, defaults to localhost
- :port
-
the port of the SMTP server, defauts to 22
- :only_errors
-
mail only on errors. Defaults to false.
Sets the level of parallelism during the build
See parallel_build_level for detailed information
Configure the programs used by different packages
A cache of entries in programs to their resolved full path
@return [{String=>}] the triplet (full path,
tool name, value of ENV['PATH']). The last two values are used to invalidate the cache when needed
@see tool_in_path
@return [{String=>Class<Utility>}] the known utilities @see {register_utility_class}
Public Class Methods
Source
# File lib/autobuild/subcommand.rb, line 33 def self.add_stat(package, phase, duration) if !@statistics[package] @statistics[package] = { phase => duration } elsif !@statistics[package][phase] @statistics[package][phase] = duration else @statistics[package][phase] += duration end end
Source
# File lib/autobuild/config.rb, line 297 def self.all_phases %w[import prepare build] + utilities.keys end
The name of all build phases that Autobuild
knows about
@return [Array<String>]
Source
# File lib/autobuild/config.rb, line 302 def self.apply(packages, buildname = "autobuild", phases = [], options = Hash.new) options = Kernel.validate_options options, parallel: Autobuild.parallel_build_level if Autobuild.mail[:to] if !Autobuild::HAS_RMAIL Autobuild.warn "RMail is not available. Mail notification is disabled" else Reporting << MailReporter.new(Autobuild.mail) end end if Autobuild.do_rebuild packages.each do |pkg_name| Autobuild::Package[pkg_name].prepare_for_rebuild end # And delete the prefix ! FileUtils.rm_rf Autobuild.prefix elsif Autobuild.do_forced_build packages.each do |pkg_name| Autobuild::Package[pkg_name].prepare_for_forced_build end end if phases.empty? if Autobuild.only_doc phases = ['doc'] else phases = ['import'] phases += %w[prepare build] if Autobuild.do_build phases << 'doc' if Autobuild.do_doc end end phases.each do |phase| # We create a dummy task listing what needs to be done, and then we # call it targets = if packages.empty? phase else packages. find_all { |pkg| Rake.application.lookup("#{pkg}-#{phase}") }. map { |pkg| "#{pkg}-#{phase}" } end task "#{buildname}-#{phase}" => targets end begin invoker = Autobuild::RakeTaskParallelism.new(options[:parallel]) Autobuild.parallel_task_manager = invoker phases.each do |phase| package_tasks = packages.each_with_object({}) do |pkg_name, h| h["#{pkg_name}-#{phase}"] = true end callback = if block_given? proc do |task| yield(task.package, phase) if package_tasks[task.name] end else proc {} end invoker.invoke_parallel([Rake::Task["#{buildname}-#{phase}"]], completion_callback: callback) end ensure Autobuild.parallel_task_manager = nil end end
Source
# File lib/autobuild/config.rb, line 119 def self.apply_post_install(pkg, info) return unless info case info when Array args = info.dup tool = Autobuild.tool(args.shift) pkg.run 'post-install', tool, *args when Proc if info.arity == 1 info.call(pkg) else info.call end end end
Source
# File lib/autobuild/environment.rb, line 957 def self.arch_names Autobuild.warn 'Autobuild.arch_names is deprecated, "\ "use Autobuild.env.arch_names instead' env.arch_names end
Source
# File lib/autobuild/environment.rb, line 951 def self.arch_size Autobuild.warn 'Autobuild.arch_size is deprecated, "\ "use Autobuild.env.arch_size instead' env.arch_size end
Source
# File lib/autobuild/import/archive.rb, line 578 def self.archive(source, options = {}) ArchiveImporter.new(source, options) end
Creates an importer which downloads a tarball from source
and unpacks it. The allowed values in options
are described in ArchiveImporter.new
.
Source
# File lib/autobuild/subcommand.rb, line 83 def self.autodetect_processor_count return @processor_count if @processor_count if File.file?('/proc/cpuinfo') cpuinfo = File.readlines('/proc/cpuinfo') physical_ids = [] core_count = [] processor_ids = [] cpuinfo.each do |line| case line when /^processor\s+:\s+(\d+)$/ processor_ids << Integer($1) when /^physical id\s+:\s+(\d+)$/ physical_ids << Integer($1) when /^cpu cores\s+:\s+(\d+)$/ core_count << Integer($1) end end # Try to count the number of physical cores, not the number of # logical ones. If the info is not available, fallback to the # logical count has_consistent_info = (physical_ids.size == core_count.size) && (physical_ids.size == processor_ids.size) if has_consistent_info info = Array.new while (id = physical_ids.shift) info[id] = core_count.shift end @processor_count = info.compact.inject(&:+) else @processor_count = processor_ids.size end else result = Open3.popen3("sysctl", "-n", "hw.ncpu") do |_, io, _| io.read end @processor_count = Integer(result.chomp.strip) unless result.empty? end # The format of the cpuinfo file is ... let's say not very standardized. # If the cpuinfo detection fails, inform the user and set it to 1 unless @processor_count # Hug... What kind of system is it ? Autobuild.message "INFO: cannot autodetect the number of CPUs on this sytem" Autobuild.message "INFO: turning parallel builds off" Autobuild.message "INFO: you can manually set the number of parallel build "\ "processes to N" Autobuild.message "INFO: (and therefore turn this message off)" Autobuild.message "INFO: with" Autobuild.message " Autobuild.parallel_build_level = N" @processor_count = 1 end @processor_count end
Returns the number of CPUs present on this system
Source
# File lib/autobuild/packages/autotools.rb, line 10 def self.autotools(opts, &proc) Autotools.new(opts, &proc) end
Source
# File lib/autobuild/environment.rb, line 21 def self.bsd? @freebsd || @macos # can be extended to some other OSes liek NetBSD end
Source
# File lib/autobuild/config.rb, line 176 def clean_log! Reporting.each_log do |file| FileUtils.rm_f file end end
Removes all log files
Source
# File lib/autobuild/subcommand.rb, line 9 def self.clear_logfiles @logfiles.clear end
Source
# File lib/autobuild/packages/cmake.rb, line 5 def self.cmake(options, &block) CMake.new(options, &block) end
Source
# File lib/autobuild/reporting.rb, line 20 def color(message, *style) @colorizer.decorate(message, *style) end
Source
# File lib/autobuild/reporting.rb, line 7 def color=(flag) @colorizer = if flag.nil? Pastel.new else Pastel.new(enabled: flag) end end
Source
# File lib/autobuild/config.rb, line 184 def commandline(args) parser = OptionParser.new do |opts| opts.separator "Path specification" opts.on("--srcdir PATH", "sources are installed in PATH") do |v| Autobuild.srcdir = v end opts.on("--prefix PATH", "built packages are installed in PATH") do |v| Autobuild.prefix = v end opts.on("--logdir PATH", "logs are saved in PATH "\ "(default: <prefix>/autobuild)") do |v| Autobuild.logdir = v end opts.separator "" opts.separator "General behaviour" opts.on('--nice NICE', Integer, 'nice the subprocesses to the given value') do |v| Autobuild.nice = v end opts.on("-h", "--help", "Show this message") do puts opts exit end if defined? Daemons opts.on("--[no-]daemon", "go into daemon mode") do |v| Autobuild.daemonize = v end end opts.on("--no-update", "update already checked-out sources") do |v| Autobuild.do_update = v end opts.on("--no-build", "only prepare packages, do not build them") do |v| Autobuild.do_build = v end opts.on("--forced-build", "force the trigger of "\ "all the build commands") do |v| Autobuild.do_forced_build = v end opts.on("--rebuild", "clean and rebuild") do |v| Autobuild.do_forced_build = v end opts.on("--only-doc", "only generate documentation") do |v| Autobuild.only_doc = v end opts.on("--no-doc", "don't generate documentation") do |v| Autobuild.do_doc = v end opts.on("--doc-errors", "treat documentation failure as error") do |v| Autobuild.pass_doc_errors = v end opts.separator "" opts.separator "Program output" opts.on("--[no-]verbose", "display output of commands on stdout") do |v| Autobuild.verbose = v end opts.on("--[no-]debug", "debug information") do |v| Autobuild.debug = v end opts.on("--keep-oldlogs", "old logs will be kept, "\ "new program output being appended") do |v| Autobuild.keep_oldlogs = v end opts.on('--version', "displays autobuild version and then exits") do puts "autobuild v#{Autobuild::VERSION}" exit 0 end opts.separator "" opts.separator "Mail reports" opts.on("--mail-from EMAIL", String, "From: field of the sent mails") do |from_email| mail[:from] = from_email end opts.on("--mail-to EMAILS", String, "comma-separated list of emails "\ "to which the reports should be sent") do |emails| mail[:to] ||= [] mail[:to] += emails.split(',') end opts.on("--mail-subject SUBJECT", String, "Subject: field of the sent mails") do |subject_email| mail[:subject] = subject_email end opts.on("--mail-smtp HOSTNAME", String, "address of the mail server "\ "written as hostname[:port]") do |smtp| unless smtp =~ /^([^:]+)(?::(\d+))?$/ raise "invalid SMTP specification #{smtp}" end mail[:smtp] = $1 mail[:port] = Integer($2) if $2 && !$2.empty? end opts.on("--mail-only-errors", "send mail only on errors") do mail[:only_errors] = true end end parser.parse!(args) unless args[0] puts parser exit end Rake.application.options.trace = debug args[0..-1] end
Gets autobuild options from the command line and returns the remaining elements
Source
# File lib/autobuild/config.rb, line 69 def create_utility(utility_name, package) klass, creation_options, options = utilities[utility_name] if klass utility = klass.new(utility_name, package, **options) package.utilities[utility_name] = utility utility.enabled = !creation_options[:disabled_by_default] utility else raise ArgumentError, "there is no utility called #{utility_name}, "\ "available utilities are #{utilities.keys.sort.join(', ')}" end end
Source
# File lib/autobuild/import/cvs.rb, line 82 def self.cvs(root, options = {}, backward_compatibility = nil) if backward_compatibility backward_compatibility[:module] = options CVSImporter.new(root, backward_compatibility) else CVSImporter.new(root, options) end end
Returns the CVS importer which will get the name
module in repository repo
. The allowed values in options
are described in CVSImporter.new
.
Source
# File lib/autobuild/import/darcs.rb, line 51 def self.darcs(source, options = {}) DarcsImporter.new(source, options) end
Returns the Darcs importer which will get the source from the Darcs repository source
. The allowed values in options
are described in DarcsImporter.new
.
Source
# File lib/autobuild/subcommand.rb, line 56 def displayed_error_line_count=(value) @displayed_error_line_count = validate_displayed_error_line_count(value) end
set/get a value how much log lines should be displayed on errors this may be an integer or ‘ALL’ (which will be translated to -1) this is not using an attr_accessor to be able to validate the values
Source
# File lib/autobuild/packages/dummy.rb, line 2 def self.dummy(spec) DummyPackage.new(spec) end
Source
# File lib/autobuild/environment.rb, line 933 def self.each_env_search_path(prefix, patterns) env.each_env_search_path(prefix, patterns) end
@deprecated, use the API on {env} instead
Source
# File lib/autobuild/config.rb, line 48 def each_utility return enum_for(__method__) unless block_given? utilities.each { |name, (utl, options)| yield(name, utl, options) } end
Yields all known utility classes
@yieldparam [String] utility name @yieldparam [Class] utility class @yieldparam [Hash] utility options @return [void]
Source
# File lib/autobuild/packages/gnumake.rb, line 9 def self.ensure_gnumake_detected(pkg, path = Autobuild.tool(:make)) @make_is_gnumake ||= Hash.new @gnumake_version ||= Hash.new return @make_is_gnumake[path] if @make_is_gnumake.key?(path) begin gnumake_version_string = pkg.run('prepare', path, '--version') rescue Autobuild::SubcommandFailed @make_is_gnumake[path] = false return end gnumake_match = /^GNU Make[^\d]+(\d[\d.]+)/.match(gnumake_version_string.first) unless gnumake_match @make_is_gnumake[path] = false return end @gnumake_version[path] = Gem::Version.new(gnumake_match[1]) @make_is_gnumake[path] = true end
Source
# File lib/autobuild/environment.rb, line 836 def self.env unless @env @env = Environment.new @env.prepare end @env end
Source
# File lib/autobuild/environment.rb, line 885 def self.env_add(name, *values) env.add(name, *values) end
@deprecated, use the API on {env} instead
Source
# File lib/autobuild/environment.rb, line 898 def self.env_add_path(name, *paths) env.add_path(name, *paths) end
@deprecated, use the API on {env} instead
Source
# File lib/autobuild/environment.rb, line 850 def self.env_clear(name = nil) env.clear(name) end
@deprecated, use the API on {env} instead
Source
# File lib/autobuild/environment.rb, line 870 def self.env_inherit(*names) env.inherit(*names) end
@deprecated, use the API on {env} instead
Source
# File lib/autobuild/environment.rb, line 865 def self.env_inherit=(value) env.inherit = value end
@deprecated, use the API on {env} instead
Source
# File lib/autobuild/environment.rb, line 860 def self.env_inherit?(name = nil) env.inherit?(name) end
@deprecated, use the API on {env} instead
Source
# File lib/autobuild/environment.rb, line 875 def self.env_init_from_env(name) env.init_from_env(name) end
@deprecated, use the API on {env} instead
Source
# File lib/autobuild/environment.rb, line 880 def self.env_push(name, *values) env.push(name, *values) end
@deprecated, use the API on {env} instead
Source
# File lib/autobuild/environment.rb, line 908 def self.env_push_path(name, *values) env.push_path(name, *values) end
@deprecated, use the API on {env} instead
Source
# File lib/autobuild/environment.rb, line 903 def self.env_remove_path(name, *paths) env.remove_path(name, *paths) end
@deprecated, use the API on {env} instead
Source
# File lib/autobuild/environment.rb, line 845 def self.env_reset(name = nil) env.reset(name) end
@deprecated, use the API on {env} instead
Source
# File lib/autobuild/environment.rb, line 855 def self.env_set(name, *values) env.set(name, *values) end
@deprecated, use the API on {env} instead
Source
# File lib/autobuild/environment.rb, line 923 def self.env_source_after(file = nil, shell: 'sh') env.source_after(file, shell: shell) end
@deprecated, use the API on {env} instead
Source
# File lib/autobuild/environment.rb, line 918 def self.env_source_before(file = nil, shell: 'sh') env.source_before(file, shell: shell) end
@deprecated, use the API on {env} instead
Source
# File lib/autobuild/environment.rb, line 913 def self.env_source_file(file, shell: 'sh') env.source_after(file, shell: shell) end
@deprecated, use the API on {env} instead
Source
# File lib/autobuild/environment.rb, line 895 def self.env_update_var(name); end
@deprecated, there is no corresponding API on the {Environment}
Source
# File lib/autobuild/environment.rb, line 890 def self.env_value(name, options = Hash.new) env.value(name, options) end
@deprecated, use the API on {env} instead
Source
# File lib/autobuild/reporting.rb, line 72 def self.error(message = "") message(" ERROR: #{message}", :red, :bold, io: STDERR) end
Displays an error message
Source
# File lib/autobuild/environment.rb, line 928 def self.export_env_sh(io) env.export_env_sh(io) end
@deprecated, use the API on {env} instead
Source
# File lib/autobuild/tools.rb, line 25 def find_in_path(file, envvar = 'PATH') env.find_in_path(file, envvar) end
Find a file in a given path-like variable
Source
# File lib/autobuild/config.rb, line 85 def full_build? do_build && !only_doc && packages.empty? end
True if we build and if the build is applied on all packages
Source
# File lib/autobuild/packages/genom.rb, line 6 def self.genom(opts, &proc) GenomModule.new(opts, &proc) end
Source
# File lib/autobuild/timestamps.rb, line 84 def self.get_stamp(stampfile) if File.exist?(stampfile) File.mtime(stampfile) else Time.at(0) end end
Source
# File lib/autobuild/import/git.rb, line 1454 def self.git(repository, branch = nil, options = {}) Git.new(repository, branch, options) end
Creates a git importer which gets the source for the given repository and branch URL source
.
Source
# File lib/autobuild/packages/gnumake.rb, line 57 def self.gnumake_jobserver_option(job_server, pkg, path = Autobuild.tool(:make)) jobserver_fds_arg = "#{job_server.rio.fileno},#{job_server.wio.fileno}" version = gnumake_version(pkg, path) if version >= GNUMAKE_JOBSERVER_AUTH_VERSION ["--jobserver-auth=#{jobserver_fds_arg}"] else ["--jobserver-fds=#{jobserver_fds_arg}", "-j"] end end
Source
# File lib/autobuild/packages/gnumake.rb, line 38 def self.gnumake_version(pkg, path = Autobuild.tool(:make)) if ensure_gnumake_detected(pkg, path) @gnumake_version.fetch(path) else raise NotGNUMake, "either #{path} is not a GNU Make or it does not have "\ "the expected version string" end end
Source
# File lib/autobuild/import/hg.rb, line 83 def self.hg(repository, options = {}) Hg.new(repository, options) end
Creates a hg importer which gets the source for the given repository and branch URL source
.
@param (see Hg#initialize)
Source
# File lib/autobuild/timestamps.rb, line 92 def self.hires_modification_time? if @hires_modification_time.nil? Tempfile.open('test') do |io| io.flush p_time = File.mtime(io.path) @hires_modification_time = (p_time.tv_usec != 0) end end @hires_modification_time end
Source
# File lib/autobuild/reporting.rb, line 244 def self.human_readable_size(size) HUMAN_READABLE_SIZES.each do |scale, name| scaled_size = (size / scale) if scaled_size > 1 return format("%3.1<scaled>f%<scale_name>s", scaled: scaled_size, scale_name: name) end end end
Source
# File lib/autobuild/timestamps.rb, line 17 def self.ignore(path) ignored_files << if path.kind_of?(Regexp) path else Regexp.new("^#{Regexp.quote(path)}") end end
Add a file and/or a regular expression to the ignore list
The matching paths will not be considered when looking if a source tree has been updated or not.
Source
# File lib/autobuild/packages/import.rb, line 5 def self.import(spec, &proc) ImporterPackage.new(spec, &proc) end
Source
# File lib/autobuild/packages/pkgconfig.rb, line 26 def self.installed_pkgconfig(name, &block) InstalledPkgConfig.new(name, &block) end
Source
# File lib/autobuild/packages/gnumake.rb, line 68 def self.invoke_make_parallel(pkg, cmd_path = Autobuild.tool(:make)) reserved = nil return yield unless make_has_j_option?(pkg, cmd_path) manager = Autobuild.parallel_task_manager return yield("-j#{pkg.parallel_build_level}") unless manager job_server = manager.job_server specific_parallel_level = ( pkg.parallel_build_level != Autobuild.parallel_build_level ) if !make_has_gnumake_jobserver?(pkg, cmd_path) || specific_parallel_level reserved = pkg.parallel_build_level # Account for the one token autobuild uses begin job_server.get(reserved - 1) return yield("-j#{pkg.parallel_build_level}") ensure job_server.put(reserved - 1) end end options = gnumake_jobserver_option(job_server, pkg, cmd_path) yield(*options) end
Source
# File lib/autobuild/import/git-lfs.rb, line 6 def self.lfs_setup(importer, package) importer.run_git(package, 'lfs', 'install', '--force', '--local', '--skip-smudge') includes = importer.options.fetch(:lfs_include, '') if includes.empty? begin importer.run_git_bare(package, 'config', '--local', '--unset', 'lfs.fetchinclude') rescue SubcommandFailed => e raise if e.status != 5 end else importer.run_git_bare(package, 'config', '--local', 'lfs.fetchinclude', includes) end excludes = importer.options.fetch(:lfs_exclude, '') if excludes.empty? begin importer.run_git_bare(package, 'config', '--local', '--unset', 'lfs.fetchexclude') rescue SubcommandFailed => e raise if e.status != 5 end else importer.run_git_bare(package, 'config', '--local', 'lfs.fetchexclude', excludes) end if importer.options[:lfs] != false importer.run_git(package, 'lfs', 'pull', importer.remote_name) end end
Source
# File lib/autobuild/config.rb, line 171 def logdir @logdir || "#{prefix}/log" end
The directory in which logs are saved
Source
# File lib/autobuild/packages/gnumake.rb, line 51 def self.make_has_gnumake_jobserver?(pkg, path = Autobuild.tool(:make)) make_is_gnumake?(pkg, path) end
Source
# File lib/autobuild/packages/gnumake.rb, line 47 def self.make_has_j_option?(pkg, path = Autobuild.tool(:make)) make_is_gnumake?(pkg, path) end
Source
# File lib/autobuild/packages/gnumake.rb, line 31 def self.make_is_gnumake?(pkg, path = Autobuild.tool(:make)) ensure_gnumake_detected(pkg, path) end
Source
# File lib/autobuild/packages/gnumake.rb, line 95 def self.make_subcommand(pkg, phase, *options, &block) invoke_make_parallel(pkg, Autobuild.tool(:make)) do |*make_parallel_options| pkg.run(phase, Autobuild.tool(:make), *make_parallel_options, *options, &block) end end
Source
# File lib/autobuild/reporting.rb, line 67 def self.message(*args, **options) @display.message(*args, **options) end
Source
# File lib/autobuild/packages/orogen.rb, line 2 def self.orogen(opts, &proc) Orogen.new(opts, &proc) end
Source
# File lib/autobuild/package.rb, line 884 def self.package_set(spec) spec.each do |name, packages| Autobuild::TARGETS.each do |target| task "#{name}-#{target}" => packages.map { |dep| "#{dep}-#{target}" } end end end
Source
# File lib/autobuild/subcommand.rb, line 69 def parallel_build_level if @parallel_build_level.nil? # No user-set value, return the count of processors on this # machine autodetect_processor_count elsif !@parallel_build_level || @parallel_build_level <= 0 1 else @parallel_build_level end end
Returns the number of processes that can run in parallel during the build. This is a system-wide value that can be overriden in a per-package fashion by using Package#parallel_build_level
.
If not set, defaults to the number of CPUs on the system
See also parallel_build_level=
Source
# File lib/autobuild/environment.rb, line 943 def self.pathvar(path, varname) if File.directory?(path) return if block_given? && !yield(path) env.add_path(varname, path) end end
@deprecated use {Env#add_path} on {.env} instead
Source
# File lib/autobuild/config.rb, line 106 def self.post_install(*args, &block) if args.empty? @post_install_handlers << block elsif !block @post_install_handlers << args else raise ArgumentError, "cannot set both arguments and block" end end
Source
# File lib/autobuild/config.rb, line 156 def post_success_message(*args, &block) if args.empty? && !block if @post_success_message.respond_to?(:to_str) @post_success_message.to_str elsif @post_success_message @post_success_message.call end elsif block @post_success_message = block else @post_success_message = args.first.to_str end end
Gets or updates a message to be displayed on success. Can either be a string or a block, in which case the block must return the message string.
Source
# File lib/autobuild/reporting.rb, line 85 def self.progress(key, *args) @display.progress(key, *args) end
Source
# File lib/autobuild/reporting.rb, line 55 def self.progress_display_enabled=(value) @display.progress_enabled = value end
@deprecated use {progress_display_mode=} instead
Source
# File lib/autobuild/reporting.rb, line 46 def self.progress_display_enabled? @display.progress_enabled? end
Source
# File lib/autobuild/reporting.rb, line 59 def self.progress_display_mode=(value) @display.progress_mode = value end
Source
# File lib/autobuild/reporting.rb, line 63 def self.progress_display_period=(value) @display.progress_period = value end
Source
# File lib/autobuild/reporting.rb, line 50 def self.progress_display_synchronize(&block) @display.synchronize(&block) end
Source
# File lib/autobuild/reporting.rb, line 89 def self.progress_done(key, display_last = true, message: nil) @display.progress_done(key, display_last, message: message) end
Source
# File lib/autobuild/reporting.rb, line 81 def self.progress_start(key, *args, **options, &block) @display.progress_start(key, *args, **options, &block) end
Source
# File lib/autobuild/packages/python.rb, line 6 def self.python(opts, &proc) Python.new(opts, &proc) end
Source
# File lib/autobuild/subcommand.rb, line 17 def self.register_logfile(path) @logfiles << path end
Source
# File lib/autobuild/config.rb, line 54 def register_utility_class(name, klass, disabled_by_default: false, **options) creation_options = { disabled_by_default: disabled_by_default } utilities[name] = [klass, creation_options, options] singleton_class.class_eval do attr_accessor "only_#{name}" attr_accessor "do_#{name}" attr_accessor "#{name}_prefix" attr_accessor "pass_#{name}_errors" end instance_variable_set "@only_#{name}", false instance_variable_set "@do_#{name}", false instance_variable_set "@pass_#{name}_errors", false instance_variable_set "@#{name}_prefix", name end
Source
# File lib/autobuild/subcommand.rb, line 21 def self.registered_logfile?(logfile) @logfiles.include?(logfile) end
Source
# File lib/autobuild/packages/gnumake.rb, line 4 def self.reset_gnumake_detection @make_is_gnumake = Hash.new @gnumake_version = Hash.new end
Source
# File lib/autobuild/subcommand.rb, line 29 def self.reset_statistics @statistics = Hash.new end
Source
# File lib/autobuild/packages/ruby.rb, line 114 def self.ruby(spec, &proc) Ruby.new(spec, &proc) end
Source
# File lib/autobuild/reporting.rb, line 42 def self.silent(&block) @display.silent(&block) end
Source
# File lib/autobuild/reporting.rb, line 36 def silent=(flag) @display.silent = flag end
Source
# File lib/autobuild/timestamps.rb, line 78 def self.source_tree(path, &block) task = SourceTreeTask.define_task(path) block&.call(task) task end
Source
# File lib/autobuild/subcommand.rb, line 25 def self.statistics @statistics end
Source
# File lib/autobuild/import/svn.rb, line 258 def self.svn(source, options = {}) SVN.new(source, options) end
Creates a subversion importer which import the source for the Subversion URL source
. The allowed values in options
are described in SVN.new
.
Source
# File lib/autobuild/import/archive.rb, line 583 def self.tar(source, options = {}) ArchiveImporter.new(source, options) end
DEPRECATED. Use Autobuild.archive
instead.
Source
# File lib/autobuild/tools.rb, line 20 def tool(name) programs[name.to_sym] || programs[name.to_s] || name.to_s end
Get a given program, using its name as default value. For instance
tool('automake')
will return ‘automake’ unless the autobuild script defined another automake program in Autobuild.programs
by doing
Autobuild.programs['automake'] = 'automake1.9'
Source
# File lib/autobuild/tools.rb, line 30 def tool_in_path(name, env: self.env) path, path_name, path_env = programs_in_path[name] current = tool(name) env_path = env.resolved_env['PATH'] if (path_env != env_path) || (path_name != current) # Delete the current entry given that it is invalid programs_in_path.delete(name) path = if current[0, 1] == "/" # This is already a full path current else env.find_executable_in_path(current) end unless path raise ArgumentError, "tool #{name}, set to #{current}, "\ "can not be found in PATH=#{env_path}" end programs_in_path[name] = [path, current, env_path] end path end
Resolves the absolute path to a given tool
Source
# File lib/autobuild/timestamps.rb, line 103 def self.touch_stamp(stampfile) Autobuild.message "Touching #{stampfile}" if Autobuild.debug dir = File.dirname(stampfile) if File.exist?(dir) && !File.directory?(dir) raise "#{dir} exists and is not a directory" elsif !File.exist?(dir) FileUtils.mkdir_p dir end FileUtils.touch(stampfile) unless hires_modification_time? # File modification times on most Unix filesystems have a granularity of # one second, so we (unfortunately) have to sleep 1s to make sure that # time comparisons will work as expected. sleep(1) end end
Source
# File lib/autobuild/timestamps.rb, line 26 def self.tree_timestamp(path, *exclude) # Exclude autobuild timestamps exclude << /#{Regexp.quote(STAMPFILE)}$/ exclude << /\.autobuild-patches$/ Autobuild.message "getting tree timestamp for #{path}" if Autobuild.debug latest = Time.at(0) latest_file = "" Find.find(path) do |p| Find.prune if File.basename(p) =~ /^\./ exclude.each do |pattern| if pattern === p if Autobuild.debug Autobuild.message " excluding #{p} because of #{pattern}" end Find.prune end end next unless File.file?(p) p_time = File.mtime(p) if latest < p_time latest = p_time latest_file = p end end Autobuild.message " newest file: #{latest_file} at #{latest}" if Autobuild.debug [latest_file, latest] end
Source
# File lib/autobuild/environment.rb, line 938 def self.update_environment(newprefix, includes = nil) env.update_environment(newprefix, includes) end
@deprecated, use the API on {env} instead
Source
# File lib/autobuild/subcommand.rb, line 141 def self.validate_displayed_error_line_count(lines) if lines == 'ALL' Float::INFINITY elsif lines.to_i > 0 lines.to_i else raise ConfigException.new, 'Autobuild.displayed_error_line_count can only "\ "be a positive integer or \'ALL\'' end end
Source
# File lib/autobuild/reporting.rb, line 77 def self.warn(message = "", *style) message(" WARN: #{message}", :magenta, *style, io: STDERR) end
Displays a warning message