Class: Simp::Rake::Build::Clean

Inherits:
Rake::TaskLib
  • Object
show all
Includes:
Constants
Defined in:
lib/simp/rake/build/clean.rb

Instance Method Summary collapse

Methods included from Constants

#init_member_vars, #os_build_metadata

Constructor Details

#initialize(base_dir) ⇒ Clean

Returns a new instance of Clean.



10
11
12
13
# File 'lib/simp/rake/build/clean.rb', line 10

def initialize( base_dir )
  init_member_vars( base_dir )
  define_tasks
end

Instance Method Details

#advanced_clean(type, args) ⇒ Object

This just abstracts the clean/clobber space in such a way that clobber can actally be used!



35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/simp/rake/build/clean.rb', line 35

def advanced_clean(type,args)
  fail "Type must be one of 'clean' or 'clobber'" unless ['clean','clobber'].include?(type)

  validate_in_mock_group?

  mock_dirs = Dir.glob("/var/lib/mock/*").map{|x| x = File.basename(x) }

  unless ( mock_dirs.empty? or args.chroot )
    $stderr.puts "Notice: You must pass a Mock chroot to erase a specified build root."
  end

  Rake::Task["pkg:#{type}"].invoke(args.chroot)
end

#define_tasksObject



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
# File 'lib/simp/rake/build/clean.rb', line 15

def define_tasks
  ::CLEAN.include(
    "#{@dist_dir}/*",
    ".discinfo",
    @dvd_dir,
    "#{@build_dir}/SIMP",
    "#{@base_dir}/SIMP_ISO*"
  )

  if $simp6_build_dirs
    ::CLEAN.include($simp6_clean_dirs)
  end

  ::CLOBBER.include(
    @dist_dir,
    "#{@build_dir}/build_keys/dev",
    "#{@build_dir}/yum_data/*/packages"
  )

  # This just abstracts the clean/clobber space in such a way that clobber can actally be used!
  def advanced_clean(type,args)
    fail "Type must be one of 'clean' or 'clobber'" unless ['clean','clobber'].include?(type)

    validate_in_mock_group?

    mock_dirs = Dir.glob("/var/lib/mock/*").map{|x| x = File.basename(x) }

    unless ( mock_dirs.empty? or args.chroot )
      $stderr.puts "Notice: You must pass a Mock chroot to erase a specified build root."
    end

    Rake::Task["pkg:#{type}"].invoke(args.chroot)
  end

  task :clobber,[:chroot] do |t,args|
    advanced_clean('clobber',args)
  end

  task :clean,[:chroot] do |t,args|
    advanced_clean('clean',args)
  end
end