Class: Uttk::Strategies::Configure

Inherits:
Proxy show all
Includes:
Concrete
Defined in:
lib/uttk/strategies/Configure.rb

Overview

I run then check whether the configure stage of a compilation process fail. I used in the Package strategy to handle the configuration stage.

Constant Summary collapse

CONFIGURE =
/^configure(\.sh)?$/
CONFIGURE_INPUT =
/^configure\.(ac|in)$/

Instance Attribute Summary

Attributes inherited from Strategy

#status

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Proxy

#create

Methods inherited from Composite

#<<, #contents, #create, #initialize, #initialize_copy, #initialize_test

Methods inherited from Strategy

#abort, #assign, #clean_instance_variables, #display_unexpected_exc, #display_unexpected_synflow_exc, #fail, #initialize, #initialize_flow_factory, #name=, #pass, #raise_error, #reject, #run, #running?, #skip, #skip_if_cached, #skip_wrt_rpath_and_rpath_exclude, #strategy, #strategy=, #symbols=, #symtbl, #symtbl=, #testify, #timeout=, to_form, #to_s, to_yaml_type, #wclass=

Constructor Details

This class inherits a constructor from Uttk::Strategies::Composite

Class Method Details

.have_configure?(dir = Pathname.new('.')) ⇒ Boolean

Returns:

  • (Boolean)


53
54
55
56
# File 'lib/uttk/strategies/Configure.rb', line 53

def self.have_configure? ( dir=Pathname.new('.') )
  res = dir.entries.find { |ent| ent.to_s =~ CONFIGURE }
  (res.nil?) ? nil : dir + res
end

.have_configure_input?(dir = Pathname.new('.')) ⇒ Boolean

Returns:

  • (Boolean)


48
49
50
51
# File 'lib/uttk/strategies/Configure.rb', line 48

def self.have_configure_input? ( dir=Pathname.new('.') )
  res = dir.entries.find { |ent| ent.to_s =~ CONFIGURE_INPUT }
  (res.nil?) ? nil : dir + res
end

Instance Method Details

#mk_command(script) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/uttk/strategies/Configure.rb', line 19

def mk_command ( script )
  cmd = script.to_s
  cmd += " --prefix=#@prefix" if @prefix
  if @flags.is_a? Array
    @flags = @flags.join(' ')
  else
    @flags = @flags.to_s
  end
  symtbl_configure_flags = @symtbl[:configure_flags]
  @flags += ' ' + symtbl_configure_flags unless symtbl_configure_flags.nil?
  @symtbl[:configure_flags] = @flags
  cmd + ' ' + @flags
end

#prologueObject



33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/uttk/strategies/Configure.rb', line 33

def prologue
  super
  @dir = Pathname.new(@dir)
  if script = self.class.have_configure?(@dir)
    create(Cmd) do |test|
      test.name = 'command'
      test.exit = 0
      test.dir = @dir
      test.command = mk_command(script)
      test.verbose_print = true
      test.reject :strategy, :dir
    end
  end
end