# Author:: Nicolas Pouillard . # Copyright:: Copyright (c) 2004, 2005 Uttk team. All rights reserved. # License:: LGPL # $Id: /fey/uttk/trunk/lib/uttk/strategies/Package.rb 8789 2005-09-27T14:49:49.088376Z ertai $ module Uttk module Strategies class Package < Collection include Concrete include Ordered def prologue 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='<>'" 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 def skip_step? ( step ) step = /#{step}/i unless step.is_a? Regexp @skip_steps.any? { |x| step =~ x } end attribute :url, 'url of the package to install', :mandatory attribute :test, 'the test to execute', :invisible attribute :prefix, 'the prefix directory for `configure\'' attribute :configure_flags, 'set flags for the configure step' attribute :install_prefix, 'the prefix directory for `make install\'' attribute :skip_steps, 'steps to skip (a list of strings or regexps)' do [] end end # class Package end # module Strategies end # module Uttk