Class: Uttk::Strategies::Package

Inherits:
Collection show all
Includes:
Concrete, Ordered
Defined in:
lib/uttk/strategies/Package.rb

Instance Attribute Summary

Attributes inherited from Strategy

#status

Instance Method Summary collapse

Methods inherited from Collection

#attributes, #attributes=, #contents=, #create, #initialize, #method_missing, #strategyclass, #strategyclass=

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::Collection

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Uttk::Strategies::Collection

Instance Method Details

#prologueObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/uttk/strategies/Package.rb', line 15

def prologue
  extract_dir = '<<extract_dir>>'
  self.attributes = {
    :dir => extract_dir,
  }

  super

  create(Checkout) do |checkout|
    checkout.name = 'Checkout'
    checkout.url = @url
    checkout.fatal = true
    checkout.weight = 0
  end

  unless skip_step? 'configure'
    create(Bootstrap) do |bootstrap|
      bootstrap.name = 'Bootstrapping'
      bootstrap.weight = 0
    end
  end

  unless skip_step? 'bootstrap'
    create(Configure) do |configure|
      configure.name = 'Configuring'
      configure.prefix = @prefix
      configure.flags = @configure_flags
      configure.weight = 0
    end
  end

  unless skip_step? 'build'
    create(Make) do |build|
      build.name = 'Building'
      build.continue_mode = true
      # build.jobs = 2
      build.fatal = true
    end
  end

  make = {}

  [ Make::Check, Make::DistCheck, Make::Install ].each do |step|
    step_name = step.target
    next if skip_step? step_name
    create(Make) do |build|
      build.name = "Building #{step_name}"
      build.target = step
      build.fatal = true
      make[step_name.to_sym] = build
    end
  end

  if @install_prefix and make.has_key? :install
    make[:install].options << "prefix=#@install_prefix"
  end

  if make.has_key? :distcheck
    make[:distcheck].options <<
      "DISTCHECK_CONFIGURE_FLAGS='<<configure_flags>>'"
  end

  # FIXME does this step make sense
  unless skip_step? 'tarball'
    create(Block) do |test|
      test.name = 'Exporting the tarball'
      test.test = proc do
        balls = Pathname.glob("#{extract_dir}/*.tar.*")
        unless balls.empty?
          @log.new_node :contents, :ordered => true do
            balls.each do |ball|
              ball.copy(dir)
              @log << ball
            end
          end
        end
        true
      end
    end
  end

  unless @test.nil? or skip_step? 'test'
    create(@test)
  end

  unless skip_step? 'clean'
    create(Clean) do |clean|
      clean.name = 'Cleaning'
      clean.fatal = true
      clean.weight = 0
    end
  end

end

#skip_step?(step) ⇒ Boolean

Returns:

  • (Boolean)


110
111
112
113
# File 'lib/uttk/strategies/Package.rb', line 110

def skip_step? ( step )
  step = /#{step}/i unless step.is_a? Regexp
  @skip_steps.any? { |x| step =~ x }
end